diff options
| author | Jeremy Rimpo <jeremy.rimpo@servermonkey.com> | 2023-09-25 17:39:41 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-09-25 17:39:41 -0500 |
| commit | 79d457f598bcfa7a8d094a87033a31f370c9c4c1 (patch) | |
| tree | 3674e6b1223ac104422ce77b06d020c50ad31cc0 /src/installationmanager.cpp | |
| parent | 70509275405d2a5c5e94743786f03b17ef2051f2 (diff) | |
| parent | 74668b9363d877d055a5e8b8c7d001ba448dc832 (diff) | |
Merge pull request #1880 from ModOrganizer2/qt6-category
WIP: Category Revamp
Diffstat (limited to 'src/installationmanager.cpp')
| -rw-r--r-- | src/installationmanager.cpp | 29 |
1 files changed, 26 insertions, 3 deletions
diff --git a/src/installationmanager.cpp b/src/installationmanager.cpp index 8c2ce78d..37c86c7e 100644 --- a/src/installationmanager.cpp +++ b/src/installationmanager.cpp @@ -645,6 +645,7 @@ InstallationResult InstallationManager::install(const QString& fileName, QString gameName = ""; QString version = ""; QString newestVersion = ""; + int category = 0; int categoryID = 0; int fileCategoryID = 1; QString repository = "Nexus"; @@ -661,9 +662,31 @@ InstallationResult InstallationManager::install(const QString& fileName, version = metaFile.value("version", "").toString(); newestVersion = metaFile.value("newestVersion", "").toString(); - unsigned int categoryIndex = CategoryFactory::instance().resolveNexusID( - metaFile.value("category", 0).toInt()); - categoryID = CategoryFactory::instance().getCategoryID(categoryIndex); + category = metaFile.value("category", 0).toInt(); + unsigned int categoryIndex = CategoryFactory::instance().resolveNexusID(category); + if (category != 0 && categoryIndex == 0U && + Settings::instance().nexus().categoryMappings()) { + QMessageBox nexusQuery; + nexusQuery.setWindowTitle(tr("No category found")); + nexusQuery.setText(tr( + "This Nexus category has not yet been mapped. Do you wish to proceed without " + "setting a category, proceed and disable automatic Nexus mappings, or stop " + "and configure your category mappings?")); + QPushButton* proceedButton = + nexusQuery.addButton(tr("&Proceed"), QMessageBox::YesRole); + QPushButton* disableButton = + nexusQuery.addButton(tr("&Disable"), QMessageBox::AcceptRole); + QPushButton* stopButton = + nexusQuery.addButton(tr("&Stop && Configure"), QMessageBox::DestructiveRole); + nexusQuery.exec(); + if (nexusQuery.clickedButton() == disableButton) { + Settings::instance().nexus().setCategoryMappings(false); + } else if (nexusQuery.clickedButton() == stopButton) { + return MOBase::IPluginInstaller::RESULT_CATEGORYREQUESTED; + } + } else { + categoryID = CategoryFactory::instance().getCategoryID(categoryIndex); + } repository = metaFile.value("repository", "").toString(); fileCategoryID = metaFile.value("fileCategory", 1).toInt(); } |
