Debian Codegraph @

include/filesystem/dbasefilewatcher.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 DBASEFILEWATCHER_H
6 #define DBASEFILEWATCHER_H
7
8 #include "dtkcore_global.h"
9 #include "dobject.h"
10
11 #include <QObject>
12
13 DCORE_BEGIN_NAMESPACE
14
15 class DBaseFileWatcherPrivate;
16 class LIBDTKCORESHARED_EXPORT DBaseFileWatcher : public QObject, public DObject
17 {
18 Q_OBJECT
19
20 public:
21 ~DBaseFileWatcher();
22
23 QUrl fileUrl() const;
24
25 bool startWatcher();
26 bool stopWatcher();
27 bool restartWatcher();
28
29 virtual void setEnabledSubfileWatcher(const QUrl &subfileUrl, bool enabled = true);
30
31 using SignalType1 = void(DBaseFileWatcher::*)(const QUrl &);
32 using SignalType2 = void(DBaseFileWatcher::*)(const QUrl &, const QUrl &);
33 static bool ghostSignal(const QUrl &targetUrl, SignalType1 signal, const QUrl &arg1);
34 static bool ghostSignal(const QUrl &targetUrl, SignalType2 signal, const QUrl &arg1, const QUrl &arg2);
35
36 Q_SIGNALS:
37 void fileDeleted(const QUrl &url);
38 void fileAttributeChanged(const QUrl &url);
39 void fileMoved(const QUrl &fromUrl, const QUrl &toUrl);
40 void subfileCreated(const QUrl &url);
41 void fileModified(const QUrl &url);
42 void fileClosed(const QUrl &url);
43
44 protected:
45 explicit DBaseFileWatcher(DBaseFileWatcherPrivate &dd, const QUrl &url, QObject *parent = 0);
46
47 private:
48 Q_DISABLE_COPY(DBaseFileWatcher)
49 D_DECLARE_PRIVATE(DBaseFileWatcher)
50 };
51
52 DCORE_END_NAMESPACE
53
54 #endif // DBASEFILEWATCHER_H