Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
qfilesystemwatcher_win_p.h
Go to the documentation of this file.
1// Copyright (C) 2016 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
4#ifndef QFILESYSTEMWATCHER_WIN_P_H
5#define QFILESYSTEMWATCHER_WIN_P_H
6
7//
8// W A R N I N G
9// -------------
10//
11// This file is not part of the Qt API. It exists purely as an
12// implementation detail. This header file may change from version to
13// version without notice, or even be removed.
14//
15// We mean it.
16//
17
19
20#include <QtCore/qdatetime.h>
21#include <QtCore/qfile.h>
22#include <QtCore/qfileinfo.h>
23#include <QtCore/qhash.h>
24#include <QtCore/qlist.h>
25#include <QtCore/qmutex.h>
26#include <QtCore/qthread.h>
27
29
32
33// Even though QWindowsFileSystemWatcherEngine is derived of QThread
34// via QFileSystemWatcher, it does not start a thread.
35// Instead QWindowsFileSystemWatcher creates QWindowsFileSystemWatcherEngineThreads
36// to do the actually watching.
38{
40public:
43
44 QStringList addPaths(const QStringList &paths, QStringList *files, QStringList *directories) override;
45 QStringList removePaths(const QStringList &paths, QStringList *files, QStringList *directories) override;
46
47 class Handle
48 {
49 public:
52
53 Handle();
54 };
55
56 class PathInfo {
57 public:
60 bool isDir;
61
62 // fileinfo bits
65 QFile::Permissions permissions;
67
68 PathInfo &operator=(const QFileInfo &fileInfo)
69 {
70 ownerId = fileInfo.ownerId();
71 groupId = fileInfo.groupId();
72 permissions = fileInfo.permissions();
73 lastModified = fileInfo.lastModified();
74 return *this;
75 }
76
77 bool operator!=(const QFileInfo &fileInfo) const
78 {
79 return (ownerId != fileInfo.ownerId()
80 || groupId != fileInfo.groupId()
81 || permissions != fileInfo.permissions()
82 || lastModified != fileInfo.lastModified());
83 }
84 };
85
89 void driveRemoved(const QString &);
90
91private:
92 QList<QWindowsFileSystemWatcherEngineThread *> threads;
93 QWindowsRemovableDriveListener *m_driveListener = nullptr;
94};
95
104
106
107inline size_t qHash(const QFileSystemWatcherPathKey &key, size_t seed = 0)
108{
109 return qHash(key.toCaseFolded(), seed);
110}
111
113{
115
116public:
117 typedef QHash<QFileSystemWatcherPathKey, QWindowsFileSystemWatcherEngine::Handle> HandleForDirHash;
118 typedef QHash<QFileSystemWatcherPathKey, QWindowsFileSystemWatcherEngine::PathInfo> PathInfoHash;
119
122 void run() override;
123 void stop();
124 void wakeup();
125
127 QList<Qt::HANDLE> handles;
128 int msg;
129
131
132 QHash<Qt::HANDLE, PathInfoHash> pathInfoForHandle;
133
135 void fileChanged(const QString &path, bool removed);
136 void directoryChanged(const QString &path, bool removed);
137};
138
140
141#endif // QFILESYSTEMWATCHER_WIN_P_H
\inmodule QtCore\reentrant
Definition qdatetime.h:283
QDateTime lastModified() const
Returns the date and time when the file was last modified.
Definition qfileinfo.h:160
uint groupId() const
Returns the id of the group the file belongs to.
uint ownerId() const
Returns the id of the owner of the file.
QFile::Permissions permissions() const
Returns the complete OR-ed together combination of QFile::Permissions for the file.
QFileSystemWatcherPathKey(const QFileSystemWatcherPathKey &other)
bool operator==(const QFileSystemWatcherPathKey &other) const
QFileSystemWatcherPathKey(const QString &other)
\inmodule QtCore
Definition qmutex.h:281
\inmodule QtCore
Definition qobject.h:103
QObject * parent() const
Returns a pointer to the parent object.
Definition qobject.h:346
\inmodule QtCore
\macro QT_RESTRICTED_CAST_FROM_ASCII
Definition qstring.h:129
int compare(const QString &s, Qt::CaseSensitivity cs=Qt::CaseSensitive) const noexcept
Definition qstring.cpp:6664
void fileChanged(const QString &path, bool removed)
void directoryChanged(const QString &path, bool removed)
QHash< Qt::HANDLE, PathInfoHash > pathInfoForHandle
QHash< QFileSystemWatcherPathKey, QWindowsFileSystemWatcherEngine::PathInfo > PathInfoHash
QHash< QFileSystemWatcherPathKey, QWindowsFileSystemWatcherEngine::Handle > HandleForDirHash
bool operator!=(const QFileInfo &fileInfo) const
PathInfo & operator=(const QFileInfo &fileInfo)
void driveLockForRemoval(const QString &)
QStringList addPaths(const QStringList &paths, QStringList *files, QStringList *directories) override
void driveLockForRemovalFailed(const QString &)
QStringList removePaths(const QStringList &paths, QStringList *files, QStringList *directories) override
void driveRemoved(const QString &)
Combined button and popup list for selecting options.
void * HANDLE
@ CaseInsensitive
size_t qHash(const QFileSystemWatcherPathKey &key, size_t seed=0)
GLuint64 key
GLsizei const GLuint * paths
GLsizei const GLchar *const * path
static Q_CONSTINIT QBasicAtomicInteger< unsigned > seed
Definition qrandom.cpp:196
#define Q_OBJECT
#define signals
#define Q_SIGNALS
@ Q_RELOCATABLE_TYPE
Definition qtypeinfo.h:158
#define Q_DECLARE_TYPEINFO(TYPE, FLAGS)
Definition qtypeinfo.h:180
unsigned int uint
Definition qtypes.h:34
QSharedPointer< T > other(t)
[5]
QStringList files
[8]