Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/5.6' into 5.7
Browse files Browse the repository at this point in the history
Conflicts:
	src/corelib/mimetypes/qmimeprovider.cpp
	src/corelib/mimetypes/qmimetype.cpp

Change-Id: Ib483ddb6bfc380e7c8f195feca535703814c3872
  • Loading branch information
liangqi committed Aug 25, 2016
2 parents 3f64156 + 1e6630b commit c7cdf3a
Show file tree
Hide file tree
Showing 31 changed files with 356 additions and 468 deletions.
2 changes: 1 addition & 1 deletion configure
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion mkspecs/features/qt_build_extra.prf
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
4 changes: 2 additions & 2 deletions mkspecs/features/qt_common.prf
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
3 changes: 2 additions & 1 deletion mkspecs/macx-ios-clang/ios_destinations.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
50 changes: 50 additions & 0 deletions mkspecs/macx-ios-clang/ios_devices.pl
Original file line number Diff line number Diff line change
@@ -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";
}
5 changes: 3 additions & 2 deletions mkspecs/macx-ios-clang/xcodebuild.mk
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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))

Expand Down
4 changes: 2 additions & 2 deletions mkspecs/macx-xcode/default.xcscheme
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
useCustomWorkingDirectory = "NO"
buildConfiguration = "Debug"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugDocumentVersioning = "NO"
allowLocationSimulation = "YES">
<BuildableProductRunnable>
<BuildableReference
Expand All @@ -88,7 +88,7 @@
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
buildConfiguration = "Release"
debugDocumentVersioning = "YES">
debugDocumentVersioning = "NO">
<BuildableProductRunnable>
<BuildableReference
BuildableIdentifier = "primary"
Expand Down
6 changes: 3 additions & 3 deletions src/corelib/mimetypes/qmimetype.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
11 changes: 5 additions & 6 deletions src/corelib/thread/qfutureinterface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
Expand Down
27 changes: 2 additions & 25 deletions src/corelib/thread/qmutex.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
5 changes: 2 additions & 3 deletions src/corelib/tools/qlocale_win.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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:
Expand Down
10 changes: 5 additions & 5 deletions src/gui/kernel/qkeysequence.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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));
Expand Down Expand Up @@ -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);
Expand All @@ -1330,7 +1330,7 @@ QString QKeySequencePrivate::keyName(int key, QKeySequence::SequenceFormat forma
// 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 {
Expand Down
1 change: 1 addition & 0 deletions src/gui/kernel/qoffscreensurface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 2 additions & 0 deletions src/gui/kernel/qwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
59 changes: 28 additions & 31 deletions src/gui/text/qfontengine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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)
{
}

Expand All @@ -1573,7 +1571,6 @@ QFontEngine::GlyphCacheEntry::~GlyphCacheEntry()

QFontEngine::GlyphCacheEntry &QFontEngine::GlyphCacheEntry::operator=(const GlyphCacheEntry &o)
{
context = o.context;
cache = o.cache;
return *this;
}
Expand Down
Loading

0 comments on commit c7cdf3a

Please sign in to comment.