Debian Codegraph @

src/filesystem/private/dfilesystemwatcher_linux_p.h

raw
1 // SPDX-FileCopyrightText: 2017 - 2022 UnionTech Software Technology Co., Ltd.
2 //
3 // SPDX-License-Identifier: LGPL-3.0-or-later
4
5 #ifndef DFILESYSTEMWATCHER_P_H
6 #define DFILESYSTEMWATCHER_P_H
7
8 #include "dobject_p.h"
9
10 #include <QSocketNotifier>
11 #include <QHash>
12 #include <QMap>
13
14 DCORE_BEGIN_NAMESPACE
15
16 class DFileSystemWatcher;
17 class DFileSystemWatcherPrivate : public DObjectPrivate
18 {
19 Q_DECLARE_PUBLIC(DFileSystemWatcher)
20
21 public:
22 DFileSystemWatcherPrivate(int fd, DFileSystemWatcher *qq);
23 ~DFileSystemWatcherPrivate();
24
25 QStringList addPaths(const QStringList &paths, QStringList *files, QStringList *directories);
26 QStringList removePaths(const QStringList &paths, QStringList *files, QStringList *directories);
27
28 QStringList files, directories;
29 int inotifyFd;
30 QHash<QString, int> pathToID;
31 QMultiHash<int, QString> idToPath;
32 QSocketNotifier notifier;
33
34 // private slots
35 void _q_readFromInotify();
36
37 private:
38 void onFileChanged(const QString &path, bool removed);
39 void onDirectoryChanged(const QString &path, bool removed);
40 };
41
42 DCORE_END_NAMESPACE
43
44 #endif // DFILESYSTEMWATCHER_P_H