From bbb3b3e6f6e3c0f95873f22e6d0a4aaf350f49d9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20Mr=C3=A1zek?= Date: Sun, 15 Jul 2018 14:51:05 +0200 Subject: NOISSUE tabs -> spaces --- application/setupwizard/AnalyticsWizardPage.cpp | 74 ++++++++++---------- application/setupwizard/AnalyticsWizardPage.h | 16 ++--- application/setupwizard/BaseWizardPage.h | 42 ++++++------ application/setupwizard/JavaWizardPage.cpp | 90 ++++++++++++------------- application/setupwizard/JavaWizardPage.h | 24 +++---- application/setupwizard/LanguageWizardPage.cpp | 62 ++++++++--------- application/setupwizard/LanguageWizardPage.h | 20 +++--- application/setupwizard/SetupWizard.cpp | 90 ++++++++++++------------- application/setupwizard/SetupWizard.h | 16 ++--- 9 files changed, 217 insertions(+), 217 deletions(-) (limited to 'application/setupwizard') diff --git a/application/setupwizard/AnalyticsWizardPage.cpp b/application/setupwizard/AnalyticsWizardPage.cpp index f32bfcf6..4fb0bcca 100644 --- a/application/setupwizard/AnalyticsWizardPage.cpp +++ b/application/setupwizard/AnalyticsWizardPage.cpp @@ -9,22 +9,22 @@ #include AnalyticsWizardPage::AnalyticsWizardPage(QWidget *parent) - : BaseWizardPage(parent) + : BaseWizardPage(parent) { - setObjectName(QStringLiteral("analyticsPage")); - verticalLayout_3 = new QVBoxLayout(this); - verticalLayout_3->setObjectName(QStringLiteral("verticalLayout_3")); - textBrowser = new QTextBrowser(this); - textBrowser->setObjectName(QStringLiteral("textBrowser")); - textBrowser->setAcceptRichText(false); - textBrowser->setOpenExternalLinks(true); - verticalLayout_3->addWidget(textBrowser); + setObjectName(QStringLiteral("analyticsPage")); + verticalLayout_3 = new QVBoxLayout(this); + verticalLayout_3->setObjectName(QStringLiteral("verticalLayout_3")); + textBrowser = new QTextBrowser(this); + textBrowser->setObjectName(QStringLiteral("textBrowser")); + textBrowser->setAcceptRichText(false); + textBrowser->setOpenExternalLinks(true); + verticalLayout_3->addWidget(textBrowser); - checkBox = new QCheckBox(this); - checkBox->setObjectName(QStringLiteral("checkBox")); - checkBox->setChecked(true); - verticalLayout_3->addWidget(checkBox); - retranslate(); + checkBox = new QCheckBox(this); + checkBox->setObjectName(QStringLiteral("checkBox")); + checkBox->setChecked(true); + verticalLayout_3->addWidget(checkBox); + retranslate(); } AnalyticsWizardPage::~AnalyticsWizardPage() @@ -33,31 +33,31 @@ AnalyticsWizardPage::~AnalyticsWizardPage() bool AnalyticsWizardPage::validatePage() { - auto settings = MMC->settings(); - auto analytics = MMC->analytics(); - auto status = checkBox->isChecked(); - settings->set("AnalyticsSeen", analytics->version()); - settings->set("Analytics", status); - return true; + auto settings = MMC->settings(); + auto analytics = MMC->analytics(); + auto status = checkBox->isChecked(); + settings->set("AnalyticsSeen", analytics->version()); + settings->set("Analytics", status); + return true; } void AnalyticsWizardPage::retranslate() { - setTitle(tr("Analytics")); - setSubTitle(tr("We track some anonymous statistics about users.")); - textBrowser->setHtml(tr( - "" - "

MultiMC sends anonymous usage statistics on every start of the application. This helps us decide what platforms and issues to focus on.

" - "

The data is processed by Google Analytics, see their article on the " - "matter.

" - "

The following data is collected:

" - "" - "

If we change the tracked information, you will see this page again.

")); - checkBox->setText(tr("Enable Analytics")); + setTitle(tr("Analytics")); + setSubTitle(tr("We track some anonymous statistics about users.")); + textBrowser->setHtml(tr( + "" + "

MultiMC sends anonymous usage statistics on every start of the application. This helps us decide what platforms and issues to focus on.

" + "

The data is processed by Google Analytics, see their article on the " + "matter.

