diff options
Diffstat (limited to 'src/downloadmanager.cpp')
| -rw-r--r-- | src/downloadmanager.cpp | 21 |
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())) { |
