summaryrefslogtreecommitdiffstats
path: root/src/widgets/dialogs/qfileinfogatherer.cpp
diff options
context:
space:
mode:
authorLiang Qi <liang.qi@qt.io>2018-09-26 08:56:36 +0200
committerLiang Qi <liang.qi@qt.io>2018-09-27 08:18:55 +0000
commit555a6b5d5d2dd91a0dcf9e3d5fbadd1b31bf80f3 (patch)
treee0faaad63a8dc4055807a72ecce89cf7dc0d1cb2 /src/widgets/dialogs/qfileinfogatherer.cpp
parent5e64957ee4162ecf4456306a530a68761c2b127f (diff)
Modernize the "filesystemwatcher" feature
Change-Id: If030b56ad97e047d89d442629262b4839df306d4 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Diffstat (limited to 'src/widgets/dialogs/qfileinfogatherer.cpp')
-rw-r--r--src/widgets/dialogs/qfileinfogatherer.cpp14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/widgets/dialogs/qfileinfogatherer.cpp b/src/widgets/dialogs/qfileinfogatherer.cpp
index aef13a563f..1e03ad8b06 100644
--- a/src/widgets/dialogs/qfileinfogatherer.cpp
+++ b/src/widgets/dialogs/qfileinfogatherer.cpp
@@ -80,7 +80,7 @@ static QString translateDriveName(const QFileInfo &drive)
*/
QFileInfoGatherer::QFileInfoGatherer(QObject *parent)
: QThread(parent), abort(false),
-#ifndef QT_NO_FILESYSTEMWATCHER
+#if QT_CONFIG(filesystemwatcher)
watcher(0),
#endif
#ifdef Q_OS_WIN
@@ -88,7 +88,7 @@ QFileInfoGatherer::QFileInfoGatherer(QObject *parent)
#endif
m_iconProvider(&defaultProvider)
{
-#ifndef QT_NO_FILESYSTEMWATCHER
+#if QT_CONFIG(filesystemwatcher)
watcher = new QFileSystemWatcher(this);
connect(watcher, SIGNAL(directoryChanged(QString)), this, SLOT(list(QString)));
connect(watcher, SIGNAL(fileChanged(QString)), this, SLOT(updateFile(QString)));
@@ -179,7 +179,7 @@ void QFileInfoGatherer::fetchExtendedInformation(const QString &path, const QStr
this->files.push(files);
condition.wakeAll();
-#ifndef QT_NO_FILESYSTEMWATCHER
+#if QT_CONFIG(filesystemwatcher)
if (files.isEmpty()
&& !path.isEmpty()
&& !path.startsWith(QLatin1String("//")) /*don't watch UNC path*/) {
@@ -208,7 +208,7 @@ void QFileInfoGatherer::updateFile(const QString &filePath)
*/
void QFileInfoGatherer::clear()
{
-#ifndef QT_NO_FILESYSTEMWATCHER
+#if QT_CONFIG(filesystemwatcher)
QMutexLocker locker(&mutex);
watcher->removePaths(watcher->files());
watcher->removePaths(watcher->directories());
@@ -222,7 +222,7 @@ void QFileInfoGatherer::clear()
*/
void QFileInfoGatherer::removePath(const QString &path)
{
-#ifndef QT_NO_FILESYSTEMWATCHER
+#if QT_CONFIG(filesystemwatcher)
QMutexLocker locker(&mutex);
watcher->removePath(path);
#else
@@ -266,7 +266,7 @@ QExtendedInformation QFileInfoGatherer::getInfo(const QFileInfo &fileInfo) const
QExtendedInformation info(fileInfo);
info.icon = m_iconProvider->icon(fileInfo);
info.displayType = m_iconProvider->type(fileInfo);
-#ifndef QT_NO_FILESYSTEMWATCHER
+#if QT_CONFIG(filesystemwatcher)
// ### Not ready to listen all modifications by default
static const bool watchFiles = qEnvironmentVariableIsSet("QT_FILESYSTEMMODEL_WATCH_FILES");
if (watchFiles) {
@@ -280,7 +280,7 @@ QExtendedInformation QFileInfoGatherer::getInfo(const QFileInfo &fileInfo) const
}
}
}
-#endif
+#endif // filesystemwatcher
#ifdef Q_OS_WIN
if (m_resolveSymlinks && info.isSymLink(/* ignoreNtfsSymLinks = */ true)) {