From f911e87345c0fadeef602a6350c2e5db6f5892f2 Mon Sep 17 00:00:00 2001 From: Oliver Wolff Date: Wed, 25 Sep 2013 15:33:47 +0200 Subject: Win: Fixed namespaced build with QT_NO_FILESYSTEMWATCHER Change-Id: I70049b90d2071c7a23a8a2804842d70d0f583f19 Reviewed-by: Friedemann Kleint Reviewed-by: Joerg Bornemann --- src/corelib/io/qfilesystemwatcher_win_p.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/corelib/io') diff --git a/src/corelib/io/qfilesystemwatcher_win_p.h b/src/corelib/io/qfilesystemwatcher_win_p.h index 790fb954d9..20dfe433ec 100644 --- a/src/corelib/io/qfilesystemwatcher_win_p.h +++ b/src/corelib/io/qfilesystemwatcher_win_p.h @@ -168,8 +168,8 @@ Q_SIGNALS: void directoryChanged(const QString &path, bool removed); }; -#endif // QT_NO_FILESYSTEMWATCHER - QT_END_NAMESPACE +#endif // QT_NO_FILESYSTEMWATCHER + #endif // QFILESYSTEMWATCHER_WIN_P_H -- cgit v1.2.3 From 9ff81bdc1ab4e3d14914192cd63ae625a507fe90 Mon Sep 17 00:00:00 2001 From: hjk Date: Fri, 27 Sep 2013 13:22:59 +0200 Subject: Use a pimpl in QLoggingCategory With the usual pros/cons. Cleans up the publicly visible interface and gives some headroom for further extensions. Change-Id: I7237b1fd2a22c66574d1b7e532d99137bb56ce1d Reviewed-by: Kai Koehne --- src/corelib/io/qloggingcategory.cpp | 30 +++++++++++++++++++++++------- src/corelib/io/qloggingcategory.h | 5 +++-- 2 files changed, 26 insertions(+), 9 deletions(-) (limited to 'src/corelib/io') diff --git a/src/corelib/io/qloggingcategory.cpp b/src/corelib/io/qloggingcategory.cpp index 80acee6ad1..24eeb1584c 100644 --- a/src/corelib/io/qloggingcategory.cpp +++ b/src/corelib/io/qloggingcategory.cpp @@ -97,6 +97,20 @@ Q_GLOBAL_STATIC_WITH_ARGS(QLoggingCategory, qtDefaultCategory, configure categories globally. */ +/*! + \internal +*/ +typedef QVector Tracers; + +/*! + \internal +*/ +class QLoggingCategoryPrivate +{ +public: + Tracers tracers; +}; + /*! Constructs a QLoggingCategory object with the provided \a category name. The object becomes the local identifier for the category. @@ -104,7 +118,8 @@ Q_GLOBAL_STATIC_WITH_ARGS(QLoggingCategory, qtDefaultCategory, If \a category is \c{0}, the category name is changed to \c{"default"}. */ QLoggingCategory::QLoggingCategory(const char *category) - : name(0), + : d(new QLoggingCategoryPrivate), + name(0), enabledDebug(false), enabledWarning(true), enabledCritical(true), @@ -133,6 +148,7 @@ QLoggingCategory::~QLoggingCategory() { if (QLoggingRegistry *reg = QLoggingRegistry::instance()) reg->unregisterCategory(this); + delete d; } /*! @@ -459,7 +475,7 @@ void QLoggingCategory::setFilterRules(const QString &rules) void QTracer::addToCategory(QLoggingCategory &category) { - category.tracers.append(this); + category.d->tracers.append(this); } /*! @@ -571,7 +587,7 @@ void QTracer::addToCategory(QLoggingCategory &category) void QTraceGuard::start() { - QLoggingCategory::Tracers &tracers = target->tracers; + const Tracers &tracers = target->d->tracers; for (int i = tracers.size(); --i >= 0; ) tracers.at(i)->start(); } @@ -584,7 +600,7 @@ void QTraceGuard::start() void QTraceGuard::end() { - QLoggingCategory::Tracers &tracers = target->tracers; + const Tracers &tracers = target->d->tracers; for (int i = tracers.size(); --i >= 0; ) tracers.at(i)->end(); } @@ -599,7 +615,7 @@ void QTraceGuard::end() QTraceGuard &QTraceGuard::operator<<(int msg) { - QLoggingCategory::Tracers &tracers = target->tracers; + const Tracers &tracers = target->d->tracers; for (int i = tracers.size(); --i >= 0; ) tracers.at(i)->record(msg); return *this; @@ -614,7 +630,7 @@ QTraceGuard &QTraceGuard::operator<<(int msg) QTraceGuard &QTraceGuard::operator<<(const char *msg) { - QLoggingCategory::Tracers &tracers = target->tracers; + const Tracers &tracers = target->d->tracers; for (int i = tracers.size(); --i >= 0; ) tracers.at(i)->record(msg); return *this; @@ -630,7 +646,7 @@ QTraceGuard &QTraceGuard::operator<<(const char *msg) QTraceGuard &QTraceGuard::operator<<(const QVariant &msg) { - QLoggingCategory::Tracers &tracers = target->tracers; + const Tracers &tracers = target->d->tracers; for (int i = tracers.size(); --i >= 0; ) tracers.at(i)->record(msg); return *this; diff --git a/src/corelib/io/qloggingcategory.h b/src/corelib/io/qloggingcategory.h index 23b25b5e3f..70192fef13 100644 --- a/src/corelib/io/qloggingcategory.h +++ b/src/corelib/io/qloggingcategory.h @@ -50,6 +50,7 @@ QT_BEGIN_NAMESPACE class QTracer; class QTraceGuard; +class QLoggingCategoryPrivate; class Q_CORE_EXPORT QLoggingCategory { @@ -80,18 +81,18 @@ public: static void setFilterRules(const QString &rules); private: + friend class QLoggingCategoryPrivate; friend class QLoggingRegistry; friend class QTraceGuard; friend class QTracer; + QLoggingCategoryPrivate *d; const char *name; bool enabledDebug; bool enabledWarning; bool enabledCritical; bool enabledTrace; - typedef QVector Tracers; - Tracers tracers; }; template <> -- cgit v1.2.3 From 3705c1263d4d2232d5527361692d25a8519c222b Mon Sep 17 00:00:00 2001 From: Geir Vattekar Date: Thu, 26 Sep 2013 12:16:39 +0200 Subject: Doc: Add docs for rvalue references and move constructors These members were introduced in 4.8, but left undocumented. Because we consider undocumented API to be internal, the members are \since 5.2. Change-Id: I52e2840a8cfaa7f59f410b3e2a06c0942ea06539 Reviewed-by: Jerome Pasion Reviewed-by: Stephen Kelly --- src/corelib/io/qdir.cpp | 8 ++++++++ src/corelib/io/qfileinfo.cpp | 8 ++++++++ src/corelib/io/qurl.cpp | 17 +++++++++++++++++ src/corelib/io/qurlquery.cpp | 8 ++++++++ 4 files changed, 41 insertions(+) (limited to 'src/corelib/io') diff --git a/src/corelib/io/qdir.cpp b/src/corelib/io/qdir.cpp index cd30533ff8..5af398c360 100644 --- a/src/corelib/io/qdir.cpp +++ b/src/corelib/io/qdir.cpp @@ -514,6 +514,14 @@ inline void QDirPrivate::initFileEngine() \sa QFileInfo, QFile, QFileDialog, QCoreApplication::applicationDirPath(), {Find Files Example} */ +/*! + \fn QDir &QDir::operator=(QDir &&other) + + Move-assigns \a other to this QDir instance. + + \since 5.2 +*/ + /*! \internal */ diff --git a/src/corelib/io/qfileinfo.cpp b/src/corelib/io/qfileinfo.cpp index 1d5f16c9d9..d1b7ebac65 100644 --- a/src/corelib/io/qfileinfo.cpp +++ b/src/corelib/io/qfileinfo.cpp @@ -293,6 +293,14 @@ QDateTime &QFileInfoPrivate::getFileTime(QAbstractFileEngine::FileTime request) \sa QDir, QFile */ +/*! + \fn QFileInfo &QFileInfo::operator=(QFileInfo &&other) + + Move-assigns \a other to this QFileInfo instance. + + \since 5.2 +*/ + /*! \internal */ diff --git a/src/corelib/io/qurl.cpp b/src/corelib/io/qurl.cpp index 5535ae126a..d14add36a5 100644 --- a/src/corelib/io/qurl.cpp +++ b/src/corelib/io/qurl.cpp @@ -363,6 +363,23 @@ \sa QUrl::FormattingOptions */ +/*! + \fn QUrl::QUrl(QUrl &&other) + + Move-constructs a QUrl instance, making it point at the same + object that \a other was pointing to. + + \since 5.2 +*/ + +/*! + \fn QUrl &QUrl::operator=(QUrl &&other) + + Move-assigns \a other to this QUrl instance. + + \since 5.2 +*/ + #include "qurl.h" #include "qurl_p.h" #include "qplatformdefs.h" diff --git a/src/corelib/io/qurlquery.cpp b/src/corelib/io/qurlquery.cpp index f6b5cd44bd..f773af1433 100644 --- a/src/corelib/io/qurlquery.cpp +++ b/src/corelib/io/qurlquery.cpp @@ -139,6 +139,14 @@ QT_BEGIN_NAMESPACE \sa QUrl */ +/*! + \fn QUrlQuery &QUrlQuery::operator=(QUrlQuery &&other) + + Move-assigns \a other to this QUrlQuery instance. + + \since 5.2 +*/ + typedef QList > Map; class QUrlQueryPrivate : public QSharedData -- cgit v1.2.3 From 48061944ef358bbb1e5fd7b582376868f9788c5e Mon Sep 17 00:00:00 2001 From: Joerg Bornemann Date: Tue, 1 Oct 2013 11:16:23 +0200 Subject: remove usage of qDeleteInEventHandler from QProcess qDeleteInEventHandler is a mere wrapper for delete these days. Change-Id: I0828edf3ca17642b5abf97aab66672490c35f177 Reviewed-by: Friedemann Kleint --- src/corelib/io/qprocess.cpp | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) (limited to 'src/corelib/io') diff --git a/src/corelib/io/qprocess.cpp b/src/corelib/io/qprocess.cpp index 7f4d7f0313..9f5e626243 100644 --- a/src/corelib/io/qprocess.cpp +++ b/src/corelib/io/qprocess.cpp @@ -855,7 +855,7 @@ void QProcessPrivate::cleanup() } if (processFinishedNotifier) { processFinishedNotifier->setEnabled(false); - qDeleteInEventHandler(processFinishedNotifier); + delete processFinishedNotifier; processFinishedNotifier = 0; } @@ -866,32 +866,32 @@ void QProcessPrivate::cleanup() if (stdoutChannel.notifier) { stdoutChannel.notifier->setEnabled(false); - qDeleteInEventHandler(stdoutChannel.notifier); + delete stdoutChannel.notifier; stdoutChannel.notifier = 0; } if (stderrChannel.notifier) { stderrChannel.notifier->setEnabled(false); - qDeleteInEventHandler(stderrChannel.notifier); + delete stderrChannel.notifier; stderrChannel.notifier = 0; } if (stdinChannel.notifier) { stdinChannel.notifier->setEnabled(false); - qDeleteInEventHandler(stdinChannel.notifier); + delete stdinChannel.notifier; stdinChannel.notifier = 0; } if (startupSocketNotifier) { startupSocketNotifier->setEnabled(false); - qDeleteInEventHandler(startupSocketNotifier); + delete startupSocketNotifier; startupSocketNotifier = 0; } if (deathNotifier) { deathNotifier->setEnabled(false); - qDeleteInEventHandler(deathNotifier); + delete deathNotifier; deathNotifier = 0; } #ifdef Q_OS_WIN if (notifier) { - qDeleteInEventHandler(notifier); + delete notifier; notifier = 0; } #endif @@ -1161,10 +1161,9 @@ void QProcessPrivate::closeWriteChannel() qDebug("QProcessPrivate::closeWriteChannel()"); #endif if (stdinChannel.notifier) { - extern void qDeleteInEventHandler(QObject *o); stdinChannel.notifier->setEnabled(false); if (stdinChannel.notifier) { - qDeleteInEventHandler(stdinChannel.notifier); + delete stdinChannel.notifier; stdinChannel.notifier = 0; } } -- cgit v1.2.3 From 8388b40108eb3f78531dac2af07eef0e89a44c03 Mon Sep 17 00:00:00 2001 From: Joerg Bornemann Date: Tue, 1 Oct 2013 15:37:10 +0200 Subject: QProcess: remove now superfluous calls to setEnabled(false) This amends 48061944ef358bbb1e5fd7b582376868f9788c5e. Change-Id: Ie5b56c1499a10594b4a4b3c02d5704226ef971ba Reviewed-by: Oswald Buddenhagen --- src/corelib/io/qprocess.cpp | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) (limited to 'src/corelib/io') diff --git a/src/corelib/io/qprocess.cpp b/src/corelib/io/qprocess.cpp index 9f5e626243..fb86b053e9 100644 --- a/src/corelib/io/qprocess.cpp +++ b/src/corelib/io/qprocess.cpp @@ -854,7 +854,6 @@ void QProcessPrivate::cleanup() pid = 0; } if (processFinishedNotifier) { - processFinishedNotifier->setEnabled(false); delete processFinishedNotifier; processFinishedNotifier = 0; } @@ -865,27 +864,22 @@ void QProcessPrivate::cleanup() dying = false; if (stdoutChannel.notifier) { - stdoutChannel.notifier->setEnabled(false); delete stdoutChannel.notifier; stdoutChannel.notifier = 0; } if (stderrChannel.notifier) { - stderrChannel.notifier->setEnabled(false); delete stderrChannel.notifier; stderrChannel.notifier = 0; } if (stdinChannel.notifier) { - stdinChannel.notifier->setEnabled(false); delete stdinChannel.notifier; stdinChannel.notifier = 0; } if (startupSocketNotifier) { - startupSocketNotifier->setEnabled(false); delete startupSocketNotifier; startupSocketNotifier = 0; } if (deathNotifier) { - deathNotifier->setEnabled(false); delete deathNotifier; deathNotifier = 0; } @@ -1161,11 +1155,8 @@ void QProcessPrivate::closeWriteChannel() qDebug("QProcessPrivate::closeWriteChannel()"); #endif if (stdinChannel.notifier) { - stdinChannel.notifier->setEnabled(false); - if (stdinChannel.notifier) { - delete stdinChannel.notifier; - stdinChannel.notifier = 0; - } + delete stdinChannel.notifier; + stdinChannel.notifier = 0; } #ifdef Q_OS_WIN // ### Find a better fix, feeding the process little by little -- cgit v1.2.3 From 8dc8fe53f9b27a27230945a98b08570cfc1b4d0f Mon Sep 17 00:00:00 2001 From: Joerg Bornemann Date: Tue, 1 Oct 2013 11:03:32 +0200 Subject: QProcess/Win: fix crash in drainOutputPipes stdoutReader->waitForReadyRead() can synchronously trigger the deletion of stdoutreader (via signal readyRead(), _q_canReadStandardOutput(), destroyChannel()). Analoguous for stderrReader. Task-number: QTBUG-33730 Change-Id: I8badac53e92a979c437838b2959b4c0445c8de81 Reviewed-by: Friedemann Kleint Reviewed-by: Oswald Buddenhagen --- src/corelib/io/qprocess_win.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/corelib/io') diff --git a/src/corelib/io/qprocess_win.cpp b/src/corelib/io/qprocess_win.cpp index 291ea319ec..dba9f62b98 100644 --- a/src/corelib/io/qprocess_win.cpp +++ b/src/corelib/io/qprocess_win.cpp @@ -654,11 +654,11 @@ bool QProcessPrivate::drainOutputPipes() bool readOperationActive = false; if (stdoutReader) { readyReadEmitted |= stdoutReader->waitForReadyRead(0); - readOperationActive = stdoutReader->isReadOperationActive(); + readOperationActive = stdoutReader && stdoutReader->isReadOperationActive(); } if (stderrReader) { readyReadEmitted |= stderrReader->waitForReadyRead(0); - readOperationActive |= stderrReader->isReadOperationActive(); + readOperationActive |= stderrReader && stderrReader->isReadOperationActive(); } someReadyReadEmitted |= readyReadEmitted; if (!readOperationActive || !readyReadEmitted) -- cgit v1.2.3 From bc962256b41ebbf656a8d533397d1776c43a719e Mon Sep 17 00:00:00 2001 From: Sebastian Schuberth Date: Wed, 16 Dec 2009 15:03:20 +0100 Subject: Remove a duplicate conversion to QLatin1String Change-Id: I9641090406be2d4bad2b703594e404b4934cbc0b Reviewed-by: Oswald Buddenhagen --- src/corelib/io/qsettings_win.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/corelib/io') diff --git a/src/corelib/io/qsettings_win.cpp b/src/corelib/io/qsettings_win.cpp index 9ce14f1851..1d410862f0 100644 --- a/src/corelib/io/qsettings_win.cpp +++ b/src/corelib/io/qsettings_win.cpp @@ -450,7 +450,7 @@ QWinSettingsPrivate::QWinSettingsPrivate(QString rPath) regList.append(RegistryKey(HKEY_CLASSES_ROOT, QString(), false)); else if (rPath.startsWith(QLatin1String("HKEY_USERS\\"))) regList.append(RegistryKey(HKEY_USERS, rPath.mid(11), false)); - else if (rPath == QLatin1String(QLatin1String("HKEY_USERS"))) + else if (rPath == QLatin1String("HKEY_USERS")) regList.append(RegistryKey(HKEY_USERS, QString(), false)); else regList.append(RegistryKey(HKEY_LOCAL_MACHINE, rPath, false)); -- cgit v1.2.3 From 7d4236d28133519c30d1c500442393c87439b1f9 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Wed, 2 Oct 2013 12:24:14 +0200 Subject: QTemporaryDir: Output warnings on removal failure. Change-Id: I38d0a07c355f73899cc5f6eac60bd8cbedc73cb2 Reviewed-by: David Faure --- src/corelib/io/qtemporarydir.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'src/corelib/io') diff --git a/src/corelib/io/qtemporarydir.cpp b/src/corelib/io/qtemporarydir.cpp index 755c31f371..f21403d7f1 100644 --- a/src/corelib/io/qtemporarydir.cpp +++ b/src/corelib/io/qtemporarydir.cpp @@ -299,7 +299,13 @@ bool QTemporaryDir::remove() Q_ASSERT(!path().isEmpty()); Q_ASSERT(path() != QLatin1String(".")); - return QDir(path()).removeRecursively(); + const bool result = QDir(path()).removeRecursively(); + if (!result) { + qWarning() << "QTemporaryDir: Unable to remove" + << QDir::toNativeSeparators(path()) + << "most likely due to the presence of read-only files."; + } + return result; } QT_END_NAMESPACE -- cgit v1.2.3