OSDN Git Service

new QFileSystemWatcher methods to get and set the poll interval
[kde/Katie.git] / src / core / io / qfilesystemwatcher.h
1 /****************************************************************************
2 **
3 ** Copyright (C) 2015 The Qt Company Ltd.
4 ** Copyright (C) 2016 Ivailo Monev
5 **
6 ** This file is part of the QtCore module of the Katie Toolkit.
7 **
8 ** $QT_BEGIN_LICENSE:LGPL$
9 **
10 ** GNU Lesser General Public License Usage
11 ** This file may be used under the terms of the GNU Lesser
12 ** General Public License version 2.1 as published by the Free Software
13 ** Foundation and appearing in the file LICENSE.LGPL included in the
14 ** packaging of this file.  Please review the following information to
15 ** ensure the GNU Lesser General Public License version 2.1 requirements
16 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
17 **
18 ** $QT_END_LICENSE$
19 **
20 ****************************************************************************/
21
22 #ifndef QFILESYSTEMWATCHER_H
23 #define QFILESYSTEMWATCHER_H
24
25 #include <QtCore/qobject.h>
26
27 #ifndef QT_NO_FILESYSTEMWATCHER
28
29
30 QT_BEGIN_NAMESPACE
31
32
33 class QFileSystemWatcherPrivate;
34
35 class Q_CORE_EXPORT QFileSystemWatcher : public QObject
36 {
37     Q_OBJECT
38     Q_DECLARE_PRIVATE(QFileSystemWatcher)
39
40 public:
41     QFileSystemWatcher(QObject *parent = nullptr);
42     QFileSystemWatcher(const QStringList &paths, QObject *parent = nullptr);
43     ~QFileSystemWatcher();
44
45     void addPath(const QString &file);
46     void addPaths(const QStringList &files);
47     void removePath(const QString &file);
48     void removePaths(const QStringList &files);
49
50     QStringList files() const;
51     QStringList directories() const;
52
53     int interval() const;
54     void setInterval(int interval);
55
56 Q_SIGNALS:
57     void fileChanged(const QString &path);
58     void directoryChanged(const QString &path);
59
60 private:
61     Q_PRIVATE_SLOT(d_func(), void _q_timeout())
62 };
63
64 QT_END_NAMESPACE
65
66
67 #endif // QT_NO_FILESYSTEMWATCHER
68 #endif // QFILESYSTEMWATCHER_H