Merge remote-tracking branch 'origin/5.11' into 5.12

Change-Id: Iaa438d14357be1bf75bb645cb8d3245947c055b8
This commit is contained in:
Qt Forward Merge Bot 2018-09-30 01:00:19 +02:00
commit 07e9261105
32 changed files with 114 additions and 123 deletions

View File

@ -84,7 +84,7 @@ FragmentToy::FragmentToy(const QString &fragmentSource, QObject *parent)
QFileInfo info(fragmentSource); QFileInfo info(fragmentSource);
m_fragment_file_last_modified = info.lastModified(); m_fragment_file_last_modified = info.lastModified();
m_fragment_file = fragmentSource; m_fragment_file = fragmentSource;
#ifndef QT_NO_FILESYSTEMWATCHER #if QT_CONFIG(filesystemwatcher)
m_watcher.addPath(info.canonicalPath()); m_watcher.addPath(info.canonicalPath());
QObject::connect(&m_watcher, &QFileSystemWatcher::directoryChanged, this, &FragmentToy::fileChanged); QObject::connect(&m_watcher, &QFileSystemWatcher::directoryChanged, this, &FragmentToy::fileChanged);
#endif #endif

View File

@ -54,7 +54,9 @@
#include <QObject> #include <QObject>
#include <QFile> #include <QFile>
#include <QDateTime> #include <QDateTime>
#if QT_CONFIG(filesystemwatcher)
#include <QFileSystemWatcher> #include <QFileSystemWatcher>
#endif
#include <QOpenGLVertexArrayObject> #include <QOpenGLVertexArrayObject>
#include <QOpenGLBuffer> #include <QOpenGLBuffer>
#include <QOpenGLShaderProgram> #include <QOpenGLShaderProgram>
@ -71,7 +73,7 @@ public:
private: private:
void fileChanged(const QString &path); void fileChanged(const QString &path);
bool m_recompile_shaders; bool m_recompile_shaders;
#ifndef QT_NO_FILESYSTEMWATCHER #if QT_CONFIG(filesystemwatcher)
QFileSystemWatcher m_watcher; QFileSystemWatcher m_watcher;
#endif #endif
QString m_fragment_file; QString m_fragment_file;

View File

@ -112,7 +112,6 @@ const char _Culture[] = "Culture";
const char _DLLDataFileName[] = "DLLDataFileName"; const char _DLLDataFileName[] = "DLLDataFileName";
const char _DataExecutionPrevention[] = "DataExecutionPrevention"; const char _DataExecutionPrevention[] = "DataExecutionPrevention";
const char _DebugInformationFormat[] = "DebugInformationFormat"; const char _DebugInformationFormat[] = "DebugInformationFormat";
const char _DefaultCharIsUnsigned[] = "DefaultCharIsUnsigned";
const char _DefaultCharType[] = "DefaultCharType"; const char _DefaultCharType[] = "DefaultCharType";
const char _DelayLoadDLLs[] = "DelayLoadDLLs"; const char _DelayLoadDLLs[] = "DelayLoadDLLs";
const char _DeleteExtensionsOnClean[] = "DeleteExtensionsOnClean"; const char _DeleteExtensionsOnClean[] = "DeleteExtensionsOnClean";
@ -358,7 +357,6 @@ VCCLCompilerTool::VCCLCompilerTool()
CompileAsWinRT(unset), CompileAsWinRT(unset),
CompileOnly(unset), CompileOnly(unset),
DebugInformationFormat(debugDisabled), DebugInformationFormat(debugDisabled),
DefaultCharIsUnsigned(unset),
Detect64BitPortabilityProblems(unset), Detect64BitPortabilityProblems(unset),
DisableLanguageExtensions(unset), DisableLanguageExtensions(unset),
EnableEnhancedInstructionSet(archNotSet), EnableEnhancedInstructionSet(archNotSet),
@ -668,7 +666,7 @@ bool VCCLCompilerTool::parseOption(const char* option)
AdditionalIncludeDirectories += option+2; AdditionalIncludeDirectories += option+2;
break; break;
case 'J': case 'J':
DefaultCharIsUnsigned = _True; AdditionalOptions += option;
break; break;
case 'L': case 'L':
if(second == 'D') { if(second == 'D') {
@ -2646,7 +2644,6 @@ void VCProjectWriter::write(XmlOutput &xml, const VCCLCompilerTool &tool)
<< attrE(_CompileAsManaged, tool.CompileAsManaged, /*ifNot*/ managedDefault) << attrE(_CompileAsManaged, tool.CompileAsManaged, /*ifNot*/ managedDefault)
<< attrT(_CompileOnly, tool.CompileOnly) << attrT(_CompileOnly, tool.CompileOnly)
<< attrE(_DebugInformationFormat, tool.DebugInformationFormat, /*ifNot*/ debugUnknown) << attrE(_DebugInformationFormat, tool.DebugInformationFormat, /*ifNot*/ debugUnknown)
<< attrT(_DefaultCharIsUnsigned, tool.DefaultCharIsUnsigned)
<< attrT(_Detect64BitPortabilityProblems, tool.Detect64BitPortabilityProblems) << attrT(_Detect64BitPortabilityProblems, tool.Detect64BitPortabilityProblems)
<< attrT(_DisableLanguageExtensions, tool.DisableLanguageExtensions) << attrT(_DisableLanguageExtensions, tool.DisableLanguageExtensions)
<< attrX(_DisableSpecificWarnings, tool.DisableSpecificWarnings) << attrX(_DisableSpecificWarnings, tool.DisableSpecificWarnings)

View File

@ -1672,9 +1672,7 @@ static bool android_default_message_handler(QtMsgType type,
case QtFatalMsg: priority = ANDROID_LOG_FATAL; break; case QtFatalMsg: priority = ANDROID_LOG_FATAL; break;
}; };
__android_log_print(priority, qPrintable(QCoreApplication::applicationName()), __android_log_print(priority, qPrintable(QCoreApplication::applicationName()), "%s\n", qPrintable(formattedMessage));
"%s:%d (%s): %s\n", context.file, context.line,
context.function, qPrintable(formattedMessage));
return true; // Prevent further output to stderr return true; // Prevent further output to stderr
} }

View File

