From 32b3ed0a1362a4b0798ad71fac3450fb77cb7e41 Mon Sep 17 00:00:00 2001 From: Thomas Groman Date: Thu, 19 Sep 2019 00:41:48 -0700 Subject: merged from 0.6.7 codebase --- application/setupwizard/SetupWizard.cpp | 90 ++++++++++++++++----------------- 1 file changed, 45 insertions(+), 45 deletions(-) (limited to 'application/setupwizard/SetupWizard.cpp') diff --git a/application/setupwizard/SetupWizard.cpp b/application/setupwizard/SetupWizard.cpp index c4b21713..5c2d60ac 100644 --- a/application/setupwizard/SetupWizard.cpp +++ b/application/setupwizard/SetupWizard.cpp @@ -12,74 +12,74 @@ SetupWizard::SetupWizard(QWidget *parent) : QWizard(parent) { - setObjectName(QStringLiteral("SetupWizard")); - resize(615, 659); - // make it ugly everywhere to avoid variability in theming - setWizardStyle(QWizard::ClassicStyle); - setOptions(QWizard::NoCancelButton | QWizard::IndependentPages | QWizard::HaveCustomButton1); + setObjectName(QStringLiteral("SetupWizard")); + resize(615, 659); + // make it ugly everywhere to avoid variability in theming + setWizardStyle(QWizard::ClassicStyle); + setOptions(QWizard::NoCancelButton | QWizard::IndependentPages | QWizard::HaveCustomButton1); - retranslate(); + retranslate(); - connect(this, &QWizard::currentIdChanged, this, &SetupWizard::pageChanged); + connect(this, &QWizard::currentIdChanged, this, &SetupWizard::pageChanged); } void SetupWizard::retranslate() { - setButtonText(QWizard::NextButton, tr("&Next >")); - setButtonText(QWizard::BackButton, tr("< &Back")); - setButtonText(QWizard::FinishButton, tr("&Finish")); - setButtonText(QWizard::CustomButton1, tr("&Refresh")); - setWindowTitle(tr("MultiMC Quick Setup")); + setButtonText(QWizard::NextButton, tr("&Next >")); + setButtonText(QWizard::BackButton, tr("< &Back")); + setButtonText(QWizard::FinishButton, tr("&Finish")); + setButtonText(QWizard::CustomButton1, tr("&Refresh")); + setWindowTitle(tr("MultiMC Quick Setup")); } BaseWizardPage * SetupWizard::getBasePage(int id) { - if(id == -1) - return nullptr; - auto pagePtr = page(id); - if(!pagePtr) - return nullptr; - return dynamic_cast(pagePtr); + if(id == -1) + return nullptr; + auto pagePtr = page(id); + if(!pagePtr) + return nullptr; + return dynamic_cast(pagePtr); } BaseWizardPage * SetupWizard::getCurrentBasePage() { - return getBasePage(currentId()); + return getBasePage(currentId()); } void SetupWizard::pageChanged(int id) { - auto basePagePtr = getBasePage(id); - if(!basePagePtr) - { - return; - } - if(basePagePtr->wantsRefreshButton()) - { - setButtonLayout({QWizard::CustomButton1, QWizard::Stretch, QWizard::BackButton, QWizard::NextButton, QWizard::FinishButton}); - auto customButton = button(QWizard::CustomButton1); - connect(customButton, &QAbstractButton::pressed, [&](){ - auto basePagePtr = getCurrentBasePage(); - if(basePagePtr) - { - basePagePtr->refresh(); - } - }); - } - else - { - setButtonLayout({QWizard::Stretch, QWizard::BackButton, QWizard::NextButton, QWizard::FinishButton}); - } + auto basePagePtr = getBasePage(id); + if(!basePagePtr) + { + return; + } + if(basePagePtr->wantsRefreshButton()) + { + setButtonLayout({QWizard::CustomButton1, QWizard::Stretch, QWizard::BackButton, QWizard::NextButton, QWizard::FinishButton}); + auto customButton = button(QWizard::CustomButton1); + connect(customButton, &QAbstractButton::pressed, [&](){ + auto basePagePtr = getCurrentBasePage(); + if(basePagePtr) + { + basePagePtr->refresh(); + } + }); + } + else + { + setButtonLayout({QWizard::Stretch, QWizard::BackButton, QWizard::NextButton, QWizard::FinishButton}); + } } void SetupWizard::changeEvent(QEvent *event) { - if (event->type() == QEvent::LanguageChange) - { - retranslate(); - } - QWizard::changeEvent(event); + if (event->type() == QEvent::LanguageChange) + { + retranslate(); + } + QWizard::changeEvent(event); } SetupWizard::~SetupWizard() -- cgit v1.2.3