summaryrefslogtreecommitdiffstats
path: root/application/setupwizard
diff options
context:
space:
mode:
authorPetr Mrázek <peterix@gmail.com>2017-01-21 18:18:53 +0100
committerPetr Mrázek <peterix@gmail.com>2017-01-21 18:27:16 +0100
commit782384f185720699c5105271bfc78275bdc78054 (patch)
treeff34b04d183ffa856bb757b06f82a0a652083aa3 /application/setupwizard
parentceb5fc6d755cdcb263edc27386db38de9499048f (diff)
downloadMultiMC-782384f185720699c5105271bfc78275bdc78054.tar
MultiMC-782384f185720699c5105271bfc78275bdc78054.tar.gz
MultiMC-782384f185720699c5105271bfc78275bdc78054.tar.lz
MultiMC-782384f185720699c5105271bfc78275bdc78054.tar.xz
MultiMC-782384f185720699c5105271bfc78275bdc78054.zip
GH-1793 rearrange setup wizard logic to only check if they are needed once
Diffstat (limited to 'application/setupwizard')
-rw-r--r--application/setupwizard/AnalyticsWizardPage.cpp19
-rw-r--r--application/setupwizard/AnalyticsWizardPage.h1
-rw-r--r--application/setupwizard/JavaWizardPage.cpp18
-rw-r--r--application/setupwizard/JavaWizardPage.h1
-rw-r--r--application/setupwizard/LanguageWizardPage.cpp8
-rw-r--r--application/setupwizard/LanguageWizardPage.h2
-rw-r--r--application/setupwizard/SetupWizard.cpp32
-rw-r--r--application/setupwizard/SetupWizard.h3
8 files changed, 0 insertions, 84 deletions
diff --git a/application/setupwizard/AnalyticsWizardPage.cpp b/application/setupwizard/AnalyticsWizardPage.cpp
index ee834db9..f32bfcf6 100644
--- a/application/setupwizard/AnalyticsWizardPage.cpp
+++ b/application/setupwizard/AnalyticsWizardPage.cpp
@@ -41,25 +41,6 @@ bool AnalyticsWizardPage::validatePage()
return true;
}
-bool AnalyticsWizardPage::isRequired()
-{
- if(BuildConfig.ANALYTICS_ID.isEmpty())
- {
- return false;
- }
- 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;
-}
-
void AnalyticsWizardPage::retranslate()
{
setTitle(tr("Analytics"));
diff --git a/application/setupwizard/AnalyticsWizardPage.h b/application/setupwizard/AnalyticsWizardPage.h
index 88fbed01..03de9cb0 100644
--- a/application/setupwizard/AnalyticsWizardPage.h
+++ b/application/setupwizard/AnalyticsWizardPage.h
@@ -14,7 +14,6 @@ public:
virtual ~AnalyticsWizardPage();
bool validatePage() override;
- static bool isRequired();
protected:
void retranslate() override;
diff --git a/application/setupwizard/JavaWizardPage.cpp b/application/setupwizard/JavaWizardPage.cpp
index d0357504..46b6ee3f 100644
--- a/application/setupwizard/JavaWizardPage.cpp
+++ b/application/setupwizard/JavaWizardPage.cpp
@@ -197,24 +197,6 @@ bool JavaWizardPage::validatePage()
return true;
}
-bool JavaWizardPage::isRequired()
-{
- QString currentHostName = QHostInfo::localHostName();
- QString oldHostName = MMC->settings()->get("LastHostname").toString();
- if (currentHostName != oldHostName)
- {
- MMC->settings()->set("LastHostname", currentHostName);
- return true;
- }
- QString currentJavaPath = MMC->settings()->get("JavaPath").toString();
- QString actualPath = FS::ResolveExecutable(currentJavaPath);
- if (actualPath.isNull())
- {
- return true;
- }
- return false;
-}
-
bool JavaWizardPage::wantsRefreshButton()
{
return true;
diff --git a/application/setupwizard/JavaWizardPage.h b/application/setupwizard/JavaWizardPage.h
index 7b0d8830..f240217e 100644
--- a/application/setupwizard/JavaWizardPage.h
+++ b/application/setupwizard/JavaWizardPage.h
@@ -31,7 +31,6 @@ public:
void refresh() override;
void initializePage() override;
bool validatePage() override;
- static bool isRequired();
enum class JavaStatus
{
diff --git a/application/setupwizard/LanguageWizardPage.cpp b/application/setupwizard/LanguageWizardPage.cpp
index 0613938d..b884c91a 100644
--- a/application/setupwizard/LanguageWizardPage.cpp
+++ b/application/setupwizard/LanguageWizardPage.cpp
@@ -47,14 +47,6 @@ bool LanguageWizardPage::validatePage()
return true;
}
-bool LanguageWizardPage::isRequired()
-{
- auto settings = MMC->settings();
- if (settings->get("Language").toString().isEmpty())
- return true;
- return false;
-}
-
void LanguageWizardPage::retranslate()
{
setTitle(tr("Language"));
diff --git a/application/setupwizard/LanguageWizardPage.h b/application/setupwizard/LanguageWizardPage.h
index 9c24b29d..8b55d57f 100644
--- a/application/setupwizard/LanguageWizardPage.h
+++ b/application/setupwizard/LanguageWizardPage.h
@@ -19,8 +19,6 @@ public:
bool validatePage() override;
- static bool isRequired();
-
protected:
void retranslate() override;
diff --git a/application/setupwizard/SetupWizard.cpp b/application/setupwizard/SetupWizard.cpp
index ef16c2bf..c13f15ee 100644
--- a/application/setupwizard/SetupWizard.cpp
+++ b/application/setupwizard/SetupWizard.cpp
@@ -11,13 +11,6 @@
#include <QAbstractButton>
-enum Page
-{
- Language,
- Java,
- Analytics,
-};
-
SetupWizard::SetupWizard(QWidget *parent) : QWizard(parent)
{
setObjectName(QStringLiteral("SetupWizard"));
@@ -29,19 +22,6 @@ SetupWizard::SetupWizard(QWidget *parent) : QWizard(parent)
retranslate();
connect(this, &QWizard::currentIdChanged, this, &SetupWizard::pageChanged);
-
- if (LanguageWizardPage::isRequired())
- {
- setPage(Page::Language, new LanguageWizardPage(this));
- }
- if (JavaWizardPage::isRequired())
- {
- setPage(Page::Java, new JavaWizardPage(this));
- }
- if(AnalyticsWizardPage::isRequired())
- {
- setPage(Page::Analytics, new AnalyticsWizardPage(this));
- }
}
void SetupWizard::retranslate()
@@ -106,15 +86,3 @@ void SetupWizard::changeEvent(QEvent *event)
SetupWizard::~SetupWizard()
{
}
-
-bool SetupWizard::isRequired()
-{
- if (LanguageWizardPage::isRequired())
- return true;
- if (JavaWizardPage::isRequired())
- return true;
- if (AnalyticsWizardPage::isRequired())
- return true;
- return false;
-}
-
diff --git a/application/setupwizard/SetupWizard.h b/application/setupwizard/SetupWizard.h
index 51b0f1a3..a336f575 100644
--- a/application/setupwizard/SetupWizard.h
+++ b/application/setupwizard/SetupWizard.h
@@ -39,9 +39,6 @@ public: /* con/destructors */
private slots:
void pageChanged(int id);
-public: /* methods */
- static bool isRequired();
-
private: /* methods */
void retranslate();
};