summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLiang Qi <liang.qi@qt.io>2016-08-25 14:20:33 +0000
committerThe Qt Project <gerrit-noreply@qt-project.org>2016-08-25 16:08:09 +0000
commit13680ceb9a468f824e24e448e932eed3a4ad9007 (patch)
tree5b8441f3cfc6e2e012172795b9a83f0adc8798fc
parent095abb192577d61215fcf7ea3a55338c54a3c4b0 (diff)
parentc7cdf3aac7ef9571ce0c0cf25a2c8455c7604451 (diff)
Merge "Merge remote-tracking branch 'origin/5.6' into 5.7" into refs/staging/5.7
-rwxr-xr-xconfigure2
-rw-r--r--mkspecs/features/qt_build_extra.prf2
-rw-r--r--mkspecs/features/qt_common.prf4
-rwxr-xr-xmkspecs/macx-ios-clang/ios_destinations.sh3
-rwxr-xr-xmkspecs/macx-ios-clang/ios_devices.pl50
-rw-r--r--mkspecs/macx-ios-clang/xcodebuild.mk5
-rw-r--r--mkspecs/macx-xcode/default.xcscheme4
-rw-r--r--src/corelib/mimetypes/qmimetype.cpp6
-rw-r--r--src/corelib/thread/qfutureinterface.cpp11
-rw-r--r--src/corelib/thread/qmutex.cpp27
-rw-r--r--src/corelib/tools/qlocale_win.cpp5
-rw-r--r--src/gui/kernel/qkeysequence.cpp10
-rw-r--r--src/gui/kernel/qoffscreensurface.cpp1
-rw-r--r--src/gui/kernel/qwindow.cpp2
-rw-r--r--src/gui/text/qfontengine.cpp59
-rw-r--r--src/gui/text/qfontengine_p.h7
-rw-r--r--src/plugins/bearer/networkmanager/qnetworkmanagerengine.cpp200
-rw-r--r--src/plugins/bearer/networkmanager/qnetworkmanagerengine.h7
-rw-r--r--src/plugins/bearer/networkmanager/qnetworkmanagerservice.cpp142
-rw-r--r--src/plugins/bearer/networkmanager/qnetworkmanagerservice.h11
-rw-r--r--src/plugins/platforms/ios/qiostextresponder.mm2
-rw-r--r--src/plugins/platforms/winrt/qwinrtclipboard.cpp2
-rw-r--r--src/widgets/dialogs/qsidebar.cpp4
-rw-r--r--src/widgets/styles/qstylesheetstyle.cpp18
-rw-r--r--src/widgets/styles/qwindowsvistastyle.cpp11
-rw-r--r--src/widgets/styles/qwindowsxpstyle.cpp22
-rw-r--r--tests/auto/concurrent/qtconcurrentrun/tst_qtconcurrentrun.cpp37
-rw-r--r--tests/auto/corelib/mimetypes/qmimedatabase/tst_qmimedatabase.cpp16
-rw-r--r--tests/auto/corelib/mimetypes/qmimedatabase/tst_qmimedatabase.h1
-rw-r--r--tests/auto/gui/qopenglconfig/tst_qopenglconfig.cpp12
-rw-r--r--tests/manual/qopenglwindow/multiwindow/main.cpp141
31 files changed, 356 insertions, 468 deletions
diff --git a/configure b/configure
index 8db1f2a634..930895203e 100755
--- a/configure
+++ b/configure
@@ -6840,7 +6840,7 @@ case "$QMAKE_CONF_COMPILER" in
# Clang
COMPILER_VERSION=`${QMAKE_CONF_COMPILER} -v 2>&1 | sed -n -E '
/^Apple (clang|LLVM) version /{s///; s/^([0-9]*)\.([0-9]*).*$/QT_APPLE_CLANG_MAJOR_VERSION=\1; QT_APPLE_CLANG_MINOR_VERSION=\2/;p;q;}
-/^clang version /{s///; s/^([0-9]*)\.([0-9]*).*$/QT_CLANG_MAJOR_VERSION=\1; QT_CLANG_MINOR_VERSION=\2/;p;q;}'`
+/^(FreeBSD )?clang version /{s///; s/^([0-9]*)\.([0-9]*).*$/QT_CLANG_MAJOR_VERSION=\1; QT_CLANG_MINOR_VERSION=\2/;p;q;}'`
eval "$COMPILER_VERSION"
;;
*icpc)
diff --git a/mkspecs/features/qt_build_extra.prf b/mkspecs/features/qt_build_extra.prf
index 378f5bbd7c..abdd7bc2b2 100644
--- a/mkspecs/features/qt_build_extra.prf
+++ b/mkspecs/features/qt_build_extra.prf
@@ -13,7 +13,7 @@ equals(TEMPLATE, subdirs): return()
# It's likely that these extra flags will be wrong for host builds,
# and the bootstrapped tools usually don't need them anyway.
-host_build:force_bootstrap: return()
+host_build:cross_compile: return()
# The headersclean check needs defines and includes even for
# header-only modules.
diff --git a/mkspecs/features/qt_common.prf b/mkspecs/features/qt_common.prf
index b367bc12af..8fd4389946 100644
--- a/mkspecs/features/qt_common.prf
+++ b/mkspecs/features/qt_common.prf
@@ -44,9 +44,9 @@ contains(TEMPLATE, .*lib) {
QMAKE_PRL_INSTALL_REPLACE += lib_replace
}
-# The remainder of this file must not apply to bootstrapped tools,
+# The remainder of this file must not apply to host tools/libraries,
# as the host compiler's version and capabilities are not checked.
-host_build:force_bootstrap: return()
+host_build:cross_compile: return()
# Extra warnings for Qt non-example code, to ensure cleanliness of the sources.
# The block below may turn these warnings into errors for some Qt targets.
diff --git a/mkspecs/macx-ios-clang/ios_destinations.sh b/mkspecs/macx-ios-clang/ios_destinations.sh
index b898082598..d80a5cecf4 100755
--- a/mkspecs/macx-ios-clang/ios_destinations.sh
+++ b/mkspecs/macx-ios-clang/ios_destinations.sh
@@ -39,7 +39,8 @@
##
#############################################################################
-booted_simulator=$(xcrun simctl list devices | grep -E "iPhone|iPad" | grep -v unavailable | grep Booted | perl -lne 'print $1 if /\((.*?)\)/')
+DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
+booted_simulator=$($DIR/ios_devices.pl "iPhone|iPad" "Booted" "NOT unavailable" | tail -n 1)
echo "IPHONESIMULATOR_DEVICES = $booted_simulator"
xcodebuild test -scheme $1 -destination 'id=0' -destination-timeout 1 2>&1| sed -n 's/{ \(platform:.*\) }/\1/p' | while read destination; do
diff --git a/mkspecs/macx-ios-clang/ios_devices.pl b/mkspecs/macx-ios-clang/ios_devices.pl
new file mode 100755
index 0000000000..eb45d1dab9
--- /dev/null
+++ b/mkspecs/macx-ios-clang/ios_devices.pl
@@ -0,0 +1,50 @@
+#!/usr/bin/perl
+
+#############################################################################
+##
+## Copyright (C) 2016 The Qt Company Ltd.
+## Contact: http://www.qt.io/licensing/
+##
+## This file is the build configuration utility of the Qt Toolkit.
+##
+## $QT_BEGIN_LICENSE:LGPL21$
+## Commercial License Usage
+## Licensees holding valid commercial Qt licenses may use this file in
+## accordance with the commercial license agreement provided with the
+## Software or, alternatively, in accordance with the terms contained in
+## a written agreement between you and The Qt Company. For licensing terms
+## and conditions see http://www.qt.io/terms-conditions. For further
+## information use the contact form at http://www.qt.io/contact-us.
+##
+## GNU Lesser General Public License Usage
+## Alternatively, this file may be used under the terms of the GNU Lesser
+## General Public License version 2.1 or version 3 as published by the Free
+## Software Foundation and appearing in the file LICENSE.LGPLv21 and
+## LICENSE.LGPLv3 included in the packaging of this file. Please review the
+## following information to ensure the GNU Lesser General Public License
+## requirements will be met: https://www.gnu.org/licenses/lgpl.html and
+## http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+##
+## As a special exception, The Qt Company gives you certain additional
+## rights. These rights are described in The Qt Company LGPL Exception
+## version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+##
+## $QT_END_LICENSE$
+##
+#############################################################################
+
+$output = `xcrun simctl list devices --json 2>&1`;
+$output =~ s/\n//g;
+
+BLOCK:
+foreach $block ($output =~ /{.*?}/g) {
+ foreach $filter (@ARGV) {
+ if ($filter =~ /^NOT\s(.*)/) {
+ $block =~ /$1/ && next BLOCK;
+ } else {
+ $block =~ /$filter/ || next BLOCK;
+ }
+ }
+ $block =~ /udid[:|\s|\"]+(.*)\"/;
+ print "$1\n";
+}
diff --git a/mkspecs/macx-ios-clang/xcodebuild.mk b/mkspecs/macx-ios-clang/xcodebuild.mk
index 1bd18430df..bf6b791368 100644
--- a/mkspecs/macx-ios-clang/xcodebuild.mk
+++ b/mkspecs/macx-ios-clang/xcodebuild.mk
@@ -56,11 +56,12 @@ iphonesimulator-install: ACTION = build
release-%: CONFIGURATION = Release
debug-%: CONFIGURATION = Debug
+SPECDIR := $(dir $(lastword $(MAKEFILE_LIST)))
+
# Test and build (device) destinations
ifneq ($(filter check%,$(MAKECMDGOALS)),)
ifeq ($(DEVICES),)
$(info Enumerating test destinations (you may override this by setting DEVICES explicitly), please wait...)
- SPECDIR := $(dir $(lastword $(MAKEFILE_LIST)))
DESTINATIONS_INCLUDE = /tmp/ios_destinations.mk
$(shell $(SPECDIR)/ios_destinations.sh $(TARGET) > $(DESTINATIONS_INCLUDE))
include $(DESTINATIONS_INCLUDE)
@@ -71,7 +72,7 @@ endif
%-iphoneos: DEVICES = $(IPHONEOS_DEVICES)
IPHONEOS_GENERIC_DESTINATION := "generic/platform=iOS"
-IPHONESIMULATOR_GENERIC_DESTINATION := "id=$(shell xcrun simctl list devices | grep -E 'iPhone|iPad' | grep -v unavailable | perl -lne 'print $$1 if /\((.*?)\)/' | tail -n 1)"
+IPHONESIMULATOR_GENERIC_DESTINATION := "id=$(shell $(SPECDIR)/ios_devices.pl "iPhone|iPad" "NOT unavailable" | tail -n 1)"
DESTINATION = $(if $(DESTINATION_ID),"id=$(DESTINATION_ID)",$(value $(call toupper,$(call basesdk,$(SDK)))_GENERIC_DESTINATION))
diff --git a/mkspecs/macx-xcode/default.xcscheme b/mkspecs/macx-xcode/default.xcscheme
index ab2f6a8ab7..6beb0d8280 100644
--- a/mkspecs/macx-xcode/default.xcscheme
+++ b/mkspecs/macx-xcode/default.xcscheme
@@ -62,7 +62,7 @@
useCustomWorkingDirectory = "NO"
buildConfiguration = "Debug"
ignoresPersistentStateOnLaunch = "NO"
- debugDocumentVersioning = "YES"
+ debugDocumentVersioning = "NO"
allowLocationSimulation = "YES">
<BuildableProductRunnable>
<BuildableReference
@@ -88,7 +88,7 @@
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
buildConfiguration = "Release"
- debugDocumentVersioning = "YES">
+ debugDocumentVersioning = "NO">
<BuildableProductRunnable>
<BuildableReference
BuildableIdentifier = "primary"
diff --git a/src/corelib/mimetypes/qmimetype.cpp b/src/corelib/mimetypes/qmimetype.cpp
index 80b6a76ecc..b259b42ac8 100644
--- a/src/corelib/mimetypes/qmimetype.cpp
+++ b/src/corelib/mimetypes/qmimetype.cpp
@@ -238,15 +238,15 @@ QString QMimeType::name() const
/*!
Returns the description of the MIME type to be displayed on user interfaces.
- The system language (QLocale::system().name()) is used to select the appropriate translation.
+ The default language (QLocale().name()) is used to select the appropriate translation.
*/
QString QMimeType::comment() const
{
QMimeDatabasePrivate::instance()->provider()->loadMimeTypePrivate(*d);
QStringList languageList;
- languageList << QLocale::system().name();
- languageList << QLocale::system().uiLanguages();
+ languageList << QLocale().name();
+ languageList << QLocale().uiLanguages();
for (const QString &language : qAsConst(languageList)) {
const QString lang = language == QLatin1String("C") ? QLatin1String("en_US") : language;
const QString comm = d->localeComments.value(lang);
diff --git a/src/corelib/thread/qfutureinterface.cpp b/src/corelib/thread/qfutureinterface.cpp
index 6690f28556..ce31fe9270 100644
--- a/src/corelib/thread/qfutureinterface.cpp
+++ b/src/corelib/thread/qfutureinterface.cpp
@@ -305,12 +305,11 @@ void QFutureInterfaceBase::waitForResult(int resultIndex)
lock.relock();
- if (!(d->state & Running))
- return;
-
- const int waitIndex = (resultIndex == -1) ? INT_MAX : resultIndex;
- while ((d->state & Running) && d->internal_isResultReadyAt(waitIndex) == false)
- d->waitCondition.wait(&d->m_mutex);
+ if (d->state & Running) {
+ const int waitIndex = (resultIndex == -1) ? INT_MAX : resultIndex;
+ while ((d->state & Running) && d->internal_isResultReadyAt(waitIndex) == false)
+ d->waitCondition.wait(&d->m_mutex);
+ }
d->m_exceptionStore.throwPossibleException();
}
diff --git a/src/corelib/thread/qmutex.cpp b/src/corelib/thread/qmutex.cpp
index 0b14ec31c2..878a920ffc 100644
--- a/src/corelib/thread/qmutex.cpp
+++ b/src/corelib/thread/qmutex.cpp
@@ -580,34 +580,11 @@ const int FreeListConstants::Sizes[FreeListConstants::BlockCount] = {
typedef QFreeList<QMutexPrivate, FreeListConstants> FreeList;
// We cannot use Q_GLOBAL_STATIC because it uses QMutex
-#if defined(Q_COMPILER_THREADSAFE_STATICS)
+static FreeList freeList_;
FreeList *freelist()
{
- static FreeList list;
- return &list;
+ return &freeList_;
}
-#else
-static QBasicAtomicPointer<FreeList> freeListPtr;
-
-FreeList *freelist()
-{
- FreeList *local = freeListPtr.loadAcquire();
- if (!local) {
- local = new FreeList;
- if (!freeListPtr.testAndSetRelease(0, local)) {
- delete local;
- local = freeListPtr.loadAcquire();
- }
- }
- return local;
-}
-
-static void qFreeListDeleter()
-{
- delete freeListPtr.load();
-}
-Q_DESTRUCTOR_FUNCTION(qFreeListDeleter)
-#endif
}
QMutexPrivate *QMutexPrivate::allocate()
diff --git a/src/corelib/tools/qlocale_win.cpp b/src/corelib/tools/qlocale_win.cpp
index 88bfada515..9d2db61a11 100644
--- a/src/corelib/tools/qlocale_win.cpp
+++ b/src/corelib/tools/qlocale_win.cpp
@@ -848,7 +848,6 @@ QVariant QSystemLocale::query(QueryType type, QVariant in = QVariant()) const
case ZeroDigit:
return d->zeroDigit();
case LanguageId:
- case ScriptId:
case CountryId: {
QString locale = QString::fromLatin1(getWinLocaleName());
QLocale::Language lang;
@@ -857,12 +856,12 @@ QVariant QSystemLocale::query(QueryType type, QVariant in = QVariant()) const
QLocalePrivate::getLangAndCountry(locale, lang, script, cntry);
if (type == LanguageId)
return lang;
- if (type == ScriptId)
- return script == QLocale::AnyScript ? fallbackUiLocale().script() : script;
if (cntry == QLocale::AnyCountry)
return fallbackUiLocale().country();
return cntry;
}
+ case ScriptId:
+ return QVariant(QLocale::AnyScript);
case MeasurementSystem:
return d->measurementSystem();
case AMText:
diff --git a/src/gui/kernel/qkeysequence.cpp b/src/gui/kernel/qkeysequence.cpp
index f1135db307..9a75f4bc83 100644
--- a/src/gui/kernel/qkeysequence.cpp
+++ b/src/gui/kernel/qkeysequence.cpp
@@ -411,7 +411,7 @@ void Q_GUI_EXPORT qt_set_sequence_auto_mnemonic(bool b) { qt_sequence_no_mnemoni
static const struct {
int key;
- const char* name;
+ const char name[25];
} keyname[] = {
//: This and all following "incomprehensible" strings in QShortcut context
//: are key names. Please use the localized names appearing on actual
@@ -693,8 +693,8 @@ static const struct {
{ Qt::Key_TouchpadOn, QT_TRANSLATE_NOOP("QShortcut", "Touchpad On") },
{ Qt::Key_TouchpadOff, QT_TRANSLATE_NOOP("QShortcut", "Touchpad Off") },
- { 0, 0 }
};
+static Q_CONSTEXPR int numKeyNames = sizeof keyname / sizeof *keyname;
/*!
\enum QKeySequence::StandardKey
@@ -1179,7 +1179,7 @@ int QKeySequencePrivate::decodeString(const QString &str, QKeySequence::Sequence
for (int tran = 0; tran < 2; ++tran) {
if (!nativeText)
++tran;
- for (int i = 0; keyname[i].name; ++i) {
+ for (int i = 0; i < numKeyNames; ++i) {
QString keyName(tran == 0
? QCoreApplication::translate("QShortcut", keyname[i].name)
: QString::fromLatin1(keyname[i].name));
@@ -1318,7 +1318,7 @@ QString QKeySequencePrivate::keyName(int key, QKeySequence::SequenceFormat forma
#if defined(Q_OS_MACX)
NonSymbol:
#endif
- while (keyname[i].name) {
+ while (i < numKeyNames) {
if (key == keyname[i].key) {
p = nativeText ? QCoreApplication::translate("QShortcut", keyname[i].name)
: QString::fromLatin1(keyname[i].name);
@@ -1330,7 +1330,7 @@ NonSymbol:
// fall back on the unicode representation of it...
// Or else characters like Qt::Key_aring may not get displayed
// (Really depends on you locale)
- if (!keyname[i].name) {
+ if (i >= numKeyNames) {
if (!QChar::requiresSurrogates(key)) {
p = QChar(ushort(key)).toUpper();
} else {
diff --git a/src/gui/kernel/qoffscreensurface.cpp b/src/gui/kernel/qoffscreensurface.cpp
index d18847c434..41f7251277 100644
--- a/src/gui/kernel/qoffscreensurface.cpp
+++ b/src/gui/kernel/qoffscreensurface.cpp
@@ -183,6 +183,7 @@ void QOffscreenSurface::create()
if (QThread::currentThread() != qGuiApp->thread())
qWarning("Attempting to create QWindow-based QOffscreenSurface outside the gui thread. Expect failures.");
d->offscreenWindow = new QWindow(d->screen);
+ d->offscreenWindow->setObjectName("QOffscreenSurface");
// Remove this window from the global list since we do not want it to be destroyed when closing the app.
// The QOffscreenSurface has to be usable even after exiting the event loop.
QGuiApplicationPrivate::window_list.removeOne(d->offscreenWindow);
diff --git a/src/gui/kernel/qwindow.cpp b/src/gui/kernel/qwindow.cpp
index f061a2bf50..5f71bdaded 100644
--- a/src/gui/kernel/qwindow.cpp
+++ b/src/gui/kernel/qwindow.cpp
@@ -210,6 +210,8 @@ QWindow::~QWindow()
{
destroy();
QGuiApplicationPrivate::window_list.removeAll(this);
+ if (!QGuiApplicationPrivate::is_app_closing)
+ QGuiApplicationPrivate::instance()->modalWindowList.removeOne(this);
}
void QWindowPrivate::init()
diff --git a/src/gui/text/qfontengine.cpp b/src/gui/text/qfontengine.cpp
index fe5d544dba..4f0c6d25f7 100644
--- a/src/gui/text/qfontengine.cpp
+++ b/src/gui/text/qfontengine.cpp
@@ -1039,46 +1039,45 @@ QByteArray QFontEngine::getSfntTable(uint tag) const
return table;
}
-void QFontEngine::clearGlyphCache(const void *key)
+void QFontEngine::clearGlyphCache(const void *context)
{
- for (QLinkedList<GlyphCacheEntry>::iterator it = m_glyphCaches.begin(), end = m_glyphCaches.end(); it != end; ) {
- if (it->context == key)
- it = m_glyphCaches.erase(it);
- else
- ++it;
- }
+ m_glyphCaches.remove(context);
}
-void QFontEngine::setGlyphCache(const void *key, QFontEngineGlyphCache *data)
+void QFontEngine::setGlyphCache(const void *context, QFontEngineGlyphCache *cache)
{
- Q_ASSERT(data);
+ Q_ASSERT(cache);
- GlyphCacheEntry entry;
- entry.context = key;
- entry.cache = data;
- if (m_glyphCaches.contains(entry))
- return;
+ GlyphCaches &caches = m_glyphCaches[context];
+ for (GlyphCaches::const_iterator it = caches.constBegin(), end = caches.constEnd(); it != end; ++it) {
+ if (cache == it->cache.data())
+ return;
+ }
- // Limit the glyph caches to 4. This covers all 90 degree rotations and limits
- // memory use when there is continuous or random rotation
- if (m_glyphCaches.size() == 4)
- m_glyphCaches.removeLast();
+ // Limit the glyph caches to 4 per context. This covers all 90 degree rotations,
+ // and limits memory use when there is continuous or random rotation
+ if (caches.size() == 4)
+ caches.removeLast();
- m_glyphCaches.push_front(entry);
+ GlyphCacheEntry entry;
+ entry.cache = cache;
+ caches.push_front(entry);
}
-QFontEngineGlyphCache *QFontEngine::glyphCache(const void *key, GlyphFormat format, const QTransform &transform) const
+QFontEngineGlyphCache *QFontEngine::glyphCache(const void *context, GlyphFormat format, const QTransform &transform) const
{
- for (QLinkedList<GlyphCacheEntry>::const_iterator it = m_glyphCaches.constBegin(), end = m_glyphCaches.constEnd(); it != end; ++it) {
- QFontEngineGlyphCache *c = it->cache.data();
- if (key == it->context
- && format == c->glyphFormat()
- && qtransform_equals_no_translate(c->m_transform, transform)) {
- return c;
- }
+ const QHash<const void*, GlyphCaches>::const_iterator caches = m_glyphCaches.constFind(context);
+ if (caches == m_glyphCaches.cend())
+ return Q_NULLPTR;
+
+ for (GlyphCaches::const_iterator it = caches->begin(), end = caches->end(); it != end; ++it) {
+ QFontEngineGlyphCache *cache = it->cache.data();
+ if (format == cache->glyphFormat() && qtransform_equals_no_translate(cache->m_transform, transform))
+ return cache;
}
- return 0;
+
+ return Q_NULLPTR;
}
static inline QFixed kerning(int left, int right, const QFontEngine::KernPair *pairs, int numPairs)
@@ -1558,12 +1557,11 @@ QFixed QFontEngine::lastRightBearing(const QGlyphLayout &glyphs, bool round)
QFontEngine::GlyphCacheEntry::GlyphCacheEntry()
- : context(0)
{
}
QFontEngine::GlyphCacheEntry::GlyphCacheEntry(const GlyphCacheEntry &o)
- : context(o.context), cache(o.cache)
+ : cache(o.cache)
{
}
@@ -1573,7 +1571,6 @@ QFontEngine::GlyphCacheEntry::~GlyphCacheEntry()
QFontEngine::GlyphCacheEntry &QFontEngine::GlyphCacheEntry::operator=(const GlyphCacheEntry &o)
{
- context = o.context;
cache = o.cache;
return *this;
}
diff --git a/src/gui/text/qfontengine_p.h b/src/gui/text/qfontengine_p.h
index 1430444c7e..132531f5bc 100644
--- a/src/gui/text/qfontengine_p.h
+++ b/src/gui/text/qfontengine_p.h
@@ -357,12 +357,11 @@ private:
GlyphCacheEntry &operator=(const GlyphCacheEntry &);
- const void *context;
QExplicitlySharedDataPointer<QFontEngineGlyphCache> cache;
- bool operator==(const GlyphCacheEntry &other) const { return context == other.context && cache == other.cache; }
+ bool operator==(const GlyphCacheEntry &other) const { return cache == other.cache; }
};
-
- mutable QLinkedList<GlyphCacheEntry> m_glyphCaches;
+ typedef QLinkedList<GlyphCacheEntry> GlyphCaches;
+ mutable QHash<const void *, GlyphCaches> m_glyphCaches;
private:
QVariant m_userData;
diff --git a/src/plugins/bearer/networkmanager/qnetworkmanagerengine.cpp b/src/plugins/bearer/networkmanager/qnetworkmanagerengine.cpp
index b0bc8a265e..59a6d107dc 100644
--- a/src/plugins/bearer/networkmanager/qnetworkmanagerengine.cpp
+++ b/src/plugins/bearer/networkmanager/qnetworkmanagerengine.cpp
@@ -129,6 +129,9 @@ void QNetworkManagerEngine::setupConfigurations()
// Get active connections.
foreach (const QDBusObjectPath &acPath, managerInterface->activeConnections()) {
+ if (activeConnectionsList.contains(acPath.path()))
+ continue;
+
QNetworkManagerConnectionActive *activeConnection =
new QNetworkManagerConnectionActive(acPath.path(),this);
activeConnectionsList.insert(acPath.path(), activeConnection);
@@ -141,14 +144,6 @@ void QNetworkManagerEngine::setupConfigurations()
connectionInterfaces.insert(activeConnection->connection().path(),device.networkInterface());
}
}
-
- // Get current list of access points.
- foreach (const QDBusObjectPath &devicePath, managerInterface->getDevices()) {
- locker.unlock();
- deviceAdded(devicePath); //add all accesspoints
- locker.relock();
- }
-
// Get connections.
foreach (const QDBusObjectPath &settingsPath, systemSettings->listConnections()) {
locker.unlock();
@@ -224,6 +219,10 @@ void QNetworkManagerEngine::disconnectFromId(const QString &id)
QMutexLocker locker(&mutex);
QNetworkManagerSettingsConnection *connection = connectionFromId(id);
+
+ if (!connection)
+ return;
+
QNmSettingsMap map = connection->getSettings();
bool connectionAutoconnect = map.value("connection").value("autoconnect",true).toBool(); //if not present is true !!
if (connectionAutoconnect) { //autoconnect connections will simply be reconnected by nm
@@ -253,11 +252,6 @@ void QNetworkManagerEngine::requestUpdate()
QMetaObject::invokeMethod(this, "updateCompleted", Qt::QueuedConnection);
}
-void QNetworkManagerEngine::scanFinished()
-{
- QMetaObject::invokeMethod(this, "updateCompleted", Qt::QueuedConnection);
-}
-
void QNetworkManagerEngine::interfacePropertiesChanged(const QMap<QString, QVariant> &properties)
{
QMutexLocker locker(&mutex);
@@ -399,57 +393,6 @@ void QNetworkManagerEngine::deviceConnectionsChanged(const QStringList &connecti
}
}
-void QNetworkManagerEngine::deviceAdded(const QDBusObjectPath &path)
-{
- QNetworkManagerInterfaceDevice *iDevice;
- iDevice = new QNetworkManagerInterfaceDevice(path.path(),this);
- connect(iDevice,SIGNAL(connectionsChanged(QStringList)),
- this,SLOT(deviceConnectionsChanged(QStringList)));
-
- interfaceDevices.insert(path.path(),iDevice);
- if (iDevice->deviceType() == DEVICE_TYPE_WIFI) {
- QNetworkManagerInterfaceDeviceWireless *wirelessDevice =
- new QNetworkManagerInterfaceDeviceWireless(iDevice->path(),this);
-
- connect(wirelessDevice, SIGNAL(accessPointAdded(QString)),
- this, SLOT(newAccessPoint(QString)));
- connect(wirelessDevice, SIGNAL(accessPointRemoved(QString)),
- this, SLOT(removeAccessPoint(QString)));
- connect(wirelessDevice,SIGNAL(scanDone()),this,SLOT(scanFinished()));
- wirelessDevice->setConnections();
-
- wirelessDevices.insert(path.path(), wirelessDevice);
- }
-
- if (iDevice->deviceType() == DEVICE_TYPE_ETHERNET) {
- QNetworkManagerInterfaceDeviceWired *wiredDevice =
- new QNetworkManagerInterfaceDeviceWired(iDevice->path(),this);
- connect(wiredDevice,SIGNAL(carrierChanged(bool)),this,SLOT(wiredCarrierChanged(bool)));
- wiredDevices.insert(iDevice->path(), wiredDevice);
- }
-}
-
-void QNetworkManagerEngine::deviceRemoved(const QDBusObjectPath &path)
-{
- QMutexLocker locker(&mutex);
-
- if (interfaceDevices.contains(path.path())) {
- locker.unlock();
- delete interfaceDevices.take(path.path());
- locker.relock();
- }
- if (wirelessDevices.contains(path.path())) {
- locker.unlock();
- delete wirelessDevices.take(path.path());
- locker.relock();
- }
- if (wiredDevices.contains(path.path())) {
- locker.unlock();
- delete wiredDevices.take(path.path());
- locker.relock();
- }
-}
-
void QNetworkManagerEngine::wiredCarrierChanged(bool carrier)
{
QNetworkManagerInterfaceDeviceWired *deviceWired = qobject_cast<QNetworkManagerInterfaceDeviceWired *>(sender());
@@ -540,7 +483,7 @@ void QNetworkManagerEngine::newConnection(const QDBusObjectPath &path,
if (i.value()->deviceType() == deviceType) {
QNetworkManagerInterfaceDeviceWired *wiredDevice
= wiredDevices.value(i.value()->path());
- if (wiredDevice->carrier()) {
+ if (wiredDevice && wiredDevice->carrier()) {
cpPriv->state |= QNetworkConfiguration::Discovered;
}
}
@@ -569,7 +512,7 @@ bool QNetworkManagerEngine::isConnectionActive(const QString &settingsPath)
}
QNetworkManagerSettingsConnection *settingsConnection = connectionFromId(settingsPath);
- if (settingsConnection->getType() == DEVICE_TYPE_MODEM) {
+ if (settingsConnection && settingsConnection->getType() == DEVICE_TYPE_MODEM) {
return isActiveContext(settingsConnection->path());
}
@@ -598,15 +541,10 @@ void QNetworkManagerEngine::removeConnection(const QString &path)
emit configurationRemoved(ptr);
locker.relock();
}
+
// add base AP back into configurations
- QMapIterator<QString, QString> i(configuredAccessPoints);
- while (i.hasNext()) {
- i.next();
- if (i.value() == path) {
- configuredAccessPoints.remove(i.key());
- newAccessPoint(i.key());
- }
- }
+
+ // removed along with all AP props code...
}
void QNetworkManagerEngine::updateConnection()
@@ -680,114 +618,6 @@ void QNetworkManagerEngine::activationFinished(QDBusPendingCallWatcher *watcher)
}
}
-void QNetworkManagerEngine::newAccessPoint(const QString &path)
-{
- QMutexLocker locker(&mutex);
- QNetworkManagerInterfaceAccessPoint *accessPoint =
- new QNetworkManagerInterfaceAccessPoint(path,this);
-
- bool okToAdd = true;
- for (int i = 0; i < accessPoints.count(); ++i) {
- if (accessPoints.at(i)->path() == path) {
- okToAdd = false;
- }
- }
- if (okToAdd) {
- accessPoints.append(accessPoint);
- }
- // Check if configuration exists for connection.
- if (!accessPoint->ssid().isEmpty()) {
-
- for (int i = 0; i < connections.count(); ++i) {
- QNetworkManagerSettingsConnection *connection = connections.at(i);
- const QString settingsPath = connection->path();
-
- if (accessPoint->ssid() == connection->getSsid()) {
- if (!configuredAccessPoints.contains(path)) {
- configuredAccessPoints.insert(path,settingsPath);
- }
-
- QNetworkConfigurationPrivatePointer ptr =
- accessPointConfigurations.value(settingsPath);
- ptr->mutex.lock();
- QNetworkConfiguration::StateFlags flag = QNetworkConfiguration::Defined;
- ptr->state = (flag | QNetworkConfiguration::Discovered);
-
- if (isConnectionActive(settingsPath))
- ptr->state = (flag | QNetworkConfiguration::Active);
- ptr->mutex.unlock();
-
- locker.unlock();
- emit configurationChanged(ptr);
- return;
- }
- }
- }
-
- // New access point.
- QNetworkConfigurationPrivatePointer ptr(new QNetworkConfigurationPrivate);
-
- ptr->name = accessPoint->ssid();
- ptr->isValid = true;
- ptr->id = path;
- ptr->type = QNetworkConfiguration::InternetAccessPoint;
- ptr->purpose = QNetworkConfiguration::PublicPurpose;
- ptr->state = QNetworkConfiguration::Undefined;
- ptr->bearerType = QNetworkConfiguration::BearerWLAN;
-
- accessPointConfigurations.insert(ptr->id, ptr);
-
- locker.unlock();
- emit configurationAdded(ptr);
-}
-
-void QNetworkManagerEngine::removeAccessPoint(const QString &path)
-{
- QMutexLocker locker(&mutex);
- for (int i = 0; i < accessPoints.count(); ++i) {
- QNetworkManagerInterfaceAccessPoint *accessPoint = accessPoints.at(i);
- if (accessPoint->path() == path) {
- accessPoints.removeOne(accessPoint);
-
- if (configuredAccessPoints.contains(accessPoint->path())) {
- // find connection and change state to Defined
- configuredAccessPoints.remove(accessPoint->path());
-
- for (int i = 0; i < connections.count(); ++i) {
- QNetworkManagerSettingsConnection *connection = connections.at(i);
-
- if (accessPoint->ssid() == connection->getSsid()) {//might not have bssid yet
- const QString settingsPath = connection->path();
- const QString connectionId = settingsPath;
-
- QNetworkConfigurationPrivatePointer ptr =
- accessPointConfigurations.value(connectionId);
- ptr->mutex.lock();
- ptr->state = QNetworkConfiguration::Defined;
- ptr->mutex.unlock();
-
- locker.unlock();
- emit configurationChanged(ptr);
- locker.relock();
- break;
- }
- }
- } else {
- QNetworkConfigurationPrivatePointer ptr =
- accessPointConfigurations.take(path);
-
- if (ptr) {
- locker.unlock();
- emit configurationRemoved(ptr);
- locker.relock();
- }
- }
- delete accessPoint;
- break;
- }
- }
-}
-
QNetworkConfigurationPrivate *QNetworkManagerEngine::parseConnection(const QString &settingsPath,
const QNmSettingsMap &map)
{
@@ -810,7 +640,7 @@ QNetworkConfigurationPrivate *QNetworkManagerEngine::parseConnection(const QStri
QNetworkManagerInterfaceDevice device(devicePath.path(),this);
if (device.deviceType() == DEVICE_TYPE_ETHERNET) {
QNetworkManagerInterfaceDeviceWired *wiredDevice = wiredDevices.value(device.path());
- if (wiredDevice->carrier()) {
+ if (wiredDevice && wiredDevice->carrier()) {
cpPriv->state |= QNetworkConfiguration::Discovered;
break;
}
@@ -1080,10 +910,6 @@ void QNetworkManagerEngine::nmRegistered(const QString &)
managerInterface = new QNetworkManagerInterface(this);
systemSettings = new QNetworkManagerSettings(NM_DBUS_SERVICE, this);
- connect(managerInterface, SIGNAL(deviceAdded(QDBusObjectPath)),
- this, SLOT(deviceAdded(QDBusObjectPath)));
- connect(managerInterface, SIGNAL(deviceRemoved(QDBusObjectPath)),
- this, SLOT(deviceRemoved(QDBusObjectPath)));
connect(managerInterface, SIGNAL(activationFinished(QDBusPendingCallWatcher*)),
this, SLOT(activationFinished(QDBusPendingCallWatcher*)));
connect(managerInterface, SIGNAL(propertiesChanged(QMap<QString,QVariant>)),
diff --git a/src/plugins/bearer/networkmanager/qnetworkmanagerengine.h b/src/plugins/bearer/networkmanager/qnetworkmanagerengine.h
index e8c40a881d..2de570b1ba 100644
--- a/src/plugins/bearer/networkmanager/qnetworkmanagerengine.h
+++ b/src/plugins/bearer/networkmanager/qnetworkmanagerengine.h
@@ -99,19 +99,12 @@ private Q_SLOTS:
void interfacePropertiesChanged(const QMap<QString, QVariant> &properties);
void activeConnectionPropertiesChanged(const QMap<QString, QVariant> &properties);
- void deviceAdded(const QDBusObjectPath &path);
- void deviceRemoved(const QDBusObjectPath &path);
-
void newConnection(const QDBusObjectPath &path, QNetworkManagerSettings *settings = 0);
void removeConnection(const QString &path);
void updateConnection();
void activationFinished(QDBusPendingCallWatcher *watcher);
void deviceConnectionsChanged(const QStringList &activeConnectionsList);
- void newAccessPoint(const QString &path);
- void removeAccessPoint(const QString &path);
- void scanFinished();
-
void wiredCarrierChanged(bool);
void nmRegistered(const QString &serviceName = QString());
diff --git a/src/plugins/bearer/networkmanager/qnetworkmanagerservice.cpp b/src/plugins/bearer/networkmanager/qnetworkmanagerservice.cpp
index 6c3c661db6..c8f00118bb 100644
--- a/src/plugins/bearer/networkmanager/qnetworkmanagerservice.cpp
+++ b/src/plugins/bearer/networkmanager/qnetworkmanagerservice.cpp
@@ -101,6 +101,21 @@ QNetworkManagerInterface::QNetworkManagerInterface(QObject *parent)
QNetworkManagerInterface::~QNetworkManagerInterface()
{
+ QDBusConnection::systemBus().disconnect(QLatin1String(NM_DBUS_SERVICE),
+ QLatin1String(NM_DBUS_PATH),
+ QLatin1String(NM_DBUS_INTERFACE),
+ QLatin1String("PropertiesChanged"),
+ this,SLOT(propertiesSwap(QMap<QString,QVariant>)));
+ QDBusConnection::systemBus().disconnect(QLatin1String(NM_DBUS_SERVICE),
+ QLatin1String(NM_DBUS_PATH),
+ QLatin1String(NM_DBUS_INTERFACE),
+ QLatin1String("DeviceAdded"),
+ this,SIGNAL(deviceAdded(QDBusObjectPath)));
+ QDBusConnection::systemBus().disconnect(QLatin1String(NM_DBUS_SERVICE),
+ QLatin1String(NM_DBUS_PATH),
+ QLatin1String(NM_DBUS_INTERFACE),
+ QLatin1String("DeviceRemoved"),
+ this,SIGNAL(deviceRemoved(QDBusObjectPath)));
}
bool QNetworkManagerInterface::setConnections()
@@ -241,28 +256,6 @@ QNetworkManagerInterfaceAccessPoint::QNetworkManagerInterfaceAccessPoint(const Q
NM_DBUS_INTERFACE_ACCESS_POINT,
QDBusConnection::systemBus(),parent)
{
- if (!isValid()) {
- return;
- }
- PropertiesDBusInterface *accessPointPropertiesInterface = new PropertiesDBusInterface(QLatin1String(NM_DBUS_SERVICE),
- dbusPathName,
- DBUS_PROPERTIES_INTERFACE,
- QDBusConnection::systemBus());
-
- QList<QVariant> argumentList;
- argumentList << QLatin1String(NM_DBUS_INTERFACE_ACCESS_POINT);
- QDBusPendingReply<QVariantMap> propsReply
- = accessPointPropertiesInterface->callWithArgumentList(QDBus::Block,QLatin1String("GetAll"),
- argumentList);
- if (!propsReply.isError()) {
- propertyMap = propsReply.value();
- }
-
- QDBusConnection::systemBus().connect(QLatin1String(NM_DBUS_SERVICE),
- dbusPathName,
- QLatin1String(NM_DBUS_INTERFACE_ACCESS_POINT),
- QLatin1String("PropertiesChanged"),
- this,SLOT(propertiesSwap(QMap<QString,QVariant>)));
}
QNetworkManagerInterfaceAccessPoint::~QNetworkManagerInterfaceAccessPoint()
@@ -375,6 +368,11 @@ QNetworkManagerInterfaceDevice::QNetworkManagerInterfaceDevice(const QString &de
QNetworkManagerInterfaceDevice::~QNetworkManagerInterfaceDevice()
{
+ QDBusConnection::systemBus().disconnect(QLatin1String(NM_DBUS_SERVICE),
+ path(),
+ QLatin1String(NM_DBUS_INTERFACE_DEVICE),
+ QLatin1String("PropertiesChanged"),
+ this,SLOT(propertiesSwap(QMap<QString,QVariant>)));
}
QString QNetworkManagerInterfaceDevice::udi() const
@@ -474,6 +472,11 @@ QNetworkManagerInterfaceDeviceWired::QNetworkManagerInterfaceDeviceWired(const Q
QNetworkManagerInterfaceDeviceWired::~QNetworkManagerInterfaceDeviceWired()
{
+ QDBusConnection::systemBus().disconnect(QLatin1String(NM_DBUS_SERVICE),
+ path(),
+ QLatin1String(NM_DBUS_INTERFACE_DEVICE_WIRED),
+ QLatin1String("PropertiesChanged"),
+ this,SLOT(propertiesSwap(QMap<QString,QVariant>)));
}
QString QNetworkManagerInterfaceDeviceWired::hwAddress() const
@@ -563,77 +566,20 @@ QNetworkManagerInterfaceDeviceWireless::QNetworkManagerInterfaceDeviceWireless(c
QLatin1String(NM_DBUS_INTERFACE_DEVICE_WIRELESS),
QLatin1String("PropertiesChanged"),
this,SLOT(propertiesSwap(QMap<QString,QVariant>)));
-
- QDBusPendingReply<QList<QDBusObjectPath> > reply
- = asyncCall(QLatin1String("GetAccessPoints"));
-
- QDBusPendingCallWatcher *callWatcher = new QDBusPendingCallWatcher(reply);
- connect(callWatcher, SIGNAL(finished(QDBusPendingCallWatcher*)),
- this, SLOT(accessPointsFinished(QDBusPendingCallWatcher*)));
}
QNetworkManagerInterfaceDeviceWireless::~QNetworkManagerInterfaceDeviceWireless()
{
-}
-
-void QNetworkManagerInterfaceDeviceWireless::slotAccessPointAdded(QDBusObjectPath path)
-{
- if (path.path().length() > 2)
- Q_EMIT accessPointAdded(path.path());
-}
-
-void QNetworkManagerInterfaceDeviceWireless::slotAccessPointRemoved(QDBusObjectPath path)
-{
- if (path.path().length() > 2)
- Q_EMIT accessPointRemoved(path.path());
+ QDBusConnection::systemBus().disconnect(QLatin1String(NM_DBUS_SERVICE),
+ path(),
+ QLatin1String(NM_DBUS_INTERFACE_DEVICE_WIRELESS),
+ QLatin1String("PropertiesChanged"),
+ this,SLOT(propertiesSwap(QMap<QString,QVariant>)));
}
bool QNetworkManagerInterfaceDeviceWireless::setConnections()
{
- if (!isValid())
- return false;
-
- QDBusConnection dbusConnection = QDBusConnection::systemBus();
- bool allOk = true;
-
- if (!dbusConnection.connect(QLatin1String(NM_DBUS_SERVICE),
- interfacePath,
- QLatin1String(NM_DBUS_INTERFACE_DEVICE_WIRELESS),
- QLatin1String("AccessPointAdded"),
- this, SLOT(slotAccessPointAdded(QDBusObjectPath)))) {
- allOk = false;
- }
-
-
- if (!dbusConnection.connect(QLatin1String(NM_DBUS_SERVICE),
- interfacePath,
- QLatin1String(NM_DBUS_INTERFACE_DEVICE_WIRELESS),
- QLatin1String("AccessPointRemoved"),
- this, SLOT(slotAccessPointRemoved(QDBusObjectPath)))) {
- allOk = false;
- }
-
- if (!dbusConnection.connect(QLatin1String(NM_DBUS_SERVICE),
- interfacePath,
- QLatin1String(NM_DBUS_INTERFACE_DEVICE_WIRELESS),
- QLatin1String("ScanDone"),
- this, SLOT(scanIsDone()))) {
- allOk = false;
- }
- return allOk;
-}
-
-void QNetworkManagerInterfaceDeviceWireless::accessPointsFinished(QDBusPendingCallWatcher *watcher)
-{
- QDBusPendingReply<QList<QDBusObjectPath> > reply(*watcher);
- watcher->deleteLater();
- if (!reply.isError()) {
- accessPointsList = reply.value();
- }
-
- for (int i = 0; i < accessPointsList.size(); i++) {
- Q_EMIT accessPointAdded(accessPointsList.at(i).path());
- }
+ return true;
}
QList <QDBusObjectPath> QNetworkManagerInterfaceDeviceWireless::getAccessPoints()
@@ -682,11 +628,6 @@ quint32 QNetworkManagerInterfaceDeviceWireless::wirelessCapabilities() const
return 0;
}
-void QNetworkManagerInterfaceDeviceWireless::scanIsDone()
-{
- Q_EMIT scanDone();
-}
-
void QNetworkManagerInterfaceDeviceWireless::requestScan()
{
asyncCall(QLatin1String("RequestScan"));
@@ -735,6 +676,12 @@ QNetworkManagerInterfaceDeviceModem::QNetworkManagerInterfaceDeviceModem(const Q
QNetworkManagerInterfaceDeviceModem::~QNetworkManagerInterfaceDeviceModem()
{
+ QDBusConnection::systemBus().disconnect(QLatin1String(NM_DBUS_SERVICE),
+ path(),
+ QLatin1String(NM_DBUS_PATH_SETTINGS),
+ QLatin1String(NM_DBUS_IFACE_SETTINGS),
+ QLatin1String("NewConnection"),
+ this, SIGNAL(newConnection(QDBusObjectPath)));
}
QNetworkManagerInterfaceDeviceModem::ModemCapabilities QNetworkManagerInterfaceDeviceModem::modemCapabilities() const
@@ -839,6 +786,16 @@ QNetworkManagerSettingsConnection::QNetworkManagerSettingsConnection(const QStri
QNetworkManagerSettingsConnection::~QNetworkManagerSettingsConnection()
{
+ QDBusConnection::systemBus().disconnect(service(),
+ path(),
+ QLatin1String(NM_DBUS_IFACE_SETTINGS_CONNECTION),
+ QLatin1String("Updated"),
+ this, SIGNAL(updated()));
+ QDBusConnection::systemBus().disconnect(service(),
+ path(),
+ QLatin1String(NM_DBUS_IFACE_SETTINGS_CONNECTION),
+ QLatin1String("Removed"),
+ this, SIGNAL(slotSettingsRemoved()));
}
bool QNetworkManagerSettingsConnection::setConnections()
@@ -995,6 +952,11 @@ QNetworkManagerConnectionActive::QNetworkManagerConnectionActive(const QString &
QNetworkManagerConnectionActive::~QNetworkManagerConnectionActive()
{
+ QDBusConnection::systemBus().disconnect(QLatin1String(NM_DBUS_SERVICE),
+ path(),
+ QLatin1String(NM_DBUS_INTERFACE_ACTIVE_CONNECTION),
+ QLatin1String("PropertiesChanged"),
+ this,SLOT(propertiesSwap(QMap<QString,QVariant>)));
}
QDBusObjectPath QNetworkManagerConnectionActive::connection() const
diff --git a/src/plugins/bearer/networkmanager/qnetworkmanagerservice.h b/src/plugins/bearer/networkmanager/qnetworkmanagerservice.h
index 561bded156..65e618d15f 100644
--- a/src/plugins/bearer/networkmanager/qnetworkmanagerservice.h
+++ b/src/plugins/bearer/networkmanager/qnetworkmanagerservice.h
@@ -328,7 +328,6 @@ public:
QObject *parent = 0);
~QNetworkManagerInterfaceDeviceWireless();
- QDBusObjectPath path() const;
QList <QDBusObjectPath> getAccessPoints();
QString hwAddress() const;
@@ -341,21 +340,11 @@ public:
void requestScan();
Q_SIGNALS:
void propertiesChanged(QMap<QString,QVariant>);
- void accessPointAdded(const QString &);
- void accessPointRemoved(const QString &);
- void scanDone();
void propertiesReady();
- void accessPointsReady();
private Q_SLOTS:
- void scanIsDone();
void propertiesSwap(QMap<QString,QVariant>);
- void slotAccessPointAdded(QDBusObjectPath);
- void slotAccessPointRemoved(QDBusObjectPath);
-
- void accessPointsFinished(QDBusPendingCallWatcher *watcher);
-
private:
QVariantMap propertyMap;
QList <QDBusObjectPath> accessPointsList;
diff --git a/src/plugins/platforms/ios/qiostextresponder.mm b/src/plugins/platforms/ios/qiostextresponder.mm
index 37d5557794..9a077323e7 100644
--- a/src/plugins/platforms/ios/qiostextresponder.mm
+++ b/src/plugins/platforms/ios/qiostextresponder.mm
@@ -914,7 +914,7 @@
UIFont *uifont = [UIFont fontWithName:qfont.family().toNSString() size:qfont.pointSize()];
if (!uifont)
return [NSDictionary dictionary];
- return [NSDictionary dictionaryWithObject:uifont forKey:UITextInputTextFontKey];
+ return [NSDictionary dictionaryWithObject:uifont forKey:NSFontAttributeName];
}
- (NSDictionary *)markedTextStyle
diff --git a/src/plugins/platforms/winrt/qwinrtclipboard.cpp b/src/plugins/platforms/winrt/qwinrtclipboard.cpp
index 2811f1f018..4eb2517e14 100644
--- a/src/plugins/platforms/winrt/qwinrtclipboard.cpp
+++ b/src/plugins/platforms/winrt/qwinrtclipboard.cpp
@@ -146,7 +146,7 @@ void QWinRTClipboard::setMimeData(QMimeData *data, QClipboard::Mode mode)
return;
#ifndef Q_OS_WINPHONE
- const QString text = data->text();
+ const QString text = data ? data->text() : QString();
HRESULT hr = QEventDispatcherWinRT::runOnXamlThread([this, text]() {
HRESULT hr;
ComPtr<IDataPackage> package;
diff --git a/src/widgets/dialogs/qsidebar.cpp b/src/widgets/dialogs/qsidebar.cpp
index d86cddab61..713ccb6556 100644
--- a/src/widgets/dialogs/qsidebar.cpp
+++ b/src/widgets/dialogs/qsidebar.cpp
@@ -198,7 +198,9 @@ void QUrlModel::setUrl(const QModelIndex &index, const QUrl &url, const QModelIn
QIcon newIcon = qvariant_cast<QIcon>(dirIndex.data(Qt::DecorationRole));
if (!dirIndex.isValid()) {
- newIcon = fileSystemModel->iconProvider()->icon(QFileIconProvider::Folder);
+ const QFileIconProvider *provider = fileSystemModel->iconProvider();
+ if (provider)
+ newIcon = provider->icon(QFileIconProvider::Folder);
newName = QFileInfo(url.toLocalFile()).fileName();
if (!invalidUrls.contains(url))
invalidUrls.append(url);
diff --git a/src/widgets/styles/qstylesheetstyle.cpp b/src/widgets/styles/qstylesheetstyle.cpp
index 5c046d0130..4cf77b7a1e 100644
--- a/src/widgets/styles/qstylesheetstyle.cpp
+++ b/src/widgets/styles/qstylesheetstyle.cpp
@@ -1002,15 +1002,17 @@ QRenderRule::QRenderRule(const QVector<Declaration> &declarations, const QObject
}
}
- if (const QWidget *widget = qobject_cast<const QWidget *>(object)) {
- QStyleSheetStyle *style = const_cast<QStyleSheetStyle *>(globalStyleSheetStyle);
- if (!style)
- style = qobject_cast<QStyleSheetStyle *>(widget->style());
- if (style)
- fixupBorder(style->nativeFrameWidth(widget));
+ if (hasBorder()) {
+ if (const QWidget *widget = qobject_cast<const QWidget *>(object)) {
+ QStyleSheetStyle *style = const_cast<QStyleSheetStyle *>(globalStyleSheetStyle);
+ if (!style)
+ style = qobject_cast<QStyleSheetStyle *>(widget->style());
+ if (style)
+ fixupBorder(style->nativeFrameWidth(widget));
+ }
+ if (border()->hasBorderImage())
+ defaultBackground = QBrush();
}
- if (hasBorder() && border()->hasBorderImage())
- defaultBackground = QBrush();
}
QRect QRenderRule::borderRect(const QRect& r) const
diff --git a/src/widgets/styles/qwindowsvistastyle.cpp b/src/widgets/styles/qwindowsvistastyle.cpp
index 1f4598ea14..599dfdb8b5 100644
--- a/src/widgets/styles/qwindowsvistastyle.cpp
+++ b/src/widgets/styles/qwindowsvistastyle.cpp
@@ -1181,9 +1181,9 @@ void QWindowsVistaStyle::drawControl(ControlElement element, const QStyleOption
case CE_MenuItem:
if (const QStyleOptionMenuItem *menuitem = qstyleoption_cast<const QStyleOptionMenuItem *>(option)) {
// windows always has a check column, regardless whether we have an icon or not
- const qreal devicePixelRatio = QWindowsXPStylePrivate::devicePixelRatio(widget);
- int checkcol = qRound(qreal(25) / devicePixelRatio);
- const int gutterWidth = qRound(qreal(3) / devicePixelRatio);
+ const qreal factor = QWindowsXPStylePrivate::nativeMetricScaleFactor(widget);
+ int checkcol = qRound(qreal(25) * factor);
+ const int gutterWidth = qRound(qreal(3) * factor);
{
XPThemeData theme(widget, 0, QWindowsXPStylePrivate::MenuTheme,
MENU_POPUPCHECKBACKGROUND, MBI_HOT);
@@ -2172,8 +2172,9 @@ QRect QWindowsVistaStyle::subControlRect(ComplexControl control, const QStyleOpt
const bool isToolTitle = false;
const int height = tb->rect.height();
const int width = tb->rect.width();
- int buttonWidth = GetSystemMetrics(SM_CXSIZE) / QWindowsStylePrivate::devicePixelRatio(widget)
- - int(QStyleHelper::dpiScaled(4));
+ const int buttonWidth =
+ qRound(qreal(GetSystemMetrics(SM_CXSIZE)) * QWindowsStylePrivate::nativeMetricScaleFactor(widget)
+ - QStyleHelper::dpiScaled(4));
const int frameWidth = proxy()->pixelMetric(PM_MdiSubWindowFrameWidth, option, widget);
const bool sysmenuHint = (tb->titleBarFlags & Qt::WindowSystemMenuHint) != 0;
diff --git a/src/widgets/styles/qwindowsxpstyle.cpp b/src/widgets/styles/qwindowsxpstyle.cpp
index ed4271505b..9fb18f63e8 100644
--- a/src/widgets/styles/qwindowsxpstyle.cpp
+++ b/src/widgets/styles/qwindowsxpstyle.cpp
@@ -2106,7 +2106,7 @@ void QWindowsXPStyle::drawControl(ControlElement element, const QStyleOption *op
themeNumber = QWindowsXPStylePrivate::StatusTheme;
partId = SP_GRIPPER;
XPThemeData theme(0, p, themeNumber, partId, 0);
- QSize size = (theme.size() / QWindowsStylePrivate::devicePixelRatio(widget)).toSize();
+ QSize size = (theme.size() * QWindowsStylePrivate::nativeMetricScaleFactor(widget)).toSize();
size.rheight()--;
if (const QStyleOptionSizeGrip *sg = qstyleoption_cast<const QStyleOptionSizeGrip *>(option)) {
switch (sg->corner) {
@@ -2177,7 +2177,7 @@ void QWindowsXPStyle::drawControl(ControlElement element, const QStyleOption *op
QWindowsXPStylePrivate::ToolBarTheme,
TP_SPLITBUTTONDROPDOWN);
if (theme.isValid()) {
- const QSize size = (theme.size() / QWindowsStylePrivate::devicePixelRatio(widget)).toSize();
+ const QSize size = (theme.size() * QWindowsStylePrivate::nativeMetricScaleFactor(widget)).toSize();
mbiw = size.width();
mbih = size.height();
}
@@ -2640,10 +2640,11 @@ void QWindowsXPStyle::drawControl(ControlElement element, const QStyleOption *op
QRect QWindowsXPStylePrivate::scrollBarGripperBounds(QStyle::State flags, const QWidget *widget, XPThemeData *theme)
{
const bool horizontal = flags & QStyle::State_Horizontal;
- const QMargins contentsMargin = (theme->margins(theme->rect, TMT_SIZINGMARGINS)
- / QWindowsStylePrivate::devicePixelRatio(widget)).toMargins();
+ const qreal factor = QWindowsStylePrivate::nativeMetricScaleFactor(widget);
+ const QMargins contentsMargin =
+ (theme->margins(theme->rect, TMT_SIZINGMARGINS) * factor).toMargins();
theme->partId = horizontal ? SBP_GRIPPERHORZ : SBP_GRIPPERVERT;
- const QSize size = (theme->size() / QWindowsStylePrivate::devicePixelRatio(widget)).toSize();
+ const QSize size = (theme->size() * factor).toSize();
const int hSpace = theme->rect.width() - size.width();
const int vSpace = theme->rect.height() - size.height();
@@ -3801,12 +3802,13 @@ QSize QWindowsXPStyle::sizeFromContents(ContentsType ct, const QStyleOption *opt
{
XPThemeData buttontheme(widget, 0, QWindowsXPStylePrivate::ButtonTheme, BP_PUSHBUTTON, PBS_NORMAL);
if (buttontheme.isValid()) {
- const qreal devicePixelRatio = QWindowsXPStylePrivate::devicePixelRatio(widget);
- const QMarginsF borderSize = buttontheme.margins() / devicePixelRatio;
+ const qreal factor = QWindowsXPStylePrivate::nativeMetricScaleFactor(widget);
+ const QMarginsF borderSize = buttontheme.margins() * factor;
if (!borderSize.isNull()) {
- const qreal margin = qreal(2) / devicePixelRatio;
+ const qreal margin = qreal(2) * factor;
sz.rwidth() += qRound(borderSize.left() + borderSize.right() - margin);
- sz.rheight() += int(borderSize.bottom() + borderSize.top() - margin + devicePixelRatio - 1);
+ sz.rheight() += int(borderSize.bottom() + borderSize.top() - margin
+ + qreal(1) / factor - 1);
}
const int textMargins = 2*(proxy()->pixelMetric(PM_FocusFrameHMargin) + 1);
sz += QSize(qMax(pixelMetric(QStyle::PM_ScrollBarExtent, option, widget)
@@ -4080,7 +4082,7 @@ QIcon QWindowsXPStyle::standardIcon(StandardPixmap standardIcon,
XPThemeData theme(0, 0, QWindowsXPStylePrivate::WindowTheme,
WP_RESTOREBUTTON, RBS_NORMAL);
if (theme.isValid()) {
- const QSize size = (themeSize.size() / QWindowsStylePrivate::devicePixelRatio(widget)).toSize();
+ const QSize size = (themeSize.size() * QWindowsStylePrivate::nativeMetricScaleFactor(widget)).toSize();
QPixmap pm(size);
pm.fill(Qt::transparent);
QPainter p(&pm);
diff --git a/tests/auto/concurrent/qtconcurrentrun/tst_qtconcurrentrun.cpp b/tests/auto/concurrent/qtconcurrentrun/tst_qtconcurrentrun.cpp
index 1b0ac7a8bc..bd53aa69fe 100644
--- a/tests/auto/concurrent/qtconcurrentrun/tst_qtconcurrentrun.cpp
+++ b/tests/auto/concurrent/qtconcurrentrun/tst_qtconcurrentrun.cpp
@@ -464,6 +464,19 @@ int throwFunctionReturn()
return 0;
}
+class SlowTask : public QRunnable
+{
+public:
+ static QAtomicInt cancel;
+ void run() Q_DECL_OVERRIDE {
+ int iter = 60;
+ while (--iter && !cancel.load())
+ QThread::currentThread()->msleep(25);
+ }
+};
+
+QAtomicInt SlowTask::cancel;
+
void tst_QtConcurrentRun::exceptions()
{
QThreadPool pool;
@@ -504,6 +517,30 @@ void tst_QtConcurrentRun::exceptions()
}
if (!caught)
QFAIL("did not get exception");
+
+ caught = false;
+ try {
+ QtConcurrent::run(&pool, throwFunctionReturn).result();
+ } catch (QException &) {
+ caught = true;
+ }
+ QVERIFY2(caught, "did not get exception");
+
+ // Force the task to be run on this thread.
+ caught = false;
+ QThreadPool shortPool;
+ shortPool.setMaxThreadCount(1);
+ SlowTask *st = new SlowTask();
+ try {
+ shortPool.start(st);
+ QtConcurrent::run(&shortPool, throwFunctionReturn).result();
+ } catch (QException &) {
+ caught = true;
+ }
+
+ SlowTask::cancel.store(true);
+
+ QVERIFY2(caught, "did not get exception");
}
#endif
diff --git a/tests/auto/corelib/mimetypes/qmimedatabase/tst_qmimedatabase.cpp b/tests/auto/corelib/mimetypes/qmimedatabase/tst_qmimedatabase.cpp
index 593706ac0d..61ca1a5ddd 100644
--- a/tests/auto/corelib/mimetypes/qmimedatabase/tst_qmimedatabase.cpp
+++ b/tests/auto/corelib/mimetypes/qmimedatabase/tst_qmimedatabase.cpp
@@ -127,6 +127,7 @@ tst_QMimeDatabase::tst_QMimeDatabase()
void tst_QMimeDatabase::initTestCase()
{
+ QLocale::setDefault(QLocale::c());
QVERIFY2(m_temporaryDir.isValid(), qPrintable(m_temporaryDir.errorString()));
QStandardPaths::setTestModeEnabled(true);
m_localMimeDir = QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation) + "/mime";
@@ -445,6 +446,21 @@ void tst_QMimeDatabase::icons()
QCOMPARE(pub.genericIconName(), QString::fromLatin1("x-office-document"));
}
+void tst_QMimeDatabase::comment()
+{
+ struct RestoreLocale
+ {
+ ~RestoreLocale() { QLocale::setDefault(QLocale::c()); }
+ } restoreLocale;
+
+ QLocale::setDefault(QLocale("de"));
+ QMimeDatabase db;
+ QMimeType directory = db.mimeTypeForName(QStringLiteral("inode/directory"));
+ QCOMPARE(directory.comment(), QStringLiteral("Ordner"));
+ QLocale::setDefault(QLocale("fr"));
+ QCOMPARE(directory.comment(), QStringLiteral("dossier"));
+}
+
// In here we do the tests that need some content in a temporary file.
// This could also be added to shared-mime-info's testsuite...
void tst_QMimeDatabase::mimeTypeForFileWithContent()
diff --git a/tests/auto/corelib/mimetypes/qmimedatabase/tst_qmimedatabase.h b/tests/auto/corelib/mimetypes/qmimedatabase/tst_qmimedatabase.h
index 06e875c9e2..4918dc6f4a 100644
--- a/tests/auto/corelib/mimetypes/qmimedatabase/tst_qmimedatabase.h
+++ b/tests/auto/corelib/mimetypes/qmimedatabase/tst_qmimedatabase.h
@@ -55,6 +55,7 @@ private slots:
void listAliases_data();
void listAliases();
void icons();
+ void comment();
void mimeTypeForFileWithContent();
void mimeTypeForUrl();
void mimeTypeForData_data();
diff --git a/tests/auto/gui/qopenglconfig/tst_qopenglconfig.cpp b/tests/auto/gui/qopenglconfig/tst_qopenglconfig.cpp
index 447b6e8468..39f7beca6f 100644
--- a/tests/auto/gui/qopenglconfig/tst_qopenglconfig.cpp
+++ b/tests/auto/gui/qopenglconfig/tst_qopenglconfig.cpp
@@ -152,11 +152,13 @@ static void dumpConfiguration(QTextStream &str)
}
// On Windows, this will provide addition GPU info similar to the output of dxdiag.
- const QVariant gpuInfoV = QGuiApplication::platformNativeInterface()->property("gpu");
- if (gpuInfoV.type() == QVariant::Map) {
- const QString description = gpuInfoV.toMap().value(QStringLiteral("printable")).toString();
- if (!description.isEmpty())
- str << "\nGPU:\n" << description << "\n\n";
+ if (QGuiApplication::platformNativeInterface()) {
+ const QVariant gpuInfoV = QGuiApplication::platformNativeInterface()->property("gpu");
+ if (gpuInfoV.type() == QVariant::Map) {
+ const QString description = gpuInfoV.toMap().value(QStringLiteral("printable")).toString();
+ if (!description.isEmpty())
+ str << "\nGPU:\n" << description << "\n\n";
+ }
}
}
diff --git a/tests/manual/qopenglwindow/multiwindow/main.cpp b/tests/manual/qopenglwindow/multiwindow/main.cpp
index e2a2d899a0..0788408b47 100644
--- a/tests/manual/qopenglwindow/multiwindow/main.cpp
+++ b/tests/manual/qopenglwindow/multiwindow/main.cpp
@@ -32,26 +32,22 @@
#include <QOpenGLFunctions>
#include <QPainter>
#include <QElapsedTimer>
+#include <QCommandLineParser>
+#include <QScreen>
+
+const char applicationDescription[] = "\n\
+This application opens multiple windows and continuously schedules updates for\n\
+them. Each of them is a separate QOpenGLWindow so there will be a separate\n\
+context and swapBuffers call for each.\n\
+\n\
+By default the swap interval is 1 so the effect of multiple blocking swapBuffers\n\
+on the main thread can be examined. (the result is likely to be different\n\
+between platforms, for example OS X is buffer queuing meaning that it can\n\
+block outside swap, resulting in perfect vsync for all three windows, while\n\
+other systems that block on swap will kill the frame rate due to blocking the\n\
+thread three times)\
+";
-// This application opens three windows and continuously schedules updates for
-// them. Each of them is a separate QOpenGLWindow so there will be a separate
-// context and swapBuffers call for each.
-//
-// By default the swap interval is 1 so the effect of three blocking swapBuffers
-// on the main thread can be examined. (the result is likely to be different
-// between platforms, for example OS X is buffer queuing meaning that it can
-// block outside swap, resulting in perfect vsync for all three windows, while
-// other systems that block on swap will kill the frame rate due to blocking the
-// thread three times)
-//
-// Pass --novsync to set a swap interval of 0. This should give an unthrottled
-// refresh on all platforms for all three windows.
-//
-// Passing --vsyncone sets swap interval to 1 for the first window and 0 to the
-// others.
-//
-// Pass --extrawindows N to open N windows in addition to the default 3.
-//
// For reference, below is a table of some test results.
//
// swap interval 1 for all swap interval 1 for only one and 0 for others
@@ -64,12 +60,15 @@
class Window : public QOpenGLWindow
{
+ Q_OBJECT
public:
Window(int n) : idx(n) {
r = g = b = fps = 0;
y = 0;
resize(200, 200);
- t2.start();
+
+ connect(this, SIGNAL(frameSwapped()), SLOT(frameSwapped()));
+ fpsTimer.start();
}
void paintGL() {
@@ -101,27 +100,52 @@ public:
if (y > height() - 20)
y = 20;
- if (t2.elapsed() > 1000) {
- fps = 1000.0 / t.elapsed();
- t2.restart();
- }
- t.restart();
-
update();
}
+public slots:
+ void frameSwapped() {
+ ++framesSwapped;
+ if (fpsTimer.elapsed() > 1000) {
+ fps = qRound(framesSwapped * (1000.0 / fpsTimer.elapsed()));
+ framesSwapped = 0;
+ fpsTimer.restart();
+ }
+ }
+
private:
int idx;
- GLfloat r, g, b, fps;
+ GLfloat r, g, b;
int y;
- QElapsedTimer t, t2;
+
+ int framesSwapped;
+ QElapsedTimer fpsTimer;
+ int fps;
};
int main(int argc, char **argv)
{
QGuiApplication app(argc, argv);
+
+ QCommandLineParser parser;
+ parser.setApplicationDescription(applicationDescription);
+ parser.addHelpOption();
+
+ QCommandLineOption noVsyncOption("novsync", "Disable Vsync by setting swap interval to 0. "
+ "This should give an unthrottled refresh on all platforms for all windows.");
+ parser.addOption(noVsyncOption);
+
+ QCommandLineOption vsyncOneOption("vsyncone", "Enable Vsync only for first window, "
+ "by setting swap interval to 1 for the first window and 0 for the others.");
+ parser.addOption(vsyncOneOption);
+
+ QCommandLineOption numWindowsOption("numwindows", "Open <N> windows instead of the default 3.", "N", "3");
+ parser.addOption(numWindowsOption);
+
+ parser.process(app);
+
QSurfaceFormat fmt;
- if (QGuiApplication::arguments().contains(QLatin1String("--novsync"))) {
+ if (parser.isSet(noVsyncOption)) {
qDebug("swap interval 0 (no throttling)");
fmt.setSwapInterval(0);
} else {
@@ -129,36 +153,41 @@ int main(int argc, char **argv)
}
QSurfaceFormat::setDefaultFormat(fmt);
- Window w1(0);
- if (QGuiApplication::arguments().contains(QLatin1String("--vsyncone"))) {
- qDebug("swap interval 1 for first window only");
- QSurfaceFormat w1fmt = fmt;
- w1fmt.setSwapInterval(1);
- w1.setFormat(w1fmt);
- fmt.setSwapInterval(0);
- QSurfaceFormat::setDefaultFormat(fmt);
- }
- Window w2(1);
- Window w3(2);
- w1.setGeometry(QRect(QPoint(10, 100), w1.size()));
- w2.setGeometry(QRect(QPoint(300, 100), w2.size()));
- w3.setGeometry(QRect(QPoint(600, 100), w3.size()));
- w1.show();
- w2.show();
- w3.show();
-
- QList<QWindow *> extraWindows;
- int countIdx;
- if ((countIdx = QGuiApplication::arguments().indexOf(QLatin1String("--extrawindows"))) >= 0) {
- int extraWindowCount = QGuiApplication::arguments().at(countIdx + 1).toInt();
- for (int i = 0; i < extraWindowCount; ++i) {
- Window *w = new Window(3 + i);
- extraWindows << w;
- w->show();
+ QRect availableGeometry = app.primaryScreen()->availableGeometry();
+
+ int numberOfWindows = qMax(parser.value(numWindowsOption).toInt(), 1);
+ QList<QWindow *> windows;
+ for (int i = 0; i < numberOfWindows; ++i) {
+ Window *w = new Window(i + 1);
+ windows << w;
+
+ if (i == 0 && parser.isSet(vsyncOneOption)) {
+ qDebug("swap interval 1 for first window only");
+ QSurfaceFormat vsyncedSurfaceFormat = fmt;
+ vsyncedSurfaceFormat.setSwapInterval(1);
+ w->setFormat(vsyncedSurfaceFormat);
+ fmt.setSwapInterval(0);
+ QSurfaceFormat::setDefaultFormat(fmt);
}
+
+ static int windowWidth = w->width() + 20;
+ static int windowHeight = w->height() + 20;
+
+ static int windowsPerRow = availableGeometry.width() / windowWidth;
+
+ int col = i;
+ int row = col / windowsPerRow;
+ col -= row * windowsPerRow;
+
+ QPoint position = availableGeometry.topLeft();
+ position += QPoint(col * windowWidth, row * windowHeight);
+ w->setFramePosition(position);
+ w->show();
}
int r = app.exec();
- qDeleteAll(extraWindows);
+ qDeleteAll(windows);
return r;
}
+
+#include "main.moc"