diff options
| author | Jeremy Rimpo <jeremy.rimpo@servermonkey.com> | 2021-07-30 21:29:16 -0500 |
|---|---|---|
| committer | Jeremy Rimpo <jeremy.rimpo@servermonkey.com> | 2023-09-21 17:23:34 -0500 |
| commit | 535623693e63569f485c15984274ea65c4d0c872 (patch) | |
| tree | 2782a219fd0eec5717f1df81f0969388ded15b35 /src/modlistviewactions.cpp | |
| parent | 69f953a3fb181eddaf730e83e2ac63ec7f154b14 (diff) | |
Add menu item to auto-assign categories based on nexus assignments
Diffstat (limited to 'src/modlistviewactions.cpp')
| -rw-r--r-- | src/modlistviewactions.cpp | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/modlistviewactions.cpp b/src/modlistviewactions.cpp index a6f0f07e..21079f1d 100644 --- a/src/modlistviewactions.cpp +++ b/src/modlistviewactions.cpp @@ -12,6 +12,7 @@ #include "categories.h" #include "csvbuilder.h" #include "directoryrefresher.h" +#include "downloadmanager.h" #include "filedialogmemory.h" #include "filterlist.h" #include "listdialog.h" @@ -259,6 +260,23 @@ void ModListViewActions::checkModsForUpdates() const } } +void ModListViewActions::assignCategories() const +{ + for (auto mod : m_core.modList()->allMods()) { + ModInfo::Ptr modInfo = ModInfo::getByName(mod); + for (auto category : modInfo->categories()) { + modInfo->removeCategory(category); + } + QString file = modInfo->installationFile(); + auto download = m_core.downloadManager()->getDownloadIndex(file); + if (download >= 0) { + int nexusCategory = m_core.downloadManager()->getCategoryID(download); + int category = CategoryFactory::instance()->resolveNexusID(nexusCategory); + modInfo->setCategory(CategoryFactory::instance()->getCategoryID(category), true); + } + } +} + void ModListViewActions::checkModsForUpdates( std::multimap<QString, int> const& IDs) const { |
