Skip to content
Snippets Groups Projects
Commit 3d1ee364 authored by SeeLook's avatar SeeLook
Browse files

Added pages of first run wizard - but it hasn't initialized options yet

parent 60d76c8d
No related branches found
No related tags found
No related merge requests found
......@@ -16,6 +16,7 @@
TRANSLATION CONTEXT CHANGES
TpitchView -> PitchView
TvolumeView -> VolumeBar
TaboutNootka -> AuthorsPage
TscoreSettings -> ScorePage, KeySufixEdit, (rearrange ScorePage)
TradioClef - Tclef (rearrange Tclef)
TguitarSettings - InstrumentPage
......
......@@ -199,12 +199,12 @@ public:
/**
* Returns highest possible note on the staff in current clef
*/
Tnote highestNote();
Q_INVOKABLE Tnote highestNote();
/**
* Returns lowest possible note on the staff in current clef
*/
Tnote lowestNote();
Q_INVOKABLE Tnote lowestNote();
bool isPianoStaff() { return m_clefType == Tclef::PianoStaffClefs; }
......
......@@ -311,3 +311,8 @@ QString TnootkaQML::aboutQt() {
QStringLiteral("qt.io/licensing"),
QStringLiteral("qt.io"));
}
QString TnootkaQML::pix(const QString& imageFileName) {
return Tpath::pix(imageFileName);
}
......@@ -84,6 +84,7 @@ public:
Q_INVOKABLE QString getXmlToOpen();
Q_INVOKABLE QString getXmlToSave();
Q_INVOKABLE QString aboutQt();
Q_INVOKABLE QString pix(const QString& imageFileName);
private:
static TnootkaQML *m_instance;
......
......@@ -18,7 +18,6 @@
#include <tinitcorelib.h>
#include <tpath.h>
//#include <tmtr.h>
#include <QtWidgets/qapplication.h>
#include <QtGui/qicon.h>
......@@ -31,6 +30,7 @@
#include <QtCore/qfile.h>
#include <QtCore/qsettings.h>
#include "tpath.h"
#include "tnootkaqml.h"
#if defined (Q_OS_ANDROID)
......@@ -43,7 +43,7 @@ static QString logFile;
void myMessageOutput(QtMsgType type, const QMessageLogContext &context, const QString &msg) {
Q_UNUSED(context)
Q_UNUSED(type)
// if (type == QtDebugMsg) {
#if defined (Q_OS_ANDROID)
QFile outFile(logFile);
#else
......@@ -52,7 +52,7 @@ void myMessageOutput(QtMsgType type, const QMessageLogContext &context, const QS
outFile.open(QIODevice::WriteOnly | QIODevice::Append);
QTextStream ts(&outFile);
ts << msg << endl;
// }
}
......@@ -79,7 +79,6 @@ int main(int argc, char *argv[])
QTranslator nooTranslator;
QPointer<QApplication> a = nullptr;
QQmlApplicationEngine *e = nullptr;
Tpath pathObj;
TnootkaQML nooObj;
int exitCode;
......@@ -88,7 +87,8 @@ int main(int argc, char *argv[])
resetConfig = false;
do {
#if !defined (Q_OS_ANDROID)
if (a) delete a;
if (a)
delete a;
if (resetConfig) { // delete config file - new Nootka instance will start with first run wizard
QFile f(confFile);
f.remove();
......@@ -111,9 +111,17 @@ int main(int argc, char *argv[])
// creating main window
e = new QQmlApplicationEngine;
e->rootContext()->setContextProperty(QStringLiteral("Tpath"), &pathObj);
e->rootContext()->setContextProperty(QStringLiteral("GLOB"), GLOB);
e->rootContext()->setContextProperty(QStringLiteral("Noo"), &nooObj);
if (GLOB->isFirstRun) {
e->load(QUrl(QStringLiteral("qrc:/wizard/Wizard.qml")));
exitCode = a->exec();
delete e;
e = new QQmlApplicationEngine;
e->rootContext()->setContextProperty(QStringLiteral("GLOB"), GLOB);
e->rootContext()->setContextProperty(QStringLiteral("Noo"), &nooObj);
GLOB->isFirstRun = false;
}
e->load(QUrl(QStringLiteral("qrc:/MainWindow.qml")));
// #if defined (Q_OS_ANDROID)
......
......@@ -69,6 +69,11 @@
<file alias="level/AccidsPage.qml">qml/level/AccidsPage.qml</file>
<file alias="level/RangePage.qml">qml/level/RangePage.qml</file>
<file alias="wizard/Wizard.qml">qml/wizard/Wizard.qml</file>
<file alias="wizard/WizardInstrument.qml">qml/wizard/WizardInstrument.qml</file>
<file alias="wizard/WizardClef.qml">qml/wizard/WizardClef.qml</file>
<file alias="wizard/WizardOptions.qml">qml/wizard/WizardOptions.qml</file>
<file alias="fakeTrans.js">qml/shared/fakeTrans.js</file>
<file alias="qtquickcontrols2.conf">qml/qtquickcontrols2.conf</file>
......
......@@ -6,15 +6,19 @@ import QtQuick 2.9
import "../"
Item {
Flickable {
width: parent.width
height: parent.height
contentHeight: aboutCol.height
contentWidth: width
Column {
anchors.fill: parent
id: aboutCol
width: parent.width
spacing: nootkaWindow.fontSize
Rectangle {
height: parent.height / 7
height: nootkaWindow.fontSize * 7
width: parent.width
color: nooLab.bgColor
NootkaLabel {
......@@ -25,5 +29,28 @@ Item {
bgColor: randColor()
}
}
Tile {
bgColor: Qt.tint(nooLab.bgColor, Qt.rgba(activPal.base.r, activPal.base.g, activPal.base.b, 0.9))
bgBorder { width: 2; color: nooLab.bgColor }
width: parent.width * 0.9
Column {
width: parent.width
spacing: nootkaWindow.fontSize
Text {
width: parent.width
font { pixelSize: nootkaWindow.fontSize * 2; bold: true }
horizontalAlignment: Text.AlignHCenter
text: "Nootka " + Noo.version()
color: activPal.text
}
Text {
text: "A few nice words to introduce Nootka shortly."
width: parent.width
font { pixelSize: nootkaWindow.fontSize * 1.2 }
horizontalAlignment: Text.AlignHCenter
color: activPal.text
}
}
}
}
}
/** This file is part of Nootka (http://nootka.sf.net) *
* Copyright (C) 2017 by Tomasz Bojczuk (seelook@gmail.com) *
* on the terms of GNU GPLv3 license (http://www.gnu.org/licenses) */
import QtQuick 2.9
import QtQuick.Controls 2.2
import QtQuick.Window 2.2
import "../about"
import "../fakeTrans.js" as Fake
ApplicationWindow {
id: nootkaWindow
title: "Nootka - " + qsTr("First run wizard")
visible: true
color: activPal.window
width: GLOB.geometry.width
height: GLOB.geometry.height
x: GLOB.geometry.x
y: GLOB.geometry.y
property alias instrument: instrPage.instrument
readonly property int fontSize: nootkaWindow.font.pixelSize
SystemPalette { id: activPal; colorGroup: SystemPalette.Active }
SystemPalette { id: disdPal; colorGroup: SystemPalette.Disabled }
SwipeView {
id: swipe
anchors.fill: parent
Item {
AboutPage {}
// Image {
// source: TcheckBoxpix("wizard-left")
// height: nootkaWindow.height
// width: nootkaWindow.height * 0.246
// }
}
WizardInstrument {
id: instrPage
}
WizardClef {}
WizardOptions {}
Item {
Text { text: "Some help"; anchors.centerIn: parent }
}
}
footer: Column {
width: parent.width;
PageIndicator {
count: swipe.count
currentIndex: swipe.currentIndex
anchors.horizontalCenter: parent.horizontalCenter
}
Item {
visible: !Noo.isAndroid()
width: parent.width; height: prevBut.height
Button {
x: parent.width / 2 - width - fontSize
id: prevBut
text: Fake.tr("QWizard", "< &Back").replace("&", "")
enabled: swipe.currentIndex > 0
onClicked: swipe.currentIndex -= 1
}
Button {
x: parent.width / 2 + fontSize
text: Fake.tr("QWizard", "&Next >").replace("&", "")
enabled: swipe.currentIndex < swipe.count - 1
onClicked: swipe.currentIndex += 1
}
Button {
anchors.right: parent.right
text: Fake.tr("QWizard", "&Finish").replace("&", "")
onClicked: nootkaWindow.close()
}
}
}
onClosing: {
console.log("Wizard is closing")
Qt.quit()
}
Component.onDestruction: console.log("Wizard Bye")
}
/** This file is part of Nootka (http://nootka.sf.net) *
* Copyright (C) 2017 by Tomasz Bojczuk (seelook@gmail.com) *
* on the terms of GNU GPLv3 license (http://www.gnu.org/licenses) */
import QtQuick 2.9
import QtQuick.Controls 2.2
import Score 1.0
import "../"
Flickable {
contentHeight: clefCol.height
contentWidth: width
Column {
id: clefCol
width: parent.width
Loader { sourceComponent: nootkaWindow.instrument === 0 ? noInstrComp : null }
Component {
id: noInstrComp
Column {
parent: clefCol
width: parent ? parent.width : 0
spacing: nootkaWindow.fontSize
Text {
width: parent.width
font { pixelSize: nootkaWindow.fontSize * 2; bold: true }
wrapMode: Text.WordWrap
horizontalAlignment: Text.AlignHCenter
color: activPal.text
text: "Select a clef and scale of notes appropriate for your instrument."
}
Score {
id: sc
height: nootkaWindow.fontSize * 20
width: nootkaWindow.fontSize * 12
anchors.horizontalCenter: parent.horizontalCenter
meter: Tmeter.NoMeter
scoreObj.showNoteNames: true
scoreObj.nameColor: GLOB.nameColor
scoreObj.nameStyle: GLOB.noteNameStyle
Component.onCompleted: {
sc.addNote(scoreObj.lowestNote())
sc.addNote(scoreObj.highestNote())
}
onClefChanged: {
// sc.addNote(scoreObj.lowestNote())
// sc.addNote(scoreObj.highestNote())
}
}
}
}
// Classical or electric guitar
Loader { sourceComponent: nootkaWindow.instrument === 1 || nootkaWindow.instrument === 2 ? classicComp : null }
Component {
id: classicComp
Column {
parent: clefCol
spacing: nootkaWindow.fontSize
width: parent ? parent.width : 0
Text {
width: parent.width
wrapMode: Text.WordWrap
horizontalAlignment: Text.AlignHCenter
color: activPal.text
text: "Guitar notation uses the treble clef with the digit \"eight\" written below (even if some editors are forgetting about this digit).<br><br>Try to understand this."
}
Row {
anchors.horizontalCenter: parent.horizontalCenter
spacing: nootkaWindow.fontSize
Repeater {
model: 2
Score {
id: sc
height: nootkaWindow.fontSize * 20
width: nootkaWindow.fontSize * 9
meter: Tmeter.NoMeter
clef: index === 1 ? Tclef.Treble_G_8down : Tclef.Treble_G
scoreObj.clefType: clef
scoreObj.showNoteNames: true
scoreObj.nameColor: GLOB.nameColor
scoreObj.nameStyle: GLOB.noteNameStyle
Component.onCompleted: sc.addNote(Noo.note(1, 1, 0, Trhythm.NoRhythm))
}
}
}
Text {
width: parent.width
wrapMode: Text.WordWrap
horizontalAlignment: Text.AlignHCenter
color: activPal.text
text: "<b><font size=\"5\">Both pictures above show the same note: c<sup>1</sup></font></b><br>(note c in one-line octave)</p>"
}
}
}
}
}
/** This file is part of Nootka (http://nootka.sf.net) *
* Copyright (C) 2017 by Tomasz Bojczuk (seelook@gmail.com) *
* on the terms of GNU GPLv3 license (http://www.gnu.org/licenses) */
import QtQuick 2.9
import QtQuick.Controls 2.2
Flickable {
property int instrument: 1
property var instrGlyphs: ["v", "h", "i", "j", "f"]
contentHeight: instrCol.height
contentWidth: width
Column {
id: instrCol
width: parent.width
spacing: nootkaWindow.fontSize * 3
Text {
text: qsTr("What instrument do you play?")
font { pixelSize: nootkaWindow.fontSize * 2; bold: true }
width: parent.width
wrapMode: Text.WordWrap
horizontalAlignment: Text.AlignHCenter
color: activPal.text
}
Column {
anchors.horizontalCenter: parent.horizontalCenter
Repeater {
model: instrGlyphs.length
Row {
width: nootkaWindow.fontSize * 30
spacing: nootkaWindow.fontSize * 3
Text {
font {family: "nootka"; pixelSize: nootkaWindow.fontSize * 5 }
text: instrGlyphs[index]
color: instrument === index ? activPal.highlight : activPal.text
scale: instrument === index ? 1.4 : 1.0
x: instrument === index ? -nootkaWindow.fontSize / 3 : 0
Behavior on x { enabled: GLOB.useAnimations; SpringAnimation { spring: 2; damping: 0.1; duration: 500 }}
Behavior on scale { enabled: GLOB.useAnimations; PropertyAnimation { duration: 300 }}
MouseArea {
anchors.fill: parent
onClicked: instrument = index
}
}
Text {
id: instrText
text: Noo.instrumentName(index)
font { pixelSize: nootkaWindow.fontSize * (instrument === index ? 1.4 : 1.0); bold: true }
color: index === instrument ? activPal.highlight : activPal.text
anchors.verticalCenter: parent.verticalCenter
MouseArea {
anchors.fill: parent
onClicked: instrument = index
}
}
}
}
}
}
}
/** This file is part of Nootka (http://nootka.sf.net) *
* Copyright (C) 2017 by Tomasz Bojczuk (seelook@gmail.com) *
* on the terms of GNU GPLv3 license (http://www.gnu.org/licenses) */
import QtQuick 2.9
import QtQuick.Controls 2.2
import "../settings"
import "../"
Flickable {
contentHeight: optCol.height
contentWidth: width
Column {
id: optCol
width: parent.width
spacing: nootkaWindow.fontSize
Text {
width: parent.width
font { pixelSize: nootkaWindow.fontSize * 2; bold: true }
wrapMode: Text.WordWrap
horizontalAlignment: Text.AlignHCenter
color: activPal.text
text: qsTr("7th note can be B or H, depends on country<br>What is the name of 7th note in your country?")
}
Select7note {
anchors.horizontalCenter: parent.horizontalCenter
}
Tile {
width: innerCol.width +nootkaWindow.fontSize * 2
Column {
id: innerCol
spacing: nootkaWindow.fontSize
anchors.horizontalCenter: parent.horizontalCenter
TcheckBox {
id: dblAccidsChB
text: qsTr("I know about double sharps (x) and double flats (bb)")
}
TcheckBox {
id: enharmChB
text: qsTr("I know that e# is the same as f")
}
TcheckBox {
id: keySignChB
text: qsTr("I know about key signatures")
}
}
}
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment