diff --git a/TODO b/TODO index e24ffd3ac7c35bdf445b683dfbc62a797bc3ff61..d0d1f88409d66456511620a4edd397e8f72fa3e0 100644 --- a/TODO +++ b/TODO @@ -16,6 +16,7 @@ TRANSLATION CONTEXT CHANGES TpitchView -> PitchView TvolumeView -> VolumeBar + TaboutNootka -> AuthorsPage TscoreSettings -> ScorePage, KeySufixEdit, (rearrange ScorePage) TradioClef - Tclef (rearrange Tclef) TguitarSettings - InstrumentPage diff --git a/src/libs/core/score/tscoreobject.h b/src/libs/core/score/tscoreobject.h index 7f4eebb029d7fb33e78dbd0b2529c87b990ae14b..e3a9ac934f3b69d7e9824e0a4d7b3ccb84625ae9 100644 --- a/src/libs/core/score/tscoreobject.h +++ b/src/libs/core/score/tscoreobject.h @@ -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; } diff --git a/src/libs/core/tnootkaqml.cpp b/src/libs/core/tnootkaqml.cpp index 4a156c333cb46cf9d6c33ef2b83f218cdd58c931..b738959eb3ce8da38057fffed1533d7ce04c188c 100644 --- a/src/libs/core/tnootkaqml.cpp +++ b/src/libs/core/tnootkaqml.cpp @@ -311,3 +311,8 @@ QString TnootkaQML::aboutQt() { QStringLiteral("qt.io/licensing"), QStringLiteral("qt.io")); } + + +QString TnootkaQML::pix(const QString& imageFileName) { + return Tpath::pix(imageFileName); +} diff --git a/src/libs/core/tnootkaqml.h b/src/libs/core/tnootkaqml.h index a24a54daba978b2c0ece777df9b87f043e694a0e..70e1318aceda096f5aa71050c3d2e63e78e12ed9 100644 --- a/src/libs/core/tnootkaqml.h +++ b/src/libs/core/tnootkaqml.h @@ -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; diff --git a/src/main.cpp b/src/main.cpp index 586563f225d561fcca5b69e5da49f3f1a78ae752..0bdb3e9447f5b3b3b464d1a7a87db0ef8da4b5e2 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -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) diff --git a/src/nootka.qrc b/src/nootka.qrc index 70e397cccbc63797a9d1689165252db724ae17c2..fe38e395e2dfd9979fecde6afcbd425c99eb7010 100644 --- a/src/nootka.qrc +++ b/src/nootka.qrc @@ -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> diff --git a/src/qml/about/AboutPage.qml b/src/qml/about/AboutPage.qml index ffd5a14d7daa12f761e799b4e14fc03b862cdfe4..4d925c9e8a964edcf5c64775b4d78fd46a58d5d9 100644 --- a/src/qml/about/AboutPage.qml +++ b/src/qml/about/AboutPage.qml @@ -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 + } + } + } } } diff --git a/src/qml/wizard/Wizard.qml b/src/qml/wizard/Wizard.qml new file mode 100644 index 0000000000000000000000000000000000000000..4918e097042c769c4e4504d280637c5aa9e4e10f --- /dev/null +++ b/src/qml/wizard/Wizard.qml @@ -0,0 +1,88 @@ +/** 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") +} diff --git a/src/qml/wizard/WizardClef.qml b/src/qml/wizard/WizardClef.qml new file mode 100644 index 0000000000000000000000000000000000000000..80d2629c82a61751fd470cc6003903d1b6c06caa --- /dev/null +++ b/src/qml/wizard/WizardClef.qml @@ -0,0 +1,101 @@ +/** 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>" + } + } + } + + } +} diff --git a/src/qml/wizard/WizardInstrument.qml b/src/qml/wizard/WizardInstrument.qml new file mode 100644 index 0000000000000000000000000000000000000000..ba939463f344ff82719cc04ee602c619df2d3056 --- /dev/null +++ b/src/qml/wizard/WizardInstrument.qml @@ -0,0 +1,64 @@ +/** 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 + } + } + } + } + } + } +} diff --git a/src/qml/wizard/WizardOptions.qml b/src/qml/wizard/WizardOptions.qml new file mode 100644 index 0000000000000000000000000000000000000000..14134d7faa61bbbcf7c01a6dd5a51d5d0fea0992 --- /dev/null +++ b/src/qml/wizard/WizardOptions.qml @@ -0,0 +1,53 @@ +/** 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") + } + } + } + } +}