| Absolute File Name: | /home/qt/qt5_coco/qt5/qtbase/src/corelib/io/qfilesystemwatcher.cpp |
| Source code | Switch to Preprocessed file |
| Line | Source | Count | ||||||
|---|---|---|---|---|---|---|---|---|
| 1 | /**************************************************************************** | - | ||||||
| 2 | ** | - | ||||||
| 3 | ** Copyright (C) 2016 The Qt Company Ltd. | - | ||||||
| 4 | ** Contact: https://www.qt.io/licensing/ | - | ||||||
| 5 | ** | - | ||||||
| 6 | ** This file is part of the QtCore module of the Qt Toolkit. | - | ||||||
| 7 | ** | - | ||||||
| 8 | ** $QT_BEGIN_LICENSE:LGPL$ | - | ||||||
| 9 | ** Commercial License Usage | - | ||||||
| 10 | ** Licensees holding valid commercial Qt licenses may use this file in | - | ||||||
| 11 | ** accordance with the commercial license agreement provided with the | - | ||||||
| 12 | ** Software or, alternatively, in accordance with the terms contained in | - | ||||||
| 13 | ** a written agreement between you and The Qt Company. For licensing terms | - | ||||||
| 14 | ** and conditions see https://www.qt.io/terms-conditions. For further | - | ||||||
| 15 | ** information use the contact form at https://www.qt.io/contact-us. | - | ||||||
| 16 | ** | - | ||||||
| 17 | ** GNU Lesser General Public License Usage | - | ||||||
| 18 | ** Alternatively, this file may be used under the terms of the GNU Lesser | - | ||||||
| 19 | ** General Public License version 3 as published by the Free Software | - | ||||||
| 20 | ** Foundation and appearing in the file LICENSE.LGPL3 included in the | - | ||||||
| 21 | ** packaging of this file. Please review the following information to | - | ||||||
| 22 | ** ensure the GNU Lesser General Public License version 3 requirements | - | ||||||
| 23 | ** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. | - | ||||||
| 24 | ** | - | ||||||
| 25 | ** GNU General Public License Usage | - | ||||||
| 26 | ** Alternatively, this file may be used under the terms of the GNU | - | ||||||
| 27 | ** General Public License version 2.0 or (at your option) the GNU General | - | ||||||
| 28 | ** Public license version 3 or any later version approved by the KDE Free | - | ||||||
| 29 | ** Qt Foundation. The licenses are as published by the Free Software | - | ||||||
| 30 | ** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 | - | ||||||
| 31 | ** included in the packaging of this file. Please review the following | - | ||||||
| 32 | ** information to ensure the GNU General Public License requirements will | - | ||||||
| 33 | ** be met: https://www.gnu.org/licenses/gpl-2.0.html and | - | ||||||
| 34 | ** https://www.gnu.org/licenses/gpl-3.0.html. | - | ||||||
| 35 | ** | - | ||||||
| 36 | ** $QT_END_LICENSE$ | - | ||||||
| 37 | ** | - | ||||||
| 38 | ****************************************************************************/ | - | ||||||
| 39 | - | |||||||
| 40 | #include "qfilesystemwatcher.h" | - | ||||||
| 41 | #include "qfilesystemwatcher_p.h" | - | ||||||
| 42 | - | |||||||
| 43 | #ifndef QT_NO_FILESYSTEMWATCHER | - | ||||||
| 44 | - | |||||||
| 45 | #include <qdatetime.h> | - | ||||||
| 46 | #include <qdebug.h> | - | ||||||
| 47 | #include <qdir.h> | - | ||||||
| 48 | #include <qfileinfo.h> | - | ||||||
| 49 | #include <qset.h> | - | ||||||
| 50 | #include <qtimer.h> | - | ||||||
| 51 | - | |||||||
| 52 | #if defined(Q_OS_LINUX) || (defined(Q_OS_QNX) && !defined(QT_NO_INOTIFY)) | - | ||||||
| 53 | #define USE_INOTIFY | - | ||||||
| 54 | #endif | - | ||||||
| 55 | - | |||||||
| 56 | #include "qfilesystemwatcher_polling_p.h" | - | ||||||
| 57 | #if defined(Q_OS_WIN) | - | ||||||
| 58 | # include "qfilesystemwatcher_win_p.h" | - | ||||||
| 59 | #elif defined(USE_INOTIFY) | - | ||||||
| 60 | # include "qfilesystemwatcher_inotify_p.h" | - | ||||||
| 61 | #elif defined(Q_OS_FREEBSD) || defined(Q_OS_NETBSD) || defined(Q_OS_OPENBSD) || defined(Q_OS_IOS) | - | ||||||
| 62 | # include "qfilesystemwatcher_kqueue_p.h" | - | ||||||
| 63 | #elif defined(Q_OS_OSX) | - | ||||||
| 64 | # include "qfilesystemwatcher_fsevents_p.h" | - | ||||||
| 65 | #endif | - | ||||||
| 66 | - | |||||||
| 67 | QT_BEGIN_NAMESPACE | - | ||||||
| 68 | - | |||||||
| 69 | QFileSystemWatcherEngine *QFileSystemWatcherPrivate::createNativeEngine(QObject *parent) | - | ||||||
| 70 | { | - | ||||||
| 71 | #if defined(Q_OS_WIN) | - | ||||||
| 72 | return new QWindowsFileSystemWatcherEngine(parent); | - | ||||||
| 73 | #elif defined(USE_INOTIFY) | - | ||||||
| 74 | // there is a chance that inotify may fail on Linux pre-2.6.13 (August | - | ||||||
| 75 | // 2005), so we can't just new inotify directly. | - | ||||||
| 76 | return QInotifyFileSystemWatcherEngine::create(parent); | - | ||||||
| 77 | #elif defined(Q_OS_FREEBSD) || defined(Q_OS_NETBSD) || defined(Q_OS_OPENBSD) || defined(Q_OS_IOS) | - | ||||||
| 78 | return QKqueueFileSystemWatcherEngine::create(parent); | - | ||||||
| 79 | #elif defined(Q_OS_OSX) | - | ||||||
| 80 | return QFseventsFileSystemWatcherEngine::create(parent); | - | ||||||
| 81 | #else | - | ||||||
| 82 | Q_UNUSED(parent); | - | ||||||
| 83 | return 0; | - | ||||||
| 84 | #endif | - | ||||||
| 85 | } | - | ||||||
| 86 | - | |||||||
| 87 | QFileSystemWatcherPrivate::QFileSystemWatcherPrivate() | - | ||||||
| 88 | : native(0), poller(0) | - | ||||||
| 89 | { | - | ||||||
| 90 | } | - | ||||||
| 91 | - | |||||||
| 92 | void QFileSystemWatcherPrivate::init() | - | ||||||
| 93 | { | - | ||||||
| 94 | Q_Q(QFileSystemWatcher); | - | ||||||
| 95 | native = createNativeEngine(q); | - | ||||||
| 96 | if (native) { | - | ||||||
| 97 | QObject::connect(native, | - | ||||||
| 98 | SIGNAL(fileChanged(QString,bool)), | - | ||||||
| 99 | q, | - | ||||||
| 100 | SLOT(_q_fileChanged(QString,bool))); | - | ||||||
| 101 | QObject::connect(native, | - | ||||||
| 102 | SIGNAL(directoryChanged(QString,bool)), | - | ||||||
| 103 | q, | - | ||||||
| 104 | SLOT(_q_directoryChanged(QString,bool))); | - | ||||||
| 105 | } | - | ||||||
| 106 | } | - | ||||||
| 107 | - | |||||||
| 108 | void QFileSystemWatcherPrivate::initPollerEngine() | - | ||||||
| 109 | { | - | ||||||
| 110 | if(poller) | - | ||||||
| 111 | return; | - | ||||||
| 112 | - | |||||||
| 113 | Q_Q(QFileSystemWatcher); | - | ||||||
| 114 | poller = new QPollingFileSystemWatcherEngine(q); // that was a mouthful | - | ||||||
| 115 | QObject::connect(poller, | - | ||||||
| 116 | SIGNAL(fileChanged(QString,bool)), | - | ||||||
| 117 | q, | - | ||||||
| 118 | SLOT(_q_fileChanged(QString,bool))); | - | ||||||
| 119 | QObject::connect(poller, | - | ||||||
| 120 | SIGNAL(directoryChanged(QString,bool)), | - | ||||||
| 121 | q, | - | ||||||
| 122 | SLOT(_q_directoryChanged(QString,bool))); | - | ||||||
| 123 | } | - | ||||||
| 124 | - | |||||||
| 125 | void QFileSystemWatcherPrivate::_q_fileChanged(const QString &path, bool removed) | - | ||||||
| 126 | { | - | ||||||
| 127 | Q_Q(QFileSystemWatcher); | - | ||||||
| 128 | if (!files.contains(path)) { | - | ||||||
| 129 | // the path was removed after a change was detected, but before we delivered the signal | - | ||||||
| 130 | return; | - | ||||||
| 131 | } | - | ||||||
| 132 | if (removed) | - | ||||||
| 133 | files.removeAll(path); | - | ||||||
| 134 | emit q->fileChanged(path, QFileSystemWatcher::QPrivateSignal()); | - | ||||||
| 135 | } | - | ||||||
| 136 | - | |||||||
| 137 | void QFileSystemWatcherPrivate::_q_directoryChanged(const QString &path, bool removed) | - | ||||||
| 138 | { | - | ||||||
| 139 | Q_Q(QFileSystemWatcher); | - | ||||||
| 140 | if (!directories.contains(path)) { | - | ||||||
| 141 | // perhaps the path was removed after a change was detected, but before we delivered the signal | - | ||||||
| 142 | return; | - | ||||||
| 143 | } | - | ||||||
| 144 | if (removed) | - | ||||||
| 145 | directories.removeAll(path); | - | ||||||
| 146 | emit q->directoryChanged(path, QFileSystemWatcher::QPrivateSignal()); | - | ||||||
| 147 | } | - | ||||||
| 148 | - | |||||||
| 149 | - | |||||||
| 150 | - | |||||||
| 151 | /*! | - | ||||||
| 152 | \class QFileSystemWatcher | - | ||||||
| 153 | \inmodule QtCore | - | ||||||
| 154 | \brief The QFileSystemWatcher class provides an interface for monitoring files and directories for modifications. | - | ||||||
| 155 | \ingroup io | - | ||||||
| 156 | \since 4.2 | - | ||||||
| 157 | \reentrant | - | ||||||
| 158 | - | |||||||
| 159 | QFileSystemWatcher monitors the file system for changes to files | - | ||||||
| 160 | and directories by watching a list of specified paths. | - | ||||||
| 161 | - | |||||||
| 162 | Call addPath() to watch a particular file or directory. Multiple | - | ||||||
| 163 | paths can be added using the addPaths() function. Existing paths can | - | ||||||
| 164 | be removed by using the removePath() and removePaths() functions. | - | ||||||
| 165 | - | |||||||
| 166 | QFileSystemWatcher examines each path added to it. Files that have | - | ||||||
| 167 | been added to the QFileSystemWatcher can be accessed using the | - | ||||||
| 168 | files() function, and directories using the directories() function. | - | ||||||
| 169 | - | |||||||
| 170 | The fileChanged() signal is emitted when a file has been modified, | - | ||||||
| 171 | renamed or removed from disk. Similarly, the directoryChanged() | - | ||||||
| 172 | signal is emitted when a directory or its contents is modified or | - | ||||||
| 173 | removed. Note that QFileSystemWatcher stops monitoring files once | - | ||||||
| 174 | they have been renamed or removed from disk, and directories once | - | ||||||
| 175 | they have been removed from disk. | - | ||||||
| 176 | - | |||||||
| 177 | \list | - | ||||||
| 178 | \li \b Notes: | - | ||||||
| 179 | \list | - | ||||||
| 180 | \li On systems running a Linux kernel without inotify support, | - | ||||||
| 181 | file systems that contain watched paths cannot be unmounted. | - | ||||||
| 182 | - | |||||||
| 183 | \li The act of monitoring files and directories for | - | ||||||
| 184 | modifications consumes system resources. This implies there is a | - | ||||||
| 185 | limit to the number of files and directories your process can | - | ||||||
| 186 | monitor simultaneously. On all BSD variants, for | - | ||||||
| 187 | example, an open file descriptor is required for each monitored | - | ||||||
| 188 | file. Some system limits the number of open file descriptors to 256 | - | ||||||
| 189 | by default. This means that addPath() and addPaths() will fail if | - | ||||||
| 190 | your process tries to add more than 256 files or directories to | - | ||||||
| 191 | the file system monitor. Also note that your process may have | - | ||||||
| 192 | other file descriptors open in addition to the ones for files | - | ||||||
| 193 | being monitored, and these other open descriptors also count in | - | ||||||
| 194 | the total. \macos uses a different backend and does not | - | ||||||
| 195 | suffer from this issue. | - | ||||||
| 196 | \endlist | - | ||||||
| 197 | \endlist | - | ||||||
| 198 | - | |||||||
| 199 | \sa QFile, QDir | - | ||||||
| 200 | */ | - | ||||||
| 201 | - | |||||||
| 202 | - | |||||||
| 203 | /*! | - | ||||||
| 204 | Constructs a new file system watcher object with the given \a parent. | - | ||||||
| 205 | */ | - | ||||||
| 206 | QFileSystemWatcher::QFileSystemWatcher(QObject *parent) | - | ||||||
| 207 | : QObject(*new QFileSystemWatcherPrivate, parent) | - | ||||||
| 208 | { | - | ||||||
| 209 | d_func()->init(); | - | ||||||
| 210 | } | - | ||||||
| 211 | - | |||||||
| 212 | /*! | - | ||||||
| 213 | Constructs a new file system watcher object with the given \a parent | - | ||||||
| 214 | which monitors the specified \a paths list. | - | ||||||
| 215 | */ | - | ||||||
| 216 | QFileSystemWatcher::QFileSystemWatcher(const QStringList &paths, QObject *parent) | - | ||||||
| 217 | : QObject(*new QFileSystemWatcherPrivate, parent) | - | ||||||
| 218 | { | - | ||||||
| 219 | d_func()->init(); | - | ||||||
| 220 | addPaths(paths); | - | ||||||
| 221 | } | - | ||||||
| 222 | - | |||||||
| 223 | /*! | - | ||||||
| 224 | Destroys the file system watcher. | - | ||||||
| 225 | */ | - | ||||||
| 226 | QFileSystemWatcher::~QFileSystemWatcher() | - | ||||||
| 227 | { } | - | ||||||
| 228 | - | |||||||
| 229 | /*! | - | ||||||
| 230 | Adds \a path to the file system watcher if \a path exists. The | - | ||||||
| 231 | path is not added if it does not exist, or if it is already being | - | ||||||
| 232 | monitored by the file system watcher. | - | ||||||
| 233 | - | |||||||
| 234 | If \a path specifies a directory, the directoryChanged() signal | - | ||||||
| 235 | will be emitted when \a path is modified or removed from disk; | - | ||||||
| 236 | otherwise the fileChanged() signal is emitted when \a path is | - | ||||||
| 237 | modified, renamed or removed. | - | ||||||
| 238 | - | |||||||
| 239 | If the watch was successful, true is returned. | - | ||||||
| 240 | - | |||||||
| 241 | Reasons for a watch failure are generally system-dependent, but | - | ||||||
| 242 | may include the resource not existing, access failures, or the | - | ||||||
| 243 | total watch count limit, if the platform has one. | - | ||||||
| 244 | - | |||||||
| 245 | \note There may be a system dependent limit to the number of | - | ||||||
| 246 | files and directories that can be monitored simultaneously. | - | ||||||
| 247 | If this limit is been reached, \a path will not be monitored, | - | ||||||
| 248 | and false is returned. | - | ||||||
| 249 | - | |||||||
| 250 | \sa addPaths(), removePath() | - | ||||||
| 251 | */ | - | ||||||
| 252 | bool QFileSystemWatcher::addPath(const QString &path) | - | ||||||
| 253 | { | - | ||||||
| 254 | if (path.isEmpty()) { | - | ||||||
| 255 | qWarning("QFileSystemWatcher::addPath: path is empty"); | - | ||||||
| 256 | return true; | - | ||||||
| 257 | } | - | ||||||
| 258 | - | |||||||
| 259 | QStringList paths = addPaths(QStringList(path)); | - | ||||||
| 260 | return paths.isEmpty(); | - | ||||||
| 261 | } | - | ||||||
| 262 | - | |||||||
| 263 | /*! | - | ||||||
| 264 | Adds each path in \a paths to the file system watcher. Paths are | - | ||||||
| 265 | not added if they not exist, or if they are already being | - | ||||||
| 266 | monitored by the file system watcher. | - | ||||||
| 267 | - | |||||||
| 268 | If a path specifies a directory, the directoryChanged() signal | - | ||||||
| 269 | will be emitted when the path is modified or removed from disk; | - | ||||||
| 270 | otherwise the fileChanged() signal is emitted when the path is | - | ||||||
| 271 | modified, renamed, or removed. | - | ||||||
| 272 | - | |||||||
| 273 | The return value is a list of paths that could not be watched. | - | ||||||
| 274 | - | |||||||
| 275 | Reasons for a watch failure are generally system-dependent, but | - | ||||||
| 276 | may include the resource not existing, access failures, or the | - | ||||||
| 277 | total watch count limit, if the platform has one. | - | ||||||
| 278 | - | |||||||
| 279 | \note There may be a system dependent limit to the number of | - | ||||||
| 280 | files and directories that can be monitored simultaneously. | - | ||||||
| 281 | If this limit has been reached, the excess \a paths will not | - | ||||||
| 282 | be monitored, and they will be added to the returned QStringList. | - | ||||||
| 283 | - | |||||||
| 284 | \sa addPath(), removePaths() | - | ||||||
| 285 | */ | - | ||||||
| 286 | QStringList QFileSystemWatcher::addPaths(const QStringList &paths) | - | ||||||
| 287 | { | - | ||||||
| 288 | Q_D(QFileSystemWatcher); | - | ||||||
| 289 | - | |||||||
| 290 | QStringList p = paths; | - | ||||||
| 291 | QMutableListIterator<QString> it(p); | - | ||||||
| 292 | - | |||||||
| 293 | while (it.hasNext()) {
| 487-488 | ||||||
| 294 | const QString &path = it.next(); | - | ||||||
| 295 | if (path.isEmpty())
| 1-487 | ||||||
| 296 | it.remove(); executed 1 time by 1 test: it.remove();Executed by:
| 1 | ||||||
| 297 | } executed 488 times by 8 tests: end of blockExecuted by:
| 488 | ||||||
| 298 | - | |||||||
| 299 | if (p.isEmpty()) {
| 2-485 | ||||||
| 300 | qWarning("QFileSystemWatcher::addPaths: list is empty"); | - | ||||||
| 301 | return QStringList(); executed 2 times by 1 test: return QStringList();Executed by:
| 2 | ||||||
| 302 | } | - | ||||||
| 303 | - | |||||||
| 304 | QFileSystemWatcherEngine *engine = 0; | - | ||||||
| 305 | - | |||||||
| 306 | const QString on = objectName(); | - | ||||||
| 307 | - | |||||||
| 308 | if (!on.startsWith(QLatin1String("_qt_autotest_force_engine_"))) {
| 27-458 | ||||||
| 309 | // Normal runtime case - search intelligently for best engine | - | ||||||
| 310 | if(d->native) {
| 0-458 | ||||||
| 311 | engine = d->native; | - | ||||||
| 312 | } else { executed 458 times by 8 tests: end of blockExecuted by:
| 458 | ||||||
| 313 | d_func()->initPollerEngine(); | - | ||||||
| 314 | engine = d->poller; | - | ||||||
| 315 | } never executed: end of block | 0 | ||||||
| 316 | - | |||||||
| 317 | } else { | - | ||||||
| 318 | // Autotest override case - use the explicitly selected engine only | - | ||||||
| 319 | const QStringRef forceName = on.midRef(26); | - | ||||||
| 320 | if(forceName == QLatin1String("poller")) {
| 9-18 | ||||||
| 321 | qDebug() << ("QFileSystemWatcher: skipping native engine, using only polling engine";); | - | ||||||
| 322 | d_func()->initPollerEngine(); | - | ||||||
| 323 | engine = d->poller; | - | ||||||
| 324 | } else if(forceName == QLatin1String("native")) { executed 9 times by 1 test: end of blockExecuted by:
| 0-18 | ||||||
| 325 | qDebug() << ("QFileSystemWatcher: skipping polling engine, using only native engine";); | - | ||||||
| 326 | engine = d->native; | - | ||||||
| 327 | } executed 18 times by 1 test: end of blockExecuted by:
| 18 | ||||||
| 328 | } executed 27 times by 1 test: end of blockExecuted by:
| 27 | ||||||
| 329 | - | |||||||
| 330 | if(engine)
| 0-485 | ||||||
| 331 | p = engine->addPaths(p, &d->files, &d->directories); executed 485 times by 8 tests: p = engine->addPaths(p, &d->files, &d->directories);Executed by:
| 485 | ||||||
| 332 | - | |||||||
| 333 | return p; executed 485 times by 8 tests: return p;Executed by:
| 485 | ||||||
| 334 | } | - | ||||||
| 335 | - | |||||||
| 336 | /*! | - | ||||||
| 337 | Removes the specified \a path from the file system watcher. | - | ||||||
| 338 | - | |||||||
| 339 | If the watch is successfully removed, true is returned. | - | ||||||
| 340 | - | |||||||
| 341 | Reasons for watch removal failing are generally system-dependent, | - | ||||||
| 342 | but may be due to the path having already been deleted, for example. | - | ||||||
| 343 | - | |||||||
| 344 | \sa removePaths(), addPath() | - | ||||||
| 345 | */ | - | ||||||
| 346 | bool QFileSystemWatcher::removePath(const QString &path) | - | ||||||
| 347 | { | - | ||||||
| 348 | if (path.isEmpty()) { | - | ||||||
| 349 | qWarning("QFileSystemWatcher::removePath: path is empty"); | - | ||||||
| 350 | return true; | - | ||||||
| 351 | } | - | ||||||
| 352 | - | |||||||
| 353 | QStringList paths = removePaths(QStringList(path)); | - | ||||||
| 354 | return paths.isEmpty(); | - | ||||||
| 355 | } | - | ||||||
| 356 | - | |||||||
| 357 | /*! | - | ||||||
| 358 | Removes the specified \a paths from the file system watcher. | - | ||||||
| 359 | - | |||||||
| 360 | The return value is a list of paths which were not able to be | - | ||||||
| 361 | unwatched successfully. | - | ||||||
| 362 | - | |||||||
| 363 | Reasons for watch removal failing are generally system-dependent, | - | ||||||
| 364 | but may be due to the path having already been deleted, for example. | - | ||||||
| 365 | - | |||||||
| 366 | \sa removePath(), addPaths() | - | ||||||
| 367 | */ | - | ||||||
| 368 | QStringList QFileSystemWatcher::removePaths(const QStringList &paths) | - | ||||||
| 369 | { | - | ||||||
| 370 | Q_D(QFileSystemWatcher); | - | ||||||
| 371 | - | |||||||
| 372 | QStringList p = paths; | - | ||||||
| 373 | QMutableListIterator<QString> it(p); | - | ||||||
| 374 | - | |||||||
| 375 | while (it.hasNext()) { | - | ||||||
| 376 | const QString &path = it.next(); | - | ||||||
| 377 | if (path.isEmpty()) | - | ||||||
| 378 | it.remove(); | - | ||||||
| 379 | } | - | ||||||
| 380 | - | |||||||
| 381 | if (p.isEmpty()) { | - | ||||||
| 382 | qWarning("QFileSystemWatcher::removePaths: list is empty"); | - | ||||||
| 383 | return QStringList(); | - | ||||||
| 384 | } | - | ||||||
| 385 | - | |||||||
| 386 | if (d->native) | - | ||||||
| 387 | p = d->native->removePaths(p, &d->files, &d->directories); | - | ||||||
| 388 | if (d->poller) | - | ||||||
| 389 | p = d->poller->removePaths(p, &d->files, &d->directories); | - | ||||||
| 390 | - | |||||||
| 391 | return p; | - | ||||||
| 392 | } | - | ||||||
| 393 | - | |||||||
| 394 | /*! | - | ||||||
| 395 | \fn void QFileSystemWatcher::fileChanged(const QString &path) | - | ||||||
| 396 | - | |||||||
| 397 | This signal is emitted when the file at the specified \a path is | - | ||||||
| 398 | modified, renamed or removed from disk. | - | ||||||
| 399 | - | |||||||
| 400 | \sa directoryChanged() | - | ||||||
| 401 | */ | - | ||||||
| 402 | - | |||||||
| 403 | /*! | - | ||||||
| 404 | \fn void QFileSystemWatcher::directoryChanged(const QString &path) | - | ||||||
| 405 | - | |||||||
| 406 | This signal is emitted when the directory at a specified \a path | - | ||||||
| 407 | is modified (e.g., when a file is added or deleted) or removed | - | ||||||
| 408 | from disk. Note that if there are several changes during a short | - | ||||||
| 409 | period of time, some of the changes might not emit this signal. | - | ||||||
| 410 | However, the last change in the sequence of changes will always | - | ||||||
| 411 | generate this signal. | - | ||||||
| 412 | - | |||||||
| 413 | \sa fileChanged() | - | ||||||
| 414 | */ | - | ||||||
| 415 | - | |||||||
| 416 | /*! | - | ||||||
| 417 | \fn QStringList QFileSystemWatcher::directories() const | - | ||||||
| 418 | - | |||||||
| 419 | Returns a list of paths to directories that are being watched. | - | ||||||
| 420 | - | |||||||
| 421 | \sa files() | - | ||||||
| 422 | */ | - | ||||||
| 423 | - | |||||||
| 424 | /*! | - | ||||||
| 425 | \fn QStringList QFileSystemWatcher::files() const | - | ||||||
| 426 | - | |||||||
| 427 | Returns a list of paths to files that are being watched. | - | ||||||
| 428 | - | |||||||
| 429 | \sa directories() | - | ||||||
| 430 | */ | - | ||||||
| 431 | - | |||||||
| 432 | QStringList QFileSystemWatcher::directories() const | - | ||||||
| 433 | { | - | ||||||
| 434 | Q_D(const QFileSystemWatcher); | - | ||||||
| 435 | return d->directories; | - | ||||||
| 436 | } | - | ||||||
| 437 | - | |||||||
| 438 | QStringList QFileSystemWatcher::files() const | - | ||||||
| 439 | { | - | ||||||
| 440 | Q_D(const QFileSystemWatcher); | - | ||||||
| 441 | return d->files; | - | ||||||
| 442 | } | - | ||||||
| 443 | - | |||||||
| 444 | QT_END_NAMESPACE | - | ||||||
| 445 | - | |||||||
| 446 | #include "moc_qfilesystemwatcher.cpp" | - | ||||||
| 447 | - | |||||||
| 448 | #endif // QT_NO_FILESYSTEMWATCHER | - | ||||||
| 449 | - | |||||||
| Source code | Switch to Preprocessed file |