DtkCore
DTK Core module
dbasefilewatcher.h
1/*
2 * Copyright (C) 2017 ~ 2017 Deepin Technology Co., Ltd.
3 *
4 * This program is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU Lesser General Public License as published by
6 * the Free Software Foundation, either version 3 of the License, or
7 * any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU Lesser General Public License
15 * along with this program. If not, see <http://www.gnu.org/licenses/>.
16 */
17
18#ifndef DBASEFILEWATCHER_H
19#define DBASEFILEWATCHER_H
20
21#include "dtkcore_global.h"
22#include "dobject.h"
23
24#include <QObject>
25
26DCORE_BEGIN_NAMESPACE
27
28class DBaseFileWatcherPrivate;
29class LIBDTKCORESHARED_EXPORT DBaseFileWatcher : public QObject, public DObject
30{
31 Q_OBJECT
32
33public:
35
36 QUrl fileUrl() const;
37
38 bool startWatcher();
39 bool stopWatcher();
40 bool restartWatcher();
41
42 virtual void setEnabledSubfileWatcher(const QUrl &subfileUrl, bool enabled = true);
43
44 using SignalType1 = void(DBaseFileWatcher::*)(const QUrl &);
45 using SignalType2 = void(DBaseFileWatcher::*)(const QUrl &, const QUrl &);
46 static bool ghostSignal(const QUrl &targetUrl, SignalType1 signal, const QUrl &arg1);
47 static bool ghostSignal(const QUrl &targetUrl, SignalType2 signal, const QUrl &arg1, const QUrl &arg2);
48
49Q_SIGNALS:
50 void fileDeleted(const QUrl &url);
51 void fileAttributeChanged(const QUrl &url);
52 void fileMoved(const QUrl &fromUrl, const QUrl &toUrl);
53 void subfileCreated(const QUrl &url);
54 void fileModified(const QUrl &url);
55 void fileClosed(const QUrl &url);
56
57protected:
58 explicit DBaseFileWatcher(DBaseFileWatcherPrivate &dd, const QUrl &url, QObject *parent = 0);
59
60private:
61 Q_DISABLE_COPY(DBaseFileWatcher)
62 D_DECLARE_PRIVATE(DBaseFileWatcher)
63};
64
65DCORE_END_NAMESPACE
66
67#endif // DBASEFILEWATCHER_H
Definition: dbasefilewatcher_p.h:29
The DBaseFileWatcher class provides an interface for monitoring files and directories for modificatio...
Definition: dbasefilewatcher.h:30
一些宏的定义.
Definition: dobject.h:38