diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/downloadmanager.cpp | 8 | ||||
| -rw-r--r-- | src/downloadmanager.h | 8 | ||||
| -rw-r--r-- | src/modlistviewactions.cpp | 19 |
3 files changed, 10 insertions, 25 deletions
diff --git a/src/downloadmanager.cpp b/src/downloadmanager.cpp index 3e5303c6..3c9e776e 100644 --- a/src/downloadmanager.cpp +++ b/src/downloadmanager.cpp @@ -1404,14 +1404,6 @@ int DownloadManager::getModID(int index) const return m_ActiveDownloads.at(index)->m_FileInfo->modID; } -int DownloadManager::getCategoryID(int index) const -{ - if ((index < 0) || (index >= m_ActiveDownloads.size())) { - throw MyException(tr("mod id: invalid download index %1").arg(index)); - } - return m_ActiveDownloads.at(index)->m_FileInfo->categoryID; -} - QString DownloadManager::getDisplayGameName(int index) const { if ((index < 0) || (index >= m_ActiveDownloads.size())) { diff --git a/src/downloadmanager.h b/src/downloadmanager.h index 359455d9..d264ec87 100644 --- a/src/downloadmanager.h +++ b/src/downloadmanager.h @@ -357,14 +357,6 @@ public: int getModID(int index) const; /** - * @brief retrieve the nexus category id of the download specified by index - * - * @param index index of the file to look up - * @return the nexus category id - */ - int getCategoryID(int index) const; - - /** * @brief retrieve the displayable game name of the download specified by the index * * @param index index of the file to look up diff --git a/src/modlistviewactions.cpp b/src/modlistviewactions.cpp index fd2f5c68..d82dca87 100644 --- a/src/modlistviewactions.cpp +++ b/src/modlistviewactions.cpp @@ -279,12 +279,13 @@ void ModListViewActions::assignCategories() const } for (auto mod : m_core.modList()->allMods()) { ModInfo::Ptr modInfo = ModInfo::getByName(mod); - QString file = modInfo->installationFile(); int nexusCategory = modInfo->getNexusCategory(); if (!nexusCategory) { - auto download = m_core.downloadManager()->getDownloadIndex(file); - if (download >= 0) { - nexusCategory = m_core.downloadManager()->getCategoryID(download); + QSettings downloadMeta(m_core.downloadsPath() + "/" + + modInfo->installationFile() + ".meta", + QSettings::IniFormat); + if (downloadMeta.contains("category")) { + nexusCategory = downloadMeta.value("category", 0).toInt(); } } int newCategory = CategoryFactory::instance()->resolveNexusID(nexusCategory); @@ -1127,11 +1128,11 @@ void ModListViewActions::remapCategory(const QModelIndexList& indices) const int categoryID = modInfo->getNexusCategory(); if (!categoryID) { - int downloadIndex = - m_core.downloadManager()->getDownloadIndex(modInfo->installationFile()); - if (downloadIndex >= 0) { - auto downloadInfo = m_core.downloadManager()->getFileInfo(downloadIndex); - categoryID = downloadInfo->categoryID; + QSettings downloadMeta(m_core.downloadsPath() + "/" + + modInfo->installationFile() + ".meta", + QSettings::IniFormat); + if (downloadMeta.contains("category")) { + categoryID = downloadMeta.value("category", 0).toInt(); } } unsigned int categoryIndex = |
