| 1 |
// SPDX-FileCopyrightText: 2017 - 2022 UnionTech Software Technology Co., Ltd. |
| 2 |
// |
| 3 |
// SPDX-License-Identifier: LGPL-3.0-or-later |
| 4 |
|
| 5 |
#ifndef DFILESYSTEMWATCHER_H |
| 6 |
#define DFILESYSTEMWATCHER_H |
| 7 |
|
| 8 |
#include "dtkcore_global.h" |
| 9 |
#include "dobject.h" |
| 10 |
|
| 11 |
#include <QObject> |
| 12 |
|
| 13 |
DCORE_BEGIN_NAMESPACE |
| 14 |
|
| 15 |
class DFileSystemWatcherPrivate; |
| 16 |
class LIBDTKCORESHARED_EXPORT DFileSystemWatcher : public QObject, public DObject |
| 17 |
{ |
| 18 |
Q_OBJECT |
| 19 |
D_DECLARE_PRIVATE(DFileSystemWatcher) |
| 20 |
|
| 21 |
public: |
| 22 |
DFileSystemWatcher(QObject *parent = Q_NULLPTR); |
| 23 |
DFileSystemWatcher(const QStringList &paths, QObject *parent = Q_NULLPTR); |
| 24 |
~DFileSystemWatcher(); |
| 25 |
|
| 26 |
bool addPath(const QString &file); |
| 27 |
QStringList addPaths(const QStringList &files); |
| 28 |
bool removePath(const QString &file); |
| 29 |
QStringList removePaths(const QStringList &files); |
| 30 |
|
| 31 |
QStringList files() const; |
| 32 |
QStringList directories() const; |
| 33 |
|
| 34 |
Q_SIGNALS: |
| 35 |
void fileDeleted(const QString &path, const QString &name, QPrivateSignal); |
| 36 |
void fileAttributeChanged(const QString &path, const QString &name, QPrivateSignal); |
| 37 |
void fileClosed(const QString &path, const QString &name, QPrivateSignal); |
| 38 |
void fileMoved(const QString &fromPath, const QString &fromName, |
| 39 |
const QString &toPath, const QString &toName, QPrivateSignal); |
| 40 |
void fileCreated(const QString &path, const QString &name, QPrivateSignal); |
| 41 |
void fileModified(const QString &path, const QString &name, QPrivateSignal); |
| 42 |
|
| 43 |
private: |
| 44 |
Q_PRIVATE_SLOT(d_func(), void _q_readFromInotify()) |
| 45 |
}; |
| 46 |
|
| 47 |
DCORE_END_NAMESPACE |
| 48 |
|
| 49 |
#endif // DFILESYSTEMWATCHER_H |