@ -38,9 +38,6 @@ HEADERS += \
io/qsettings_p.h \ io/qsettings_p.h \
io/qfsfileengine_p.h \ io/qfsfileengine_p.h \
io/qfsfileengine_iterator_p.h \ io/qfsfileengine_iterator_p.h \
io/qfilesystemwatcher.h \
io/qfilesystemwatcher_p.h \
io/qfilesystemwatcher_polling_p.h \
io/qfilesystementry_p.h \ io/qfilesystementry_p.h \
io/qfilesystemengine_p.h \ io/qfilesystemengine_p.h \
io/qfilesystemmetadata_p.h \ io/qfilesystemmetadata_p.h \
@ -79,14 +76,38 @@ SOURCES += \
io/qsettings.cpp \ io/qsettings.cpp \
io/qfsfileengine.cpp \ io/qfsfileengine.cpp \
io/qfsfileengine_iterator.cpp \ io/qfsfileengine_iterator.cpp \
io/qfilesystemwatcher.cpp \
io/qfilesystemwatcher_polling.cpp \
io/qfilesystementry.cpp \ io/qfilesystementry.cpp \
io/qfilesystemengine.cpp \ io/qfilesystemengine.cpp \
io/qfileselector.cpp \ io/qfileselector.cpp \
io/qloggingcategory.cpp \ io/qloggingcategory.cpp \
io/qloggingregistry.cpp io/qloggingregistry.cpp
qtConfig(filesystemwatcher) {
HEADERS += \
io/qfilesystemwatcher.h \
io/qfilesystemwatcher_p.h \
io/qfilesystemwatcher_polling_p.h
SOURCES += \
io/qfilesystemwatcher.cpp \
io/qfilesystemwatcher_polling.cpp
win32 {
SOURCES += io/qfilesystemwatcher_win.cpp
HEADERS += io/qfilesystemwatcher_win_p.h
} else:macos {
OBJECTIVE_SOURCES += io/qfilesystemwatcher_fsevents.mm
HEADERS += io/qfilesystemwatcher_fsevents_p.h
} else:qtConfig(inotify) {
SOURCES += io/qfilesystemwatcher_inotify.cpp
HEADERS += io/qfilesystemwatcher_inotify_p.h
} else {
freebsd|darwin|openbsd|netbsd {
SOURCES += io/qfilesystemwatcher_kqueue.cpp
HEADERS += io/qfilesystemwatcher_kqueue_p.h
}
}
}
qtConfig(processenvironment) { qtConfig(processenvironment) {
SOURCES += \ SOURCES += \
io/qprocess.cpp io/qprocess.cpp
@ -103,9 +124,6 @@ qtConfig(processenvironment) {
win32 { win32 {
SOURCES += io/qfsfileengine_win.cpp SOURCES += io/qfsfileengine_win.cpp
SOURCES += io/qlockfile_win.cpp SOURCES += io/qlockfile_win.cpp
SOURCES += io/qfilesystemwatcher_win.cpp
HEADERS += io/qfilesystemwatcher_win_p.h
SOURCES += io/qfilesystemengine_win.cpp SOURCES += io/qfilesystemengine_win.cpp
qtConfig(filesystemiterator) { qtConfig(filesystemiterator) {
@ -153,8 +171,6 @@ win32 {
OBJECTIVE_SOURCES += io/qprocess_darwin.mm OBJECTIVE_SOURCES += io/qprocess_darwin.mm
OBJECTIVE_SOURCES += io/qstandardpaths_mac.mm OBJECTIVE_SOURCES += io/qstandardpaths_mac.mm
osx { osx {
OBJECTIVE_SOURCES += io/qfilesystemwatcher_fsevents.mm
HEADERS += io/qfilesystemwatcher_fsevents_p.h
LIBS += -framework DiskArbitration -framework IOKit LIBS += -framework DiskArbitration -framework IOKit
} else { } else {
LIBS += -framework MobileCoreServices LIBS += -framework MobileCoreServices
@ -173,17 +189,5 @@ win32 {
io/qstandardpaths_unix.cpp \ io/qstandardpaths_unix.cpp \
io/qstorageinfo_unix.cpp io/qstorageinfo_unix.cpp
} }
linux|if(qnx:qtConfig(inotify)) {
SOURCES += io/qfilesystemwatcher_inotify.cpp
HEADERS += io/qfilesystemwatcher_inotify_p.h
}
!nacl {
freebsd-*|mac|darwin-*|openbsd-*|netbsd-*:{
SOURCES += io/qfilesystemwatcher_kqueue.cpp
HEADERS += io/qfilesystemwatcher_kqueue_p.h
}
}
} }

View File

@ -40,8 +40,6 @@
#include "qfilesystemwatcher.h" #include "qfilesystemwatcher.h"
#include "qfilesystemwatcher_p.h" #include "qfilesystemwatcher_p.h"
#ifndef QT_NO_FILESYSTEMWATCHER
#include <qdatetime.h> #include <qdatetime.h>
#include <qdebug.h> #include <qdebug.h>
#include <qdir.h> #include <qdir.h>
@ -499,5 +497,3 @@ QT_END_NAMESPACE
#include "moc_qfilesystemwatcher.cpp" #include "moc_qfilesystemwatcher.cpp"
#include "moc_qfilesystemwatcher_p.cpp" #include "moc_qfilesystemwatcher_p.cpp"
#endif // QT_NO_FILESYSTEMWATCHER

View File

@ -42,7 +42,7 @@
#include <QtCore/qobject.h> #include <QtCore/qobject.h>
#ifndef QT_NO_FILESYSTEMWATCHER QT_REQUIRE_CONFIG(filesystemwatcher);
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
@ -78,5 +78,4 @@ private:
QT_END_NAMESPACE QT_END_NAMESPACE
#endif // QT_NO_FILESYSTEMWATCHER
#endif // QFILESYSTEMWATCHER_H #endif // QFILESYSTEMWATCHER_H

View File

@ -45,8 +45,6 @@
#include "private/qcore_unix_p.h" #include "private/qcore_unix_p.h"
#include "kernel/qcore_mac_p.h" #include "kernel/qcore_mac_p.h"
#ifndef QT_NO_FILESYSTEMWATCHER
#include <qdebug.h> #include <qdebug.h>
#include <qdir.h> #include <qdir.h>
#include <qfile.h> #include <qfile.h>
@ -585,6 +583,4 @@ bool QFseventsFileSystemWatcherEngine::derefPath(const QString &watchedPath)
return false; return false;
} }
#endif //QT_NO_FILESYSTEMWATCHER
QT_END_NAMESPACE QT_END_NAMESPACE

View File

@ -62,7 +62,7 @@
#include <dispatch/dispatch.h> #include <dispatch/dispatch.h>
#include <CoreServices/CoreServices.h> #include <CoreServices/CoreServices.h>
#ifndef QT_NO_FILESYSTEMWATCHER QT_REQUIRE_CONFIG(filesystemwatcher);
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
@ -150,5 +150,4 @@ private:
QT_END_NAMESPACE QT_END_NAMESPACE
#endif //QT_NO_FILESYSTEMWATCHER
#endif // QFILESYSTEMWATCHER_FSEVENTS_P_H #endif // QFILESYSTEMWATCHER_FSEVENTS_P_H

View File

@ -40,8 +40,6 @@
#include "qfilesystemwatcher.h" #include "qfilesystemwatcher.h"
#include "qfilesystemwatcher_inotify_p.h" #include "qfilesystemwatcher_inotify_p.h"
#ifndef QT_NO_FILESYSTEMWATCHER
#include "private/qcore_unix_p.h" #include "private/qcore_unix_p.h"
#include "private/qsystemerror_p.h" #include "private/qsystemerror_p.h"
@ -427,5 +425,3 @@ QString QInotifyFileSystemWatcherEngine::getPathFromID(int id) const
QT_END_NAMESPACE QT_END_NAMESPACE
#include "moc_qfilesystemwatcher_inotify_p.cpp" #include "moc_qfilesystemwatcher_inotify_p.cpp"
#endif // QT_NO_FILESYSTEMWATCHER

View File

@ -53,7 +53,7 @@
#include "qfilesystemwatcher_p.h" #include "qfilesystemwatcher_p.h"
#ifndef QT_NO_FILESYSTEMWATCHER QT_REQUIRE_CONFIG(filesystemwatcher);
#include <QtCore/qhash.h> #include <QtCore/qhash.h>
#include <QtCore/qmutex.h> #include <QtCore/qmutex.h>
@ -89,5 +89,4 @@ private:
QT_END_NAMESPACE QT_END_NAMESPACE
#endif // QT_NO_FILESYSTEMWATCHER
#endif // QFILESYSTEMWATCHER_INOTIFY_P_H #endif // QFILESYSTEMWATCHER_INOTIFY_P_H

View File

@ -43,8 +43,6 @@
#include "qfilesystemwatcher_kqueue_p.h" #include "qfilesystemwatcher_kqueue_p.h"
#include "private/qcore_unix_p.h" #include "private/qcore_unix_p.h"
#ifndef QT_NO_FILESYSTEMWATCHER
#include <qdebug.h> #include <qdebug.h>
#include <qfile.h> #include <qfile.h>
#include <qsocketnotifier.h> #include <qsocketnotifier.h>
@ -254,6 +252,4 @@ void QKqueueFileSystemWatcherEngine::readFromKqueue()
} }
} }
#endif //QT_NO_FILESYSTEMWATCHER
QT_END_NAMESPACE QT_END_NAMESPACE

View File

@ -59,7 +59,7 @@
#include <QtCore/qvector.h> #include <QtCore/qvector.h>
#include <QtCore/qsocketnotifier.h> #include <QtCore/qsocketnotifier.h>
#ifndef QT_NO_FILESYSTEMWATCHER QT_REQUIRE_CONFIG(filesystemwatcher);
struct kevent; struct kevent;
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
@ -90,5 +90,4 @@ private:
QT_END_NAMESPACE QT_END_NAMESPACE
#endif //QT_NO_FILESYSTEMWATCHER
#endif // QFILESYSTEMWATCHER_KQUEUE_P_H #endif // QFILESYSTEMWATCHER_KQUEUE_P_H

View File

@ -53,7 +53,7 @@
#include "qfilesystemwatcher.h" #include "qfilesystemwatcher.h"
#ifndef QT_NO_FILESYSTEMWATCHER QT_REQUIRE_CONFIG(filesystemwatcher);
#include <private/qobject_p.h> #include <private/qobject_p.h>
@ -120,5 +120,4 @@ private:
QT_END_NAMESPACE QT_END_NAMESPACE
#endif // QT_NO_FILESYSTEMWATCHER
#endif // QFILESYSTEMWATCHER_P_H #endif // QFILESYSTEMWATCHER_P_H

View File

@ -40,8 +40,6 @@
#include "qfilesystemwatcher_polling_p.h" #include "qfilesystemwatcher_polling_p.h"
#include <QtCore/qtimer.h> #include <QtCore/qtimer.h>
#ifndef QT_NO_FILESYSTEMWATCHER
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
QPollingFileSystemWatcherEngine::QPollingFileSystemWatcherEngine(QObject *parent) QPollingFileSystemWatcherEngine::QPollingFileSystemWatcherEngine(QObject *parent)
@ -153,5 +151,3 @@ void QPollingFileSystemWatcherEngine::timeout()
QT_END_NAMESPACE QT_END_NAMESPACE
#include "moc_qfilesystemwatcher_polling_p.cpp" #include "moc_qfilesystemwatcher_polling_p.cpp"
#endif // !QT_NO_FILESYSTEMWATCHER

View File

@ -60,7 +60,7 @@
#include "qfilesystemwatcher_p.h" #include "qfilesystemwatcher_p.h"
#ifndef QT_NO_FILESYSTEMWATCHER QT_REQUIRE_CONFIG(filesystemwatcher);
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
enum { PollingInterval = 1000 }; enum { PollingInterval = 1000 };
@ -121,6 +121,5 @@ private:
}; };
QT_END_NAMESPACE QT_END_NAMESPACE
#endif // !QT_NO_FILESYSTEMWATCHER
#endif // QFILESYSTEMWATCHER_POLLING_P_H #endif // QFILESYSTEMWATCHER_POLLING_P_H

