diff options
Diffstat (limited to 'src/widgets/dialogs/qfileinfogatherer_p.h')
-rw-r--r-- | src/widgets/dialogs/qfileinfogatherer_p.h | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/src/widgets/dialogs/qfileinfogatherer_p.h b/src/widgets/dialogs/qfileinfogatherer_p.h index 829c620c1e..3d30a98d04 100644 --- a/src/widgets/dialogs/qfileinfogatherer_p.h +++ b/src/widgets/dialogs/qfileinfogatherer_p.h @@ -169,12 +169,13 @@ public: explicit QFileInfoGatherer(QObject *parent = nullptr); ~QFileInfoGatherer(); -#if QT_CONFIG(filesystemwatcher) && defined(Q_OS_WIN) - QStringList watchedFiles() const { return watcher->files(); } - QStringList watchedDirectories() const { return watcher->directories(); } - void watchPaths(const QStringList &paths) { watcher->addPaths(paths); } - void unwatchPaths(const QStringList &paths) { watcher->removePaths(paths); } -#endif // filesystemwatcher && Q_OS_WIN + QStringList watchedFiles() const; + QStringList watchedDirectories() const; + void watchPaths(const QStringList &paths); + void unwatchPaths(const QStringList &paths); + + bool isWatching() const; + void setWatching(bool v); // only callable from this->thread(): void clear(); @@ -201,6 +202,8 @@ private: void fetch(const QFileInfo &info, QElapsedTimer &base, bool &firstTime, QVector<QPair<QString, QFileInfo> > &updatedFiles, const QString &path); private: + void createWatcher(); + mutable QMutex mutex; // begin protected by mutex QWaitCondition condition; @@ -210,13 +213,16 @@ private: QAtomicInt abort; #if QT_CONFIG(filesystemwatcher) - QFileSystemWatcher *watcher = nullptr; + QFileSystemWatcher *m_watcher = nullptr; #endif QFileIconProvider *m_iconProvider; // not accessed by run() QFileIconProvider defaultProvider; #ifdef Q_OS_WIN bool m_resolveSymlinks = true; // not accessed by run() #endif +#if QT_CONFIG(filesystemwatcher) + bool m_watching = true; +#endif }; QT_END_NAMESPACE |