diff options
| author | Jeremy Rimpo <jeremy.rimpo@servermonkey.com> | 2021-12-26 19:52:40 -0600 |
|---|---|---|
| committer | Jeremy Rimpo <jeremy.rimpo@servermonkey.com> | 2023-09-21 17:27:49 -0500 |
| commit | eeddc993a7ee1785d2beaac8e6f3bf0bc155c158 (patch) | |
| tree | f8708c49a68cd2387219b1607430b96d7de6e3b9 /src | |
| parent | 9a801f65013396e02c228785d84f9694d4b187c6 (diff) | |
Add reminder dialog for old instances
Diffstat (limited to 'src')
| -rw-r--r-- | src/mainwindow.cpp | 45 | ||||
| -rw-r--r-- | src/mainwindow.h | 2 | ||||
| -rw-r--r-- | src/settings.cpp | 10 | ||||
| -rw-r--r-- | src/settings.h | 3 |
4 files changed, 57 insertions, 3 deletions
diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 3005ab8f..99273d46 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -1290,7 +1290,6 @@ void MainWindow::showEvent(QShowEvent* event) newCatDialog.setText(tr("Please choose how to handle the default category setup.\n\n" "If you've already connected to Nexus, you can automatically import Nexus categories for this game (if applicable). Otherwise, use the old Mod Organizer default category structure, or leave the categories blank.")); QPushButton importBtn(tr("&Import Nexus Categories")); - connect(&importBtn, &QPushButton::clicked, this, &MainWindow::importCategories); QPushButton defaultBtn(tr("Use &Default Categories")); QPushButton cancelBtn(tr("Do &Nothing")); if (NexusInterface::instance().getAccessManager()->validated()) { @@ -1299,8 +1298,9 @@ void MainWindow::showEvent(QShowEvent* event) newCatDialog.addButton(&defaultBtn, QMessageBox::ButtonRole::AcceptRole); newCatDialog.addButton(&cancelBtn, QMessageBox::ButtonRole::RejectRole); newCatDialog.exec(); - disconnect(&importBtn, &QPushButton::clicked, this, &MainWindow::importCategories); - if (newCatDialog.clickedButton() == &cancelBtn) { + if (newCatDialog.clickedButton() == &importBtn) { + importCategories(false); + } else if (newCatDialog.clickedButton() == &cancelBtn) { m_CategoryFactory->reset(); } else if (newCatDialog.clickedButton() == &defaultBtn) { m_CategoryFactory->loadCategories(); @@ -1308,6 +1308,43 @@ void MainWindow::showEvent(QShowEvent* event) m_CategoryFactory->saveCategories(); m_OrganizerCore.settings().setFirstStart(false); + } else { + auto& settings = m_OrganizerCore.settings(); + if (m_LastVersion < QVersionNumber(2, 5) && !GlobalSettings::hideCategoryReminder()) { + QMessageBox migrateCatDialog; + migrateCatDialog.setWindowTitle("Category Updates"); + migrateCatDialog.setText( + tr( + "This is your first time running version 2.5 or higher with an old MO2 instance. The category system now relies on an updated system to map Nexus categories.\n\n" + "In order to assign Nexus categories automatically, you will need to import the Nexus categories for the currently managed game and map them to your preferred category structure.\n\n" + "You can either manually open the category editor, via the Settings dialog or the category filter sidebar, and set up the mappings as you see fit, or you can automatically import and map the categories as defined on Nexus.\n\n" + "As a final option, you can disable Nexus category mapping altogether, which can be changed at any time in the Settings dialog." + ) + ); + QPushButton importBtn(tr("&Import Nexus Categories")); + QPushButton openSettingsBtn(tr("&Open Categories Dialog")); + QPushButton showTutorialBtn(tr("&Show Tutorial")); + QPushButton closeBtn(tr("&Close")); + QCheckBox dontShow(tr("&Don't show this again")); + if (NexusInterface::instance().getAccessManager()->validated()) { + migrateCatDialog.addButton(&importBtn, QMessageBox::ButtonRole::AcceptRole); + } + migrateCatDialog.addButton(&openSettingsBtn, QMessageBox::ButtonRole::AcceptRole); + migrateCatDialog.addButton(&showTutorialBtn, QMessageBox::ButtonRole::AcceptRole); + migrateCatDialog.addButton(&closeBtn, QMessageBox::ButtonRole::RejectRole); + migrateCatDialog.setCheckBox(&dontShow); + migrateCatDialog.exec(); + if (migrateCatDialog.clickedButton() == &importBtn) { + importCategories(dontShow.isChecked()); + } else if (migrateCatDialog.clickedButton() == &openSettingsBtn) { + this->ui->filtersEdit->click(); + } else if (migrateCatDialog.clickedButton() == &showTutorialBtn) { + // TODO: Implement tutorial + } + if (dontShow.isChecked()) { + GlobalSettings::setHideCategoryReminder(true); + } + } } m_OrganizerCore.settings().widgets().restoreIndex(ui->groupCombo); @@ -2138,6 +2175,8 @@ void MainWindow::processUpdates() const auto lastVersion = settings.version().value_or(earliest); const auto currentVersion = m_OrganizerCore.getVersion().asQVersionNumber(); + m_LastVersion = lastVersion; + settings.processUpdates(currentVersion, lastVersion); if (!settings.firstStart()) { diff --git a/src/mainwindow.h b/src/mainwindow.h index dd3ff823..2db1a9d7 100644 --- a/src/mainwindow.h +++ b/src/mainwindow.h @@ -326,6 +326,8 @@ private: std::atomic<bool> m_ProblemsCheckRequired; std::mutex m_CheckForProblemsMutex; + QVersionNumber m_LastVersion; + Executable* getSelectedExecutable(); private slots: diff --git a/src/settings.cpp b/src/settings.cpp index b568d802..ec9bb362 100644 --- a/src/settings.cpp +++ b/src/settings.cpp @@ -2430,6 +2430,16 @@ void GlobalSettings::setHideTutorialQuestion(bool b) settings().setValue("HideTutorialQuestion", b); } +bool GlobalSettings::hideCategoryReminder() +{ + return settings().value("HideCategoryReminder", false).toBool(); +} + +void GlobalSettings::setHideCategoryReminder(bool b) +{ + settings().setValue("HideCategoryReminder", b); +} + bool GlobalSettings::nexusApiKey(QString& apiKey) { QString tempKey = getWindowsCredential("APIKEY"); diff --git a/src/settings.h b/src/settings.h index 34a8669a..66dbf81c 100644 --- a/src/settings.h +++ b/src/settings.h @@ -923,6 +923,9 @@ public: static bool hideTutorialQuestion(); static void setHideTutorialQuestion(bool b); + static bool hideCategoryReminder(); + static void setHideCategoryReminder(bool b); + // if the key exists from the credentials store, puts it in `apiKey` and // returns true; otherwise, returns false and leaves `apiKey` untouched // |
