blob: f427e1d86a93f574a968c01e5163bdafb59ae99f (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
|
// Copyright (C) 2016 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#pragma once
#include "utils_global.h"
#include "filepath.h"
#include <QObject>
namespace Utils {
// Documentation inside.
class QTCREATOR_UTILS_EXPORT FileSystemWatcher final : public QObject
{
Q_OBJECT
public:
enum WatchMode
{
WatchModifiedDate,
WatchAllChanges
};
explicit FileSystemWatcher(QObject *parent = nullptr);
explicit FileSystemWatcher(int id, QObject *parent = nullptr);
~FileSystemWatcher() override;
void clear();
void addFile(const Utils::FilePath &file, WatchMode wm);
void addFiles(const Utils::FilePaths &files, WatchMode wm);
void removeFile(const Utils::FilePath &file);
void removeFiles(const Utils::FilePaths &files);
bool watchesFile(const Utils::FilePath &file) const;
Utils::FilePaths files() const;
void addDirectory(const Utils::FilePath &dir, WatchMode wm);
void addDirectories(const Utils::FilePaths &dirs, WatchMode wm);
void removeDirectory(const Utils::FilePath &dir);
void removeDirectories(const Utils::FilePaths &dirs);
bool watchesDirectory(const Utils::FilePath &dir) const;
Utils::FilePaths directories() const;
signals:
void fileChanged(const Utils::FilePath &path);
void directoryChanged(const Utils::FilePath &path);
private:
class FileSystemWatcherPrivate *d;
};
} // namespace Utils
|