diff --git a/src/libs/core/tnootkaqml.h b/src/libs/core/tnootkaqml.h index 52598800294b5b595ce600eeedfb58665287c312..76afe1d33fd780ea3351b0cc5951a648f1f30e14 100644 --- a/src/libs/core/tnootkaqml.h +++ b/src/libs/core/tnootkaqml.h @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2017 by Tomasz Bojczuk * + * Copyright (C) 2017-2018 by Tomasz Bojczuk * * seelook@gmail.com * * * * This program is free software; you can redistribute it and/or modify * @@ -130,6 +130,9 @@ public: Q_INVOKABLE qreal bound(qreal min, qreal val, qreal max); + bool resetConfig() const { return m_resetConfig; } + Q_INVOKABLE void setResetConfig(bool rc) { m_resetConfig = rc; } + /** * All stuff below is responsible for handling note changes in score, instrument and sound in/out. * @p TnootkaQML has score and instrument pointers to handle theirs signals when note is changed, @@ -187,6 +190,7 @@ private: TscoreObject *m_scoreObject = nullptr; bool m_nodeConnected = false; bool m_ignoreScore = false; /**< Becomes @p TRUE to ignore @p scoreChangedNote() slot */ + bool m_resetConfig = false; }; #endif // TNOOTKAQML_H diff --git a/src/main.cpp b/src/main.cpp index b8df76359c6ebfdf8fbc379cfdc8a7c988017226..19120296a5cc7bcefecc07a8430b7b68286ab77a 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2011-2017 by Tomasz Bojczuk * + * Copyright (C) 2011-2018 by Tomasz Bojczuk * * seelook@gmail.com * * * * This program is free software; you can redistribute it and/or modify * @@ -65,10 +65,6 @@ void myMessageOutput(QtMsgType type, const QMessageLogContext &context, const QS } -Tglobals *gl; -bool resetConfig; - - int main(int argc, char *argv[]) { // QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling); @@ -89,6 +85,7 @@ int main(int argc, char *argv[]) QTranslator qtTranslator; QTranslator nooTranslator; + Tglobals *gl = nullptr; QPointer<QApplication> a = nullptr; QQmlApplicationEngine *e = nullptr; TnootkaQML nooObj; @@ -96,16 +93,15 @@ int main(int argc, char *argv[]) int exitCode; bool firstTime = true; QString confFile; - resetConfig = false; do { #if !defined (Q_OS_ANDROID) if (a) delete a; - if (resetConfig) { // delete config file - new Nootka instance will start with first run wizard - QFile f(confFile); - f.remove(); + if (nooObj.resetConfig()) { // delete config file - new Nootka instance will start with first run wizard + QFile f(confFile); + f.remove(); } - resetConfig = false; + nooObj.setResetConfig(false); #endif a = new QApplication(argc, argv); Tmtr::init(a); @@ -171,7 +167,7 @@ int main(int argc, char *argv[]) qDebug() << "NOOTKA LAUNCH TIME" << startElapsed.nsecsElapsed() / 1000000.0 << " [ms]"; #else QTextStream o(stdout); - o << "\033[01;35m[Nootka launch time: " << startElapsed.nsecsElapsed() / 1000000.0 << " [ms]\033[01;00m\n"; + o << "\033[01;35m Nootka launch time: " << startElapsed.nsecsElapsed() / 1000000.0 << " [ms]\033[01;00m\n"; #endif } sound.init(); @@ -180,15 +176,15 @@ int main(int argc, char *argv[]) delete e; delete gl; #if defined (Q_OS_ANDROID) - if (resetConfig) { // delete config file - new Nootka instance will start with first run wizard + if (nooObj.resetConfig()) { // delete config file - new Nootka instance will start with first run wizard QFile f(confFile); f.remove(); - Tandroid::restartNootka(); // and call Nootka after delay + Tandroid::restartNootka(); // and call Nootka after delay } - resetConfig = false; // do - while loop doesn't work with Android + nooObj.setResetConfig(false); // do - while loop doesn't work with Android qApp->quit(); // HACK: calling QApplication::quick() solves hang on x86 when Qt uses native (usually obsolete) SSL libraries #endif - } while (resetConfig); + } while (nooObj.resetConfig()); delete a; return exitCode; diff --git a/src/qml/DialogLoader.qml b/src/qml/DialogLoader.qml index 2c83feac0208db0819062c72301da371312410ad..1e7edb2f58baee2bdd9ec051dd3f763971a5fb54 100644 --- a/src/qml/DialogLoader.qml +++ b/src/qml/DialogLoader.qml @@ -42,7 +42,6 @@ Old.Dialog { spacing: Noo.fontSize() delegate: TiconButton { pixmap: Noo.pix(dialogObj.buttonRoleIcon(DialogButtonBox.buttonRole)) - background: Rectangle { color: enabled ? (checked ? activPal.highlight : activPal.button) : disdPal.button } } background: Rectangle { anchors.fill: parent @@ -51,8 +50,8 @@ Old.Dialog { onClicked: { switch (button.DialogButtonBox.buttonRole) { case DialogButtonBox.AcceptRole: dialLoader.accepted(); break - case DialogButtonBox.HelpRole: help(); break - case DialogButtonBox.ResetRole: reset(); break + case DialogButtonBox.HelpRole: dialLoader.help(); break + case DialogButtonBox.ResetRole: dialLoader.reset(); break case DialogButtonBox.ApplyRole: dialLoader.apply(); break case DialogButtonBox.ActionRole: break default: dialLoader.close() diff --git a/src/qml/about/AboutPage.qml b/src/qml/about/AboutPage.qml index 6f2f5912afdea390d0fe557b78d7619812df57df..81151ca52c5a3b5c92790ff3957b2c7f62aae61d 100644 --- a/src/qml/about/AboutPage.qml +++ b/src/qml/about/AboutPage.qml @@ -9,6 +9,7 @@ import "../" Flickable { width: parent.width height: parent.height + clip: true contentHeight: aboutCol.height contentWidth: width diff --git a/src/qml/settings/GlobalPage.qml b/src/qml/settings/GlobalPage.qml index 428b8404685adefacf39f2ba54c039a6064c9d86..882642e6d73e319f73920f96aec217081e728b73 100644 --- a/src/qml/settings/GlobalPage.qml +++ b/src/qml/settings/GlobalPage.qml @@ -4,6 +4,7 @@ import QtQuick 2.9 import QtQuick.Controls 2.2 +import QtQuick.Dialogs 1.3 import "../" @@ -141,6 +142,18 @@ Tflickable { TcuteButton { anchors.horizontalCenter: parent.horizontalCenter text: qsTranslate("TglobalSettings", "Restore all default settings") + onClicked: restoreDialog.open() + MessageDialog { + id: restoreDialog + icon: StandardIcon.Critical + standardButtons: StandardButton.Ok | StandardButton.Abort + title: qsTranslate("TglobalSettings", "Restore all default settings") + text: qsTranslate("TglobalSettings", "All settings will be reset to their default values!<br>Nootka will start up with the first-run wizard.") + onAccepted: { + Noo.setResetConfig(true) + Qt.quit() + } + } } } diff --git a/src/qml/wizard/Wizard.qml b/src/qml/wizard/Wizard.qml index decb7ac1dfc8cf0dca11640e94d351c98ed3043c..f031737cbd9e95702d427684a81f514d30300eb4 100644 --- a/src/qml/wizard/Wizard.qml +++ b/src/qml/wizard/Wizard.qml @@ -1,5 +1,5 @@ /** This file is part of Nootka (http://nootka.sf.net) * - * Copyright (C) 2017 by Tomasz Bojczuk (seelook@gmail.com) * + * Copyright (C) 2017-2018 by Tomasz Bojczuk (seelook@gmail.com) * * on the terms of GNU GPLv3 license (http://www.gnu.org/licenses) */ import QtQuick 2.9 @@ -7,6 +7,7 @@ import QtQuick.Controls 2.2 import QtQuick.Window 2.2 import "../about" +import "../" ApplicationWindow { @@ -57,22 +58,25 @@ ApplicationWindow { } Item { visible: !Noo.isAndroid() - width: parent.width; height: prevBut.height - Button { + width: parent.width; height: prevBut.height + fontSize + TcuteButton { + anchors.verticalCenter: parent.verticalCenter x: parent.width / 2 - width - fontSize id: prevBut text: Noo.TR("QWizard", "< &Back").replace("&", "") enabled: swipe.currentIndex > 0 onClicked: swipe.currentIndex -= 1 } - Button { + TcuteButton { + anchors.verticalCenter: parent.verticalCenter x: parent.width / 2 + fontSize text: Noo.TR("QWizard", "&Next >").replace("&", "") enabled: swipe.currentIndex < swipe.count - 1 onClicked: swipe.currentIndex += 1 } - Button { - anchors.right: parent.right + TcuteButton { + anchors.verticalCenter: parent.verticalCenter + x: parent.width - width - fontSize text: Noo.TR("QWizard", "&Finish").replace("&", "") onClicked: nootkaWindow.close() } @@ -86,10 +90,9 @@ ApplicationWindow { GLOB.transposition = clefPage.transposition GLOB.seventhIsB = optionsPage.is7B GLOB.enableDoubleAccids = optionsPage.doubleAccids - GLOB.keySignatureEnabled - optionsPage.useKeys + GLOB.keySignatureEnabled = optionsPage.useKeys GLOB.showEnharmNotes = optionsPage.enharmNames GLOB.preferFlats = GLOB.instrument.isSax ? true : false Qt.quit() } -// Component.onDestruction: console.log("Wizard Bye") } diff --git a/src/qml/wizard/WizardOptions.qml b/src/qml/wizard/WizardOptions.qml index 4f9ce4a7c5e05fd0a5658c22454afd10b2b27032..160130db83ec8e95cf79b8a176956c9bd7b6c7cf 100644 --- a/src/qml/wizard/WizardOptions.qml +++ b/src/qml/wizard/WizardOptions.qml @@ -1,5 +1,5 @@ /** This file is part of Nootka (http://nootka.sf.net) * - * Copyright (C) 2017 by Tomasz Bojczuk (seelook@gmail.com) * + * Copyright (C) 2017-2018 by Tomasz Bojczuk (seelook@gmail.com) * * on the terms of GNU GPLv3 license (http://www.gnu.org/licenses) */ import QtQuick 2.9