14#if (defined(Q_OS_LINUX) || defined(Q_OS_QNX)) && QT_CONFIG(inotify)
21#elif defined(USE_INOTIFY)
23#elif defined(Q_OS_FREEBSD) || defined(Q_OS_NETBSD) || defined(Q_OS_OPENBSD) || defined(QT_PLATFORM_UIKIT)
25#elif defined(Q_OS_MACOS)
42#elif defined(USE_INOTIFY)
46#elif defined(Q_OS_FREEBSD) || defined(Q_OS_NETBSD) || defined(Q_OS_OPENBSD) || defined(QT_PLATFORM_UIKIT)
48#elif defined(Q_OS_MACOS)
77 q, [
this] (
const QString &
p) { _q_winDriveLockForRemoval(
p); });
80 q, [
this] (
const QString &
p) { _q_winDriveLockForRemovalFailed(
p); });
83 q, [
this] (
const QString &
p) { _q_winDriveRemoved(
p); });
108 qCDebug(lcWatcher) <<
"file changed" <<
path <<
"removed?" << removed <<
"watching?" <<
files.contains(
path);
115 emit q->fileChanged(
path, QFileSystemWatcher::QPrivateSignal());
128 emit q->directoryChanged(
path, QFileSystemWatcher::QPrivateSignal());
133void QFileSystemWatcherPrivate::_q_winDriveLockForRemoval(
const QString &
path)
140 std::remove_copy_if(
files.cbegin(),
files.cend(),
141 std::back_inserter(pathsToBeRemoved), pred);
143 std::back_inserter(pathsToBeRemoved), pred);
144 if (!pathsToBeRemoved.isEmpty()) {
145 q->removePaths(pathsToBeRemoved);
146 temporarilyRemovedPaths.insert(
path.at(0), pathsToBeRemoved);
150void QFileSystemWatcherPrivate::_q_winDriveLockForRemovalFailed(
const QString &
path)
155 if (!
path.isEmpty()) {
156 const auto it = temporarilyRemovedPaths.
find(
path.at(0));
157 if (
it != temporarilyRemovedPaths.
end()) {
158 q->addPaths(
it.value());
159 temporarilyRemovedPaths.erase(
it);
164void QFileSystemWatcherPrivate::_q_winDriveRemoved(
const QString &
path)
168 temporarilyRemovedPaths.remove(
path.at(0));
275 if (
path.isEmpty()) {
276 qWarning(
"QFileSystemWatcher::addPath: path is empty");
281 return paths.isEmpty();
288 const auto isEmpty = [](
const QString &
s) {
return s.isEmpty(); };
289 std::remove_copy_if(
paths.begin(),
paths.end(),
290 std::back_inserter(
p),
325 qWarning(
"QFileSystemWatcher::addPaths: list is empty");
330#ifdef QT_BUILD_INTERNAL
336 if (forceName ==
"poller"_L1) {
337 qCDebug(lcWatcher,
"QFileSystemWatcher: skipping native engine, using only polling engine");
338 d_func()->initPollerEngine();
340 }
else if (forceName ==
"native"_L1) {
341 qCDebug(lcWatcher,
"QFileSystemWatcher: skipping polling engine, using only native engine");
351 d_func()->initPollerEngine();
356 if (
auto engine = selectEngine())
357 p =
engine->addPaths(
p, &
d->files, &
d->directories);
374 if (
path.isEmpty()) {
375 qWarning(
"QFileSystemWatcher::removePath: path is empty");
380 return paths.isEmpty();
401 qWarning(
"QFileSystemWatcher::removePaths: list is empty");
407 p =
d->native->removePaths(
p, &
d->files, &
d->directories);
409 p =
d->poller->removePaths(
p, &
d->files, &
d->directories);
461 return d->directories;
472#include "moc_qfilesystemwatcher.cpp"
473#include "moc_qfilesystemwatcher_p.cpp"
QFileSystemWatcherEngine * native
void _q_fileChanged(const QString &path, bool removed)
QFileSystemWatcherEngine * poller
void _q_directoryChanged(const QString &path, bool removed)
QFileSystemWatcherPrivate()
QStringList directories() const
Returns a list of paths to directories that are being watched.
QStringList files() const
Returns a list of paths to files that are being watched.
QFileSystemWatcher(QObject *parent=nullptr)
Constructs a new file system watcher object with the given parent.
bool removePath(const QString &file)
Removes the specified path from the file system watcher.
QStringList removePaths(const QStringList &files)
Removes the specified paths from the file system watcher.
bool addPath(const QString &file)
Adds path to the file system watcher if path exists.
~QFileSystemWatcher()
Destroys the file system watcher.
QStringList addPaths(const QStringList &files)
Adds each path in paths to the file system watcher.
static QFseventsFileSystemWatcherEngine * create(QObject *parent)
static QInotifyFileSystemWatcherEngine * create(QObject *parent)
static QKqueueFileSystemWatcherEngine * create(QObject *parent)
static QMetaObject::Connection connect(const QObject *sender, const char *signal, const QObject *receiver, const char *member, Qt::ConnectionType=Qt::AutoConnection)
\threadsafe
QString objectName
the name of this object
iterator find(const T &value)
\macro QT_RESTRICTED_CAST_FROM_ASCII
bool startsWith(const QString &s, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
Returns true if the string starts with s; otherwise returns false.
QString mid(qsizetype position, qsizetype n=-1) const
Returns a string that contains n characters of this string, starting at the specified position index.
void driveLockForRemoval(const QString &)
void driveLockForRemovalFailed(const QString &)
void driveRemoved(const QString &)
QSet< QString >::iterator it
Combined button and popup list for selecting options.
static QStringList empty_paths_pruned(const QStringList &paths)
#define Q_LOGGING_CATEGORY(name,...)
#define qCDebug(category,...)
GLsizei const GLuint * paths
GLdouble GLdouble GLdouble GLdouble q
GLsizei const GLchar *const * path
IUIAutomationTreeWalker __RPC__deref_out_opt IUIAutomationElement ** parent