View File

@ -40,8 +40,6 @@
#include "qfilesystemwatcher.h" #include "qfilesystemwatcher.h"
#include "qfilesystemwatcher_win_p.h" #include "qfilesystemwatcher_win_p.h"
#ifndef QT_NO_FILESYSTEMWATCHER
#include <qdebug.h> #include <qdebug.h>
#include <qfileinfo.h> #include <qfileinfo.h>
#include <qstringlist.h> #include <qstringlist.h>
@ -760,5 +758,3 @@ QT_END_NAMESPACE
#ifndef Q_OS_WINRT #ifndef Q_OS_WINRT
# include "qfilesystemwatcher_win.moc" # include "qfilesystemwatcher_win.moc"
#endif #endif
#endif // QT_NO_FILESYSTEMWATCHER

View File

@ -53,8 +53,6 @@
#include "qfilesystemwatcher_p.h" #include "qfilesystemwatcher_p.h"
#ifndef QT_NO_FILESYSTEMWATCHER
#include <QtCore/qdatetime.h> #include <QtCore/qdatetime.h>
#include <QtCore/qthread.h> #include <QtCore/qthread.h>
#include <QtCore/qfile.h> #include <QtCore/qfile.h>
@ -175,6 +173,4 @@ Q_SIGNALS:
QT_END_NAMESPACE QT_END_NAMESPACE
#endif // QT_NO_FILESYSTEMWATCHER
#endif // QFILESYSTEMWATCHER_WIN_P_H #endif // QFILESYSTEMWATCHER_WIN_P_H

View File