" + "

The following data is collected:

" + "" + "

If we change the tracked information, you will see this page again.

")); + checkBox->setText(tr("Enable Analytics")); } diff --git a/application/setupwizard/AnalyticsWizardPage.h b/application/setupwizard/AnalyticsWizardPage.h index 0234f02a..c451db2c 100644 --- a/application/setupwizard/AnalyticsWizardPage.h +++ b/application/setupwizard/AnalyticsWizardPage.h @@ -8,18 +8,18 @@ class QCheckBox; class AnalyticsWizardPage : public BaseWizardPage { - Q_OBJECT + Q_OBJECT public: - explicit AnalyticsWizardPage(QWidget *parent = Q_NULLPTR); - virtual ~AnalyticsWizardPage(); + explicit AnalyticsWizardPage(QWidget *parent = Q_NULLPTR); + virtual ~AnalyticsWizardPage(); - bool validatePage() override; + bool validatePage() override; protected: - void retranslate() override; + void retranslate() override; private: - QVBoxLayout *verticalLayout_3 = nullptr; - QTextBrowser *textBrowser = nullptr; - QCheckBox *checkBox = nullptr; + QVBoxLayout *verticalLayout_3 = nullptr; + QTextBrowser *textBrowser = nullptr; + QCheckBox *checkBox = nullptr; }; \ No newline at end of file diff --git a/application/setupwizard/BaseWizardPage.h b/application/setupwizard/BaseWizardPage.h index 9ad54e09..72dbecfd 100644 --- a/application/setupwizard/BaseWizardPage.h +++ b/application/setupwizard/BaseWizardPage.h @@ -6,28 +6,28 @@ class BaseWizardPage : public QWizardPage { public: - explicit BaseWizardPage(QWidget *parent = Q_NULLPTR) - : QWizardPage(parent) - { - } - virtual ~BaseWizardPage() {}; + explicit BaseWizardPage(QWidget *parent = Q_NULLPTR) + : QWizardPage(parent) + { + } + virtual ~BaseWizardPage() {}; - virtual bool wantsRefreshButton() - { - return false; - } - virtual void refresh() - { - } + virtual bool wantsRefreshButton() + { + return false; + } + virtual void refresh() + { + } protected: - virtual void retranslate() = 0; - void changeEvent(QEvent * event) override - { - if (event->type() == QEvent::LanguageChange) - { - retranslate(); - } - QWizardPage::changeEvent(event); - } + virtual void retranslate() = 0; + void changeEvent(QEvent * event) override + { + if (event->type() == QEvent::LanguageChange) + { + retranslate(); + } + QWizardPage::changeEvent(event); + } }; diff --git a/application/setupwizard/JavaWizardPage.cpp b/application/setupwizard/JavaWizardPage.cpp index cd2bca46..ad571c09 100644 --- a/application/setupwizard/JavaWizardPage.cpp +++ b/application/setupwizard/JavaWizardPage.cpp @@ -21,76 +21,76 @@ JavaWizardPage::JavaWizardPage(QWidget *parent) - :BaseWizardPage(parent) + :BaseWizardPage(parent) { - setupUi(); + setupUi(); } void JavaWizardPage::setupUi() { - setObjectName(QStringLiteral("javaPage")); - QVBoxLayout * layout = new QVBoxLayout(this); + setObjectName(QStringLiteral("javaPage")); + QVBoxLayout * layout = new QVBoxLayout(this); - m_java_widget = new JavaSettingsWidget(this); - layout->addWidget(m_java_widget); - setLayout(layout); + m_java_widget = new JavaSettingsWidget(this); + layout->addWidget(m_java_widget); + setLayout(layout); - retranslate(); + retranslate(); } void JavaWizardPage::refresh() { - m_java_widget->refresh(); + m_java_widget->refresh(); } void JavaWizardPage::initializePage() { - m_java_widget->initialize(); + m_java_widget->initialize(); } bool JavaWizardPage::wantsRefreshButton() { - return true; + return true; } bool JavaWizardPage::validatePage() { - auto settings = MMC->settings(); - auto result = m_java_widget->validate(); - switch(result) - { - default: - case JavaSettingsWidget::ValidationStatus::Bad: - { - return false; - } - case JavaSettingsWidget::ValidationStatus::AllOK: - { - settings->set("JavaPath", m_java_widget->javaPath()); - } - case JavaSettingsWidget::ValidationStatus::JavaBad: - { - // Memory - auto s = MMC->settings(); - s->set("MinMemAlloc", m_java_widget->minHeapSize()); - s->set("MaxMemAlloc", m_java_widget->maxHeapSize()); - if (m_java_widget->permGenEnabled()) - { - s->set("PermGen", m_java_widget->permGenSize()); - } - else - { - s->reset("PermGen"); - } - return true; - } - } + auto settings = MMC->settings(); + auto result = m_java_widget->validate(); + switch(result) + { + default: + case JavaSettingsWidget::ValidationStatus::Bad: + { + return false; + } + case JavaSettingsWidget::ValidationStatus::AllOK: + { + settings->set("JavaPath", m_java_widget->javaPath()); + } + case JavaSettingsWidget::ValidationStatus::JavaBad: + { + // Memory + auto s = MMC->settings(); + s->set("MinMemAlloc", m_java_widget->minHeapSize()); + s->set("MaxMemAlloc", m_java_widget->maxHeapSize()); + if (m_java_widget->permGenEnabled()) + { + s->set("PermGen", m_java_widget->permGenSize()); + } + else + { + s->reset("PermGen"); + } + return true; + } + } } void JavaWizardPage::retranslate() { - setTitle(tr("Java")); - setSubTitle(tr("You do not have a working Java set up yet or it went missing.\n" - "Please select one of the following or browse for a java executable.")); - m_java_widget->retranslate(); + setTitle(tr("Java")); + setSubTitle(tr("You do not have a working Java set up yet or it went missing.\n" + "Please select one of the following or browse for a java executable.")); + m_java_widget->retranslate(); } diff --git a/application/setupwizard/JavaWizardPage.h b/application/setupwizard/JavaWizardPage.h index 592fa24c..0d749039 100644 --- a/application/setupwizard/JavaWizardPage.h +++ b/application/setupwizard/JavaWizardPage.h @@ -6,24 +6,24 @@ class JavaSettingsWidget; class JavaWizardPage : public BaseWizardPage { - Q_OBJECT + Q_OBJECT public: - explicit JavaWizardPage(QWidget *parent = Q_NULLPTR); + explicit JavaWizardPage(QWidget *parent = Q_NULLPTR); - virtual ~JavaWizardPage() - { - }; + virtual ~JavaWizardPage() + { + }; - bool wantsRefreshButton() override; - void refresh() override; - void initializePage() override; - bool validatePage() override; + bool wantsRefreshButton() override; + void refresh() override; + void initializePage() override; + bool validatePage() override; protected: /* methods */ - void setupUi(); - void retranslate() override; + void setupUi(); + void retranslate() override; private: /* data */ - JavaSettingsWidget *m_java_widget = nullptr; + JavaSettingsWidget *m_java_widget = nullptr; }; diff --git a/application/setupwizard/LanguageWizardPage.cpp b/application/setupwizard/LanguageWizardPage.cpp index b884c91a..dbbe5e7f 100644 --- a/application/setupwizard/LanguageWizardPage.cpp +++ b/application/setupwizard/LanguageWizardPage.cpp @@ -6,21 +6,21 @@ #include LanguageWizardPage::LanguageWizardPage(QWidget *parent) - : BaseWizardPage(parent) + : BaseWizardPage(parent) { - setObjectName(QStringLiteral("languagePage")); - verticalLayout = new QVBoxLayout(this); - verticalLayout->setObjectName(QStringLiteral("verticalLayout")); - languageView = new QListView(this); - languageView->setObjectName(QStringLiteral("languageView")); - verticalLayout->addWidget(languageView); - retranslate(); + setObjectName(QStringLiteral("languagePage")); + verticalLayout = new QVBoxLayout(this); + verticalLayout->setObjectName(QStringLiteral("verticalLayout")); + languageView = new QListView(this); + languageView->setObjectName(QStringLiteral("languageView")); + verticalLayout->addWidget(languageView); + retranslate(); - auto translations = MMC->translations(); - auto index = translations->selectedIndex(); - languageView->setModel(translations.get()); - languageView->setCurrentIndex(index); - connect(languageView->selectionModel(), &QItemSelectionModel::currentRowChanged, this, &LanguageWizardPage::languageRowChanged); + auto translations = MMC->translations(); + auto index = translations->selectedIndex(); + languageView->setModel(translations.get()); + languageView->setCurrentIndex(index); + connect(languageView->selectionModel(), &QItemSelectionModel::currentRowChanged, this, &LanguageWizardPage::languageRowChanged); } LanguageWizardPage::~LanguageWizardPage() @@ -29,38 +29,38 @@ LanguageWizardPage::~LanguageWizardPage() bool LanguageWizardPage::wantsRefreshButton() { - return true; + return true; } void LanguageWizardPage::refresh() { - auto translations = MMC->translations(); - translations->downloadIndex(); + auto translations = MMC->translations(); + translations->downloadIndex(); } bool LanguageWizardPage::validatePage() { - auto settings = MMC->settings(); - auto translations = MMC->translations(); - QString key = translations->data(languageView->currentIndex(), Qt::UserRole).toString(); - settings->set("Language", key); - return true; + auto settings = MMC->settings(); + auto translations = MMC->translations(); + QString key = translations->data(languageView->currentIndex(), Qt::UserRole).toString(); + settings->set("Language", key); + return true; } void LanguageWizardPage::retranslate() { - setTitle(tr("Language")); - setSubTitle(tr("Select the language to use in MultiMC")); + setTitle(tr("Language")); + setSubTitle(tr("Select the language to use in MultiMC")); } void LanguageWizardPage::languageRowChanged(const QModelIndex ¤t, const QModelIndex &previous) { - if (current == previous) - { - return; - } - auto translations = MMC->translations(); - QString key = translations->data(current, Qt::UserRole).toString(); - translations->selectLanguage(key); - translations->updateLanguage(key); + if (current == previous) + { + return; + } + auto translations = MMC->translations(); + QString key = translations->data(current, Qt::UserRole).toString(); + translations->selectLanguage(key); + translations->updateLanguage(key); } diff --git a/application/setupwizard/LanguageWizardPage.h b/application/setupwizard/LanguageWizardPage.h index 5a9e882d..866f81c3 100644 --- a/application/setupwizard/LanguageWizardPage.h +++ b/application/setupwizard/LanguageWizardPage.h @@ -7,25 +7,25 @@ class QListView; class LanguageWizardPage : public BaseWizardPage { - Q_OBJECT + Q_OBJECT public: - explicit LanguageWizardPage(QWidget *parent = Q_NULLPTR); + explicit LanguageWizardPage(QWidget *parent = Q_NULLPTR); - virtual ~LanguageWizardPage(); + virtual ~LanguageWizardPage(); - bool wantsRefreshButton() override; + bool wantsRefreshButton() override; - void refresh() override; + void refresh() override; - bool validatePage() override; + bool validatePage() override; protected: - void retranslate() override; + void retranslate() override; protected slots: - void languageRowChanged(const QModelIndex ¤t, const QModelIndex &previous); + void languageRowChanged(const QModelIndex ¤t, const QModelIndex &previous); private: - QVBoxLayout *verticalLayout = nullptr; - QListView *languageView = nullptr; + QVBoxLayout *verticalLayout = nullptr; + QListView *languageView = nullptr; }; diff --git a/application/setupwizard/SetupWizard.cpp b/application/setupwizard/SetupWizard.cpp index c13f15ee..60a78b8d 100644 --- a/application/setupwizard/SetupWizard.cpp +++ b/application/setupwizard/SetupWizard.cpp @@ -13,74 +13,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() diff --git a/application/setupwizard/SetupWizard.h b/application/setupwizard/SetupWizard.h index e3292997..aa3fb32c 100644 --- a/application/setupwizard/SetupWizard.h +++ b/application/setupwizard/SetupWizard.h @@ -26,20 +26,20 @@ class BaseWizardPage; class SetupWizard : public QWizard { - Q_OBJECT + Q_OBJECT public: /* con/destructors */ - explicit SetupWizard(QWidget *parent = 0); - virtual ~SetupWizard(); + explicit SetupWizard(QWidget *parent = 0); + virtual ~SetupWizard(); - void changeEvent(QEvent * event) override; - BaseWizardPage *getBasePage(int id); - BaseWizardPage *getCurrentBasePage(); + void changeEvent(QEvent * event) override; + BaseWizardPage *getBasePage(int id); + BaseWizardPage *getCurrentBasePage(); private slots: - void pageChanged(int id); + void pageChanged(int id); private: /* methods */ - void retranslate(); + void retranslate(); }; -- cgit v1.2.3