summaryrefslogtreecommitdiff
path: root/src/downloadmanager.h
diff options
context:
space:
mode:
authorAl12rs <gabriel.cortesi@outlook.com>2018-05-11 20:16:48 +0200
committerAl12rs <gabriel.cortesi@outlook.com>2018-05-17 00:02:34 +0200
commit1c6543454ef4d3b84e2ce1f6928b6c99005eee29 (patch)
tree49e591b095f94adf789003addeb752362483505f /src/downloadmanager.h
parent941c50bff903bdd241764240167d21013d9e8f5c (diff)
Initial work on avoiding the spamming of the Downlods tab refresh caused by the fileSystemWatcher picking up changes made by MO itself and triggering multiple refreshes
Diffstat (limited to 'src/downloadmanager.h')
-rw-r--r--src/downloadmanager.h16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/downloadmanager.h b/src/downloadmanager.h
index 17ae8a35..74627be5 100644
--- a/src/downloadmanager.h
+++ b/src/downloadmanager.h
@@ -144,6 +144,17 @@ public:
**/
void setOutputDirectory(const QString &outputDirectory);
+ /**
+ * @brief disables feedback from the downlods fileSystemWhatcher untill disableDownloadsWatcherEnd() is called
+ *
+ **/
+ void startDisableDirWatcher();
+
+ /**
+ * @brief re-enables feedback from the downlods fileSystemWhatcher after disableDownloadsWatcherStart() was called
+ **/
+ void endDisableDirWatcher();
+
/**
* @return current download directory
**/
@@ -519,6 +530,11 @@ private:
QFileSystemWatcher m_DirWatcher;
+ //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.
+ int m_DirWatcherDisabler;
+
std::map<QString, int> m_DownloadFails;
bool m_ShowHidden;