@ -3726,37 +3726,37 @@ bool QUrl::matches(const QUrl &url, FormattingOptions options) const
if (isLocalFile()) if (isLocalFile())
mask &= ~QUrlPrivate::Host; mask &= ~QUrlPrivate::Host;
if (options & QUrl::RemoveScheme) if (options.testFlag(QUrl::RemoveScheme))
mask &= ~QUrlPrivate::Scheme; mask &= ~QUrlPrivate::Scheme;
else if (d->scheme != url.d->scheme) else if (d->scheme != url.d->scheme)
return false; return false;
if (options & QUrl::RemovePassword) if (options.testFlag(QUrl::RemovePassword))
mask &= ~QUrlPrivate::Password; mask &= ~QUrlPrivate::Password;
else if (d->password != url.d->password) else if (d->password != url.d->password)
return false; return false;
if (options & QUrl::RemoveUserInfo) if (options.testFlag(QUrl::RemoveUserInfo))
mask &= ~QUrlPrivate::UserName; mask &= ~QUrlPrivate::UserName;
else if (d->userName != url.d->userName) else if (d->userName != url.d->userName)
return false; return false;
if (options & QUrl::RemovePort) if (options.testFlag(QUrl::RemovePort))
mask &= ~QUrlPrivate::Port; mask &= ~QUrlPrivate::Port;
else if (d->port != url.d->port) else if (d->port != url.d->port)
return false; return false;
if (options & QUrl::RemoveAuthority) if (options.testFlag(QUrl::RemoveAuthority))
mask &= ~QUrlPrivate::Host; mask &= ~QUrlPrivate::Host;
else if (d->host != url.d->host) else if (d->host != url.d->host)
return false; return false;
if (options & QUrl::RemoveQuery) if (options.testFlag(QUrl::RemoveQuery))
mask &= ~QUrlPrivate::Query; mask &= ~QUrlPrivate::Query;
else if (d->query != url.d->query) else if (d->query != url.d->query)
return false; return false;
if (options & QUrl::RemoveFragment) if (options.testFlag(QUrl::RemoveFragment))
mask &= ~QUrlPrivate::Fragment; mask &= ~QUrlPrivate::Fragment;
else if (d->fragment != url.d->fragment) else if (d->fragment != url.d->fragment)
return false; return false;
@ -3764,7 +3764,7 @@ bool QUrl::matches(const QUrl &url, FormattingOptions options) const
if ((d->sectionIsPresent & mask) != (url.d->sectionIsPresent & mask)) if ((d->sectionIsPresent & mask) != (url.d->sectionIsPresent & mask))
return false; return false;
if (options & QUrl::RemovePath) if (options.testFlag(QUrl::RemovePath))
return true; return true;
// Compare paths, after applying path-related options // Compare paths, after applying path-related options

View File

