diff options
| author | Mikaƫl Capelle <capelle.mikael@gmail.com> | 2020-10-21 20:08:01 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-10-21 20:08:01 +0200 |
| commit | 52cfb8e8a7609c8b763652e1575a769dd5fe1b02 (patch) | |
| tree | 6febde8afe518f8f33a1067b734cf2faadb760ca /src/downloadmanager.cpp | |
| parent | ef82ddd36ae30e654841257634b26fa563319f9b (diff) | |
| parent | 3c1f206d7d29d3b3d27082aca23dafd87a95a71b (diff) | |
Merge pull request #1260 from Holt59/iplugin-setactive-fix
Fix usage of isActive
Diffstat (limited to 'src/downloadmanager.cpp')
| -rw-r--r-- | src/downloadmanager.cpp | 31 |
1 files changed, 29 insertions, 2 deletions
diff --git a/src/downloadmanager.cpp b/src/downloadmanager.cpp index 3e6010db..5db0cbdf 100644 --- a/src/downloadmanager.cpp +++ b/src/downloadmanager.cpp @@ -694,6 +694,7 @@ void DownloadManager::removeFile(int index, bool deleteFile) if(!download->m_Hidden) metaSettings.setValue("removed", true); } + m_DownloadRemoved(index); endDisableDirWatcher(); } @@ -1453,13 +1454,19 @@ void DownloadManager::setState(DownloadManager::DownloadInfo *info, DownloadMana } info->m_State = state; switch (state) { - case STATE_PAUSED: + case STATE_PAUSED: { + info->m_Reply->abort(); + info->m_Output.close(); + m_DownloadPaused(row); + } break; case STATE_ERROR: { info->m_Reply->abort(); info->m_Output.close(); + m_DownloadFailed(row); } break; case STATE_CANCELED: { info->m_Reply->abort(); + m_DownloadFailed(row); } break; case STATE_FETCHINGMODINFO: { m_RequestIDs.insert(m_NexusInterface->requestDescription(info->m_FileInfo->gameName, info->m_FileInfo->modID, this, info->m_DownloadID, QString())); @@ -1473,7 +1480,7 @@ void DownloadManager::setState(DownloadManager::DownloadInfo *info, DownloadMana } break; case STATE_READY: { createMetaFile(info); - emit downloadComplete(row); + m_DownloadComplete(row); } break; default: /* NOP */ break; } @@ -1792,6 +1799,26 @@ QString DownloadManager::downloadPath(int id) return getFilePath(id); } +bool DownloadManager::onDownloadComplete(const std::function<void(int)>& callback) +{ + return m_DownloadComplete.connect(callback).connected(); +} + +bool DownloadManager::onDownloadPaused(const std::function<void(int)>& callback) +{ + return m_DownloadPaused.connect(callback).connected(); +} + +bool DownloadManager::onDownloadFailed(const std::function<void(int)>& callback) +{ + return m_DownloadFailed.connect(callback).connected(); +} + +bool DownloadManager::onDownloadRemoved(const std::function<void(int)>& callback) +{ + return m_DownloadRemoved.connect(callback).connected(); +} + int DownloadManager::indexByName(const QString &fileName) const { for (int i = 0; i < m_ActiveDownloads.size(); ++i) { |
