diff options
author | Petr Mrázek <peterix@gmail.com> | 2017-01-01 19:59:46 +0100 |
---|---|---|
committer | Petr Mrázek <peterix@gmail.com> | 2017-01-01 20:04:08 +0100 |
commit | a666dc0a1afa69b5b42aa3a487c8fa971c01cde1 (patch) | |
tree | e226954e1af8f1dce0f9e73898331aef2481503b /application/setupwizard | |
parent | 722896d41f15a8bc78a864f7adcfd0527648073c (diff) | |
download | MultiMC-a666dc0a1afa69b5b42aa3a487c8fa971c01cde1.tar MultiMC-a666dc0a1afa69b5b42aa3a487c8fa971c01cde1.tar.gz MultiMC-a666dc0a1afa69b5b42aa3a487c8fa971c01cde1.tar.lz MultiMC-a666dc0a1afa69b5b42aa3a487c8fa971c01cde1.tar.xz MultiMC-a666dc0a1afa69b5b42aa3a487c8fa971c01cde1.zip |
NOISSUE fix up translation selection in settings and add OS/sys arch reporting
Diffstat (limited to 'application/setupwizard')
-rw-r--r-- | application/setupwizard/SetupWizard.cpp | 93 | ||||
-rw-r--r-- | application/setupwizard/SetupWizard.h | 3 |
2 files changed, 57 insertions, 39 deletions
diff --git a/application/setupwizard/SetupWizard.cpp b/application/setupwizard/SetupWizard.cpp index af6b8c8e..3c87759f 100644 --- a/application/setupwizard/SetupWizard.cpp +++ b/application/setupwizard/SetupWizard.cpp @@ -67,7 +67,27 @@ public: languageView->setCurrentIndex(index); connect(languageView->selectionModel(), &QItemSelectionModel::currentRowChanged, this, &LanguageWizardPage::languageRowChanged); } - virtual ~LanguageWizardPage() {}; + + virtual ~LanguageWizardPage() + { + }; + + bool validatePage() override + { + auto settings = MMC->settings(); + auto translations = MMC->translations(); + QString key = translations->data(languageView->currentIndex(), Qt::UserRole).toString(); + settings->set("Language", key); + return true; + } + + static bool isRequired() + { + auto settings = MMC->settings(); + if (settings->get("Language").toString().isEmpty()) + return true; + return false; + } protected: void retranslate() override @@ -116,7 +136,35 @@ public: verticalLayout_3->addWidget(checkBox); retranslate(); } - virtual ~AnalyticsWizardPage() {}; + + virtual ~AnalyticsWizardPage() + { + }; + + bool validatePage() override + { + auto settings = MMC->settings(); + auto analytics = MMC->analytics(); + auto status = checkBox->isChecked(); + settings->set("AnalyticsSeen", analytics->version()); + settings->set("Analytics", status); + return true; + } + + static bool isRequired() + { + auto settings = MMC->settings(); + auto analytics = MMC->analytics(); + if(!settings->get("Analytics").toBool()) + { + return false; + } + if(settings->get("AnalyticsSeen").toInt() < analytics->version()) + { + return true; + } + return false; + } protected: void retranslate() override @@ -149,20 +197,12 @@ SetupWizard::SetupWizard(QWidget *parent) : QWizard(parent) { setObjectName(QStringLiteral("SetupWizard")); resize(615, 659); - setOptions(QWizard::NoCancelButton); - if (languageIsRequired()) + setOptions(QWizard::NoCancelButton | QWizard::IndependentPages); + if (LanguageWizardPage::isRequired()) { setPage(Page::Language, new LanguageWizardPage(this)); } - if(javaIsRequired()) - { - // set up java selection - } - else - { - removePage(Page::Java); - } - if(analyticsIsRequired()) + if(AnalyticsWizardPage::isRequired()) { setPage(Page::Analytics, new AnalyticsWizardPage(this)); } @@ -189,14 +229,7 @@ SetupWizard::~SetupWizard() { } -bool SetupWizard::languageIsRequired() -{ - auto settings = MMC->settings(); - if (settings->get("Language").toString().isEmpty()) - return true; - return false; -} - +/* bool SetupWizard::javaIsRequired() { QString currentHostName = QHostInfo::localHostName(); @@ -214,25 +247,13 @@ bool SetupWizard::javaIsRequired() } return false; } - -bool SetupWizard::analyticsIsRequired() -{ - auto settings = MMC->settings(); - auto analytics = MMC->analytics(); - if(settings->get("AnalyticsSeen").toInt() < analytics->version()) - { - return true; - } - return false; -} +*/ bool SetupWizard::isRequired() { - if (languageIsRequired()) - return true; - if (javaIsRequired()) + if (LanguageWizardPage::isRequired()) return true; - if (analyticsIsRequired()) + if (AnalyticsWizardPage::isRequired()) return true; return false; } diff --git a/application/setupwizard/SetupWizard.h b/application/setupwizard/SetupWizard.h index e5c8ad77..adf254c7 100644 --- a/application/setupwizard/SetupWizard.h +++ b/application/setupwizard/SetupWizard.h @@ -34,9 +34,6 @@ public: /* con/destructors */ public: /* methods */ static bool isRequired(); - static bool javaIsRequired(); - static bool languageIsRequired(); - static bool analyticsIsRequired(); private: /* methods */ void retranslate(); |