@ -1049,7 +1049,11 @@ QString QCommandLineParser::helpText() const
static QString wrapText(const QString &names, int longestOptionNameString, const QString &description) static QString wrapText(const QString &names, int longestOptionNameString, const QString &description)
{ {
const QLatin1Char nl('\n'); const QLatin1Char nl('\n');
QString text = QLatin1String(" ") + names.leftJustified(longestOptionNameString) + QLatin1Char(' '); const QLatin1String indentation(" ");
if (description.isEmpty())
return indentation + names + nl;
QString text = indentation + names.leftJustified(longestOptionNameString) + QLatin1Char(' ');
const int indent = text.length(); const int indent = text.length();
int lineStart = 0; int lineStart = 0;
int lastBreakable = -1; int lastBreakable = -1;

View File

@ -712,7 +712,8 @@ void QSslSocketBackendPrivate::transmit()
// Check if we've got any data to be written to the socket. // Check if we've got any data to be written to the socket.
QVarLengthArray<char, 4096> data; QVarLengthArray<char, 4096> data;
int pendingBytes; int pendingBytes;
while (plainSocket->isValid() && (pendingBytes = q_BIO_pending(writeBio)) > 0) { while (plainSocket->isValid() && (pendingBytes = q_BIO_pending(writeBio)) > 0
&& plainSocket->openMode() != QIODevice::NotOpen) {
// Read encrypted data from the write BIO into a buffer. // Read encrypted data from the write BIO into a buffer.
data.resize(pendingBytes); data.resize(pendingBytes);
int encryptedBytesRead = q_BIO_read(writeBio, data.data(), pendingBytes); int encryptedBytesRead = q_BIO_read(writeBio, data.data(), pendingBytes);
@ -799,6 +800,10 @@ void QSslSocketBackendPrivate::transmit()
int readBytes = 0; int readBytes = 0;
const int bytesToRead = 4096; const int bytesToRead = 4096;
do { do {
if (readChannelCount == 0) {
// The read buffer is deallocated, don't try resize or write to it.
break;
}
// Don't use SSL_pending(). It's very unreliable. // Don't use SSL_pending(). It's very unreliable.
readBytes = q_SSL_read(ssl, buffer.reserve(bytesToRead), bytesToRead); readBytes = q_SSL_read(ssl, buffer.reserve(bytesToRead), bytesToRead);
if (readBytes > 0) { if (readBytes > 0) {

View File

@ -112,7 +112,7 @@ QIBusPlatformInputContext::QIBusPlatformInputContext ()
QString socketPath = QIBusPlatformInputContextPrivate::getSocketPath(); QString socketPath = QIBusPlatformInputContextPrivate::getSocketPath();
QFile file(socketPath); QFile file(socketPath);
if (file.open(QFile::ReadOnly)) { if (file.open(QFile::ReadOnly)) {
#ifndef QT_NO_FILESYSTEMWATCHER #if QT_CONFIG(filesystemwatcher)
qCDebug(qtQpaInputMethods) << "socketWatcher.addPath" << socketPath; qCDebug(qtQpaInputMethods) << "socketWatcher.addPath" << socketPath;
// If KDE session save is used or restart ibus-daemon, // If KDE session save is used or restart ibus-daemon,
// the applications could run before ibus-daemon runs. // the applications could run before ibus-daemon runs.
@ -564,7 +564,7 @@ void QIBusPlatformInputContext::connectToBus()
d->initBus(); d->initBus();
connectToContextSignals(); connectToContextSignals();
#ifndef QT_NO_FILESYSTEMWATCHER #if QT_CONFIG(filesystemwatcher)
if (!d->usePortal && m_socketWatcher.files().size() == 0) if (!d->usePortal && m_socketWatcher.files().size() == 0)
m_socketWatcher.addPath(QIBusPlatformInputContextPrivate::getSocketPath()); m_socketWatcher.addPath(QIBusPlatformInputContextPrivate::getSocketPath());
#endif #endif

View File

@ -44,7 +44,9 @@
#include <QtCore/qpointer.h> #include <QtCore/qpointer.h>
#include <QtCore/QLocale> #include <QtCore/QLocale>
#include <QtDBus/qdbuspendingreply.h> #include <QtDBus/qdbuspendingreply.h>
#if QT_CONFIG(filesystemwatcher)
#include <QFileSystemWatcher> #include <QFileSystemWatcher>
#endif
#include <QTimer> #include <QTimer>
#include <QWindow> #include <QWindow>
@ -116,7 +118,7 @@ public Q_SLOTS:
private: private:
QIBusPlatformInputContextPrivate *d; QIBusPlatformInputContextPrivate *d;
bool m_eventFilterUseSynchronousMode; bool m_eventFilterUseSynchronousMode;
#ifndef QT_NO_FILESYSTEMWATCHER #if QT_CONFIG(filesystemwatcher)
QFileSystemWatcher m_socketWatcher; QFileSystemWatcher m_socketWatcher;
#endif #endif
QTimer m_timer; QTimer m_timer;

View File

@ -80,7 +80,7 @@ static QString translateDriveName(const QFileInfo &drive)
*/ */
QFileInfoGatherer::QFileInfoGatherer(QObject *parent) QFileInfoGatherer::QFileInfoGatherer(QObject *parent)
: QThread(parent), abort(false), : QThread(parent), abort(false),
#ifndef QT_NO_FILESYSTEMWATCHER #if QT_CONFIG(filesystemwatcher)
watcher(0), watcher(0),
#endif #endif
#ifdef Q_OS_WIN #ifdef Q_OS_WIN
@ -88,7 +88,7 @@ QFileInfoGatherer::QFileInfoGatherer(QObject *parent)
#endif #endif
m_iconProvider(&defaultProvider) m_iconProvider(&defaultProvider)
{ {
#ifndef QT_NO_FILESYSTEMWATCHER #if QT_CONFIG(filesystemwatcher)
watcher = new QFileSystemWatcher(this); watcher = new QFileSystemWatcher(this);
connect(watcher, SIGNAL(directoryChanged(QString)), this, SLOT(list(QString))); connect(watcher, SIGNAL(directoryChanged(QString)), this, SLOT(list(QString)));
connect(watcher, SIGNAL(fileChanged(QString)), this, SLOT(updateFile(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); this->files.push(files);
condition.wakeAll(); condition.wakeAll();
#ifndef QT_NO_FILESYSTEMWATCHER #if QT_CONFIG(filesystemwatcher)
if (files.isEmpty() if (files.isEmpty()
&& !path.isEmpty() && !path.isEmpty()
&& !path.startsWith(QLatin1String("//")) /*don't watch UNC path*/) { && !path.startsWith(QLatin1String("//")) /*don't watch UNC path*/) {
@ -208,7 +208,7 @@ void QFileInfoGatherer::updateFile(const QString &filePath)
*/ */
void QFileInfoGatherer::clear() void QFileInfoGatherer::clear()
{ {
#ifndef QT_NO_FILESYSTEMWATCHER #if QT_CONFIG(filesystemwatcher)
QMutexLocker locker(&mutex); QMutexLocker locker(&mutex);
watcher->removePaths(watcher->files()); watcher->removePaths(watcher->files());
watcher->removePaths(watcher->directories()); watcher->removePaths(watcher->directories());
@ -222,7 +222,7 @@ void QFileInfoGatherer::clear()
*/ */
void QFileInfoGatherer::removePath(const QString &path) void QFileInfoGatherer::removePath(const QString &path)
{ {
#ifndef QT_NO_FILESYSTEMWATCHER #if QT_CONFIG(filesystemwatcher)
QMutexLocker locker(&mutex); QMutexLocker locker(&mutex);
watcher->removePath(path); watcher->removePath(path);
#else #else
@ -266,7 +266,7 @@ QExtendedInformation QFileInfoGatherer::getInfo(const QFileInfo &fileInfo) const
QExtendedInformation info(fileInfo); QExtendedInformation info(fileInfo);
info.icon = m_iconProvider->icon(fileInfo); info.icon = m_iconProvider->icon(fileInfo);
info.displayType = m_iconProvider->type(fileInfo); info.displayType = m_iconProvider->type(fileInfo);
#ifndef QT_NO_FILESYSTEMWATCHER #if QT_CONFIG(filesystemwatcher)
// ### Not ready to listen all modifications by default // ### Not ready to listen all modifications by default
static const bool watchFiles = qEnvironmentVariableIsSet("QT_FILESYSTEMMODEL_WATCH_FILES"); static const bool watchFiles = qEnvironmentVariableIsSet("QT_FILESYSTEMMODEL_WATCH_FILES");
if (watchFiles) { if (watchFiles) {
@ -280,7 +280,7 @@ QExtendedInformation QFileInfoGatherer::getInfo(const QFileInfo &fileInfo) const
} }
} }
} }
#endif #endif // filesystemwatcher
#ifdef Q_OS_WIN #ifdef Q_OS_WIN
if (m_resolveSymlinks && info.isSymLink(/* ignoreNtfsSymLinks = */ true)) { if (m_resolveSymlinks && info.isSymLink(/* ignoreNtfsSymLinks = */ true)) {

View File

@ -56,7 +56,9 @@
#include <qthread.h> #include <qthread.h>
#include <qmutex.h> #include <qmutex.h>
#include <qwaitcondition.h> #include <qwaitcondition.h>
#if QT_CONFIG(filesystemwatcher)
#include <qfilesystemwatcher.h> #include <qfilesystemwatcher.h>
#endif
#include <qfileiconprovider.h> #include <qfileiconprovider.h>
#include <qpair.h> #include <qpair.h>
#include <qstack.h> #include <qstack.h>
@ -207,7 +209,7 @@ private:
// end protected by mutex // end protected by mutex
QAtomicInt abort; QAtomicInt abort;
#ifndef QT_NO_FILESYSTEMWATCHER #if QT_CONFIG(filesystemwatcher)
QFileSystemWatcher *watcher; QFileSystemWatcher *watcher;
#endif #endif
#ifdef Q_OS_WIN #ifdef Q_OS_WIN

View File

@ -475,7 +475,7 @@ QFileSystemModelPrivate::QFileSystemNode *QFileSystemModelPrivate::node(const QS
return const_cast<QFileSystemModelPrivate::QFileSystemNode*>(&root); return const_cast<QFileSystemModelPrivate::QFileSystemNode*>(&root);
QFileSystemModelPrivate *p = const_cast<QFileSystemModelPrivate*>(this); QFileSystemModelPrivate *p = const_cast<QFileSystemModelPrivate*>(this);
node = p->addNode(parent, element,info); node = p->addNode(parent, element,info);
#ifndef QT_NO_FILESYSTEMWATCHER #if QT_CONFIG(filesystemwatcher)
node->populate(fileInfoGatherer.getInfo(info)); node->populate(fileInfoGatherer.getInfo(info));
#endif #endif
} else { } else {
@ -513,7 +513,7 @@ void QFileSystemModel::timerEvent(QTimerEvent *event)
Q_D(QFileSystemModel); Q_D(QFileSystemModel);
if (event->timerId() == d->fetchingTimer.timerId()) { if (event->timerId() == d->fetchingTimer.timerId()) {
d->fetchingTimer.stop(); d->fetchingTimer.stop();
#ifndef QT_NO_FILESYSTEMWATCHER #if QT_CONFIG(filesystemwatcher)
for (int i = 0; i < d->toFetch.count(); ++i) { for (int i = 0; i < d->toFetch.count(); ++i) {
const QFileSystemModelPrivate::QFileSystemNode *node = d->toFetch.at(i).node; const QFileSystemModelPrivate::QFileSystemNode *node = d->toFetch.at(i).node;
if (!node->hasInformation()) { if (!node->hasInformation()) {
@ -661,7 +661,7 @@ void QFileSystemModel::fetchMore(const QModelIndex &parent)
if (indexNode->populatedChildren) if (indexNode->populatedChildren)
return; return;
indexNode->populatedChildren = true; indexNode->populatedChildren = true;
#ifndef QT_NO_FILESYSTEMWATCHER #if QT_CONFIG(filesystemwatcher)
d->fileInfoGatherer.list(filePath(parent)); d->fileInfoGatherer.list(filePath(parent));
#endif #endif
} }
@ -697,13 +697,13 @@ int QFileSystemModel::columnCount(const QModelIndex &parent) const
*/ */
QVariant QFileSystemModel::myComputer(int role) const QVariant QFileSystemModel::myComputer(int role) const
{ {
#ifndef QT_NO_FILESYSTEMWATCHER #if QT_CONFIG(filesystemwatcher)
Q_D(const QFileSystemModel); Q_D(const QFileSystemModel);
#endif #endif
switch (role) { switch (role) {
case Qt::DisplayRole: case Qt::DisplayRole:
return QFileSystemModelPrivate::myComputer(); return QFileSystemModelPrivate::myComputer();
#ifndef QT_NO_FILESYSTEMWATCHER #if QT_CONFIG(filesystemwatcher)
case Qt::DecorationRole: case Qt::DecorationRole:
return d->fileInfoGatherer.iconProvider()->icon(QFileIconProvider::Computer); return d->fileInfoGatherer.iconProvider()->icon(QFileIconProvider::Computer);
#endif #endif
@ -740,14 +740,14 @@ QVariant QFileSystemModel::data(const QModelIndex &index, int role) const
case Qt::DecorationRole: case Qt::DecorationRole:
if (index.column() == 0) { if (index.column() == 0) {
QIcon icon = d->icon(index); QIcon icon = d->icon(index);
#ifndef QT_NO_FILESYSTEMWATCHER #if QT_CONFIG(filesystemwatcher)
if (icon.isNull()) { if (icon.isNull()) {
if (d->node(index)->isDir()) if (d->node(index)->isDir())
icon = d->fileInfoGatherer.iconProvider()->icon(QFileIconProvider::Folder); icon = d->fileInfoGatherer.iconProvider()->icon(QFileIconProvider::Folder);
else else
icon = d->fileInfoGatherer.iconProvider()->icon(QFileIconProvider::File); icon = d->fileInfoGatherer.iconProvider()->icon(QFileIconProvider::File);
} }
#endif // QT_NO_FILESYSTEMWATCHER #endif // filesystemwatcher
return icon; return icon;
} }
break; break;
@ -824,7 +824,7 @@ QString QFileSystemModelPrivate::name(const QModelIndex &index) const
return QString(); return QString();
QFileSystemNode *dirNode = node(index); QFileSystemNode *dirNode = node(index);
if ( if (
#ifndef QT_NO_FILESYSTEMWATCHER #if QT_CONFIG(filesystemwatcher)
fileInfoGatherer.resolveSymlinks() && fileInfoGatherer.resolveSymlinks() &&
#endif #endif
!resolvedSymLinks.isEmpty() && dirNode->isSymLink(/* ignoreNtfsSymLinks = */ true)) { !resolvedSymLinks.isEmpty() && dirNode->isSymLink(/* ignoreNtfsSymLinks = */ true)) {
@ -926,7 +926,7 @@ bool QFileSystemModel::setData(const QModelIndex &idx, const QVariant &value, in
QScopedPointer<QFileSystemModelPrivate::QFileSystemNode> nodeToRename(parentNode->children.take(oldName)); QScopedPointer<QFileSystemModelPrivate::QFileSystemNode> nodeToRename(parentNode->children.take(oldName));
nodeToRename->fileName = newName; nodeToRename->fileName = newName;
nodeToRename->parent = parentNode; nodeToRename->parent = parentNode;
#ifndef QT_NO_FILESYSTEMWATCHER #if QT_CONFIG(filesystemwatcher)
nodeToRename->populate(d->fileInfoGatherer.getInfo(QFileInfo(parentPath, newName))); nodeToRename->populate(d->fileInfoGatherer.getInfo(QFileInfo(parentPath, newName)));
#endif #endif
nodeToRename->isVisible = true; nodeToRename->isVisible = true;
@ -1277,7 +1277,7 @@ QString QFileSystemModel::filePath(const QModelIndex &index) const
QString fullPath = d->filePath(index); QString fullPath = d->filePath(index);
QFileSystemModelPrivate::QFileSystemNode *dirNode = d->node(index); QFileSystemModelPrivate::QFileSystemNode *dirNode = d->node(index);
if (dirNode->isSymLink() if (dirNode->isSymLink()
#ifndef QT_NO_FILESYSTEMWATCHER #if QT_CONFIG(filesystemwatcher)
&& d->fileInfoGatherer.resolveSymlinks() && d->fileInfoGatherer.resolveSymlinks()
#endif #endif
&& d->resolvedSymLinks.contains(fullPath) && d->resolvedSymLinks.contains(fullPath)
@ -1333,7 +1333,7 @@ QModelIndex QFileSystemModel::mkdir(const QModelIndex &parent, const QString &na
d->addNode(parentNode, name, QFileInfo()); d->addNode(parentNode, name, QFileInfo());
Q_ASSERT(parentNode->children.contains(name)); Q_ASSERT(parentNode->children.contains(name));
QFileSystemModelPrivate::QFileSystemNode *node = parentNode->children[name]; QFileSystemModelPrivate::QFileSystemNode *node = parentNode->children[name];
#ifndef QT_NO_FILESYSTEMWATCHER #if QT_CONFIG(filesystemwatcher)
node->populate(d->fileInfoGatherer.getInfo(QFileInfo(dir.absolutePath() + QDir::separator() + name))); node->populate(d->fileInfoGatherer.getInfo(QFileInfo(dir.absolutePath() + QDir::separator() + name)));
#endif #endif
d->addVisibleFiles(parentNode, QStringList(name)); d->addVisibleFiles(parentNode, QStringList(name));
@ -1397,7 +1397,7 @@ QModelIndex QFileSystemModel::setRootPath(const QString &newPath)
//We remove the watcher on the previous path //We remove the watcher on the previous path
if (!rootPath().isEmpty() && rootPath() != QLatin1String(".")) { if (!rootPath().isEmpty() && rootPath() != QLatin1String(".")) {
//This remove the watcher for the old rootPath //This remove the watcher for the old rootPath
#ifndef QT_NO_FILESYSTEMWATCHER #if QT_CONFIG(filesystemwatcher)
d->fileInfoGatherer.removePath(rootPath()); d->fileInfoGatherer.removePath(rootPath());
#endif #endif
//This line "marks" the node as dirty, so the next fetchMore //This line "marks" the node as dirty, so the next fetchMore
@ -1453,7 +1453,7 @@ QDir QFileSystemModel::rootDirectory() const
void QFileSystemModel::setIconProvider(QFileIconProvider *provider) void QFileSystemModel::setIconProvider(QFileIconProvider *provider)
{ {
Q_D(QFileSystemModel); Q_D(QFileSystemModel);
#ifndef QT_NO_FILESYSTEMWATCHER #if QT_CONFIG(filesystemwatcher)
d->fileInfoGatherer.setIconProvider(provider); d->fileInfoGatherer.setIconProvider(provider);
#endif #endif
d->root.updateIcon(provider, QString()); d->root.updateIcon(provider, QString());
@ -1464,7 +1464,7 @@ void QFileSystemModel::setIconProvider(QFileIconProvider *provider)
*/ */
QFileIconProvider *QFileSystemModel::iconProvider() const QFileIconProvider *QFileSystemModel::iconProvider() const
{ {
#ifndef QT_NO_FILESYSTEMWATCHER #if QT_CONFIG(filesystemwatcher)
Q_D(const QFileSystemModel); Q_D(const QFileSystemModel);
return d->fileInfoGatherer.iconProvider(); return d->fileInfoGatherer.iconProvider();
#else #else
@ -1516,7 +1516,7 @@ QDir::Filters QFileSystemModel::filter() const
*/ */
void QFileSystemModel::setResolveSymlinks(bool enable) void QFileSystemModel::setResolveSymlinks(bool enable)
{ {
#ifndef QT_NO_FILESYSTEMWATCHER #if QT_CONFIG(filesystemwatcher)
Q_D(QFileSystemModel); Q_D(QFileSystemModel);
d->fileInfoGatherer.setResolveSymlinks(enable); d->fileInfoGatherer.setResolveSymlinks(enable);
#else #else
@ -1526,7 +1526,7 @@ void QFileSystemModel::setResolveSymlinks(bool enable)
bool QFileSystemModel::resolveSymlinks() const bool QFileSystemModel::resolveSymlinks() const
{ {
#ifndef QT_NO_FILESYSTEMWATCHER #if QT_CONFIG(filesystemwatcher)
Q_D(const QFileSystemModel); Q_D(const QFileSystemModel);
return d->fileInfoGatherer.resolveSymlinks(); return d->fileInfoGatherer.resolveSymlinks();
#else #else
@ -1628,7 +1628,7 @@ QStringList QFileSystemModel::nameFilters() const
*/ */
bool QFileSystemModel::event(QEvent *event) bool QFileSystemModel::event(QEvent *event)
{ {
#ifndef QT_NO_FILESYSTEMWATCHER #if QT_CONFIG(filesystemwatcher)
Q_D(QFileSystemModel); Q_D(QFileSystemModel);
if (event->type() == QEvent::LanguageChange) { if (event->type() == QEvent::LanguageChange) {
d->root.retranslateStrings(d->fileInfoGatherer.iconProvider(), QString()); d->root.retranslateStrings(d->fileInfoGatherer.iconProvider(), QString());
@ -1642,7 +1642,7 @@ bool QFileSystemModel::rmdir(const QModelIndex &aindex)
{ {
QString path = filePath(aindex); QString path = filePath(aindex);
const bool success = QDir().rmdir(path); const bool success = QDir().rmdir(path);
#ifndef QT_NO_FILESYSTEMWATCHER #if QT_CONFIG(filesystemwatcher)
if (success) { if (success) {
QFileSystemModelPrivate * d = const_cast<QFileSystemModelPrivate*>(d_func()); QFileSystemModelPrivate * d = const_cast<QFileSystemModelPrivate*>(d_func());
d->fileInfoGatherer.removePath(path); d->fileInfoGatherer.removePath(path);
@ -1685,7 +1685,7 @@ QFileSystemModelPrivate::QFileSystemNode* QFileSystemModelPrivate::addNode(QFile
{ {
// In the common case, itemLocation == count() so check there first // In the common case, itemLocation == count() so check there first
QFileSystemModelPrivate::QFileSystemNode *node = new QFileSystemModelPrivate::QFileSystemNode(fileName, parentNode); QFileSystemModelPrivate::QFileSystemNode *node = new QFileSystemModelPrivate::QFileSystemNode(fileName, parentNode);
#ifndef QT_NO_FILESYSTEMWATCHER #if QT_CONFIG(filesystemwatcher)
node->populate(info); node->populate(info);
#else #else
Q_UNUSED(info) Q_UNUSED(info)
@ -1793,7 +1793,7 @@ void QFileSystemModelPrivate::removeVisibleFile(QFileSystemNode *parentNode, int
*/ */
void QFileSystemModelPrivate::_q_fileSystemChanged(const QString &path, const QVector<QPair<QString, QFileInfo> > &updates) void QFileSystemModelPrivate::_q_fileSystemChanged(const QString &path, const QVector<QPair<QString, QFileInfo> > &updates)
{ {
#ifndef QT_NO_FILESYSTEMWATCHER #if QT_CONFIG(filesystemwatcher)
Q_Q(QFileSystemModel); Q_Q(QFileSystemModel);
QVector<QString> rowsToUpdate; QVector<QString> rowsToUpdate;
QStringList newFiles; QStringList newFiles;
@ -1889,7 +1889,7 @@ void QFileSystemModelPrivate::_q_fileSystemChanged(const QString &path, const QV
#else #else
Q_UNUSED(path) Q_UNUSED(path)
Q_UNUSED(updates) Q_UNUSED(updates)
#endif // !QT_NO_FILESYSTEMWATCHER #endif // filesystemwatcher
} }
/*! /*!
@ -1947,7 +1947,7 @@ void QFileSystemModelPrivate::init()
{ {
Q_Q(QFileSystemModel); Q_Q(QFileSystemModel);
qRegisterMetaType<QVector<QPair<QString,QFileInfo> > >(); qRegisterMetaType<QVector<QPair<QString,QFileInfo> > >();
#ifndef QT_NO_FILESYSTEMWATCHER #if QT_CONFIG(filesystemwatcher)
q->connect(&fileInfoGatherer, SIGNAL(newListOfFiles(QString,QStringList)), q->connect(&fileInfoGatherer, SIGNAL(newListOfFiles(QString,QStringList)),
q, SLOT(_q_directoryChanged(QString,QStringList))); q, SLOT(_q_directoryChanged(QString,QStringList)));
q->connect(&fileInfoGatherer, SIGNAL(updates(QString,QVector<QPair<QString,QFileInfo> >)), q->connect(&fileInfoGatherer, SIGNAL(updates(QString,QVector<QPair<QString,QFileInfo> >)),
@ -1956,7 +1956,7 @@ void QFileSystemModelPrivate::init()
q, SLOT(_q_resolvedName(QString,QString))); q, SLOT(_q_resolvedName(QString,QString)));
q->connect(&fileInfoGatherer, SIGNAL(directoryLoaded(QString)), q->connect(&fileInfoGatherer, SIGNAL(directoryLoaded(QString)),
q, SIGNAL(directoryLoaded(QString))); q, SIGNAL(directoryLoaded(QString)));
#endif // !QT_NO_FILESYSTEMWATCHER #endif // filesystemwatcher
q->connect(&delayedSortTimer, SIGNAL(timeout()), q, SLOT(_q_performDelayedSort()), Qt::QueuedConnection); q->connect(&delayedSortTimer, SIGNAL(timeout()), q, SLOT(_q_performDelayedSort()), Qt::QueuedConnection);
roleNames.insertMulti(QFileSystemModel::FileIconRole, QByteArrayLiteral("fileIcon")); // == Qt::decoration roleNames.insertMulti(QFileSystemModel::FileIconRole, QByteArrayLiteral("fileIcon")); // == Qt::decoration

View File

@ -55,6 +55,9 @@ SUBDIRS=\
win32:!qtConfig(private_tests): SUBDIRS -= \ win32:!qtConfig(private_tests): SUBDIRS -= \
qfilesystementry qfilesystementry
!qtConfig(filesystemwatcher): SUBDIRS -= \
qfilesystemwatcher
!qtConfig(processenvironment): SUBDIRS -= \ !qtConfig(processenvironment): SUBDIRS -= \
qprocessenvironment qprocessenvironment

View File

@ -45,7 +45,6 @@ class tst_QFileSystemWatcher : public QObject
public: public:
tst_QFileSystemWatcher(); tst_QFileSystemWatcher();
#ifndef QT_NO_FILESYSTEMWATCHER
private slots: private slots:
void basicTest_data(); void basicTest_data();
void basicTest(); void basicTest();
@ -77,24 +76,20 @@ private slots:
private: private:
QString m_tempDirPattern; QString m_tempDirPattern;
#endif // QT_NO_FILESYSTEMWATCHER
}; };
tst_QFileSystemWatcher::tst_QFileSystemWatcher() tst_QFileSystemWatcher::tst_QFileSystemWatcher()
{ {
#ifndef QT_NO_FILESYSTEMWATCHER
m_tempDirPattern = QDir::tempPath(); m_tempDirPattern = QDir::tempPath();
if (!m_tempDirPattern.endsWith(QLatin1Char('/'))) if (!m_tempDirPattern.endsWith(QLatin1Char('/')))
m_tempDirPattern += QLatin1Char('/'); m_tempDirPattern += QLatin1Char('/');
m_tempDirPattern += QStringLiteral("tst_qfilesystemwatcherXXXXXX"); m_tempDirPattern += QStringLiteral("tst_qfilesystemwatcherXXXXXX");
#endif // QT_NO_FILESYSTEMWATCHER
#if defined(Q_OS_ANDROID) && !defined(Q_OS_ANDROID_EMBEDDED) #if defined(Q_OS_ANDROID) && !defined(Q_OS_ANDROID_EMBEDDED)
QDir::setCurrent(QStandardPaths::writableLocation(QStandardPaths::CacheLocation)); QDir::setCurrent(QStandardPaths::writableLocation(QStandardPaths::CacheLocation));
#endif #endif
} }
#ifndef QT_NO_FILESYSTEMWATCHER
void tst_QFileSystemWatcher::basicTest_data() void tst_QFileSystemWatcher::basicTest_data()
{ {
QTest::addColumn<QString>("backend"); QTest::addColumn<QString>("backend");
@ -805,7 +800,6 @@ void tst_QFileSystemWatcher::watchUnicodeCharacters()
QVERIFY(testDir.mkdir("creme")); QVERIFY(testDir.mkdir("creme"));
QTRY_COMPARE(changedSpy.count(), 1); QTRY_COMPARE(changedSpy.count(), 1);
} }
#endif // QT_NO_FILESYSTEMWATCHER
QTEST_MAIN(tst_QFileSystemWatcher) QTEST_MAIN(tst_QFileSystemWatcher)
#include "tst_qfilesystemwatcher.moc" #include "tst_qfilesystemwatcher.moc"

View File

@ -4143,6 +4143,18 @@ void tst_QUrl::matches_data()
<< "http://user:pass@www.website.com/directory" << "http://user:pass@www.website.com/directory"
<< "http://otheruser:otherpass@www.website.com/directory" << "http://otheruser:otherpass@www.website.com/directory"
<< uint(QUrl::RemovePath | QUrl::RemoveAuthority) << true; << uint(QUrl::RemovePath | QUrl::RemoveAuthority) << true;
QTest::newRow("matchingHost-removePort") << "http://example.com" << "http://example.com"
<< uint(QUrl::RemovePort) << true;
QTest::newRow("nonMatchingHost-removePort") << "http://example.com" << "http://example.net"
<< uint(QUrl::RemovePort) << false;
QTest::newRow("matchingHost-removePassword") << "http://example.com" << "http://example.com"
<< uint(QUrl::RemovePassword) << true;
QTest::newRow("nonMatchingHost-removePassword") << "http://example.com" << "http://example.net"
<< uint(QUrl::RemovePassword) << false;
QTest::newRow("matchingUserName-removePassword") << "http://user@example.com" << "http://user@example.com"
<< uint(QUrl::RemovePassword) << true;
QTest::newRow("nonMatchingUserName-removePassword") << "http://user@example.com" << "http://user2@example.com"
<< uint(QUrl::RemovePassword) << false;
} }
void tst_QUrl::matches() void tst_QUrl::matches()

View File

@ -53,6 +53,7 @@ int main(int argc, char *argv[])
parser.addOption(QCommandLineOption("load", "Load file from URL.", "url")); parser.addOption(QCommandLineOption("load", "Load file from URL.", "url"));
parser.addOption(QCommandLineOption(QStringList() << "o" << "output", "Set output file.", "file")); parser.addOption(QCommandLineOption(QStringList() << "o" << "output", "Set output file.", "file"));
parser.addOption(QCommandLineOption("D", "Define macro.", "key=value")); parser.addOption(QCommandLineOption("D", "Define macro.", "key=value"));
parser.addOption(QCommandLineOption("long-option"));
// An option with a longer description, to test wrapping // An option with a longer description, to test wrapping
QCommandLineOption noImplicitIncludesOption(QStringList() << QStringLiteral("n") << QStringLiteral("no-implicit-includes")); QCommandLineOption noImplicitIncludesOption(QStringList() << QStringLiteral("n") << QStringLiteral("no-implicit-includes"));

View File

@ -536,6 +536,7 @@ static const char expectedOptionsHelp[] =
" --load <url> Load file from URL.\n" " --load <url> Load file from URL.\n"
" -o, --output <file> Set output file.\n" " -o, --output <file> Set output file.\n"
" -D <key=value> Define macro.\n" " -D <key=value> Define macro.\n"
" --long-option\n"
" -n, --no-implicit-includes Disable magic generation of implicit\n" " -n, --no-implicit-includes Disable magic generation of implicit\n"
" #include-directives.\n" " #include-directives.\n"
" --newline This is an option with a rather long\n" " --newline This is an option with a rather long\n"

View File

@ -2249,7 +2249,7 @@ Q_GLOBAL_STATIC(QLocale, tst_qapp_locale);
#if QT_CONFIG(process) #if QT_CONFIG(process)
Q_GLOBAL_STATIC(QProcess, tst_qapp_process); Q_GLOBAL_STATIC(QProcess, tst_qapp_process);
#endif #endif
#ifndef QT_NO_FILESYSTEMWATCHER #if QT_CONFIG(filesystemwatcher)
Q_GLOBAL_STATIC(QFileSystemWatcher, tst_qapp_fileSystemWatcher); Q_GLOBAL_STATIC(QFileSystemWatcher, tst_qapp_fileSystemWatcher);
#endif #endif
#ifndef QT_NO_SHAREDMEMORY #ifndef QT_NO_SHAREDMEMORY
@ -2274,7 +2274,7 @@ void tst_QApplication::globalStaticObjectDestruction()
#if QT_CONFIG(process) #if QT_CONFIG(process)
QVERIFY(tst_qapp_process()); QVERIFY(tst_qapp_process());
#endif #endif
#ifndef QT_NO_FILESYSTEMWATCHER #if QT_CONFIG(filesystemwatcher)
QVERIFY(tst_qapp_fileSystemWatcher()); QVERIFY(tst_qapp_fileSystemWatcher());
#endif #endif
#ifndef QT_NO_SHAREDMEMORY #ifndef QT_NO_SHAREDMEMORY