summaryrefslogtreecommitdiff
path: root/src/downloadmanager.cpp
diff options
context:
space:
mode:
authorJeremy Rimpo <jeremy.rimpo@servermonkey.com>2021-07-30 21:29:16 -0500
committerJeremy Rimpo <jeremy.rimpo@servermonkey.com>2023-09-21 17:23:34 -0500
commit535623693e63569f485c15984274ea65c4d0c872 (patch)
tree2782a219fd0eec5717f1df81f0969388ded15b35 /src/downloadmanager.cpp
parent69f953a3fb181eddaf730e83e2ac63ec7f154b14 (diff)
Add menu item to auto-assign categories based on nexus assignments
Diffstat (limited to 'src/downloadmanager.cpp')
-rw-r--r--src/downloadmanager.cpp21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/downloadmanager.cpp b/src/downloadmanager.cpp
index 5ccbdb4d..6cf3a95c 100644
--- a/src/downloadmanager.cpp
+++ b/src/downloadmanager.cpp
@@ -1321,6 +1321,19 @@ QString DownloadManager::getFileName(int index) const
return m_ActiveDownloads.at(index)->m_FileName;
}
+int DownloadManager::getDownloadIndex(QString filename) const
+{
+ auto file = std::find_if(m_ActiveDownloads.begin(), m_ActiveDownloads.end(), [=](DownloadManager::DownloadInfo *const val) {
+ if (val->m_FileName == filename) return true;
+ return false;
+ });
+ if (file != m_ActiveDownloads.end()) {
+ int fileIndex = m_ActiveDownloads.indexOf(*file);
+ return fileIndex;
+ }
+ return -1;
+}
+
QDateTime DownloadManager::getFileTime(int index) const
{
if ((index < 0) || (index >= m_ActiveDownloads.size())) {
@@ -1389,6 +1402,14 @@ 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())) {