summaryrefslogtreecommitdiff
path: root/src/installationmanager.cpp
diff options
context:
space:
mode:
authorJeremy Rimpo <jeremy.rimpo@servermonkey.com>2023-09-18 21:30:39 -0500
committerJeremy Rimpo <jeremy.rimpo@servermonkey.com>2023-09-21 17:32:37 -0500
commit4342fe3ce16e1e14fb44cf2676e3887002f67ec4 (patch)
tree8f22dc173c52e7cfb181875011d18748d924be07 /src/installationmanager.cpp
parent6dfe55f444bbe59899b583a5c795714bf50e91f7 (diff)
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
Diffstat (limited to 'src/installationmanager.cpp')
-rw-r--r--src/installationmanager.cpp34
1 files changed, 28 insertions, 6 deletions
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();
}