summaryrefslogtreecommitdiffstats
path: root/src/corelib
diff options
context:
space:
mode:
authorIikka Eklund <iikka.eklund@digia.com>2014-04-02 07:36:48 +0200
committerThe Qt Project <gerrit-noreply@qt-project.org>2014-04-02 07:36:48 +0200
commitd6f58e5e17d58c640fc7779652008fda0d66f41d (patch)
treed50d27e260c9eaf4bc2bcb4480b8a069a3aed857 /src/corelib
parent83de197a57ff6c3e5bbad26bd871981285384fcb (diff)
parent0ab63b035a649dc1982c867cd37d466d249004b9 (diff)
Merge "Merge remote-tracking branch 'origin/stable' into dev" into refs/staging/dev
Diffstat (limited to 'src/corelib')
-rw-r--r--src/corelib/doc/qtcore.qdocconf1
-rw-r--r--src/corelib/io/qfilesystemwatcher_fsevents.mm134
-rw-r--r--src/corelib/io/qfilesystemwatcher_fsevents_p.h13
-rw-r--r--src/corelib/io/qsettings.cpp6
-rw-r--r--src/corelib/io/qsettings_mac.cpp40
-rw-r--r--src/corelib/io/qstandardpaths_win.cpp25
-rw-r--r--src/corelib/kernel/qcoreevent.cpp3
-rw-r--r--src/corelib/kernel/qeventdispatcher_winrt.cpp6
-rw-r--r--src/corelib/kernel/qmetatype.h42
-rw-r--r--src/corelib/kernel/qmimedata.cpp2
-rw-r--r--src/corelib/kernel/qobject.cpp6
-rw-r--r--src/corelib/tools/qmargins.cpp20
-rw-r--r--src/corelib/tools/qpoint.cpp2
-rw-r--r--src/corelib/tools/qrect.cpp2
-rw-r--r--src/corelib/tools/qsimd_p.h2
-rw-r--r--src/corelib/tools/qstring.cpp24
-rw-r--r--src/corelib/tools/qstring.h2
-rw-r--r--src/corelib/xml/qxmlstream.cpp4
18 files changed, 223 insertions, 111 deletions
diff --git a/src/corelib/doc/qtcore.qdocconf b/src/corelib/doc/qtcore.qdocconf
index 2ad24d33b1..18342d0138 100644
--- a/src/corelib/doc/qtcore.qdocconf
+++ b/src/corelib/doc/qtcore.qdocconf
@@ -37,6 +37,7 @@ exampledirs += \
snippets \
../../../examples/threads/ \
../../../examples/tools/ \
+ ../../../examples/ipc/ \
../../../examples/json/ \
../../../examples/network/dnslookup
diff --git a/src/corelib/io/qfilesystemwatcher_fsevents.mm b/src/corelib/io/qfilesystemwatcher_fsevents.mm
index cb6ddd913e..bfcae2a3a2 100644
--- a/src/corelib/io/qfilesystemwatcher_fsevents.mm
+++ b/src/corelib/io/qfilesystemwatcher_fsevents.mm
@@ -55,7 +55,7 @@
#include <qfileinfo.h>
#include <qvarlengtharray.h>
-//#define FSEVENT_DEBUG
+#undef FSEVENT_DEBUG
#ifdef FSEVENT_DEBUG
# define DEBUG if (true) qDebug
#else
@@ -76,14 +76,16 @@ static void callBackFunction(ConstFSEventStreamRef streamRef,
engine->processEvent(streamRef, numEvents, paths, eventFlags, eventIds);
}
-void QFseventsFileSystemWatcherEngine::checkDir(DirsByName::iterator &it)
+bool QFseventsFileSystemWatcherEngine::checkDir(DirsByName::iterator &it)
{
+ bool needsRestart = false;
+
QT_STATBUF st;
const QString &name = it.key();
Info &info = it->dirInfo;
const int res = QT_STAT(QFile::encodeName(name), &st);
if (res == -1) {
- derefPath(info.watchedPath);
+ needsRestart |= derefPath(info.watchedPath);
emit emitDirectoryChanged(info.origPath, true);
it = watchedDirectories.erase(it);
} else if (st.st_ctimespec != info.ctime || st.st_mode != info.mode) {
@@ -127,26 +129,34 @@ void QFseventsFileSystemWatcherEngine::checkDir(DirsByName::iterator &it)
if (dirChanged)
emit emitDirectoryChanged(info.origPath, false);
}
+
+ return needsRestart;
}
-void QFseventsFileSystemWatcherEngine::rescanDirs(const QString &path)
+bool QFseventsFileSystemWatcherEngine::rescanDirs(const QString &path)
{
+ bool needsRestart = false;
+
for (DirsByName::iterator it = watchedDirectories.begin(); it != watchedDirectories.end(); ) {
if (it.key().startsWith(path))
- checkDir(it);
+ needsRestart |= checkDir(it);
else
++it;
}
+
+ return needsRestart;
}
-void QFseventsFileSystemWatcherEngine::rescanFiles(InfoByName &filesInPath)
+bool QFseventsFileSystemWatcherEngine::rescanFiles(InfoByName &filesInPath)
{
+ bool needsRestart = false;
+
for (InfoByName::iterator it = filesInPath.begin(); it != filesInPath.end(); ) {
QT_STATBUF st;
QString name = it.key();
const int res = QT_STAT(QFile::encodeName(name), &st);
if (res == -1) {
- derefPath(it->watchedPath);
+ needsRestart |= derefPath(it->watchedPath);
emit emitFileChanged(it.value().origPath, true);
it = filesInPath.erase(it);
continue;
@@ -158,13 +168,17 @@ void QFseventsFileSystemWatcherEngine::rescanFiles(InfoByName &filesInPath)
++it;
}
+
+ return needsRestart;
}
-void QFseventsFileSystemWatcherEngine::rescanFiles(const QString &path)
+bool QFseventsFileSystemWatcherEngine::rescanFiles(const QString &path)
{
+ bool needsRestart = false;
+
for (FilesByPath::iterator i = watchedFiles.begin(); i != watchedFiles.end(); ) {
if (i.key().startsWith(path)) {
- rescanFiles(i.value());
+ needsRestart |= rescanFiles(i.value());
if (i.value().isEmpty()) {
i = watchedFiles.erase(i);
continue;
@@ -173,6 +187,8 @@ void QFseventsFileSystemWatcherEngine::rescanFiles(const QString &path)
++i;
}
+
+ return needsRestart;
}
void QFseventsFileSystemWatcherEngine::processEvent(ConstFSEventStreamRef streamRef,
@@ -184,11 +200,20 @@ void QFseventsFileSystemWatcherEngine::processEvent(ConstFSEventStreamRef stream
#if defined(Q_OS_OSX) && MAC_OS_X_VERSION_MIN_REQUIRED > MAC_OS_X_VERSION_10_6
Q_UNUSED(streamRef);
+ bool needsRestart = false;
+
QMutexLocker locker(&lock);
for (size_t i = 0; i < numEvents; ++i) {
FSEventStreamEventFlags eFlags = eventFlags[i];
DEBUG("Change %llu in %s, flags %x", eventIds[i], eventPaths[i], (unsigned int)eFlags);
+
+ if (eFlags & kFSEventStreamEventFlagEventIdsWrapped) {
+ DEBUG("\tthe event ids wrapped");
+ lastReceivedEvent = 0;
+ }
+ lastReceivedEvent = qMax(lastReceivedEvent, eventIds[i]);
+
QString path = QFile::decodeName(eventPaths[i]);
if (path.endsWith(QDir::separator()))
path = path.mid(0, path.size() - 1);
@@ -199,38 +224,36 @@ void QFseventsFileSystemWatcherEngine::processEvent(ConstFSEventStreamRef stream
DEBUG("\t\t... user dropped.");
if (eFlags & kFSEventStreamEventFlagKernelDropped)
DEBUG("\t\t... kernel dropped.");
- rescanDirs(path);
- rescanFiles(path);
+ needsRestart |= rescanDirs(path);
+ needsRestart |= rescanFiles(path);
continue;
}
- if (eFlags & kFSEventStreamEventFlagEventIdsWrapped) {
- DEBUG("\tthe event ids wrapped");
- // TODO: verify if we need to do something
- }
-
if (eFlags & kFSEventStreamEventFlagRootChanged) {
// re-check everything:
DirsByName::iterator dirIt = watchedDirectories.find(path);
if (dirIt != watchedDirectories.end())
- checkDir(dirIt);
- rescanFiles(path);
+ needsRestart |= checkDir(dirIt);
+ needsRestart |= rescanFiles(path);
continue;
}
if ((eFlags & kFSEventStreamEventFlagItemIsDir) && (eFlags & kFSEventStreamEventFlagItemRemoved))
- rescanDirs(path);
+ needsRestart |= rescanDirs(path);
// check watched directories:
DirsByName::iterator dirIt = watchedDirectories.find(path);
if (dirIt != watchedDirectories.end())
- checkDir(dirIt);
+ needsRestart |= checkDir(dirIt);
// check watched files:
FilesByPath::iterator pIt = watchedFiles.find(path);
if (pIt != watchedFiles.end())
- rescanFiles(pIt.value());
+ needsRestart |= rescanFiles(pIt.value());
}
+
+ if (needsRestart)
+ emit scheduleStreamRestart();
#else
// This is a work-around for moc: when we put the version check at the top of the header file,
// moc will still see the Q_OBJECT macro and generate a meta-object when compiling for 10.6,
@@ -248,14 +271,23 @@ void QFseventsFileSystemWatcherEngine::processEvent(ConstFSEventStreamRef stream
void QFseventsFileSystemWatcherEngine::doEmitFileChanged(const QString path, bool removed)
{
+ DEBUG() << "emitting fileChanged for" << path << "with removed =" << removed;
emit fileChanged(path, removed);
}
void QFseventsFileSystemWatcherEngine::doEmitDirectoryChanged(const QString path, bool removed)
{
+ DEBUG() << "emitting directoryChanged for" << path << "with removed =" << removed;
emit directoryChanged(path, removed);
}
+void QFseventsFileSystemWatcherEngine::restartStream()
+{
+ QMutexLocker locker(&lock);
+ stopStream();
+ startStream();
+}
+
QFseventsFileSystemWatcherEngine *QFseventsFileSystemWatcherEngine::create(QObject *parent)
{
return new QFseventsFileSystemWatcherEngine(parent);
@@ -264,6 +296,7 @@ QFseventsFileSystemWatcherEngine *QFseventsFileSystemWatcherEngine::create(QObje
QFseventsFileSystemWatcherEngine::QFseventsFileSystemWatcherEngine(QObject *parent)
: QFileSystemWatcherEngine(parent)
, stream(0)
+ , lastReceivedEvent(kFSEventStreamEventIdSinceNow)
{
// We cannot use signal-to-signal queued connections, because the
@@ -272,6 +305,8 @@ QFseventsFileSystemWatcherEngine::QFseventsFileSystemWatcherEngine(QObject *pare
this, SLOT(doEmitDirectoryChanged(const QString, bool)), Qt::QueuedConnection);
connect(this, SIGNAL(emitFileChanged(const QString, bool)),
this, SLOT(doEmitFileChanged(const QString, bool)), Qt::QueuedConnection);
+ connect(this, SIGNAL(scheduleStreamRestart()),
+ this, SLOT(restartStream()), Qt::QueuedConnection);
queue = dispatch_queue_create("org.qt-project.QFseventsFileSystemWatcherEngine", NULL);
}
@@ -284,7 +319,7 @@ QFseventsFileSystemWatcherEngine::~QFseventsFileSystemWatcherEngine()
// The assumption with the locking strategy is that this class cannot and will not be subclassed!
QMutexLocker locker(&lock);
- stopStream();
+ stopStream(true);
dispatch_release(queue);
}
@@ -292,12 +327,14 @@ QStringList QFseventsFileSystemWatcherEngine::addPaths(const QStringList &paths,
QStringList *files,
QStringList *directories)
{
- if (stream)
+ if (stream) {
+ DEBUG("Flushing, last id is %llu", FSEventStreamGetLatestEventId(stream));
FSEventStreamFlushSync(stream);
+ }
QMutexLocker locker(&lock);
- bool newWatchPathsFound = false;
+ bool needsRestart = false;
QStringList p = paths;
QMutableListIterator<QString> it(p);
@@ -343,8 +380,9 @@ QStringList QFseventsFileSystemWatcherEngine::addPaths(const QStringList &paths,
PathRefCounts::iterator it = watchedPaths.find(watchedPath);
if (it == watchedPaths.end()) {
- newWatchPathsFound = true;
+ needsRestart = true;
watchedPaths.insert(watchedPath, 1);
+ DEBUG("Adding '%s' to watchedPaths", qPrintable(watchedPath));
} else {
++it.value();
}
@@ -355,12 +393,14 @@ QStringList QFseventsFileSystemWatcherEngine::addPaths(const QStringList &paths,
dirInfo.dirInfo = info;
dirInfo.entries = scanForDirEntries(realPath);
watchedDirectories.insert(realPath, dirInfo);
+ DEBUG("-- Also adding '%s' to watchedDirectories", qPrintable(realPath));
} else {
watchedFiles[parentPath].insert(realPath, info);
+ DEBUG("-- Also adding '%s' to watchedFiles", qPrintable(realPath));
}
}
- if (newWatchPathsFound) {
+ if (needsRestart) {
stopStream();
if (!startStream())
p = paths;
@@ -375,6 +415,8 @@ QStringList QFseventsFileSystemWatcherEngine::removePaths(const QStringList &pat
{
QMutexLocker locker(&lock);
+ bool needsRestart = false;
+
QStringList p = paths;
QMutableListIterator<QString> it(p);
while (it.hasNext()) {
@@ -389,10 +431,11 @@ QStringList QFseventsFileSystemWatcherEngine::removePaths(const QStringList &pat
if (fi.isDir()) {
DirsByName::iterator dirIt = watchedDirectories.find(realPath);
if (dirIt != watchedDirectories.end()) {
- derefPath(dirIt->dirInfo.watchedPath);
+ needsRestart |= derefPath(dirIt->dirInfo.watchedPath);
watchedDirectories.erase(dirIt);
directories->removeAll(origPath);
it.remove();
+ DEBUG("Removed directory '%s'", qPrintable(realPath));
}
} else {
QFileInfo fi(realPath);
@@ -402,22 +445,32 @@ QStringList QFseventsFileSystemWatcherEngine::removePaths(const QStringList &pat
InfoByName &filesInDir = pIt.value();
InfoByName::iterator fIt = filesInDir.find(realPath);
if (fIt != filesInDir.end()) {
- derefPath(fIt->watchedPath);
+ needsRestart |= derefPath(fIt->watchedPath);
filesInDir.erase(fIt);
if (filesInDir.isEmpty())
watchedFiles.erase(pIt);
files->removeAll(origPath);
it.remove();
+ DEBUG("Removed file '%s'", qPrintable(realPath));
}
}
}
}
+ locker.unlock();
+
+ if (needsRestart)
+ restartStream();
+
return p;
}
bool QFseventsFileSystemWatcherEngine::startStream()
{
+ Q_ASSERT(stream == 0);
+ if (stream) // This shouldn't happen, but let's be nice and handle it.
+ stopStream();
+
if (watchedPaths.isEmpty())
return false;
@@ -437,11 +490,15 @@ bool QFseventsFileSystemWatcherEngine::startStream()
const CFAbsoluteTime latency = .5; // in seconds
FSEventStreamCreateFlags flags = kFSEventStreamCreateFlagWatchRoot;
+ // Never start with kFSEventStreamEventIdSinceNow, because this will generate an invalid
+ // soft-assert in FSEventStreamFlushSync in CarbonCore when no event occurred.
+ if (lastReceivedEvent == kFSEventStreamEventIdSinceNow)
+ lastReceivedEvent = FSEventsGetCurrentEventId();
stream = FSEventStreamCreate(NULL,
&callBackFunction,
&callBackInfo,
reinterpret_cast<CFArrayRef>(pathsToWatch),
- kFSEventStreamEventIdSinceNow,
+ lastReceivedEvent,
latency,
flags);
@@ -453,10 +510,13 @@ bool QFseventsFileSystemWatcherEngine::startStream()
FSEventStreamSetDispatchQueue(stream, queue);
if (FSEventStreamStart(stream)) {
- DEBUG() << "Stream started successfully.";
+ DEBUG() << "Stream started successfully with sinceWhen =" << lastReceivedEvent;
return true;
} else {
DEBUG() << "Stream failed to start!";
+ FSEventStreamInvalidate(stream);
+ FSEventStreamRelease(stream);
+ stream = 0;
return false;
}
}
@@ -469,7 +529,7 @@ void QFseventsFileSystemWatcherEngine::stopStream(bool isStopped)
FSEventStreamInvalidate(stream);
FSEventStreamRelease(stream);
stream = 0;
- DEBUG() << "Stream stopped.";
+ DEBUG() << "Stream stopped. Last event ID:" << lastReceivedEvent;
}
}
@@ -490,16 +550,16 @@ QFseventsFileSystemWatcherEngine::InfoByName QFseventsFileSystemWatcherEngine::s
return entries;
}
-void QFseventsFileSystemWatcherEngine::derefPath(const QString &watchedPath)
+bool QFseventsFileSystemWatcherEngine::derefPath(const QString &watchedPath)
{
PathRefCounts::iterator it = watchedPaths.find(watchedPath);
- if (it == watchedPaths.end())
- return;
- if (--it.value() < 1) {
+ if (it != watchedPaths.end() && --it.value() < 1) {
watchedPaths.erase(it);
- stopStream();
- startStream();
+ DEBUG("Removing '%s' from watchedPaths.", qPrintable(watchedPath));
+ return true;
}
+
+ return false;
}
#endif //QT_NO_FILESYSTEMWATCHER
diff --git a/src/corelib/io/qfilesystemwatcher_fsevents_p.h b/src/corelib/io/qfilesystemwatcher_fsevents_p.h
index c899c556c8..2de2bf4f18 100644
--- a/src/corelib/io/qfilesystemwatcher_fsevents_p.h
+++ b/src/corelib/io/qfilesystemwatcher_fsevents_p.h
@@ -84,10 +84,12 @@ public:
Q_SIGNALS:
void emitFileChanged(const QString path, bool removed);
void emitDirectoryChanged(const QString path, bool removed);
+ void scheduleStreamRestart();
private slots:
void doEmitFileChanged(const QString path, bool removed);
void doEmitDirectoryChanged(const QString path, bool removed);
+ void restartStream();
private:
struct Info {
@@ -122,11 +124,11 @@ private:
bool startStream();
void stopStream(bool isStopped = false);
InfoByName scanForDirEntries(const QString &path);
- void derefPath(const QString &watchedPath);
- void checkDir(DirsByName::iterator &it);
- void rescanDirs(const QString &path);
- void rescanFiles(InfoByName &filesInPath);
- void rescanFiles(const QString &path);
+ bool derefPath(const QString &watchedPath);
+ bool checkDir(DirsByName::iterator &it);
+ bool rescanDirs(const QString &path);
+ bool rescanFiles(InfoByName &filesInPath);
+ bool rescanFiles(const QString &path);
QMutex lock;
dispatch_queue_t queue;
@@ -134,6 +136,7 @@ private:
FilesByPath watchedFiles;
DirsByName watchedDirectories;
PathRefCounts watchedPaths;
+ FSEventStreamEventId lastReceivedEvent;
};
QT_END_NAMESPACE
diff --git a/src/corelib/io/qsettings.cpp b/src/corelib/io/qsettings.cpp
index 0406aeb501..321525ca18 100644
--- a/src/corelib/io/qsettings.cpp
+++ b/src/corelib/io/qsettings.cpp
@@ -2496,6 +2496,12 @@ void QConfFileSettingsPrivate::ensureSectionParsed(QConfFile *confFile,
\snippet code/src_corelib_io_qsettings.cpp 7
+ \li On Mac OS X, permissions to access settings not belonging to the
+ current user (i.e. SystemScope) have changed with 10.7 (Lion). Prior to
+ that version, users having admin rights could access these. For 10.7 and
+ 10.8 (Mountain Lion), only root can. However, 10.9 (Mavericks) changes
+ that rule again but only for the native format (plist files).
+
\li On Unix and Mac OS X systems, the advisory file locking is disabled
if NFS (or AutoFS or CacheFS) is detected to work around a bug in the
NFS fcntl() implementation, which hangs forever if statd or lockd aren't
diff --git a/src/corelib/io/qsettings_mac.cpp b/src/corelib/io/qsettings_mac.cpp
index 23cff6af27..7d1fb1a7c5 100644
--- a/src/corelib/io/qsettings_mac.cpp
+++ b/src/corelib/io/qsettings_mac.cpp
@@ -405,7 +405,6 @@ QMacSettingsPrivate::QMacSettingsPrivate(QSettings::Scope scope, const QString &
}
// if no bundle identifier yet. use a hard coded string.
if (domainName.isEmpty()) {
- setStatus(QSettings::AccessError);
domainName = QLatin1String("unknown-organization.trolltech.com");
}
@@ -540,27 +539,30 @@ void QMacSettingsPrivate::sync()
// only report failures for the primary file (the one we write to)
if (!ok && i == 0 && hostNames[j] == hostName && status == QSettings::NoError) {
#if 1
- // work around what seems to be a bug in CFPreferences:
- // don't report an error if there are no preferences for the application
- QCFType<CFArrayRef> appIds = CFPreferencesCopyApplicationList(domains[i].userName,
- hostNames[j]);
-
- // iterate through all the applications and see if we're there
- CFIndex size = CFArrayGetCount(appIds);
- for (CFIndex k = 0; k < size; ++k) {
- const void *cfvalue = CFArrayGetValueAtIndex(appIds, k);
- if (CFGetTypeID(cfvalue) == CFStringGetTypeID()) {
- if (CFStringCompare(static_cast<CFStringRef>(cfvalue),
- domains[i].applicationOrSuiteId,
- kCFCompareCaseInsensitive) == kCFCompareEqualTo) {
- setStatus(QSettings::AccessError);
- break;
+ if (QSysInfo::macVersion() < QSysInfo::MV_10_7) {
+ // work around what seems to be a bug in CFPreferences:
+ // don't report an error if there are no preferences for the application
+ QCFType<CFArrayRef> appIds = CFPreferencesCopyApplicationList(domains[i].userName,
+ hostNames[j]);
+
+ // iterate through all the applications and see if we're there
+ CFIndex size = CFArrayGetCount(appIds);
+ for (CFIndex k = 0; k < size; ++k) {
+ const void *cfvalue = CFArrayGetValueAtIndex(appIds, k);
+ if (CFGetTypeID(cfvalue) == CFStringGetTypeID()) {
+ if (CFStringCompare(static_cast<CFStringRef>(cfvalue),
+ domains[i].applicationOrSuiteId,
+ kCFCompareCaseInsensitive) == kCFCompareEqualTo) {
+ setStatus(QSettings::AccessError);
+ break;
+ }
}
}
- }
-#else
- setStatus(QSettings::AccessError);
+ } else
#endif
+ {
+ setStatus(QSettings::AccessError);
+ }
}
}
}
diff --git a/src/corelib/io/qstandardpaths_win.cpp b/src/corelib/io/qstandardpaths_win.cpp
index a0344a0206..062ab49207 100644
--- a/src/corelib/io/qstandardpaths_win.cpp
+++ b/src/corelib/io/qstandardpaths_win.cpp
@@ -49,6 +49,10 @@
#include <qcoreapplication.h>
#endif
+#if !defined(Q_OS_WINCE)
+const GUID qCLSID_FOLDERID_Downloads = { 0x374de290, 0x123f, 0x4565, { 0x91, 0x64, 0x39, 0xc4, 0x92, 0x5e, 0x46, 0x7b } };
+#endif
+
#include <qt_windows.h>
#include <shlobj.h>
#if !defined(Q_OS_WINCE)
@@ -68,6 +72,10 @@
QT_BEGIN_NAMESPACE
+#if !defined(Q_OS_WINCE)
+typedef HRESULT (WINAPI *GetKnownFolderPath)(const GUID&, DWORD, HANDLE, LPWSTR*);
+#endif
+
static QString convertCharArray(const wchar_t *path)
{
return QDir::fromNativeSeparators(QString::fromWCharArray(path));
@@ -77,6 +85,10 @@ QString QStandardPaths::writableLocation(StandardLocation type)
{
QString result;
+#if !defined(Q_OS_WINCE)
+ static GetKnownFolderPath SHGetKnownFolderPath = (GetKnownFolderPath)QSystemLibrary::resolve(QLatin1String("shell32"), "SHGetKnownFolderPath");
+#endif
+
wchar_t path[MAX_PATH];
switch (type) {
@@ -107,7 +119,18 @@ QString QStandardPaths::writableLocation(StandardLocation type)
result = convertCharArray(path);
break;
- case DownloadLocation: // TODO implement with SHGetKnownFolderPath(FOLDERID_Downloads) (starting from Vista)
+ case DownloadLocation:
+#if !defined(Q_OS_WINCE)
+ if (SHGetKnownFolderPath) {
+ LPWSTR path;
+ if (SHGetKnownFolderPath(qCLSID_FOLDERID_Downloads, 0, 0, &path) == S_OK) {
+ result = convertCharArray(path);
+ CoTaskMemFree(path);
+ }
+ break;
+ }
+#endif
+ // fall through
case DocumentsLocation:
if (SHGetSpecialFolderPath(0, path, CSIDL_PERSONAL, FALSE))
result = convertCharArray(path);
diff --git a/src/corelib/kernel/qcoreevent.cpp b/src/corelib/kernel/qcoreevent.cpp
index ae2666f19b..5e588a9f1a 100644
--- a/src/corelib/kernel/qcoreevent.cpp
+++ b/src/corelib/kernel/qcoreevent.cpp
@@ -407,6 +407,9 @@ Q_GLOBAL_STATIC(QEventUserEventRegistration, userEventRegistrationHelper)
between QEvent::User and QEvent::MaxUser that has not yet been
registered. The \a hint is ignored if its value is not between
QEvent::User and QEvent::MaxUser.
+
+ Returns -1 if all available values are already taken or the
+ program is shutting down.
*/
int QEvent::registerEventType(int hint)
{
diff --git a/src/corelib/kernel/qeventdispatcher_winrt.cpp b/src/corelib/kernel/qeventdispatcher_winrt.cpp
index 56f4ac40de..1d4b57642c 100644
--- a/src/corelib/kernel/qeventdispatcher_winrt.cpp
+++ b/src/corelib/kernel/qeventdispatcher_winrt.cpp
@@ -45,6 +45,7 @@
#include <QtCore/QThread>
#include <QtCore/QHash>
#include <private/qabstracteventdispatcher_p.h>
+#include <private/qcoreapplication_p.h>
#include <wrl.h>
#include <windows.foundation.h>
@@ -109,6 +110,11 @@ QEventDispatcherWinRT::QEventDispatcherWinRT(QObject *parent)
: QAbstractEventDispatcher(*new QEventDispatcherWinRTPrivate, parent)
{
Q_D(QEventDispatcherWinRT);
+
+ // Only look up the event dispatcher in the main thread
+ if (QThread::currentThread() != QCoreApplicationPrivate::theMainThread)
+ return;
+
ComPtr<ICoreApplication> application;
HRESULT hr = RoGetActivationFactory(HString::MakeReference(RuntimeClass_Windows_ApplicationModel_Core_CoreApplication).Get(),
IID_PPV_ARGS(&application));
diff --git a/src/corelib/kernel/qmetatype.h b/src/corelib/kernel/qmetatype.h
index 7679258a98..0a52aaf680 100644
--- a/src/corelib/kernel/qmetatype.h
+++ b/src/corelib/kernel/qmetatype.h
@@ -939,10 +939,6 @@ public:
}
template<class T>
- static void advanceImpl(void **p, int step)
- { IteratorOwner<typename T::const_iterator>::advance(p, step); }
-
- template<class T>
static void moveToBeginImpl(const void *container, void **iterator)
{ IteratorOwner<typename T::const_iterator>::assign(iterator, static_cast<const T*>(container)->begin()); }
@@ -951,21 +947,9 @@ public:
{ IteratorOwner<typename T::const_iterator>::assign(iterator, static_cast<const T*>(container)->end()); }
template<class T>
- static void destroyIterImpl(void **iterator)
- { IteratorOwner<typename T::const_iterator>::destroy(iterator); }
-
- template<class T>
- static bool equalIterImpl(void * const *iterator, void * const *other)
- { return IteratorOwner<typename T::const_iterator>::equal(iterator, other); }
-
- template<class T>
static VariantData getImpl(void * const *iterator, int metaTypeId, uint flags)
{ return VariantData(metaTypeId, IteratorOwner<typename T::const_iterator>::getData(iterator), flags); }
- template<class T>
- static void copyIterImpl(void **dest, void * const * src)
- { IteratorOwner<typename T::const_iterator>::assign(dest, src); }
-
public:
template<class T> QSequentialIterableImpl(const T*p)
: _iterable(p)
@@ -977,11 +961,11 @@ public:
, _at(atImpl<T>)
, _moveToBegin(moveToBeginImpl<T>)
, _moveToEnd(moveToEndImpl<T>)
- , _advance(advanceImpl<T>)
+ , _advance(IteratorOwner<typename T::const_iterator>::advance)
, _get(getImpl<T>)
- , _destroyIter(destroyIterImpl<T>)
- , _equalIter(equalIterImpl<T>)
- , _copyIter(copyIterImpl<T>)
+ , _destroyIter(IteratorOwner<typename T::const_iterator>::destroy)
+ , _equalIter(IteratorOwner<typename T::const_iterator>::equal)
+ , _copyIter(IteratorOwner<typename T::const_iterator>::assign)
{
}
@@ -1134,18 +1118,6 @@ public:
static VariantData getValueImpl(void * const *iterator, int metaTypeId, uint flags)
{ return VariantData(metaTypeId, &AssociativeContainerAccessor<T>::getValue(*static_cast<typename T::const_iterator*>(*iterator)), flags); }
- template<class T>
- static void destroyIterImpl(void **iterator)
- { IteratorOwner<typename T::const_iterator>::destroy(iterator); }
-
- template<class T>
- static bool equalIterImpl(void * const *iterator, void * const *other)
- { return IteratorOwner<typename T::const_iterator>::equal(iterator, other); }
-
- template<class T>
- static void copyIterImpl(void **dest, void * const * src)
- { IteratorOwner<typename T::const_iterator>::assign(dest, src); }
-
public:
template<class T> QAssociativeIterableImpl(const T*p)
: _iterable(p)
@@ -1160,9 +1132,9 @@ public:
, _advance(advanceImpl<T>)
, _getKey(getKeyImpl<T>)
, _getValue(getValueImpl<T>)
- , _destroyIter(destroyIterImpl<T>)
- , _equalIter(equalIterImpl<T>)
- , _copyIter(copyIterImpl<T>)
+ , _destroyIter(IteratorOwner<typename T::const_iterator>::destroy)
+ , _equalIter(IteratorOwner<typename T::const_iterator>::equal)
+ , _copyIter(IteratorOwner<typename T::const_iterator>::assign)
{
}
diff --git a/src/corelib/kernel/qmimedata.cpp b/src/corelib/kernel/qmimedata.cpp
index 483692cdf8..5d2adb0561 100644
--- a/src/corelib/kernel/qmimedata.cpp
+++ b/src/corelib/kernel/qmimedata.cpp
@@ -299,7 +299,7 @@ QVariant QMimeDataPrivate::retrieveTypedData(const QString &format, QVariant::Ty
QMacPasteboardMime maps MIME to Mac flavors.
\sa QClipboard, QDragEnterEvent, QDragMoveEvent, QDropEvent, QDrag,
- QWindowsMime, QMacPasteboardMime, {Drag and Drop}
+ QMacPasteboardMime, {Drag and Drop}
*/
/*!
diff --git a/src/corelib/kernel/qobject.cpp b/src/corelib/kernel/qobject.cpp
index 262d259136..01bedb4a3a 100644
--- a/src/corelib/kernel/qobject.cpp
+++ b/src/corelib/kernel/qobject.cpp
@@ -551,7 +551,7 @@ void QMetaCallEvent::placeMetaCall(QObject *object)
QObject::signalsBlocked() state is transferred to this object.
The object's signals this signal blocker was blocking prior to
- being moved to, if any, are unblocked \em except in the case where
+ being moved to, if any, are unblocked \e except in the case where
both instances block the same object's signals and \c *this is
unblocked while \a other is not, at the time of the move.
*/
@@ -2731,9 +2731,7 @@ QMetaObject::Connection QObject::connect(const QObject *sender, const char *sign
Qt::ConnectionType type)
but it uses QMetaMethod to specify signal and method.
- \sa connect(const QObject *sender, const char *signal,
- const QObject *receiver, const char *method,
- Qt::ConnectionType type)
+ \sa connect(const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type)
*/
QMetaObject::Connection QObject::connect(const QObject *sender, const QMetaMethod &signal,
const QObject *receiver, const QMetaMethod &method,
diff --git a/src/corelib/tools/qmargins.cpp b/src/corelib/tools/qmargins.cpp
index 03993f05a9..6f2c6c2c7c 100644
--- a/src/corelib/tools/qmargins.cpp
+++ b/src/corelib/tools/qmargins.cpp
@@ -334,6 +334,26 @@ QT_BEGIN_NAMESPACE
*/
/*!
+ \fn QMargins &QMargins::operator+=(int addend)
+ \overload
+
+ Adds the \a addend to each component of this object
+ and returns a reference to it.
+
+ \sa operator-=()
+*/
+
+/*!
+ \fn QMargins &QMargins::operator-=(int subtrahend)
+ \overload
+
+ Subtracts the \a subtrahend from each component of this object
+ and returns a reference to it.
+
+ \sa operator+=()
+*/
+
+/*!
\fn QMargins &QMargins::operator*=(int factor)
Multiplies each component of this object by \a factor
diff --git a/src/corelib/tools/qpoint.cpp b/src/corelib/tools/qpoint.cpp
index f154e4c612..090e8d0ff2 100644
--- a/src/corelib/tools/qpoint.cpp
+++ b/src/corelib/tools/qpoint.cpp
@@ -49,6 +49,7 @@ QT_BEGIN_NAMESPACE
\class QPoint
\inmodule QtCore
\ingroup painting
+ \reentrant
\brief The QPoint class defines a point in the plane using integer
precision.
@@ -470,6 +471,7 @@ QDebug operator<<(QDebug dbg, const QPointF &p)
\class QPointF
\inmodule QtCore
\ingroup painting
+ \reentrant
\brief The QPointF class defines a point in the plane using
floating point precision.
diff --git a/src/corelib/tools/qrect.cpp b/src/corelib/tools/qrect.cpp
index 35c7d1cd3c..04269e485b 100644
--- a/src/corelib/tools/qrect.cpp
+++ b/src/corelib/tools/qrect.cpp
@@ -52,6 +52,7 @@ QT_BEGIN_NAMESPACE
\class QRect
\inmodule QtCore
\ingroup painting
+ \reentrant
\brief The QRect class defines a rectangle in the plane using
integer precision.
@@ -1298,6 +1299,7 @@ QDebug operator<<(QDebug dbg, const QRect &r)
\class QRectF
\inmodule QtCore
\ingroup painting
+ \reentrant
\brief The QRectF class defines a rectangle in the plane using floating
point precision.
diff --git a/src/corelib/tools/qsimd_p.h b/src/corelib/tools/qsimd_p.h
index d293532f1d..f4ca971567 100644
--- a/src/corelib/tools/qsimd_p.h
+++ b/src/corelib/tools/qsimd_p.h
@@ -79,7 +79,7 @@
// SSE intrinsics
#if defined(__SSE2__) || (defined(QT_COMPILER_SUPPORTS_SSE2) && defined(Q_CC_MSVC))
-#if defined(QT_LINUXBASE)
+#if defined(QT_LINUXBASE) || defined(Q_OS_ANDROID_NO_SDK)
/// this is an evil hack - the posix_memalign declaration in LSB
/// is wrong - see http://bugs.linuxbase.org/show_bug.cgi?id=2431
# define posix_memalign _lsb_hack_posix_memalign
diff --git a/src/corelib/tools/qstring.cpp b/src/corelib/tools/qstring.cpp
index 7547ba8c19..01faad6f2d 100644
--- a/src/corelib/tools/qstring.cpp
+++ b/src/corelib/tools/qstring.cpp
@@ -78,6 +78,7 @@
#include "qchar.cpp"
#include "qstringmatcher.cpp"
#include "qstringiterator_p.h"
+#include "qthreadstorage.h"
#ifdef Q_OS_WIN
# include <qt_windows.h>
@@ -5319,6 +5320,10 @@ int QString::localeAwareCompare(const QString &other) const
return localeAwareCompare_helper(constData(), length(), other.constData(), other.length());
}
+#if defined(QT_USE_ICU)
+Q_GLOBAL_STATIC(QThreadStorage<QCollator>, defaultCollator)
+#endif
+
/*!
\internal
\since 4.5
@@ -5362,8 +5367,9 @@ int QString::localeAwareCompare_helper(const QChar *data1, int length1,
CFRelease(otherString);
return result;
#elif defined(QT_USE_ICU)
- QCollator collator;
- return collator.compare(data1, length1, data2, length2);
+ if (!defaultCollator()->hasLocalData())
+ defaultCollator()->setLocalData(QCollator());
+ return defaultCollator()->localData().compare(data1, length1, data2, length2);
#elif defined(Q_OS_UNIX)
// declared in <string.h>
int delta = strcoll(toLocal8Bit_helper(data1, length1).constData(), toLocal8Bit_helper(data2, length2).constData());
@@ -6168,7 +6174,7 @@ qulonglong QString::toIntegral_helper(const QChar *data, uint len, bool *ok, int
\snippet qstring/main.cpp 73
- \sa number(), toULong(), toInt(), QLocale::toLong()
+ \sa number(), toULong(), toInt(), QLocale::toInt()
*/
long QString::toLong(bool *ok, int base) const
@@ -6197,7 +6203,7 @@ long QString::toLong(bool *ok, int base) const
\snippet qstring/main.cpp 78
- \sa number(), QLocale::toULong()
+ \sa number(), QLocale::toUInt()
*/
ulong QString::toULong(bool *ok, int base) const
@@ -7562,6 +7568,8 @@ QString QString::multiArg(int numArgs, const QString **args) const
\since 5.2
Constructs a new QString containing a copy of the \a string CFString.
+
+ \note this function is only available on Mac OS X and iOS.
*/
/*! \fn CFStringRef QString::toCFString() const
@@ -7569,18 +7577,24 @@ QString QString::multiArg(int numArgs, const QString **args) const
Creates a CFString from a QString. The caller owns the CFString and is
responsible for releasing it.
+
+ \note this function is only available on Mac OS X and iOS.
*/
/*! \fn QString QString::fromNSString(const NSString *string)
\since 5.2
Constructs a new QString containing a copy of the \a string NSString.
+
+ \note this function is only available on Mac OS X and iOS.
*/
/*! \fn NSString QString::toNSString() const
\since 5.2
- Creates a NSString from a QString.g. The NSString is autoreleased.
+ Creates a NSString from a QString. The NSString is autoreleased.
+
+ \note this function is only available on Mac OS X and iOS.
*/
/*! \fn bool QString::isSimpleText() const
diff --git a/src/corelib/tools/qstring.h b/src/corelib/tools/qstring.h
index cf0726d831..2d9a42957e 100644
--- a/src/corelib/tools/qstring.h
+++ b/src/corelib/tools/qstring.h
@@ -711,7 +711,7 @@ public:
Q_DECL_CONSTEXPR inline QString(QStringDataPtr dd) : d(dd.ptr) {}
private:
-#if defined(QT_NO_CAST_FROM_ASCII) && !defined(Q_NO_DECLARED_NOT_DEFINED)
+#if defined(QT_NO_CAST_FROM_ASCII)
QString &operator+=(const char *s);
QString &operator+=(const QByteArray &s);
QString(const char *ch);
diff --git a/src/corelib/xml/qxmlstream.cpp b/src/corelib/xml/qxmlstream.cpp
index 5461139582..83d0c73ae1 100644
--- a/src/corelib/xml/qxmlstream.cpp
+++ b/src/corelib/xml/qxmlstream.cpp
@@ -349,11 +349,11 @@ QXmlStreamEntityResolver *QXmlStreamReader::entityResolver() const
\l{QNetworkAccessManager} {network access manager}, you would issue
a \l{QNetworkRequest} {network request} to the manager and receive a
\l{QNetworkReply} {network reply} in return. Since a QNetworkReply
- is a QIODevice, you connect its \l{QNetworkReply::readyRead()}
+ is a QIODevice, you connect its \l{QIODevice::readyRead()}
{readyRead()} signal to a custom slot, e.g. \c{slotReadyRead()} in
the code snippet shown in the discussion for QNetworkAccessManager.
In this slot, you read all available data with
- \l{QNetworkReply::readAll()} {readAll()} and pass it to the XML
+ \l{QIODevice::readAll()} {readAll()} and pass it to the XML
stream reader using addData(). Then you call your custom parsing
function that reads the XML events from the reader.