-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathDirsWatcher.h
46 lines (35 loc) · 1013 Bytes
/
DirsWatcher.h
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
34
35
36
37
38
39
40
41
42
43
44
45
46
//
// Created by septemberhx on 2020/6/16.
//
#ifndef DDE_SMART_DIR_DIRSWATCHER_H
#define DDE_SMART_DIR_DIRSWATCHER_H
#include <QObject>
#include <QThread>
#include <QMap>
#include <QString>
#include <QFileInfo>
#include <QFileSystemWatcher>
#include <QSet>
class DirsWatcher : public QObject {
Q_OBJECT
public:
explicit DirsWatcher(QObject *parent = nullptr);
void reload();
signals:
void fileInfoListUpdated(const QList<QFileInfo>& fileInfoList);
private slots:
void watchedDirChanged(const QString& dirPath);
private:
void watchDirRecursively(const QString& dirPath);
QFileInfoList getAllFileInfo();
void infoChangedOperation();
void buildPathInfo(QString dirPath, bool reFlag);
bool fitered(QString dirName);
void removeDir(const QString& dirPath);
private:
QMap<QString, QFileInfoList> fileInfoMap;
QFileSystemWatcher *m_watcher;
QSet<QString> removeFailedPathSet;
uint maxSignalListLength = 100;
};
#endif //DDE_SMART_DIR_DIRSWATCHER_H