From 4342fe3ce16e1e14fb44cf2676e3887002f67ec4 Mon Sep 17 00:00:00 2001 From: Jeremy Rimpo Date: Mon, 18 Sep 2023 21:30:39 -0500 Subject: Several updates * No longer cause an error when deleting a category that's being used * Add a dialog when installing a mod with no Nexus mapping (if not disabled) * Allow disabling Nexus category mapping in Settings (Nexus tab) * Add context option to remove nexus mappings in the category editor * Some clang style fixes --- src/installationmanager.cpp | 34 ++++++++++++++++++++++++++++------ 1 file changed, 28 insertions(+), 6 deletions(-) (limited to 'src/installationmanager.cpp') diff --git a/src/installationmanager.cpp b/src/installationmanager.cpp index dce81bd1..901c636c 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"; @@ -659,12 +660,33 @@ InstallationResult InstallationManager::install(const QString& fileName, modName.update(doc.toPlainText(), GUESS_FALLBACK); modName.update(metaFile.value("modName", "").toString(), GUESS_META); - 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); - repository = metaFile.value("repository", "").toString(); + version = metaFile.value("version", "").toString(); + newestVersion = metaFile.value("newestVersion", "").toString(); + 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.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?")); + nexusQuery.addButton(tr("&Proceed"), QMessageBox::YesRole); + nexusQuery.addButton(tr("&Disable"), QMessageBox::AcceptRole); + nexusQuery.addButton(tr("&Stop && Configure"), QMessageBox::DestructiveRole); + auto ret = nexusQuery.exec(); + switch (ret) { + case 1: + Settings::instance().nexus().setCategoryMappings(false); + case 0: + break; + case 2: + return MOBase::IPluginInstaller::RESULT_CATEGORYREQUESTED; + } + } else { + categoryID = CategoryFactory::instance()->getCategoryID(categoryIndex); + } + repository = metaFile.value("repository", "").toString(); fileCategoryID = metaFile.value("fileCategory", 1).toInt(); } -- cgit v1.3.1