6#include <QtCore/QFileSystemWatcher>
7#include <QtCore/QObject>
9#include <QtCore/QString>
10#include <QtCore/QTimer>
136 void _onFileChanged(
const QString &path);
137 void _onDirectoryChanged(
const QString &path);
138 void _processPendingChanges();
141 void _scheduleCallback(
const QString &path,
bool isDirectory);
143 QFileSystemWatcher *_watcher =
nullptr;
146 QHash<QString, ChangeCallback> _fileCallbacks;
147 QHash<QString, ChangeCallback> _directoryCallbacks;
150 QSet<QString> _persistentFiles;
153 int _debounceDelay = 100;
154 QTimer *_debounceTimer =
nullptr;
155 QSet<QString> _pendingFileChanges;
156 QSet<QString> _pendingDirectoryChanges;
157 bool _processingPendingChanges =
false;
bool unwatchDirectory(const QString &directoryPath)
bool isWatchingDirectory(const QString &directoryPath) const
void clear()
Stop watching all files and directories.
int watchFiles(const QStringList &filePaths, ChangeCallback callback)
int watchDirectories(const QStringList &directoryPaths, ChangeCallback callback)
~QGCFileWatcher() override
QStringList watchedFiles() const
void setDebounceDelay(int milliseconds)
bool isWatchingFile(const QString &filePath) const
bool watchFilePersistent(const QString &filePath, ChangeCallback callback)
void directoryChanged(const QString &path)
void fileChanged(const QString &path)
int debounceDelay() const
std::function< void(const QString &path)> ChangeCallback
QStringList watchedDirectories() const
bool unwatchFile(const QString &filePath)
bool watchFile(const QString &filePath, ChangeCallback callback)
bool watchDirectory(const QString &directoryPath, ChangeCallback callback)