forked from ic005k/Xplist
-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathfilesystemwatcher.h
More file actions
33 lines (26 loc) · 891 Bytes
/
Copy pathfilesystemwatcher.h
File metadata and controls
33 lines (26 loc) · 891 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#ifndef FILE_SYSTEM_WATCHER_H
#define FILE_SYSTEM_WATCHER_H
#include <QFileSystemWatcher>
#include <QFontMetrics>
#include <QLabel>
#include <QMap>
#include <QMessageBox>
#include <QObject>
class FileSystemWatcher : public QObject {
Q_OBJECT
public:
static void addWatchPath(QString path);
static void removeWatchPath(QString path);
public slots:
void directoryUpdated(
const QString& path); // 目录更新时调用,path是监控的路径
void fileUpdated(const QString& path); // 文件被修改时调用,path是监控的路径
private:
explicit FileSystemWatcher(QObject* parent = 0);
private:
static FileSystemWatcher* m_pInstance; // 单例
QFileSystemWatcher* m_pSystemWatcher; // QFileSystemWatcher变量
QMap<QString, QStringList>
m_currentContentsMap; // 当前每个监控的内容目录列表
};
#endif // FILE_SYSTEM_WATCHER_H