Commit 81717770 authored by Jean-Baptiste Mardelle's avatar Jean-Baptiste Mardelle
Browse files

Revert fileWatcher to private one, as the global app sometimes messes with us...

Revert fileWatcher to private one, as the global app sometimes messes with us (when opening a file dialog)
parent 571afe97
......@@ -10,12 +10,13 @@
FileWatcher::FileWatcher(QObject *parent)
: QObject(parent)
, m_fileWatcher(new KDirWatch)
{
// Init clip modification tracker
m_modifiedTimer.setInterval(1500);
connect(KDirWatch::self(), &KDirWatch::dirty, this, &FileWatcher::slotUrlModified);
connect(KDirWatch::self(), &KDirWatch::deleted, this, &FileWatcher::slotUrlMissing);
connect(KDirWatch::self(), &KDirWatch::created, this, &FileWatcher::slotUrlAdded);
connect(m_fileWatcher.get(), &KDirWatch::dirty, this, &FileWatcher::slotUrlModified);
connect(m_fileWatcher.get(), &KDirWatch::deleted, this, &FileWatcher::slotUrlMissing);
connect(m_fileWatcher.get(), &KDirWatch::created, this, &FileWatcher::slotUrlAdded);
connect(&m_modifiedTimer, &QTimer::timeout, this, &FileWatcher::slotProcessModifiedUrls);
m_queueTimer.setInterval(300);
m_queueTimer.setSingleShot(true);
......@@ -55,7 +56,7 @@ void FileWatcher::doAddFile(const QString &binId, const QString &url)
}
if (m_occurences.count(url) == 0) {
//QtConcurrent::run([=] { KDirWatch::self()->addFile(url); });
KDirWatch::self()->addFile(url);
m_fileWatcher->addFile(url);
}
m_occurences[url].insert(binId);
m_binClipPaths[binId] = url;
......
......@@ -7,6 +7,7 @@
#define FILEWATCHER_H
#include "definitions.h"
#include <KDirWatch>
#include <QTimer>
#include <unordered_map>
#include <unordered_set>
......@@ -47,9 +48,11 @@ private slots:
void slotProcessQueue();
private:
/// This is a handle to the watcher singleton, not owned by this class.
std::unique_ptr<KDirWatch> m_fileWatcher;
/// A list with urls as keys, and the corresponding clip ids as value
std::unordered_map<QString, std::unordered_set<QString>> m_occurences;
// keys are binId, keys are stored paths
/// keys are binId, keys are stored paths
std::unordered_map<QString, QString> m_binClipPaths;
/// List of files for which we received an update since the last send
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment