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.h | |
| parent | ef82ddd36ae30e654841257634b26fa563319f9b (diff) | |
| parent | 3c1f206d7d29d3b3d27082aca23dafd87a95a71b (diff) | |
Merge pull request #1260 from Holt59/iplugin-setactive-fix
Fix usage of isActive
Diffstat (limited to 'src/downloadmanager.h')
| -rw-r--r-- | src/downloadmanager.h | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/src/downloadmanager.h b/src/downloadmanager.h index 90def927..8a0d8eed 100644 --- a/src/downloadmanager.h +++ b/src/downloadmanager.h @@ -37,6 +37,7 @@ along with Mod Organizer. If not, see <http://www.gnu.org/licenses/>. #include <QStringList> #include <QFileSystemWatcher> #include <QSettings> +#include <boost/signals2.hpp> namespace MOBase { class IPluginGame; } @@ -126,6 +127,8 @@ private: DownloadInfo() : m_TotalSize(0), m_ReQueried(false), m_Hidden(false), m_SpeedDiff(std::tuple<int,int,int,int,int>(0,0,0,0,0)), m_HasData(false) {} }; + using SignalDownloadCallback = boost::signals2::signal<void(int)>; + public: /** @@ -367,11 +370,16 @@ public: */ void refreshList(); - virtual int startDownloadURLs(const QStringList &urls); +public: // IDownloadManager interface: - virtual int startDownloadNexusFile(int modID, int fileID); + int startDownloadURLs(const QStringList &urls) override; + int startDownloadNexusFile(int modID, int fileID) override; + QString downloadPath(int id) override; - virtual QString downloadPath(int id); + bool onDownloadComplete(const std::function<void(int)>& callback) override; + bool onDownloadPaused(const std::function<void(int)>& callback) override; + bool onDownloadFailed(const std::function<void(int)>& callback) override; + bool onDownloadRemoved(const std::function<void(int)>& callback) override; /** * @brief retrieve a download index from the filename @@ -383,7 +391,7 @@ public: void pauseAll(); -signals: +Q_SIGNALS: void aboutToUpdate(); @@ -556,6 +564,11 @@ private: QFileSystemWatcher m_DirWatcher; + SignalDownloadCallback m_DownloadComplete; + SignalDownloadCallback m_DownloadPaused; + SignalDownloadCallback m_DownloadFailed; + SignalDownloadCallback m_DownloadRemoved; + //The dirWatcher is actually triggering off normal Mo operations such as deleting downloads or editing .meta files //so it needs to be disabled during operations that are known to cause the creation or deletion of files in the Downloads folder. //Notably using QSettings to edit a file creates a temporarily .lock file that causes the Watcher to trigger multiple listRefreshes freezing the ui. |
