summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorSamuel Rødal <samuel.rodal@nokia.com>2011-09-06 10:49:40 +0200
committerSamuel Rødal <samuel.rodal@nokia.com>2011-09-06 10:55:40 +0200
commita6b6e760ac2f019b9ca42847b9535207966811aa (patch)
treecdba2823eb3708f7a40593ff69b81d2be88515ea /src
parent48ba459580c9e4ce28dbb2c3ce433175148da5a1 (diff)
parent8ed47d961dc7e6f161030654d11cd330a542eadf (diff)
Merge remote branch 'gerrit/master' into HEAD
Conflicts: configure.exe src/corelib/global/qglobal.h src/gui/kernel/qplatformnativeinterface_qpa.h src/gui/widgets/qlinecontrol.cpp src/gui/widgets/qmenu_mac.mm src/gui/widgets/qmenu_p.h src/gui/widgets/qmenubar.cpp src/gui/widgets/qmenubar_p.h src/gui/widgets/widgets.pri src/plugins/platforms/wayland/qwaylandnativeinterface.cpp src/plugins/platforms/wayland/qwaylandnativeinterface.h src/src.pro tests/auto/qdir/tst_qdir.cpp tests/auto/qfileinfo/tst_qfileinfo.cpp tests/auto/qsslsocket/tst_qsslsocket.cpp tests/auto/qstring/tst_qstring.cpp Change-Id: I64cf2cefa532ba87a92f632e3595ce6914183e9b
Diffstat (limited to 'src')
-rw-r--r--src/corelib/global/qglobal.h4
-rw-r--r--src/corelib/global/qlibraryinfo.cpp27
-rw-r--r--src/corelib/global/qlibraryinfo.h1
-rw-r--r--src/corelib/io/qdir.cpp2
-rw-r--r--src/corelib/io/qfilesystemengine_symbian.cpp4
-rw-r--r--src/corelib/io/qfilesystemengine_unix.cpp2
-rw-r--r--src/corelib/io/qfilesystemengine_win.cpp6
-rw-r--r--src/corelib/io/qfilesystementry.cpp31
-rw-r--r--src/corelib/io/qfilesystementry_p.h1
-rw-r--r--src/corelib/kernel/qcoreapplication.cpp12
-rw-r--r--src/corelib/kernel/qcoreapplication_p.h1
-rw-r--r--src/corelib/plugin/qfactoryloader.cpp57
-rw-r--r--src/corelib/plugin/qlibrary.cpp215
-rw-r--r--src/corelib/plugin/qlibrary_p.h3
-rw-r--r--src/corelib/plugin/qplugin.h3
-rw-r--r--src/corelib/plugin/qpluginloader.cpp16
-rw-r--r--src/corelib/tools/qchar.cpp18
-rw-r--r--src/corelib/tools/qlist.cpp2
-rw-r--r--src/corelib/tools/qlist.h19
-rw-r--r--src/corelib/tools/qlocale.cpp38
-rw-r--r--src/corelib/tools/qlocale.h3
-rw-r--r--src/corelib/tools/qstring.cpp32
-rw-r--r--src/gui/image/qpnghandler.cpp23
-rw-r--r--src/gui/kernel/qplatformnativeinterface_qpa.cpp41
-rw-r--r--src/gui/kernel/qplatformnativeinterface_qpa.h14
-rw-r--r--src/gui/painting/qcosmeticstroker.cpp50
-rw-r--r--src/gui/painting/qcosmeticstroker_p.h10
-rw-r--r--src/gui/text/qtextcontrol.cpp42
-rw-r--r--src/network/ssl/qssl.h1
-rw-r--r--src/network/ssl/qsslcertificate.cpp23
-rw-r--r--src/network/ssl/qsslkey.cpp46
-rw-r--r--src/network/ssl/qsslkey.h1
-rw-r--r--src/network/ssl/qsslkey_p.h2
-rw-r--r--src/network/ssl/qsslsocket_openssl.cpp42
-rw-r--r--src/network/ssl/qsslsocket_openssl_symbols_p.h4
-rw-r--r--src/plugins/platforms/wayland/qwaylandnativeinterface.cpp32
-rw-r--r--src/plugins/platforms/wayland/qwaylandnativeinterface.h10
-rw-r--r--src/plugins/platforms/wayland/qwaylandwindow.cpp3
-rw-r--r--src/plugins/platforms/wayland/windowmanager_integration/qwaylandwindowmanager-client-protocol.h106
-rw-r--r--src/plugins/platforms/wayland/windowmanager_integration/qwaylandwindowmanagerintegration.cpp173
-rw-r--r--src/plugins/platforms/wayland/windowmanager_integration/qwaylandwindowmanagerintegration.h33
-rw-r--r--src/plugins/platforms/wayland/windowmanager_integration/wayland-windowmanager-client-protocol.h96
-rw-r--r--src/plugins/platforms/wayland/windowmanager_integration/wayland-windowmanager-protocol.c45
-rw-r--r--src/plugins/platforms/wayland/windowmanager_integration/windowmanager_integration.pri2
-rw-r--r--src/src.pro2
-rw-r--r--src/testlib/qabstracttestlogger.cpp30
-rw-r--r--src/testlib/qabstracttestlogger_p.h8
-rw-r--r--src/testlib/qbenchmark.cpp12
-rw-r--r--src/testlib/qbenchmark_p.h4
-rw-r--r--src/testlib/qbenchmarkevent_p.h4
-rw-r--r--src/testlib/qbenchmarkmeasurement.cpp22
-rw-r--r--src/testlib/qbenchmarkmeasurement_p.h4
-rw-r--r--src/testlib/qbenchmarkmetric.cpp2
-rw-r--r--src/testlib/qbenchmarkvalgrind.cpp8
-rw-r--r--src/testlib/qplaintestlogger.cpp9
-rw-r--r--src/testlib/qplaintestlogger_p.h4
-rw-r--r--src/testlib/qtestassert.h4
-rw-r--r--src/testlib/qtestbasicstreamer.cpp165
-rw-r--r--src/testlib/qtestbasicstreamer.h87
-rw-r--r--src/testlib/qtestcase.cpp120
-rw-r--r--src/testlib/qtestcoreelement.h15
-rw-r--r--src/testlib/qtestcorelist.h6
-rw-r--r--src/testlib/qtestdata.cpp2
-rw-r--r--src/testlib/qtestelement.cpp10
-rw-r--r--src/testlib/qtestelementattribute.cpp36
-rw-r--r--src/testlib/qtestkeyboard.h2
-rw-r--r--src/testlib/qtestlightxmlstreamer.cpp179
-rw-r--r--src/testlib/qtestlightxmlstreamer.h72
-rw-r--r--src/testlib/qtestlog.cpp76
-rw-r--r--src/testlib/qtestlog_p.h8
-rw-r--r--src/testlib/qtestmouse.h2
-rw-r--r--src/testlib/qtestxmlstreamer.cpp222
-rw-r--r--src/testlib/qtestxmlstreamer.h72
-rw-r--r--src/testlib/qtestxunitstreamer.cpp48
-rw-r--r--src/testlib/qtestxunitstreamer.h16
-rw-r--r--src/testlib/qxmltestlogger.cpp10
-rw-r--r--src/testlib/qxmltestlogger_p.h4
-rw-r--r--src/testlib/qxunittestlogger.cpp (renamed from src/testlib/qtestlogger.cpp)131
-rw-r--r--src/testlib/qxunittestlogger_p.h (renamed from src/testlib/qtestlogger_p.h)20
-rw-r--r--src/testlib/testlib.pro8
-rw-r--r--src/tools/uic/qclass_lib_map.h3
-rw-r--r--src/v8/0001-Add-hashing-and-comparison-methods-to-v8-String.patch4
-rw-r--r--src/v8/0002-Add-a-bit-field-3-to-Map.patch4
-rw-r--r--src/v8/0003-Add-a-fallback-mode-for-named-property-interceptors.patch4
-rw-r--r--src/v8/0004-Generalize-external-object-resources.patch4
-rw-r--r--src/v8/0005-Introduce-a-QML-compilation-mode.patch4
-rw-r--r--src/v8/0006-Allow-access-to-the-calling-script-data.patch4
-rw-r--r--src/v8/0007-Fix-warnings.patch4
-rw-r--r--src/v8/0008-Add-custom-object-compare-callback.patch4
-rw-r--r--src/v8/0009-Add-CallAsFunction-method-to-the-Object-class-in-the.patch7
-rw-r--r--src/v8/0010-Implement-CallAsConstructor-method-for-Object-in-the.patch7
-rw-r--r--src/v8/0011-QtScript-V8-Add-new-v8-api-to-check-if-a-value-is-an.patch5
-rw-r--r--src/v8/0012-Add-IsCallable-method-for-Object-in-the-API.patch7
-rw-r--r--src/v8/0013-Remove-execute-flag-from-v8-debug.h.patch4
-rw-r--r--src/v8/0014-Fix-build-error-suggest-parentheses-around-within.patch25
-rw-r--r--src/v8/0015-Fix-source-compatibility-where-the-String-Equals-ove.patch25
-rw-r--r--src/v8/0016-Fix-deprecated-Python-code.patch50
-rw-r--r--src/v8/v8.pri7
-rw-r--r--src/widgets/widgets/qmenu_p.h6
-rw-r--r--src/widgets/widgets/qmenu_symbian.cpp4
-rw-r--r--src/widgets/widgets/qmenu_wince.cpp4
101 files changed, 1198 insertions, 1708 deletions
diff --git a/src/corelib/global/qglobal.h b/src/corelib/global/qglobal.h
index c3e85ac0b1..71d0c720e6 100644
--- a/src/corelib/global/qglobal.h
+++ b/src/corelib/global/qglobal.h
@@ -1182,10 +1182,6 @@ Q_DECL_CONSTEXPR inline const T &qBound(const T &min, const T &val, const T &max
class QDataStream;
-#ifndef QT_BUILD_KEY
-#define QT_BUILD_KEY "unspecified"
-#endif
-
#if defined(Q_WS_MAC)
# ifndef QMAC_QMENUBAR_NO_EVENT
# define QMAC_QMENUBAR_NO_EVENT
diff --git a/src/corelib/global/qlibraryinfo.cpp b/src/corelib/global/qlibraryinfo.cpp
index 88f12ab1f7..d70c77afae 100644
--- a/src/corelib/global/qlibraryinfo.cpp
+++ b/src/corelib/global/qlibraryinfo.cpp
@@ -203,21 +203,6 @@ QLibraryInfo::licensedProducts()
}
/*!
- Returns a unique key identifying this build of Qt and its
- configurations. This key is not globally unique, rather only useful
- for establishing of two configurations are compatible. This can be
- used to compare with the \c QT_BUILD_KEY preprocessor symbol.
-
- \sa location()
-*/
-
-QString
-QLibraryInfo::buildKey()
-{
- return QString::fromLatin1(QT_BUILD_KEY);
-}
-
-/*!
\since 4.6
Returns the installation date for this build of Qt. The install date will
usually be the last time that Qt sources were configured.
@@ -514,18 +499,6 @@ void qt_core_boilerplate()
"Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).\n"
"Contact: Nokia Corporation (qt-info@nokia.com)\n"
"\n"
- "Build key: " QT_BUILD_KEY "\n"
- "Compat build key: "
-#ifdef QT_BUILD_KEY_COMPAT
- "| " QT_BUILD_KEY_COMPAT " "
-#endif
-#ifdef QT_BUILD_KEY_COMPAT2
- "| " QT_BUILD_KEY_COMPAT2 " "
-#endif
-#ifdef QT_BUILD_KEY_COMPAT3
- "| " QT_BUILD_KEY_COMPAT3 " "
-#endif
- "|\n"
"Build date: %s\n"
"Installation prefix: %s\n"
"Library path: %s\n"
diff --git a/src/corelib/global/qlibraryinfo.h b/src/corelib/global/qlibraryinfo.h
index a8fb90968c..4dcd8e1e5e 100644
--- a/src/corelib/global/qlibraryinfo.h
+++ b/src/corelib/global/qlibraryinfo.h
@@ -59,7 +59,6 @@ public:
static QString licensee();
static QString licensedProducts();
- static QString buildKey();
#ifndef QT_NO_DATESTRING
static QDate buildDate();
#endif //QT_NO_DATESTRING
diff --git a/src/corelib/io/qdir.cpp b/src/corelib/io/qdir.cpp
index 3621deea28..731c485b34 100644
--- a/src/corelib/io/qdir.cpp
+++ b/src/corelib/io/qdir.cpp
@@ -190,7 +190,7 @@ inline void QDirPrivate::resolveAbsoluteEntry() const
QString absoluteName;
if (fileEngine.isNull()) {
- if (!dirEntry.isRelative()) {
+ if (!dirEntry.isRelative() && dirEntry.isClean()) {
absoluteDirEntry = dirEntry;
return;
}
diff --git a/src/corelib/io/qfilesystemengine_symbian.cpp b/src/corelib/io/qfilesystemengine_symbian.cpp
index 18c52cbb17..c8c1dfdc84 100644
--- a/src/corelib/io/qfilesystemengine_symbian.cpp
+++ b/src/corelib/io/qfilesystemengine_symbian.cpp
@@ -114,9 +114,7 @@ QFileSystemEntry QFileSystemEngine::absoluteName(const QFileSystemEntry &entry)
{
QString orig = entry.filePath();
const bool isAbsolute = entry.isAbsolute();
- const bool isDirty = (orig.contains(QLatin1String("/../")) || orig.contains(QLatin1String("/./")) ||
- orig.contains(QLatin1String("//")) ||
- orig.endsWith(QLatin1String("/..")) || orig.endsWith(QLatin1String("/.")));
+ const bool isDirty = !entry.isClean();
if (isAbsolute && !isDirty)
return entry;
diff --git a/src/corelib/io/qfilesystemengine_unix.cpp b/src/corelib/io/qfilesystemengine_unix.cpp
index f1e0758bbe..966daba021 100644
--- a/src/corelib/io/qfilesystemengine_unix.cpp
+++ b/src/corelib/io/qfilesystemengine_unix.cpp
@@ -218,7 +218,7 @@ QFileSystemEntry QFileSystemEngine::canonicalName(const QFileSystemEntry &entry,
//static
QFileSystemEntry QFileSystemEngine::absoluteName(const QFileSystemEntry &entry)
{
- if (entry.isAbsolute())
+ if (entry.isAbsolute() && entry.isClean())
return entry;
QByteArray orig = entry.nativeFilePath();
diff --git a/src/corelib/io/qfilesystemengine_win.cpp b/src/corelib/io/qfilesystemengine_win.cpp
index f704fc3e90..df34184091 100644
--- a/src/corelib/io/qfilesystemengine_win.cpp
+++ b/src/corelib/io/qfilesystemengine_win.cpp
@@ -508,11 +508,7 @@ QFileSystemEntry QFileSystemEngine::absoluteName(const QFileSystemEntry &entry)
if (!entry.isRelative()) {
#if !defined(Q_OS_WINCE)
- if (entry.isAbsolute()
- && !entry.filePath().contains(QLatin1String("/../"))
- && !entry.filePath().contains(QLatin1String("/./"))
- && !entry.filePath().endsWith(QLatin1String("/.."))
- && !entry.filePath().endsWith(QLatin1String("/."))) {
+ if (entry.isAbsolute() && entry.isClean()) {
ret = entry.filePath();
} else {
ret = QDir::fromNativeSeparators(nativeAbsoluteFilePath(entry.filePath()));
diff --git a/src/corelib/io/qfilesystementry.cpp b/src/corelib/io/qfilesystementry.cpp
index bb7cb4e6ab..2f37542f66 100644
--- a/src/corelib/io/qfilesystementry.cpp
+++ b/src/corelib/io/qfilesystementry.cpp
@@ -380,4 +380,35 @@ void QFileSystemEntry::findFileNameSeparators() const
}
}
+bool QFileSystemEntry::isClean() const
+{
+ resolveFilePath();
+ int dots = 0;
+ bool dotok = true; // checking for ".." or "." starts to relative paths
+ bool slashok = true;
+ for (QString::const_iterator iter = m_filePath.constBegin(); iter != m_filePath.constEnd(); iter++) {
+ if (*iter == QLatin1Char('/')) {
+ if (dots == 1 || dots == 2)
+ return false; // path contains "./" or "../"
+ if (!slashok)
+ return false; // path contains "//"
+ dots = 0;
+ dotok = true;
+ slashok = false;
+ } else if (dotok) {
+ slashok = true;
+ if (*iter == QLatin1Char('.')) {
+ dots++;
+ if (dots > 2)
+ dotok = false;
+ } else {
+ //path element contains a character other than '.', it's clean
+ dots = 0;
+ dotok = false;
+ }
+ }
+ }
+ return (dots != 1 && dots != 2); // clean if path doesn't end in . or ..
+}
+
QT_END_NAMESPACE
diff --git a/src/corelib/io/qfilesystementry_p.h b/src/corelib/io/qfilesystementry_p.h
index 34b083a03e..8d524c087e 100644
--- a/src/corelib/io/qfilesystementry_p.h
+++ b/src/corelib/io/qfilesystementry_p.h
@@ -91,6 +91,7 @@ public:
QString completeSuffix() const;
bool isAbsolute() const;
bool isRelative() const;
+ bool isClean() const;
#if defined(Q_OS_WIN) || defined(Q_OS_SYMBIAN)
bool isDriveRoot() const;
diff --git a/src/corelib/kernel/qcoreapplication.cpp b/src/corelib/kernel/qcoreapplication.cpp
index d12391914b..7252a34a2d 100644
--- a/src/corelib/kernel/qcoreapplication.cpp
+++ b/src/corelib/kernel/qcoreapplication.cpp
@@ -266,18 +266,6 @@ bool QCoreApplicationPrivate::is_app_closing = false;
// initialized in qcoreapplication and in qtextstream autotest when setlocale is called.
Q_CORE_EXPORT bool qt_locale_initialized = false;
-
-/*
- Create an instance of Trolltech.conf. This ensures that the settings will not
- be thrown out of QSetting's cache for unused settings.
- */
-Q_GLOBAL_STATIC_WITH_ARGS(QSettings, staticTrolltechConf, (QSettings::UserScope, QLatin1String("Trolltech")))
-
-QSettings *QCoreApplicationPrivate::trolltechConf()
-{
- return staticTrolltechConf();
-}
-
Q_CORE_EXPORT uint qGlobalPostedEventsCount()
{
QThreadData *currentThreadData = QThreadData::current();
diff --git a/src/corelib/kernel/qcoreapplication_p.h b/src/corelib/kernel/qcoreapplication_p.h
index 62026141a1..0914b24a16 100644
--- a/src/corelib/kernel/qcoreapplication_p.h
+++ b/src/corelib/kernel/qcoreapplication_p.h
@@ -141,7 +141,6 @@ public:
static uint attribs;
static inline bool testAttribute(uint flag) { return attribs & (1 << flag); }
static int app_compile_version;
- static QSettings *trolltechConf();
};
QT_END_NAMESPACE
diff --git a/src/corelib/plugin/qfactoryloader.cpp b/src/corelib/plugin/qfactoryloader.cpp
index c8831e5ae5..c175dcfe1b 100644
--- a/src/corelib/plugin/qfactoryloader.cpp
+++ b/src/corelib/plugin/qfactoryloader.cpp
@@ -45,7 +45,6 @@
#include "qfactoryinterface.h"
#include "qmap.h"
#include <qdir.h>
-#include <qsettings.h>
#include <qdebug.h>
#include "qmutex.h"
#include "qplugin.h"
@@ -107,7 +106,6 @@ void QFactoryLoader::update()
#ifdef QT_SHARED
Q_D(QFactoryLoader);
QStringList paths = QCoreApplication::libraryPaths();
- QSettings settings(QSettings::UserScope, QLatin1String("Trolltech"));
for (int i = 0; i < paths.count(); ++i) {
const QString &pluginDir = paths.at(i);
// Already loaded, skip it...
@@ -127,7 +125,7 @@ void QFactoryLoader::update()
qDebug() << "QFactoryLoader::QFactoryLoader() looking at" << fileName;
}
library = QLibraryPrivate::findOrCreate(QFileInfo(fileName).canonicalFilePath());
- if (!library->isPlugin(&settings)) {
+ if (!library->isPlugin()) {
if (qt_debug_component()) {
qDebug() << library->errorString;
qDebug() << " not a plugin";
@@ -135,45 +133,26 @@ void QFactoryLoader::update()
library->release();
continue;
}
- QString regkey = QString::fromLatin1("Qt Factory Cache %1.%2/%3:/%4")
- .arg((QT_VERSION & 0xff0000) >> 16)
- .arg((QT_VERSION & 0xff00) >> 8)
- .arg(QLatin1String(d->iid))
- .arg(fileName);
- QStringList reg, keys;
- reg = settings.value(regkey).toStringList();
- if (reg.count() && library->lastModified == reg[0]) {
- keys = reg;
- keys.removeFirst();
- } else {
- if (!library->loadPlugin()) {
- if (qt_debug_component()) {
- qDebug() << library->errorString;
- qDebug() << " could not load";
- }
- library->release();
- continue;
- }
- QObject *instance = library->instance();
- if (!instance) {
- library->release();
- // ignore plugins that have a valid signature but cannot be loaded.
- continue;
+ QStringList keys;
+ if (!library->loadPlugin()) {
+ if (qt_debug_component()) {
+ qDebug() << library->errorString;
+ qDebug() << " could not load";
}
- QFactoryInterface *factory = qobject_cast<QFactoryInterface*>(instance);
- if (instance && factory && instance->qt_metacast(d->iid))
- keys = factory->keys();
- if (keys.isEmpty())
- library->unload();
- reg.clear();
- reg << library->lastModified;
- reg += keys;
- settings.setValue(regkey, reg);
+ library->release();
+ continue;
}
- if (qt_debug_component()) {
- qDebug() << "keys" << keys;
+ QObject *instance = library->instance();
+ if (!instance) {
+ library->release();
+ // ignore plugins that have a valid signature but cannot be loaded.
+ continue;
}
-
+ QFactoryInterface *factory = qobject_cast<QFactoryInterface*>(instance);
+ if (instance && factory && instance->qt_metacast(d->iid))
+ keys = factory->keys();
+ if (keys.isEmpty())
+ library->unload();
if (keys.isEmpty()) {
library->release();
continue;
diff --git a/src/corelib/plugin/qlibrary.cpp b/src/corelib/plugin/qlibrary.cpp
index 45515f32e1..580dc37bd2 100644
--- a/src/corelib/plugin/qlibrary.cpp
+++ b/src/corelib/plugin/qlibrary.cpp
@@ -50,8 +50,6 @@
#include <qfileinfo.h>
#include <qmutex.h>
#include <qmap.h>
-#include <qsettings.h>
-#include <qdatetime.h>
#include <private/qcoreapplication_p.h>
#ifdef Q_OS_MAC
# include <private/qcore_mac_p.h>
@@ -250,7 +248,7 @@ static int qt_tokenize(const char *s, ulong s_len, ulong *advance,
/*
returns true if the string s was correctly parsed, false otherwise.
*/
-static bool qt_parse_pattern(const char *s, uint *version, bool *debug, QByteArray *key)
+static bool qt_parse_pattern(const char *s, uint *version, bool *debug)
{
bool ret = true;
@@ -282,10 +280,6 @@ static bool qt_parse_pattern(const char *s, uint *version, bool *debug, QByteArr
}
} else if (qstrncmp("debug", pinfo.results[0], pinfo.lengths[0]) == 0) {
*debug = qstrncmp("true", pinfo.results[1], pinfo.lengths[1]) == 0;
- } else if (qstrncmp("buildkey", pinfo.results[0],
- pinfo.lengths[0]) == 0){
- // save buildkey
- *key = QByteArray(pinfo.results[1], pinfo.lengths[1]);
}
} while (parse == 1 && parselen > 0);
@@ -337,11 +331,11 @@ static long qt_find_pattern(const char *s, ulong s_len,
we can get the verification data without have to actually load the library.
This lets us detect mismatches more safely.
- Returns false if version/key information is not present, or if the
+ Returns false if version information is not present, or if the
information could not be read.
- Returns true if version/key information is present and successfully read.
+ Returns true if version information is present and successfully read.
*/
-static bool qt_unix_query(const QString &library, uint *version, bool *debug, QByteArray *key, QLibraryPrivate *lib = 0)
+static bool qt_unix_query(const QString &library, uint *version, bool *debug, QLibraryPrivate *lib = 0)
{
QFile file(library);
if (!file.open(QIODevice::ReadOnly)) {
@@ -396,7 +390,7 @@ static bool qt_unix_query(const QString &library, uint *version, bool *debug, QB
#endif // defined(Q_OF_ELF) && defined(Q_CC_GNU)
bool ret = false;
if (pos >= 0)
- ret = qt_parse_pattern(filedata + pos, version, debug, key);
+ ret = qt_parse_pattern(filedata + pos, version, debug);
if (!ret && lib)
lib->errorString = QLibrary::tr("Plugin verification data mismatch in '%1'").arg(library);
@@ -636,7 +630,7 @@ typedef const char * __stdcall (*QtPluginQueryVerificationDataFunction)();
typedef const char * (*QtPluginQueryVerificationDataFunction)();
#endif
-bool qt_get_verificationdata(QtPluginQueryVerificationDataFunction pfn, uint *qt_version, bool *debug, QByteArray *key, bool *exceptionThrown)
+bool qt_get_verificationdata(QtPluginQueryVerificationDataFunction pfn, uint *qt_version, bool *debug, bool *exceptionThrown)
{
*exceptionThrown = false;
const char *szData = 0;
@@ -649,10 +643,10 @@ bool qt_get_verificationdata(QtPluginQueryVerificationDataFunction pfn, uint *qt
#else
szData = pfn();
#endif
- return qt_parse_pattern(szData, qt_version, debug, key);
+ return qt_parse_pattern(szData, qt_version, debug);
}
-bool QLibraryPrivate::isPlugin(QSettings *settings)
+bool QLibraryPrivate::isPlugin()
{
errorString.clear();
if (pluginState != MightBeAPlugin)
@@ -660,7 +654,6 @@ bool QLibraryPrivate::isPlugin(QSettings *settings)
#ifndef QT_NO_PLUGIN_CHECK
bool debug = !QLIBRARY_AS_DEBUG;
- QByteArray key;
bool success = false;
#if defined(Q_OS_UNIX) && !defined(Q_OS_MAC)
@@ -677,141 +670,88 @@ bool QLibraryPrivate::isPlugin(QSettings *settings)
}
#endif
- QFileInfo fileinfo(fileName);
-
-#ifndef QT_NO_DATESTRING
- lastModified = fileinfo.lastModified().toString(Qt::ISODate);
-#endif
- QString regkey = QString::fromLatin1("Qt Plugin Cache %1.%2.%3/%4")
- .arg((QT_VERSION & 0xff0000) >> 16)
- .arg((QT_VERSION & 0xff00) >> 8)
- .arg(QLIBRARY_AS_DEBUG ? QLatin1String("debug") : QLatin1String("false"))
- .arg(fileName);
-#ifdef Q_WS_MAC
- // On Mac, add the application arch to the reg key in order to
- // cache plugin information separately for each arch. This prevents
- // Qt from wrongly caching plugin load failures when the archs
- // don't match.
-#if defined(__x86_64__)
- regkey += QLatin1String("-x86_64");
-#elif defined(__i386__)
- regkey += QLatin1String("-i386");
-#elif defined(__ppc64__)
- regkey += QLatin1String("-ppc64");
-#elif defined(__ppc__)
- regkey += QLatin1String("-ppc");
-#endif
-#endif // Q_WS_MAC
-
- QStringList reg;
-#ifndef QT_NO_SETTINGS
- if (!settings) {
- settings = QCoreApplicationPrivate::trolltechConf();
- }
- reg = settings->value(regkey).toStringList();
-#endif
- if (reg.count() == 4 && lastModified == reg.at(3)) {
- qt_version = reg.at(0).toUInt(0, 16);
- debug = bool(reg.at(1).toInt());
- key = reg.at(2).toLatin1();
- success = qt_version != 0;
- } else {
#if defined(Q_OS_UNIX) && !defined(Q_OS_MAC) && !defined(Q_OS_SYMBIAN)
- if (!pHnd) {
- // use unix shortcut to avoid loading the library
- success = qt_unix_query(fileName, &qt_version, &debug, &key, this);
- } else
+ if (!pHnd) {
+ // use unix shortcut to avoid loading the library
+ success = qt_unix_query(fileName, &qt_version, &debug, this);
+ } else
#endif
- {
- bool retryLoadLibrary = false; // Only used on Windows with MS compiler.(false in other cases)
- do {
- bool temporary_load = false;
+ {
+ bool retryLoadLibrary = false; // Only used on Windows with MS compiler.(false in other cases)
+ do {
+ bool temporary_load = false;
#ifdef Q_OS_WIN
- HMODULE hTempModule = 0;
+ HMODULE hTempModule = 0;
#endif
- if (!pHnd) {
+ if (!pHnd) {
#ifdef Q_OS_WIN
- DWORD dwFlags = (retryLoadLibrary) ? 0: DONT_RESOLVE_DLL_REFERENCES;
- //avoid 'Bad Image' message box
- UINT oldmode = SetErrorMode(SEM_FAILCRITICALERRORS|SEM_NOOPENFILEERRORBOX);
- hTempModule = ::LoadLibraryEx((wchar_t*)QDir::toNativeSeparators(fileName).utf16(), 0, dwFlags);
- SetErrorMode(oldmode);
+ DWORD dwFlags = (retryLoadLibrary) ? 0: DONT_RESOLVE_DLL_REFERENCES;
+ //avoid 'Bad Image' message box
+ UINT oldmode = SetErrorMode(SEM_FAILCRITICALERRORS|SEM_NOOPENFILEERRORBOX);
+ hTempModule = ::LoadLibraryEx((wchar_t*)QDir::toNativeSeparators(fileName).utf16(), 0, dwFlags);
+ SetErrorMode(oldmode);
#else
# if defined(Q_OS_SYMBIAN)
- //Guard against accidentally trying to load non-plugin libraries by making sure the stub exists
- if (fileinfo.exists())
+ //Guard against accidentally trying to load non-plugin libraries by making sure the stub exists
+ if (fileinfo.exists())
# endif
- temporary_load = load_sys();
+ temporary_load = load_sys();
#endif
- }
+ }
#ifdef Q_OS_WIN
- QtPluginQueryVerificationDataFunction qtPluginQueryVerificationDataFunction = hTempModule ? (QtPluginQueryVerificationDataFunction)
+ QtPluginQueryVerificationDataFunction qtPluginQueryVerificationDataFunction = hTempModule ? (QtPluginQueryVerificationDataFunction)
#ifdef Q_OS_WINCE
- ::GetProcAddress(hTempModule, L"qt_plugin_query_verification_data")
+ ::GetProcAddress(hTempModule, L"qt_plugin_query_verification_data")
#else
- ::GetProcAddress(hTempModule, "qt_plugin_query_verification_data")
+ ::GetProcAddress(hTempModule, "qt_plugin_query_verification_data")
#endif
- : (QtPluginQueryVerificationDataFunction) resolve("qt_plugin_query_verification_data");
+ : (QtPluginQueryVerificationDataFunction) resolve("qt_plugin_query_verification_data");
#else
- QtPluginQueryVerificationDataFunction qtPluginQueryVerificationDataFunction = NULL;
+ QtPluginQueryVerificationDataFunction qtPluginQueryVerificationDataFunction = NULL;
# if defined(Q_OS_SYMBIAN)
- if (temporary_load) {
- qtPluginQueryVerificationDataFunction = (QtPluginQueryVerificationDataFunction) resolve("qt_plugin_query_verification_data");
- // If resolving with function name failed (i.e. not STDDLL), try resolving using known ordinal
- if (!qtPluginQueryVerificationDataFunction)
- qtPluginQueryVerificationDataFunction = (QtPluginQueryVerificationDataFunction) resolve("1");
- }
-# else
+ if (temporary_load) {
qtPluginQueryVerificationDataFunction = (QtPluginQueryVerificationDataFunction) resolve("qt_plugin_query_verification_data");
+ // If resolving with function name failed (i.e. not STDDLL), try resolving using known ordinal
+ if (!qtPluginQueryVerificationDataFunction)
+ qtPluginQueryVerificationDataFunction = (QtPluginQueryVerificationDataFunction) resolve("1");
+ }
+# else
+ qtPluginQueryVerificationDataFunction = (QtPluginQueryVerificationDataFunction) resolve("qt_plugin_query_verification_data");
# endif
#endif
- bool exceptionThrown = false;
- bool ret = qt_get_verificationdata(qtPluginQueryVerificationDataFunction,
- &qt_version, &debug, &key, &exceptionThrown);
- if (!exceptionThrown) {
- if (!ret) {
- qt_version = 0;
- key = "unknown";
- if (temporary_load)
- unload_sys();
- } else {
- success = true;
- }
- retryLoadLibrary = false;
+ bool exceptionThrown = false;
+ bool ret = qt_get_verificationdata(qtPluginQueryVerificationDataFunction,
+ &qt_version, &debug, &exceptionThrown);
+ if (!exceptionThrown) {
+ if (!ret) {
+ qt_version = 0;
+ if (temporary_load)
+ unload_sys();
+ } else {
+ success = true;
}
+ retryLoadLibrary = false;
+ }
#ifdef QT_USE_MS_STD_EXCEPTION
- else {
- // An exception was thrown when calling qt_plugin_query_verification_data().
- // This usually happens when plugin is compiled with the /clr compiler flag,
- // & will only work if the dependencies are loaded & DLLMain() is called.
- // LoadLibrary() will do this, try once with this & if it fails dont load.
- retryLoadLibrary = !retryLoadLibrary;
- }
+ else {
+ // An exception was thrown when calling qt_plugin_query_verification_data().
+ // This usually happens when plugin is compiled with the /clr compiler flag,
+ // & will only work if the dependencies are loaded & DLLMain() is called.
+ // LoadLibrary() will do this, try once with this & if it fails dont load.
+ retryLoadLibrary = !retryLoadLibrary;
+ }
#endif
#ifdef Q_OS_WIN
- if (hTempModule) {
- BOOL ok = ::FreeLibrary(hTempModule);
- if (ok) {
- hTempModule = 0;
- }
-
+ if (hTempModule) {
+ BOOL ok = ::FreeLibrary(hTempModule);
+ if (ok) {
+ hTempModule = 0;
}
-#endif
- } while(retryLoadLibrary); // Will be 'false' in all cases other than when an
- // exception is thrown(will happen only when using a MS compiler)
- }
-
- // Qt 4.5 compatibility: stl doesn't affect binary compatibility
- key.replace(" no-stl", "");
-#ifndef QT_NO_SETTINGS
- QStringList queried;
- queried << QString::number(qt_version,16)
- << QString::number((int)debug)
- << QLatin1String(key)
- << lastModified;
- settings->setValue(regkey, queried);
+ }
#endif
+ } while (retryLoadLibrary); // Will be 'false' in all cases other than when an
+ // exception is thrown(will happen only when using a MS compiler)
}
if (!success) {
@@ -840,31 +780,6 @@ bool QLibraryPrivate::isPlugin(QSettings *settings)
.arg((qt_version&0xff00) >> 8)
.arg(qt_version&0xff)
.arg(debug ? QLatin1String("debug") : QLatin1String("release"));
- } else if (key != QT_BUILD_KEY
- // we may have some compatibility keys, try them too:
-#ifdef QT_BUILD_KEY_COMPAT
- && key != QT_BUILD_KEY_COMPAT
-#endif
-#ifdef QT_BUILD_KEY_COMPAT2
- && key != QT_BUILD_KEY_COMPAT2
-#endif
-#ifdef QT_BUILD_KEY_COMPAT3
- && key != QT_BUILD_KEY_COMPAT3
-#endif
- ) {
- if (qt_debug_component()) {
- qWarning("In %s:\n"
- " Plugin uses incompatible Qt library\n"
- " expected build key \"%s\", got \"%s\"",
- (const char*) QFile::encodeName(fileName),
- QT_BUILD_KEY,
- key.isEmpty() ? "<null>" : (const char *) key);
- }
- errorString = QLibrary::tr("The plugin '%1' uses incompatible Qt library."
- " Expected build key \"%2\", got \"%3\"")
- .arg(fileName)
- .arg(QLatin1String(QT_BUILD_KEY))
- .arg(key.isEmpty() ? QLatin1String("<null>") : QLatin1String((const char *) key));
#ifndef QT_NO_DEBUG_PLUGIN_CHECK
} else if(debug != QLIBRARY_AS_DEBUG) {
//don't issue a qWarning since we will hopefully find a non-debug? --Sam
diff --git a/src/corelib/plugin/qlibrary_p.h b/src/corelib/plugin/qlibrary_p.h
index c6804955d9..15825c699f 100644
--- a/src/corelib/plugin/qlibrary_p.h
+++ b/src/corelib/plugin/qlibrary_p.h
@@ -68,7 +68,6 @@ QT_BEGIN_NAMESPACE
bool qt_debug_component();
-class QSettings;
class QLibraryPrivate
{
public:
@@ -99,7 +98,7 @@ public:
QString errorString;
QLibrary::LoadHints loadHints;
- bool isPlugin(QSettings *settings = 0);
+ bool isPlugin();
private:
diff --git a/src/corelib/plugin/qplugin.h b/src/corelib/plugin/qplugin.h
index 40e6e66de3..52661671b5 100644
--- a/src/corelib/plugin/qplugin.h
+++ b/src/corelib/plugin/qplugin.h
@@ -117,8 +117,7 @@ void Q_CORE_EXPORT qRegisterStaticPluginInstanceFunction(QtPluginInstanceFunctio
static const char qt_plugin_verification_data[] = \
"pattern=""QT_PLUGIN_VERIFICATION_DATA""\n" \
"version="QT_VERSION_STR"\n" \
- "debug="QPLUGIN_DEBUG_STR"\n" \
- "buildkey="QT_BUILD_KEY;
+ "debug="QPLUGIN_DEBUG_STR;
# if defined (Q_OF_ELF) && defined (Q_CC_GNU)
# define Q_PLUGIN_VERIFICATION_SECTION \
diff --git a/src/corelib/plugin/qpluginloader.cpp b/src/corelib/plugin/qpluginloader.cpp
index bbb64e42e7..591e36e20a 100644
--- a/src/corelib/plugin/qpluginloader.cpp
+++ b/src/corelib/plugin/qpluginloader.cpp
@@ -98,22 +98,6 @@ QT_BEGIN_NAMESPACE
every instance has called unload(). Right before the unloading
happen, the root component will also be deleted.
- In order to speed up loading and validation of plugins, some of
- the information that is collected during loading is cached in
- persistent memory (through QSettings). For instance, the result
- of a load operation (e.g. succeeded or failed) is stored in the
- cache, so that subsequent load operations don't try to load an
- invalid plugin. However, if the "last modified" timestamp of
- a plugin has changed, the plugin's cache entry is invalidated
- and the plugin is reloaded regardless of the values in the cache
- entry. The cache entry is then updated with the new result of the
- load operation.
-
- This also means that the timestamp must be updated each time the
- plugin or any dependent resources (such as a shared library) is
- updated, since the dependent resources might influence the result
- of loading a plugin.
-
See \l{How to Create Qt Plugins} for more information about
how to make your application extensible through plugins.
diff --git a/src/corelib/tools/qchar.cpp b/src/corelib/tools/qchar.cpp
index 736bc63b11..b68da9def4 100644
--- a/src/corelib/tools/qchar.cpp
+++ b/src/corelib/tools/qchar.cpp
@@ -1402,7 +1402,8 @@ static void decomposeHelper(QString *str, bool canonical, QChar::UnicodeVersion
ucs4 = QChar::surrogateToUcs4(high, ucs4);
}
}
- if (QChar::unicodeVersion(ucs4) > version)
+ const QChar::UnicodeVersion v = QChar::unicodeVersion(ucs4);
+ if (v > version || v == QChar::Unicode_Unassigned)
continue;
int length;
int tag;
@@ -1462,7 +1463,7 @@ static ushort ligatureHelper(ushort u1, ushort u2)
return 0;
}
-static void composeHelper(QString *str, int from)
+static void composeHelper(QString *str, QChar::UnicodeVersion version, int from)
{
QString &s = *str;
@@ -1482,7 +1483,14 @@ static void composeHelper(QString *str, int from)
++pos;
}
}
- int combining = QChar::combiningClass(uc);
+ const QUnicodeTables::Properties *p = qGetProp(uc);
+ if (p->unicodeVersion > version || p->unicodeVersion == QChar::Unicode_Unassigned) {
+ starter = -1; // to prevent starter == pos - 1
+ lastCombining = 0;
+ ++pos;
+ continue;
+ }
+ int combining = p->combiningClass;
if (starter == pos - 1 || combining > lastCombining) {
// allowed to form ligature with S
QChar ligature = ligatureHelper(s.at(starter).unicode(), uc);
@@ -1529,7 +1537,7 @@ static void canonicalOrderHelper(QString *str, QChar::UnicodeVersion version, in
ushort c2 = 0;
{
const QUnicodeTables::Properties *p = qGetProp(u2);
- if ((QChar::UnicodeVersion)p->unicodeVersion <= version)
+ if (p->unicodeVersion <= version && p->unicodeVersion != QChar::Unicode_Unassigned)
c2 = p->combiningClass;
}
if (c2 == 0) {
@@ -1540,7 +1548,7 @@ static void canonicalOrderHelper(QString *str, QChar::UnicodeVersion version, in
ushort c1 = 0;
{
const QUnicodeTables::Properties *p = qGetProp(u1);
- if ((QChar::UnicodeVersion)p->unicodeVersion <= version)
+ if (p->unicodeVersion <= version && p->unicodeVersion != QChar::Unicode_Unassigned)
c1 = p->combiningClass;
}
diff --git a/src/corelib/tools/qlist.cpp b/src/corelib/tools/qlist.cpp
index e0b69d4361..4c04385033 100644
--- a/src/corelib/tools/qlist.cpp
+++ b/src/corelib/tools/qlist.cpp
@@ -181,7 +181,7 @@ void **QListData::append()
}
// ensures that enough space is available to append the list
-void **QListData::append2(const QListData& l)
+void **QListData::append(const QListData& l)
{
return append(l.d->end - l.d->begin);
}
diff --git a/src/corelib/tools/qlist.h b/src/corelib/tools/qlist.h
index f8f62cc8b2..b4c35b8d35 100644
--- a/src/corelib/tools/qlist.h
+++ b/src/corelib/tools/qlist.h
@@ -79,9 +79,6 @@ struct Q_CORE_EXPORT QListData {
Data *detach(int alloc);
Data *detach_grow(int *i, int n);
- Data *detach(); // remove in 5.0
- Data *detach2(); // remove in 5.0
- Data *detach3(); // remove in 5.0
void realloc(int alloc);
static Data shared_null;
Data *d;
@@ -89,7 +86,6 @@ struct Q_CORE_EXPORT QListData {
void **append(int n);
void **append();
void **append(const QListData &l);
- void **append2(const QListData &l); // remove in 5.0
void **prepend();
void **insert(int i);
void remove(int i);
@@ -338,7 +334,7 @@ private:
Node *detach_helper_grow(int i, int n);
void detach_helper(int alloc);
void detach_helper();
- void free(QListData::Data *d);
+ void dealloc(QListData::Data *d);
void node_construct(Node *n, const T &t);
void node_destruct(Node *n);
@@ -426,7 +422,7 @@ Q_INLINE_TEMPLATE QList<T> &QList<T>::operator=(const QList<T> &l)
QListData::Data *o = l.d;
o->ref.ref();
if (!d->ref.deref())
- free(d);
+ dealloc(d);
d = o;
if (!d->sharable)
detach_helper();
@@ -683,7 +679,7 @@ Q_OUTOFLINE_TEMPLATE typename QList<T>::Node *QList<T>::detach_helper_grow(int i
}
if (!x->ref.deref())
- free(x);
+ dealloc(x);
return reinterpret_cast<Node *>(p.begin() + i);
}
@@ -702,7 +698,7 @@ Q_OUTOFLINE_TEMPLATE void QList<T>::detach_helper(int alloc)
}
if (!x->ref.deref())
- free(x);
+ dealloc(x);
}
template <typename T>
@@ -715,7 +711,7 @@ template <typename T>
Q_OUTOFLINE_TEMPLATE QList<T>::~QList()
{
if (!d->ref.deref())
- free(d);
+ dealloc(d);
}
template <typename T>
@@ -736,9 +732,8 @@ Q_OUTOFLINE_TEMPLATE bool QList<T>::operator==(const QList<T> &l) const
return true;
}
-// ### Qt 5: rename freeData() to avoid confusion with std::free()
template <typename T>
-Q_OUTOFLINE_TEMPLATE void QList<T>::free(QListData::Data *data)
+Q_OUTOFLINE_TEMPLATE void QList<T>::dealloc(QListData::Data *data)
{
node_destruct(reinterpret_cast<Node *>(data->array + data->begin),
reinterpret_cast<Node *>(data->array + data->end));
@@ -802,7 +797,7 @@ Q_OUTOFLINE_TEMPLATE QList<T> &QList<T>::operator+=(const QList<T> &l)
} else {
Node *n = (d->ref != 1)
? detach_helper_grow(INT_MAX, l.size())
- : reinterpret_cast<Node *>(p.append2(l.p));
+ : reinterpret_cast<Node *>(p.append(l.p));
QT_TRY {
node_copy(n, reinterpret_cast<Node *>(p.end()),
reinterpret_cast<Node *>(l.p.begin()));
diff --git a/src/corelib/tools/qlocale.cpp b/src/corelib/tools/qlocale.cpp
index 63ffae4e2b..d2bb752c6d 100644
--- a/src/corelib/tools/qlocale.cpp
+++ b/src/corelib/tools/qlocale.cpp
@@ -89,6 +89,8 @@ Q_GLOBAL_STATIC(QLocalePrivate, globalLocalePrivate)
#ifdef QT_USE_ICU
extern bool qt_initIcu(const QString &localeName);
+extern bool qt_u_strToUpper(const QString &str, QString *out, const QLocale &locale);
+extern bool qt_u_strToLower(const QString &str, QString *out, const QLocale &locale);
#endif
/******************************************************************************
@@ -2171,6 +2173,42 @@ Qt::LayoutDirection QLocale::textDirection() const
return Qt::LeftToRight;
}
+/*!
+ \since 4.8
+
+ Returns an uppercase copy of \a str.
+*/
+QString QLocale::toUpper(const QString &str) const
+{
+#ifdef QT_USE_ICU
+ {
+ QString result;
+ if (qt_u_strToUpper(str, &result, *this))
+ return result;
+ // else fall through and use Qt's toUpper
+ }
+#endif
+ return str.toUpper();
+}
+
+/*!
+ \since 4.8
+
+ Returns a lowercase copy of \a str.
+*/
+QString QLocale::toLower(const QString &str) const
+{
+#ifdef QT_USE_ICU
+ {
+ QString result;
+ if (qt_u_strToLower(str, &result, *this))
+ return result;
+ // else fall through and use Qt's toUpper
+ }
+#endif
+ return str.toLower();
+}
+
/*!
\since 4.5
diff --git a/src/corelib/tools/qlocale.h b/src/corelib/tools/qlocale.h
index 8a5d526e8d..55dd55b984 100644
--- a/src/corelib/tools/qlocale.h
+++ b/src/corelib/tools/qlocale.h
@@ -724,6 +724,9 @@ public:
Qt::LayoutDirection textDirection() const;
+ QString toUpper(const QString &str) const;
+ QString toLower(const QString &str) const;
+
QString currencySymbol(CurrencySymbolFormat = CurrencySymbol) const;
QString toCurrencyString(qlonglong, const QString &symbol = QString()) const;
QString toCurrencyString(qulonglong, const QString &symbol = QString()) const;
diff --git a/src/corelib/tools/qstring.cpp b/src/corelib/tools/qstring.cpp
index 9ce5eead8c..c56c050f76 100644
--- a/src/corelib/tools/qstring.cpp
+++ b/src/corelib/tools/qstring.cpp
@@ -105,8 +105,6 @@ QTextCodec *QString::codecForCStrings;
#ifdef QT_USE_ICU
// qlocale_icu.cpp
extern bool qt_ucol_strcoll(const QChar *source, int sourceLength, const QChar *target, int targetLength, int *result);
-extern bool qt_u_strToUpper(const QString &str, QString *out, const QLocale &locale);
-extern bool qt_u_strToLower(const QString &str, QString *out, const QLocale &locale);
#endif
@@ -4878,7 +4876,10 @@ QString QString::rightJustified(int width, QChar fill, bool truncate) const
\snippet doc/src/snippets/qstring/main.cpp 75
- \sa toUpper()
+ The case conversion will always happen in the 'C' locale. For locale dependent
+ case folding use QLocale::toLower()
+
+ \sa toUpper(), QLocale::toLower()
*/
QString QString::toLower() const
@@ -4889,15 +4890,6 @@ QString QString::toLower() const
if (!d->size)
return *this;
-#ifdef QT_USE_ICU
- {
- QString result;
- if (qt_u_strToLower(*this, &result, QLocale()))
- return result;
- // else fall through and use Qt's toUpper
- }
-#endif
-
const ushort *e = d->data() + d->size;
// this avoids one out of bounds check in the loop
@@ -4978,7 +4970,10 @@ QString QString::toCaseFolded() const
\snippet doc/src/snippets/qstring/main.cpp 81
- \sa toLower()
+ The case conversion will always happen in the 'C' locale. For locale dependent
+ case folding use QLocale::toUpper()
+
+ \sa toLower(), QLocale::toLower()
*/
QString QString::toUpper() const
@@ -4989,15 +4984,6 @@ QString QString::toUpper() const
if (!d->size)
return *this;
-#ifdef QT_USE_ICU
- {
- QString result;
- if (qt_u_strToUpper(*this, &result, QLocale()))
- return result;
- // else fall through and use Qt's toUpper
- }
-#endif
-
const ushort *e = d->data() + d->size;
// this avoids one out of bounds check in the loop
@@ -6244,7 +6230,7 @@ void qt_string_normalize(QString *data, QString::NormalizationForm mode, QChar::
if (mode == QString::NormalizationForm_D || mode == QString::NormalizationForm_KD)
return;
- composeHelper(data, from);
+ composeHelper(data, version, from);
}
diff --git a/src/gui/image/qpnghandler.cpp b/src/gui/image/qpnghandler.cpp
index f7d07a5b14..1714442eb6 100644
--- a/src/gui/image/qpnghandler.cpp
+++ b/src/gui/image/qpnghandler.cpp
@@ -58,6 +58,29 @@
#include <pngconf.h>
#endif
+#if PNG_LIBPNG_VER >= 10400 && PNG_LIBPNG_VER <= 10502 \
+ && defined(PNG_PEDANTIC_WARNINGS_SUPPORTED)
+/*
+ Versions 1.4.0 to 1.5.2 of libpng declare png_longjmp_ptr to
+ have a noreturn attribute if PNG_PEDANTIC_WARNINGS_SUPPORTED
+ is enabled, but most declarations of longjmp in the wild do
+ not add this attribute. This causes problems when the png_jmpbuf
+ macro expands to calling png_set_longjmp_fn with a mismatched
+ longjmp, as compilers such as Clang will treat this as an error.
+
+ To work around this we override the png_jmpbuf macro to cast
+ longjmp to a png_longjmp_ptr.
+*/
+# undef png_jmpbuf
+# ifdef PNG_SETJMP_SUPPORTED
+# define png_jmpbuf(png_ptr) \
+ (*png_set_longjmp_fn((png_ptr), (png_longjmp_ptr)longjmp, sizeof(jmp_buf)))
+# else
+# define png_jmpbuf(png_ptr) \
+ (LIBPNG_WAS_COMPILED_WITH__PNG_NO_SETJMP)
+# endif
+#endif
+
#ifdef Q_OS_WINCE
#define CALLBACK_CALL_TYPE __cdecl
#else
diff --git a/src/gui/kernel/qplatformnativeinterface_qpa.cpp b/src/gui/kernel/qplatformnativeinterface_qpa.cpp
index 20d136e691..7b9ff4a7a5 100644
--- a/src/gui/kernel/qplatformnativeinterface_qpa.cpp
+++ b/src/gui/kernel/qplatformnativeinterface_qpa.cpp
@@ -64,4 +64,45 @@ void * QPlatformNativeInterface::nativeResourceForBackingStore(const QByteArray
return 0;
}
+/*!
+ Contains generic window properties that the platform may utilize.
+*/
+QVariantMap QPlatformNativeInterface::windowProperties(QPlatformWindow *window) const
+{
+ return QVariantMap();
+}
+
+/*!
+ Returns a window property with \a name.
+
+ If the property does not exist, returns a default-constructed value.
+*/
+QVariant QPlatformNativeInterface::windowProperty(QPlatformWindow *window, const QString &name) const
+{
+ Q_UNUSED(window);
+ Q_UNUSED(name);
+ return QVariant();
+}
+
+/*!
+ Returns a window property with \a name. If the value does not exist, defaultValue is returned.
+*/
+QVariant QPlatformNativeInterface::windowProperty(QPlatformWindow *window, const QString &name, const QVariant &defaultValue) const
+{
+ Q_UNUSED(window);
+ Q_UNUSED(name);
+ Q_UNUSED(defaultValue);
+ return QVariant();
+}
+
+/*!
+ Sets a window property with \a name to \a value.
+*/
+void QPlatformNativeInterface::setWindowProperty(QPlatformWindow *window, const QString &name, const QVariant &value)
+{
+ Q_UNUSED(window);
+ Q_UNUSED(name);
+ Q_UNUSED(value);
+}
+
QT_END_NAMESPACE
diff --git a/src/gui/kernel/qplatformnativeinterface_qpa.h b/src/gui/kernel/qplatformnativeinterface_qpa.h
index 6ea8104fa3..bfcf78813b 100644
--- a/src/gui/kernel/qplatformnativeinterface_qpa.h
+++ b/src/gui/kernel/qplatformnativeinterface_qpa.h
@@ -43,6 +43,8 @@
#define QPLATFORMNATIVEINTERFACE_QPA_H
#include <QtGui/qwindowdefs.h>
+#include <QtCore/QObject>
+#include <QtCore/QVariant>
QT_BEGIN_HEADER
@@ -52,14 +54,24 @@ QT_MODULE(Gui)
class QOpenGLContext;
class QWindow;
+class QPlatformWindow;
class QBackingStore;
-class Q_GUI_EXPORT QPlatformNativeInterface
+class Q_GUI_EXPORT QPlatformNativeInterface : public QObject
{
+ Q_OBJECT
public:
virtual void *nativeResourceForContext(const QByteArray &resource, QOpenGLContext *context);
virtual void *nativeResourceForWindow(const QByteArray &resource, QWindow *window);
virtual void *nativeResourceForBackingStore(const QByteArray &resource, QBackingStore *backingStore);
+
+ virtual QVariantMap windowProperties(QPlatformWindow *window) const;
+ virtual QVariant windowProperty(QPlatformWindow *window, const QString &name) const;
+ virtual QVariant windowProperty(QPlatformWindow *window, const QString &name, const QVariant &defaultValue) const;
+ virtual void setWindowProperty(QPlatformWindow *window, const QString &name, const QVariant &value);
+
+Q_SIGNALS:
+ void windowPropertyChanged(QPlatformWindow *window, const QString &propertyName);
};
QT_END_NAMESPACE
diff --git a/src/gui/painting/qcosmeticstroker.cpp b/src/gui/painting/qcosmeticstroker.cpp
index dbe957e68d..3528e6f215 100644
--- a/src/gui/painting/qcosmeticstroker.cpp
+++ b/src/gui/painting/qcosmeticstroker.cpp
@@ -425,13 +425,12 @@ void QCosmeticStroker::calculateLastPoint(qreal rx1, qreal ry1, qreal rx2, qreal
swapped = true;
qSwap(y1, y2);
qSwap(x1, x2);
- --x1; --x2; --y1; --y2;
}
int xinc = F16Dot16FixedDiv(x2 - x1, y2 - y1);
int x = x1 << 10;
- int y = (y1+32) >> 6;
- int ys = (y2+32) >> 6;
+ int y = y1 >> 6;
+ int ys = y2 >> 6;
if (y != ys) {
x += ( ((((y << 6) + 32 - y1))) * xinc ) >> 6;
@@ -457,13 +456,12 @@ void QCosmeticStroker::calculateLastPoint(qreal rx1, qreal ry1, qreal rx2, qreal
swapped = true;
qSwap(x1, x2);
qSwap(y1, y2);
- --x1; --x2; --y1; --y2;
}
int yinc = F16Dot16FixedDiv(y2 - y1, x2 - x1);
int y = y1 << 10;
- int x = (x1+32) >> 6;
- int xs = (x2+32) >> 6;
+ int x = x1 >> 6;
+ int xs = x2 >> 6;
if (x != xs) {
y += ( ((((x << 6) + 32 - x1))) * yinc ) >> 6;
@@ -716,10 +714,11 @@ static void drawLine(QCosmeticStroker *stroker, qreal rx1, qreal ry1, qreal rx2,
QCosmeticStroker::Point last = stroker->lastPixel;
-// qDebug() << "stroke" << x1/64. << y1/64. << x2/64. << y2/64. << capString(caps);
+// qDebug() << "stroke" << x1/64. << y1/64. << x2/64. << y2/64.;
if (dx < dy) {
// vertical
+ QCosmeticStroker::Direction dir = QCosmeticStroker::TopToBottom;
bool swapped = false;
if (y1 > y2) {
@@ -727,30 +726,31 @@ static void drawLine(QCosmeticStroker *stroker, qreal rx1, qreal ry1, qreal rx2,
qSwap(y1, y2);
qSwap(x1, x2);
caps = swapCaps(caps);
- --x1; --x2; --y1; --y2;
+ dir = QCosmeticStroker::BottomToTop;
}
int xinc = F16Dot16FixedDiv(x2 - x1, y2 - y1);
int x = x1 << 10;
+ if ((stroker->lastDir ^ QCosmeticStroker::VerticalMask) == dir)
+ caps |= swapped ? QCosmeticStroker::CapEnd : QCosmeticStroker::CapBegin;
+
capAdjust(caps, y1, y2, x, xinc);
- int y = (y1+32) >> 6;
- int ys = (y2+32) >> 6;
+ int y = y1 >> 6;
+ int ys = y2 >> 6;
if (y != ys) {
x += ( ((((y << 6) + 32 - y1))) * xinc ) >> 6;
// calculate first and last pixel and perform dropout control
- QCosmeticStroker::Direction dir = QCosmeticStroker::TopToBottom;
QCosmeticStroker::Point first;
first.x = x >> 16;
first.y = y;
last.x = (x + (ys - y - 1)*xinc) >> 16;
last.y = ys - 1;
- if (swapped) {
+ if (swapped)
qSwap(first, last);
- dir = QCosmeticStroker::BottomToTop;
- }
+
bool axisAligned = qAbs(xinc) < (1 << 14);
if (stroker->lastPixel.x >= 0) {
if (first.x == stroker->lastPixel.x &&
@@ -765,7 +765,7 @@ static void drawLine(QCosmeticStroker *stroker, qreal rx1, qreal ry1, qreal rx2,
} else if (stroker->lastDir != dir &&
(((axisAligned && stroker->lastAxisAligned) &&
stroker->lastPixel.x != first.x && stroker->lastPixel.y != first.y) ||
- (qAbs(stroker->lastPixel.x - first.x) > 1 &&
+ (qAbs(stroker->lastPixel.x - first.x) > 1 ||
qAbs(stroker->lastPixel.y - first.y) > 1))) {
// have a missing pixel, insert it
if (swapped) {
@@ -793,37 +793,39 @@ static void drawLine(QCosmeticStroker *stroker, qreal rx1, qreal ry1, qreal rx2,
if (!dx)
return;
+ QCosmeticStroker::Direction dir = QCosmeticStroker::LeftToRight;
+
bool swapped = false;
if (x1 > x2) {
swapped = true;
qSwap(x1, x2);
qSwap(y1, y2);
caps = swapCaps(caps);
- --x1; --x2; --y1; --y2;
+ dir = QCosmeticStroker::RightToLeft;
}
int yinc = F16Dot16FixedDiv(y2 - y1, x2 - x1);
int y = y1 << 10;
- capAdjust(caps, x1, x2, y, yinc);
+ if ((stroker->lastDir ^ QCosmeticStroker::HorizontalMask) == dir)
+ caps |= swapped ? QCosmeticStroker::CapEnd : QCosmeticStroker::CapBegin;
- int x = (x1+32) >> 6;
- int xs = (x2+32) >> 6;
+ capAdjust(caps, x1, x2, y, yinc);
+ int x = x1 >> 6;
+ int xs = x2 >> 6;
if (x != xs) {
y += ( ((((x << 6) + 32 - x1))) * yinc ) >> 6;
// calculate first and last pixel to perform dropout control
- QCosmeticStroker::Direction dir = QCosmeticStroker::LeftToRight;
QCosmeticStroker::Point first;
first.x = x;
first.y = y >> 16;
last.x = xs - 1;
last.y = (y + (xs - x - 1)*yinc) >> 16;
- if (swapped) {
+ if (swapped)
qSwap(first, last);
- dir = QCosmeticStroker::RightToLeft;
- }
+
bool axisAligned = qAbs(yinc) < (1 << 14);
if (stroker->lastPixel.x >= 0) {
if (first.x == stroker->lastPixel.x && first.y == stroker->lastPixel.y) {
@@ -837,7 +839,7 @@ static void drawLine(QCosmeticStroker *stroker, qreal rx1, qreal ry1, qreal rx2,
} else if (stroker->lastDir != dir &&
(((axisAligned && stroker->lastAxisAligned) &&
stroker->lastPixel.x != first.x && stroker->lastPixel.y != first.y) ||
- (qAbs(stroker->lastPixel.x - first.x) > 1 &&
+ (qAbs(stroker->lastPixel.x - first.x) > 1 ||
qAbs(stroker->lastPixel.y - first.y) > 1))) {
// have a missing pixel, insert it
if (swapped) {
diff --git a/src/gui/painting/qcosmeticstroker_p.h b/src/gui/painting/qcosmeticstroker_p.h
index d7bd79ad15..53cdf2c0ac 100644
--- a/src/gui/painting/qcosmeticstroker_p.h
+++ b/src/gui/painting/qcosmeticstroker_p.h
@@ -78,10 +78,12 @@ public:
// used to avoid drop outs or duplicated points
enum Direction {
- TopToBottom,
- BottomToTop,
- LeftToRight,
- RightToLeft
+ TopToBottom = 0x1,
+ BottomToTop = 0x2,
+ LeftToRight = 0x4,
+ RightToLeft = 0x8,
+ VerticalMask = 0x3,
+ HorizontalMask = 0xc
};
QCosmeticStroker(QRasterPaintEngineState *s, const QRect &dr)
diff --git a/src/gui/text/qtextcontrol.cpp b/src/gui/text/qtextcontrol.cpp
index f7ea2fa34a..204f71eced 100644
--- a/src/gui/text/qtextcontrol.cpp
+++ b/src/gui/text/qtextcontrol.cpp
@@ -685,20 +685,30 @@ void QTextControlPrivate::extendWordwiseSelection(int suggestedNewPosition, qrea
if (!wordSelectionEnabled && (mouseXPosition < wordStartX || mouseXPosition > wordEndX))
return;
- // keep the already selected word even when moving to the left
- // (#39164)
- if (suggestedNewPosition < selectedWordOnDoubleClick.position())
- cursor.setPosition(selectedWordOnDoubleClick.selectionEnd());
- else
- cursor.setPosition(selectedWordOnDoubleClick.selectionStart());
+ if (wordSelectionEnabled) {
+ if (suggestedNewPosition < selectedWordOnDoubleClick.position()) {
+ cursor.setPosition(selectedWordOnDoubleClick.selectionEnd());
+ setCursorPosition(wordStartPos, QTextCursor::KeepAnchor);
+ } else {
+ cursor.setPosition(selectedWordOnDoubleClick.selectionStart());
+ setCursorPosition(wordEndPos, QTextCursor::KeepAnchor);
+ }
+ } else {
+ // keep the already selected word even when moving to the left
+ // (#39164)
+ if (suggestedNewPosition < selectedWordOnDoubleClick.position())
+ cursor.setPosition(selectedWordOnDoubleClick.selectionEnd());
+ else
+ cursor.setPosition(selectedWordOnDoubleClick.selectionStart());
- const qreal differenceToStart = mouseXPosition - wordStartX;
- const qreal differenceToEnd = wordEndX - mouseXPosition;
+ const qreal differenceToStart = mouseXPosition - wordStartX;
+ const qreal differenceToEnd = wordEndX - mouseXPosition;
- if (differenceToStart < differenceToEnd)
- setCursorPosition(wordStartPos, QTextCursor::KeepAnchor);
- else
- setCursorPosition(wordEndPos, QTextCursor::KeepAnchor);
+ if (differenceToStart < differenceToEnd)
+ setCursorPosition(wordStartPos, QTextCursor::KeepAnchor);
+ else
+ setCursorPosition(wordEndPos, QTextCursor::KeepAnchor);
+ }
if (interactionFlags & Qt::TextSelectableByMouse) {
#ifndef QT_NO_CLIPBOARD
@@ -1591,8 +1601,10 @@ void QTextControlPrivate::mouseMoveEvent(QEvent *e, Qt::MouseButton button, cons
#endif //QT_NO_IM
} else {
//emit q->visibilityRequest(QRectF(mousePos, QSizeF(1, 1)));
- if (cursor.position() != oldCursorPos)
+ if (cursor.position() != oldCursorPos) {
emit q->cursorPositionChanged();
+ emit q->microFocusChanged();
+ }
}
selectionChanged(true);
repaintOldAndNewSelection(oldSelection);
@@ -1636,8 +1648,10 @@ void QTextControlPrivate::mouseReleaseEvent(QEvent *e, Qt::MouseButton button, c
repaintOldAndNewSelection(oldSelection);
- if (cursor.position() != oldCursorPos)
+ if (cursor.position() != oldCursorPos) {
emit q->cursorPositionChanged();
+ emit q->microFocusChanged();
+ }
if (interactionFlags & Qt::LinksAccessibleByMouse) {
if (!(button & Qt::LeftButton))
diff --git a/src/network/ssl/qssl.h b/src/network/ssl/qssl.h
index 7b76b64b4c..c8af346800 100644
--- a/src/network/ssl/qssl.h
+++ b/src/network/ssl/qssl.h
@@ -63,6 +63,7 @@ namespace QSsl {
};
enum KeyAlgorithm {
+ Opaque,
Rsa,
Dsa
};
diff --git a/src/network/ssl/qsslcertificate.cpp b/src/network/ssl/qsslcertificate.cpp
index bbc60f674c..fa97ccb78c 100644
--- a/src/network/ssl/qsslcertificate.cpp
+++ b/src/network/ssl/qsslcertificate.cpp
@@ -892,23 +892,24 @@ QList<QSslCertificate> QSslCertificatePrivate::certificatesFromDer(const QByteAr
// These certificates are known to be fraudulent and were created during the comodo
// compromise. See http://www.comodo.com/Comodo-Fraud-Incident-2011-03-23.html
static const char *certificate_blacklist[] = {
- "04:7e:cb:e9:fc:a5:5f:7b:d0:9e:ae:36:e1:0c:ae:1e",
- "f5:c8:6a:f3:61:62:f1:3a:64:f5:4f:6d:c9:58:7c:06",
- "d7:55:8f:da:f5:f1:10:5b:b2:13:28:2b:70:77:29:a3",
- "39:2a:43:4f:0e:07:df:1f:8a:a3:05:de:34:e0:c2:29",
- "3e:75:ce:d4:6b:69:30:21:21:88:30:ae:86:a8:2a:71",
- "e9:02:8b:95:78:e4:15:dc:1a:71:0a:2b:88:15:44:47",
- "92:39:d5:34:8f:40:d1:69:5a:74:54:70:e1:f2:3f:43",
- "b0:b7:13:3e:d0:96:f9:b5:6f:ae:91:c8:74:bd:3a:c0",
- "d8:f3:5f:4e:b7:87:2b:2d:ab:06:92:e3:15:38:2f:b0",
- "05:e2:e6:a4:cd:09:ea:54:d6:65:b0:75:fe:22:a2:56",
+ "04:7e:cb:e9:fc:a5:5f:7b:d0:9e:ae:36:e1:0c:ae:1e", "mail.google.com", // Comodo
+ "f5:c8:6a:f3:61:62:f1:3a:64:f5:4f:6d:c9:58:7c:06", "www.google.com", // Comodo
+ "d7:55:8f:da:f5:f1:10:5b:b2:13:28:2b:70:77:29:a3", "login.yahoo.com", // Comodo
+ "39:2a:43:4f:0e:07:df:1f:8a:a3:05:de:34:e0:c2:29", "login.yahoo.com", // Comodo
+ "3e:75:ce:d4:6b:69:30:21:21:88:30:ae:86:a8:2a:71", "login.yahoo.com", // Comodo
+ "e9:02:8b:95:78:e4:15:dc:1a:71:0a:2b:88:15:44:47", "login.skype.com", // Comodo
+ "92:39:d5:34:8f:40:d1:69:5a:74:54:70:e1:f2:3f:43", "addons.mozilla.org", // Comodo
+ "b0:b7:13:3e:d0:96:f9:b5:6f:ae:91:c8:74:bd:3a:c0", "login.live.com", // Comodo
+ "d8:f3:5f:4e:b7:87:2b:2d:ab:06:92:e3:15:38:2f:b0", "global trustee", // Comodo
+ "05:e2:e6:a4:cd:09:ea:54:d6:65:b0:75:fe:22:a2:56", "*.google.com", // DigiNotar
0
};
bool QSslCertificatePrivate::isBlacklisted(const QSslCertificate &certificate)
{
for (int a = 0; certificate_blacklist[a] != 0; a++) {
- if (certificate.serialNumber() == certificate_blacklist[a])
+ if (certificate.serialNumber() == certificate_blacklist[a++] &&
+ certificate.subjectInfo(QSslCertificate::CommonName).contains(QString::fromUtf8(certificate_blacklist[a])))
return true;
}
return false;
diff --git a/src/network/ssl/qsslkey.cpp b/src/network/ssl/qsslkey.cpp
index 29cfd0a77d..580b71bca9 100644
--- a/src/network/ssl/qsslkey.cpp
+++ b/src/network/ssl/qsslkey.cpp
@@ -89,6 +89,11 @@ void QSslKeyPrivate::clear(bool deep)
q_DSA_free(dsa);
dsa = 0;
}
+ if (opaque) {
+ if (deep)
+ q_EVP_PKEY_free(opaque);
+ opaque = 0;
+ }
}
/*!
@@ -265,6 +270,23 @@ QSslKey::QSslKey(QIODevice *device, QSsl::KeyAlgorithm algorithm, QSsl::Encoding
}
/*!
+ Constructs a QSslKey from a valid native key \a handle.
+ \a type specifies whether the key is public or private.
+
+ QSslKey will take ownership for this key and you must not
+ free the key using the native library. The algorithm used
+ when creating a key from a handle will always be QSsl::Opaque.
+*/
+QSslKey::QSslKey(Qt::HANDLE handle, QSsl::KeyType type)
+ : d(new QSslKeyPrivate)
+{
+ d->opaque = reinterpret_cast<EVP_PKEY *>(handle);
+ d->algorithm = QSsl::Opaque;
+ d->type = type;
+ d->isNull = !d->opaque;
+}
+
+/*!
Constructs an identical copy of \a other.
*/
QSslKey::QSslKey(const QSslKey &other) : d(other.d)
@@ -315,8 +337,9 @@ void QSslKey::clear()
*/
int QSslKey::length() const
{
- if (d->isNull)
+ if (d->isNull || d->algorithm == QSsl::Opaque)
return -1;
+
return (d->algorithm == QSsl::Rsa)
? q_BN_num_bits(d->rsa->n) : q_BN_num_bits(d->dsa->p);
}
@@ -345,8 +368,9 @@ QSsl::KeyAlgorithm QSslKey::algorithm() const
// ### autotest failure for non-empty passPhrase and private key
QByteArray QSslKey::toDer(const QByteArray &passPhrase) const
{
- if (d->isNull)
+ if (d->isNull || d->algorithm == QSsl::Opaque)
return QByteArray();
+
return d->derFromPem(toPem(passPhrase));
}
@@ -357,7 +381,7 @@ QByteArray QSslKey::toDer(const QByteArray &passPhrase) const
*/
QByteArray QSslKey::toPem(const QByteArray &passPhrase) const
{
- if (!QSslSocket::supportsSsl() || d->isNull)
+ if (!QSslSocket::supportsSsl() || d->isNull || d->algorithm == QSsl::Opaque)
return QByteArray();
BIO *bio = q_BIO_new(q_BIO_s_mem());
@@ -417,7 +441,16 @@ QByteArray QSslKey::toPem(const QByteArray &passPhrase) const
*/
Qt::HANDLE QSslKey::handle() const
{
- return (d->algorithm == QSsl::Rsa) ? Qt::HANDLE(d->rsa) : Qt::HANDLE(d->dsa);
+ switch (d->algorithm) {
+ case QSsl::Opaque:
+ return Qt::HANDLE(d->opaque);
+ case QSsl::Rsa:
+ return Qt::HANDLE(d->rsa);
+ case QSsl::Dsa:
+ return Qt::HANDLE(d->dsa);
+ default:
+ return Qt::HANDLE(NULL);
+ }
}
/*!
@@ -435,6 +468,8 @@ bool QSslKey::operator==(const QSslKey &other) const
return false;
if (length() != other.length())
return false;
+ if (algorithm() == QSsl::Opaque)
+ return handle() == other.handle();
return toDer() == other.toDer();
}
@@ -450,7 +485,8 @@ QDebug operator<<(QDebug debug, const QSslKey &key)
{
debug << "QSslKey("
<< (key.type() == QSsl::PublicKey ? "PublicKey" : "PrivateKey")
- << ", " << (key.algorithm() == QSsl::Rsa ? "RSA" : "DSA")
+ << ", " << (key.algorithm() == QSsl::Opaque ? "OPAQUE" :
+ (key.algorithm() == QSsl::Rsa ? "RSA" : "DSA"))
<< ", " << key.length()
<< ')';
return debug;
diff --git a/src/network/ssl/qsslkey.h b/src/network/ssl/qsslkey.h
index 5ee1b4ad2f..7064d22eb4 100644
--- a/src/network/ssl/qsslkey.h
+++ b/src/network/ssl/qsslkey.h
@@ -73,6 +73,7 @@ public:
QSsl::EncodingFormat format = QSsl::Pem,
QSsl::KeyType type = QSsl::PrivateKey,
const QByteArray &passPhrase = QByteArray());
+ explicit QSslKey(Qt::HANDLE handle, QSsl::KeyType type = QSsl::PrivateKey);
QSslKey(const QSslKey &other);
~QSslKey();
QSslKey &operator=(const QSslKey &other);
diff --git a/src/network/ssl/qsslkey_p.h b/src/network/ssl/qsslkey_p.h
index f4a77b3c3f..14075ecad0 100644
--- a/src/network/ssl/qsslkey_p.h
+++ b/src/network/ssl/qsslkey_p.h
@@ -67,6 +67,7 @@ public:
inline QSslKeyPrivate()
: rsa(0)
, dsa(0)
+ , opaque(0)
{
clear();
}
@@ -88,6 +89,7 @@ public:
QSsl::KeyAlgorithm algorithm;
RSA *rsa;
DSA *dsa;
+ EVP_PKEY *opaque;
QAtomicInt ref;
diff --git a/src/network/ssl/qsslsocket_openssl.cpp b/src/network/ssl/qsslsocket_openssl.cpp
index 300a5c84d5..0ff17910f3 100644
--- a/src/network/ssl/qsslsocket_openssl.cpp
+++ b/src/network/ssl/qsslsocket_openssl.cpp
@@ -322,7 +322,7 @@ init_context:
if (! caCertificate.isValid()) {
expiredCerts.append(caCertificate);
} else {
- q_X509_STORE_add_cert(ctx->cert_store, (X509 *)caCertificate.handle());
+ q_X509_STORE_add_cert(ctx->cert_store, reinterpret_cast<X509 *>(caCertificate.handle()));
}
}
@@ -335,7 +335,7 @@ init_context:
// now add the expired certs
if (addExpiredCerts) {
foreach (const QSslCertificate &caCertificate, expiredCerts) {
- q_X509_STORE_add_cert(ctx->cert_store, (X509 *)caCertificate.handle());
+ q_X509_STORE_add_cert(ctx->cert_store, reinterpret_cast<X509 *>(caCertificate.handle()));
}
}
@@ -358,26 +358,33 @@ init_context:
}
// Load certificate
- if (!q_SSL_CTX_use_certificate(ctx, (X509 *)configuration.localCertificate.handle())) {
+ if (!q_SSL_CTX_use_certificate(ctx, reinterpret_cast<X509 *>(configuration.localCertificate.handle()))) {
q->setErrorString(QSslSocket::tr("Error loading local certificate, %1").arg(getErrorsFromOpenSsl()));
emit q->error(QAbstractSocket::UnknownSocketError);
return false;
}
- // Load private key
- pkey = q_EVP_PKEY_new();
- // before we were using EVP_PKEY_assign_R* functions and did not use EVP_PKEY_free.
- // this lead to a memory leak. Now we use the *_set1_* functions which do not
- // take ownership of the RSA/DSA key instance because the QSslKey already has ownership.
- if (configuration.privateKey.algorithm() == QSsl::Rsa)
- q_EVP_PKEY_set1_RSA(pkey, (RSA *)configuration.privateKey.handle());
- else
- q_EVP_PKEY_set1_DSA(pkey, (DSA *)configuration.privateKey.handle());
+ if (configuration.privateKey.algorithm() == QSsl::Opaque) {
+ pkey = reinterpret_cast<EVP_PKEY *>(configuration.privateKey.handle());
+ } else {
+ // Load private key
+ pkey = q_EVP_PKEY_new();
+ // before we were using EVP_PKEY_assign_R* functions and did not use EVP_PKEY_free.
+ // this lead to a memory leak. Now we use the *_set1_* functions which do not
+ // take ownership of the RSA/DSA key instance because the QSslKey already has ownership.
+ if (configuration.privateKey.algorithm() == QSsl::Rsa)
+ q_EVP_PKEY_set1_RSA(pkey, reinterpret_cast<RSA *>(configuration.privateKey.handle()));
+ else
+ q_EVP_PKEY_set1_DSA(pkey, reinterpret_cast<DSA *>(configuration.privateKey.handle()));
+ }
+
if (!q_SSL_CTX_use_PrivateKey(ctx, pkey)) {
q->setErrorString(QSslSocket::tr("Error loading private key, %1").arg(getErrorsFromOpenSsl()));
emit q->error(QAbstractSocket::UnknownSocketError);
return false;
}
+ if (configuration.privateKey.algorithm() == QSsl::Opaque)
+ pkey = 0; // Don't free the private key, it belongs to QSslKey
// Check if the certificate matches the private key.
if (!q_SSL_CTX_check_private_key(ctx)) {
@@ -1383,7 +1390,6 @@ void QSslSocketBackendPrivate::disconnected()
q_EVP_PKEY_free(pkey);
pkey = 0;
}
-
}
QSslCipher QSslSocketBackendPrivate::sessionCipher() const
@@ -1508,7 +1514,7 @@ QList<QSslError> QSslSocketBackendPrivate::verify(QList<QSslCertificate> certifi
if (!caCertificate.isValid()) {
expiredCerts.append(caCertificate);
} else {
- q_X509_STORE_add_cert(certStore, (X509 *)caCertificate.handle());
+ q_X509_STORE_add_cert(certStore, reinterpret_cast<X509 *>(caCertificate.handle()));
}
}
@@ -1521,7 +1527,7 @@ QList<QSslError> QSslSocketBackendPrivate::verify(QList<QSslCertificate> certifi
// now add the expired certs
if (addExpiredCerts) {
foreach (const QSslCertificate &caCertificate, expiredCerts) {
- q_X509_STORE_add_cert(certStore, (X509 *)caCertificate.handle());
+ q_X509_STORE_add_cert(certStore, reinterpret_cast<X509 *>(caCertificate.handle()));
}
}
@@ -1548,9 +1554,9 @@ QList<QSslError> QSslSocketBackendPrivate::verify(QList<QSslCertificate> certifi
continue;
}
#if OPENSSL_VERSION_NUMBER >= 0x10000000L
- q_sk_push( (_STACK *)intermediates, (X509 *)cert.handle());
+ q_sk_push( (_STACK *)intermediates, reinterpret_cast<X509 *>(cert.handle()));
#else
- q_sk_push( (STACK *)intermediates, (X509 *)cert.handle());
+ q_sk_push( (STACK *)intermediates, reinterpret_cast<X509 *>(cert.handle()));
#endif
}
}
@@ -1562,7 +1568,7 @@ QList<QSslError> QSslSocketBackendPrivate::verify(QList<QSslCertificate> certifi
return errors;
}
- if (!q_X509_STORE_CTX_init(storeContext, certStore, (X509 *)certificateChain[0].handle(), intermediates)) {
+ if (!q_X509_STORE_CTX_init(storeContext, certStore, reinterpret_cast<X509 *>(certificateChain[0].handle()), intermediates)) {
q_X509_STORE_CTX_free(storeContext);
q_X509_STORE_free(certStore);
errors << QSslError(QSslError::UnspecifiedError);
diff --git a/src/network/ssl/qsslsocket_openssl_symbols_p.h b/src/network/ssl/qsslsocket_openssl_symbols_p.h
index a1db6d9320..d1705b3680 100644
--- a/src/network/ssl/qsslsocket_openssl_symbols_p.h
+++ b/src/network/ssl/qsslsocket_openssl_symbols_p.h
@@ -228,13 +228,13 @@ char *q_ERR_error_string(unsigned long a, char *b);
unsigned long q_ERR_get_error();
const EVP_CIPHER *q_EVP_des_ede3_cbc();
int q_EVP_PKEY_assign(EVP_PKEY *a, int b, char *c);
-int q_EVP_PKEY_set1_RSA(EVP_PKEY *a, RSA *b);
+Q_AUTOTEST_EXPORT int q_EVP_PKEY_set1_RSA(EVP_PKEY *a, RSA *b);
int q_EVP_PKEY_set1_DSA(EVP_PKEY *a, DSA *b);
void q_EVP_PKEY_free(EVP_PKEY *a);
RSA *q_EVP_PKEY_get1_RSA(EVP_PKEY *a);
DSA *q_EVP_PKEY_get1_DSA(EVP_PKEY *a);
int q_EVP_PKEY_type(int a);
-EVP_PKEY *q_EVP_PKEY_new();
+Q_AUTOTEST_EXPORT EVP_PKEY *q_EVP_PKEY_new();
int q_i2d_X509(X509 *a, unsigned char **b);
const char *q_OBJ_nid2sn(int a);
const char *q_OBJ_nid2ln(int a);
diff --git a/src/plugins/platforms/wayland/qwaylandnativeinterface.cpp b/src/plugins/platforms/wayland/qwaylandnativeinterface.cpp
index 3158c73605..d81fa350e9 100644
--- a/src/plugins/platforms/wayland/qwaylandnativeinterface.cpp
+++ b/src/plugins/platforms/wayland/qwaylandnativeinterface.cpp
@@ -40,12 +40,13 @@
****************************************************************************/
#include "qwaylandnativeinterface.h"
-
#include "qwaylanddisplay.h"
#include "qwaylandwindow.h"
#include <QtGui/private/qguiapplication_p.h>
#include <QtGui/QScreen>
+#include "windowmanager_integration/qwaylandwindowmanagerintegration.h"
+
void *QWaylandNativeInterface::nativeResourceForWindow(const QByteArray &resourceString, QWindow *window)
{
QByteArray lowerCaseResource = resourceString.toLower();
@@ -71,3 +72,32 @@ QWaylandScreen * QWaylandNativeInterface::qPlatformScreenForWindow(QWindow *wind
}
return screen;
}
+
+QVariantMap QWaylandNativeInterface::windowProperties(QPlatformWindow *window) const
+{
+ return m_windowProperties.value(window);
+}
+
+QVariant QWaylandNativeInterface::windowProperty(QPlatformWindow *window, const QString &name) const
+{
+ const QVariantMap properties = m_windowProperties.value(window);
+ return properties.value(name);
+}
+
+QVariant QWaylandNativeInterface::windowProperty(QPlatformWindow *window, const QString &name, const QVariant &defaultValue) const
+{
+ const QVariantMap properties = m_windowProperties.value(window);
+ return properties.value(name, defaultValue);
+}
+
+void QWaylandNativeInterface::setWindowProperty(QPlatformWindow *window, const QString &name, const QVariant &value)
+{
+ QVariantMap props = m_windowProperties.value(window);
+ props.insert(name, value);
+ m_windowProperties.insert(window, props);
+
+ QWaylandWindow *wlWindow = static_cast<QWaylandWindow*>(window);
+ QWaylandWindowManagerIntegration::instance()->setWindowProperty(wlWindow, name, value);
+
+ emit windowPropertyChanged(window, name);
+}
diff --git a/src/plugins/platforms/wayland/qwaylandnativeinterface.h b/src/plugins/platforms/wayland/qwaylandnativeinterface.h
index f1d4fe9402..9db442a265 100644
--- a/src/plugins/platforms/wayland/qwaylandnativeinterface.h
+++ b/src/plugins/platforms/wayland/qwaylandnativeinterface.h
@@ -43,7 +43,7 @@
#define QWAYLANDNATIVEINTERFACE_H
#include "qwaylandscreen.h"
-
+#include <QVariantMap>
#include <QtGui/QPlatformNativeInterface>
class QWaylandNativeInterface : public QPlatformNativeInterface
@@ -52,8 +52,16 @@ public:
void *nativeResourceForWindow(const QByteArray &resourceString,
QWindow *window);
+ QVariantMap windowProperties(QPlatformWindow *window) const;
+ QVariant windowProperty(QPlatformWindow *window, const QString &name) const;
+ QVariant windowProperty(QPlatformWindow *window, const QString &name, const QVariant &defaultValue) const;
+ void setWindowProperty(QPlatformWindow *window, const QString &name, const QVariant &value);
+
private:
static QWaylandScreen *qPlatformScreenForWindow(QWindow *window);
+
+private:
+ QHash<QPlatformWindow*, QVariantMap> m_windowProperties;
};
diff --git a/src/plugins/platforms/wayland/qwaylandwindow.cpp b/src/plugins/platforms/wayland/qwaylandwindow.cpp
index 48da7b537e..6011621044 100644
--- a/src/plugins/platforms/wayland/qwaylandwindow.cpp
+++ b/src/plugins/platforms/wayland/qwaylandwindow.cpp
@@ -149,6 +149,9 @@ void QWaylandWindow::newSurfaceCreated()
// do not damage the surface here, as this leads to graphical corruptions in the compositor until
// the first frame has been rendered
}
+#ifdef QT_WAYLAND_WINDOWMANAGER_SUPPORT
+ QWaylandWindowManagerIntegration::instance()->flushPropertyChanges(this);
+#endif
}
void QWaylandWindow::frameCallback(struct wl_surface *surface, void *data, uint32_t time)
diff --git a/src/plugins/platforms/wayland/windowmanager_integration/qwaylandwindowmanager-client-protocol.h b/src/plugins/platforms/wayland/windowmanager_integration/qwaylandwindowmanager-client-protocol.h
deleted file mode 100644
index e781b16c41..0000000000
--- a/src/plugins/platforms/wayland/windowmanager_integration/qwaylandwindowmanager-client-protocol.h
+++ /dev/null
@@ -1,106 +0,0 @@
-/*
- * Copyright © 2010 Kristian Høgsberg
- *
- * Permission to use, copy, modify, distribute, and sell this software and its
- * documentation for any purpose is hereby granted without fee, provided that
- * the above copyright notice appear in all copies and that both that copyright
- * notice and this permission notice appear in supporting documentation, and
- * that the name of the copyright holders not be used in advertising or
- * publicity pertaining to distribution of the software without specific,
- * written prior permission. The copyright holders make no representations
- * about the suitability of this software for any purpose. It is provided "as
- * is" without express or implied warranty.
- *
- * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
- * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
- * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
- * OF THIS SOFTWARE.
- */
-
-
-#ifndef WAYLAND_WINDOWMANAGER_CLIENT_PROTOCOL_H
-#define WAYLAND_WINDOWMANAGER_CLIENT_PROTOCOL_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#include <stdint.h>
-#include <stddef.h>
-#include "wayland-util.h"
-
-struct wl_client;
-
-struct wl_windowmanager;
-
-extern const struct wl_interface wl_windowmanager_interface;
-
-struct wl_windowmanager_listener {
- void (*client_onscreen_visibility)(void *data,
- struct wl_windowmanager *wl_windowmanager,
- int visible);
- void (*set_screen_rotation)(void *data,
- struct wl_windowmanager *wl_windowmanager,
- int rotation);
-};
-
-static inline int
-wl_windowmanager_add_listener(struct wl_windowmanager *wl_windowmanager,
- const struct wl_windowmanager_listener *listener, void *data)
-{
- return wl_proxy_add_listener((struct wl_proxy *) wl_windowmanager,
- (void (**)(void)) listener, data);
-}
-
-#define WL_WINDOWMANAGER_MAP_CLIENT_TO_PROCESS 0
-#define WL_WINDOWMANAGER_AUTHENTICATE_WITH_TOKEN 1
-
-static inline struct wl_windowmanager *
-wl_windowmanager_create(struct wl_display *display, uint32_t id, uint32_t version)
-{
- wl_display_bind(display, id, "wl_windowmanager", version);
-
- return (struct wl_windowmanager *)
- wl_proxy_create_for_id(display, &wl_windowmanager_interface, id);
-}
-
-static inline void
-wl_windowmanager_set_user_data(struct wl_windowmanager *wl_windowmanager, void *user_data)
-{
- wl_proxy_set_user_data((struct wl_proxy *) wl_windowmanager, user_data);
-}
-
-static inline void *
-wl_windowmanager_get_user_data(struct wl_windowmanager *wl_windowmanager)
-{
- return wl_proxy_get_user_data((struct wl_proxy *) wl_windowmanager);
-}
-
-static inline void
-wl_windowmanager_destroy(struct wl_windowmanager *wl_windowmanager)
-{
- wl_proxy_destroy((struct wl_proxy *) wl_windowmanager);
-}
-
-static inline void
-wl_windowmanager_map_client_to_process(struct wl_windowmanager *wl_windowmanager, uint32_t processid)
-{
- wl_proxy_marshal((struct wl_proxy *) wl_windowmanager,
- WL_WINDOWMANAGER_MAP_CLIENT_TO_PROCESS, processid);
-}
-
-static inline void
-wl_windowmanager_authenticate_with_token(struct wl_windowmanager *wl_windowmanager, const char *processid)
-{
- wl_proxy_marshal((struct wl_proxy *) wl_windowmanager,
- WL_WINDOWMANAGER_AUTHENTICATE_WITH_TOKEN, processid);
-}
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
diff --git a/src/plugins/platforms/wayland/windowmanager_integration/qwaylandwindowmanagerintegration.cpp b/src/plugins/platforms/wayland/windowmanager_integration/qwaylandwindowmanagerintegration.cpp
index 60b0a5605e..7d68571c24 100644
--- a/src/plugins/platforms/wayland/windowmanager_integration/qwaylandwindowmanagerintegration.cpp
+++ b/src/plugins/platforms/wayland/windowmanager_integration/qwaylandwindowmanagerintegration.cpp
@@ -40,17 +40,43 @@
****************************************************************************/
#include "qwaylandwindowmanagerintegration.h"
-#include "qwaylandwindowmanager-client-protocol.h"
+#include "wayland-windowmanager-client-protocol.h"
+#include "qwaylandwindow.h"
#include <stdint.h>
-#include <QDebug>
-#include <QEvent>
+#include <QtCore/QEvent>
+#include <QtCore/QHash>
+#include <QtGui/QPlatformNativeInterface>
+#include <QtGui/QPlatformWindow>
#include <QtGui/QtEvents>
-#include <QCoreApplication>
+#include <QtGui/QGuiApplication>
+
+#include <QDebug>
+
+class QWaylandWindowManagerIntegrationPrivate {
+public:
+ QWaylandWindowManagerIntegrationPrivate(QWaylandDisplay *waylandDisplay);
+ bool m_blockPropertyUpdates;
+ QWaylandDisplay *m_waylandDisplay;
+ struct wl_windowmanager *m_waylandWindowManager;
+ QHash<QWaylandWindow*,QVariantMap> m_queuedProperties;
-const struct wl_windowmanager_listener QWaylandWindowManagerIntegration::mWindowManagerListener = {
+};
+
+QWaylandWindowManagerIntegrationPrivate::QWaylandWindowManagerIntegrationPrivate(QWaylandDisplay *waylandDisplay)
+ : m_blockPropertyUpdates(false)
+ , m_waylandDisplay(waylandDisplay)
+ , m_waylandWindowManager(0)
+{
+
+}
+
+QWaylandWindowManagerIntegration *QWaylandWindowManagerIntegration::m_instance = 0;
+
+const struct wl_windowmanager_listener QWaylandWindowManagerIntegration::m_windowManagerListener = {
QWaylandWindowManagerIntegration::wlHandleOnScreenVisibilityChange,
QWaylandWindowManagerIntegration::wlHandleScreenOrientationChange,
+ QWaylandWindowManagerIntegration::wlHandleWindowPropertyChange
};
QWaylandWindowManagerIntegration *QWaylandWindowManagerIntegration::createIntegration(QWaylandDisplay *waylandDisplay)
@@ -59,10 +85,11 @@ QWaylandWindowManagerIntegration *QWaylandWindowManagerIntegration::createIntegr
}
QWaylandWindowManagerIntegration::QWaylandWindowManagerIntegration(QWaylandDisplay *waylandDisplay)
- : mWaylandDisplay(waylandDisplay)
- , mWaylandWindowManager(0)
+ : d_ptr(new QWaylandWindowManagerIntegrationPrivate(waylandDisplay))
{
- wl_display_add_global_listener(mWaylandDisplay->wl_display(),
+ m_instance = this;
+
+ wl_display_add_global_listener(d_ptr->m_waylandDisplay->wl_display(),
QWaylandWindowManagerIntegration::wlHandleListenerGlobal,
this);
}
@@ -72,9 +99,15 @@ QWaylandWindowManagerIntegration::~QWaylandWindowManagerIntegration()
}
+QWaylandWindowManagerIntegration *QWaylandWindowManagerIntegration::instance()
+{
+ return m_instance;
+}
+
struct wl_windowmanager *QWaylandWindowManagerIntegration::windowManager() const
{
- return mWaylandWindowManager;
+ Q_D(const QWaylandWindowManagerIntegration);
+ return d->m_waylandWindowManager;
}
void QWaylandWindowManagerIntegration::wlHandleListenerGlobal(wl_display *display, uint32_t id, const char *interface, uint32_t version, void *data)
@@ -82,29 +115,95 @@ void QWaylandWindowManagerIntegration::wlHandleListenerGlobal(wl_display *displa
Q_UNUSED(version);
if (strcmp(interface, "wl_windowmanager") == 0) {
QWaylandWindowManagerIntegration *integration = static_cast<QWaylandWindowManagerIntegration *>(data);
- integration->mWaylandWindowManager = wl_windowmanager_create(display, id, 1);
-
- wl_windowmanager_add_listener(integration->mWaylandWindowManager, &mWindowManagerListener, integration);
+ integration->d_ptr->m_waylandWindowManager = wl_windowmanager_create(display, id, 1);
+ wl_windowmanager *windowManager = integration->d_ptr->m_waylandWindowManager;
+ wl_windowmanager_add_listener(windowManager, &m_windowManagerListener, integration);
}
}
void QWaylandWindowManagerIntegration::mapClientToProcess(long long processId)
{
- if (mWaylandWindowManager)
- wl_windowmanager_map_client_to_process(mWaylandWindowManager, (uint32_t) processId);
+ Q_D(QWaylandWindowManagerIntegration);
+ if (d->m_waylandWindowManager)
+ wl_windowmanager_map_client_to_process(d->m_waylandWindowManager, (uint32_t) processId);
}
void QWaylandWindowManagerIntegration::authenticateWithToken(const QByteArray &token)
{
+ Q_D(QWaylandWindowManagerIntegration);
QByteArray authToken = token;
if (authToken.isEmpty())
authToken = qgetenv("WL_AUTHENTICATION_TOKEN");
- if (mWaylandWindowManager && !authToken.isEmpty()) {
- wl_windowmanager_authenticate_with_token(mWaylandWindowManager, authToken.constData());
+ if (d->m_waylandWindowManager && !authToken.isEmpty()) {
+ wl_windowmanager_authenticate_with_token(d->m_waylandWindowManager, authToken.constData());
+ }
+}
+
+static wl_array writePropertyValue(const QVariant &value)
+{
+ QByteArray byteValue;
+ QDataStream ds(&byteValue, QIODevice::WriteOnly);
+ ds << value;
+
+ wl_array data;
+ data.size = byteValue.size();
+ data.data = (void*)byteValue.constData();
+ data.alloc = 0;
+
+ return data;
+}
+
+void QWaylandWindowManagerIntegration::setWindowProperty(QWaylandWindow *window, const QString &propertyName, const QVariant &propertyValue)
+{
+ Q_D(QWaylandWindowManagerIntegration);
+ if (d->m_blockPropertyUpdates)
+ return;
+
+ if (window->wl_surface()) {
+ wl_array data = writePropertyValue(propertyValue);
+ wl_windowmanager_update_generic_property(d->m_waylandWindowManager, window->wl_surface(),
+ propertyName.toLatin1().constData(),
+ &data);
+ } else {
+ QVariantMap props = d->m_queuedProperties.value(window);
+ props.insert(propertyName, propertyValue);
+ d->m_queuedProperties.insert(window, props);
+ // ### TODO we'll need to add listening to destroyed() of QWindow that owns QWaylandWindow
+ // once refactor changes are in, and connect to removeQueuedPropertiesForWindow().
}
}
+void QWaylandWindowManagerIntegration::flushPropertyChanges(QWaylandWindow *windowToFlush)
+{
+ // write all changes we got while we did not have a surface.
+ // this can happen during startup, for example, or while the window is hidden.
+ Q_D(QWaylandWindowManagerIntegration);
+
+ if (!windowToFlush)
+ return;
+
+ QVariantMap properties = d->m_queuedProperties.value(windowToFlush);
+ wl_surface *surface = windowToFlush->wl_surface();
+
+ QMapIterator<QString, QVariant> pIt(properties);
+ while (pIt.hasNext()) {
+ pIt.next();
+ wl_array data = writePropertyValue(pIt.value());
+ wl_windowmanager_update_generic_property(d->m_waylandWindowManager, surface, pIt.key().toLatin1().constData(), &data);
+ }
+
+ d->m_queuedProperties.clear();
+}
+
+void QWaylandWindowManagerIntegration::removeQueuedPropertiesForWindow()
+{
+ // TODO enable this later once refactor changes are in.
+// Q_D(QWaylandWindowManagerIntegration);
+// QWaylandWindow *window = 0;
+// d->m_queuedProperties.remove(window);
+}
+
void QWaylandWindowManagerIntegration::wlHandleOnScreenVisibilityChange(void *data, struct wl_windowmanager *wl_windowmanager, int visible)
{
Q_UNUSED(data);
@@ -120,3 +219,45 @@ void QWaylandWindowManagerIntegration::wlHandleScreenOrientationChange(void *dat
QScreenOrientationChangeEvent event(screenOrientation);
QCoreApplication::sendEvent(QCoreApplication::instance(), &event);
}
+
+void QWaylandWindowManagerIntegration::wlHandleWindowPropertyChange(void *data, struct wl_windowmanager *wl_windowmanager,
+ struct wl_surface *surface,
+ const char *propertyName, struct wl_array *propertyValue)
+{
+ // window manager changes a window property
+ Q_UNUSED(data);
+ Q_UNUSED(wl_windowmanager);
+
+ QVariant variantValue;
+ QByteArray baValue = QByteArray((const char*)propertyValue->data, propertyValue->size);
+ QDataStream ds(&baValue, QIODevice::ReadOnly);
+ ds >> variantValue;
+
+ QPlatformNativeInterface *nativeInterface = qApp->platformNativeInterface();
+ QWaylandWindowManagerIntegration *inst = QWaylandWindowManagerIntegration::instance();
+
+ QList<QWindow *> windows = qApp->topLevelWindows();
+ foreach (QWindow *window, windows) {
+ QPlatformWindow *platformWindowForWindow = window->handle();
+ if (!platformWindowForWindow)
+ continue;
+ QWaylandWindow *waylandWindow = static_cast<QWaylandWindow*>(platformWindowForWindow);
+ wl_surface *windowSurface = (wl_surface*)nativeInterface->nativeResourceForWindow(QByteArray("surface"), window);
+ if (windowSurface == surface) {
+ inst->handleWindowPropertyChange(waylandWindow, QString(propertyName), variantValue);
+ break;
+ }
+ }
+}
+
+void QWaylandWindowManagerIntegration::handleWindowPropertyChange(QWaylandWindow *window,
+ const QString &propertyName, const QVariant &propertyValue)
+{
+ Q_D(QWaylandWindowManagerIntegration);
+ d->m_blockPropertyUpdates = true;
+
+ QPlatformNativeInterface *nativeInterface = qApp->platformNativeInterface();
+ nativeInterface->setWindowProperty(window, propertyName, propertyValue);
+
+ d->m_blockPropertyUpdates = false;
+}
diff --git a/src/plugins/platforms/wayland/windowmanager_integration/qwaylandwindowmanagerintegration.h b/src/plugins/platforms/wayland/windowmanager_integration/qwaylandwindowmanagerintegration.h
index 6b4658c7e1..1372fb81b8 100644
--- a/src/plugins/platforms/wayland/windowmanager_integration/qwaylandwindowmanagerintegration.h
+++ b/src/plugins/platforms/wayland/windowmanager_integration/qwaylandwindowmanagerintegration.h
@@ -42,21 +42,37 @@
#ifndef QWAYLANDWINDOWMANAGERINTEGRATION_H
#define QWAYLANDWINDOWMANAGERINTEGRATION_H
-#include <QObject>
+#include <QtCore/QObject>
+#include <QtCore/QScopedPointer>
+
#include "wayland-client.h"
#include "qwaylanddisplay.h"
-class QWaylandWindowManagerIntegration
+class QWaylandWindow;
+
+class QWaylandWindowManagerIntegrationPrivate;
+
+class QWaylandWindowManagerIntegration : public QObject
{
+ Q_OBJECT
+ Q_DECLARE_PRIVATE(QWaylandWindowManagerIntegration)
public:
explicit QWaylandWindowManagerIntegration(QWaylandDisplay *waylandDisplay);
virtual ~QWaylandWindowManagerIntegration();
static QWaylandWindowManagerIntegration *createIntegration(QWaylandDisplay *waylandDisplay);
struct wl_windowmanager *windowManager() const;
+ static QWaylandWindowManagerIntegration *instance();
+
void mapSurfaceToProcess(struct wl_surface *surface, long long processId);
void mapClientToProcess(long long processId);
void authenticateWithToken(const QByteArray &token = QByteArray());
+ void setWindowProperty(QWaylandWindow *window, const QString &propertyName, const QVariant &propertyValue);
+
+ void flushPropertyChanges(QWaylandWindow *windowToFlush);
+
+private slots:
+ void removeQueuedPropertiesForWindow();
private:
static void wlHandleListenerGlobal(wl_display *display, uint32_t id,
@@ -64,12 +80,17 @@ private:
static void wlHandleOnScreenVisibilityChange(void *data, struct wl_windowmanager *wl_windowmanager, int visible);
static void wlHandleScreenOrientationChange(void *data, struct wl_windowmanager *wl_windowmanager, int screenOrientation);
-private:
+ static void wlHandleWindowPropertyChange(void *data, struct wl_windowmanager *wl_windowmanager,
+ struct wl_surface *surface,
+ const char *propertyName, struct wl_array *propertyValue);
- QWaylandDisplay *mWaylandDisplay;
- struct wl_windowmanager *mWaylandWindowManager;
+ void handleWindowPropertyChange(QWaylandWindow *window, const QString &propertyName, const QVariant &propertyValue);
+
+private:
+ QScopedPointer<QWaylandWindowManagerIntegrationPrivate> d_ptr;
+ static QWaylandWindowManagerIntegration *m_instance;
- static const struct wl_windowmanager_listener mWindowManagerListener;
+ static const struct wl_windowmanager_listener m_windowManagerListener;
};
#endif // QWAYLANDWINDOWMANAGERINTEGRATION_H
diff --git a/src/plugins/platforms/wayland/windowmanager_integration/wayland-windowmanager-client-protocol.h b/src/plugins/platforms/wayland/windowmanager_integration/wayland-windowmanager-client-protocol.h
new file mode 100644
index 0000000000..034c08f28a
--- /dev/null
+++ b/src/plugins/platforms/wayland/windowmanager_integration/wayland-windowmanager-client-protocol.h
@@ -0,0 +1,96 @@
+#ifndef WAYLAND_WINDOWMANAGER_CLIENT_PROTOCOL_H
+#define WAYLAND_WINDOWMANAGER_CLIENT_PROTOCOL_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <stdint.h>
+#include <stddef.h>
+#include "wayland-util.h"
+
+struct wl_client;
+
+struct wl_windowmanager;
+
+extern const struct wl_interface wl_windowmanager_interface;
+
+struct wl_windowmanager_listener {
+ void (*client_onscreen_visibility)(void *data,
+ struct wl_windowmanager *wl_windowmanager,
+ int32_t visible);
+ void (*set_screen_rotation)(void *data,
+ struct wl_windowmanager *wl_windowmanager,
+ int32_t rotation);
+ void (*set_generic_property)(void *data,
+ struct wl_windowmanager *wl_windowmanager,
+ struct wl_surface *surface,
+ const char *name,
+ struct wl_array *value);
+};
+
+static inline int
+wl_windowmanager_add_listener(struct wl_windowmanager *wl_windowmanager,
+ const struct wl_windowmanager_listener *listener, void *data)
+{
+ return wl_proxy_add_listener((struct wl_proxy *) wl_windowmanager,
+ (void (**)(void)) listener, data);
+}
+
+#define WL_WINDOWMANAGER_MAP_CLIENT_TO_PROCESS 0
+#define WL_WINDOWMANAGER_AUTHENTICATE_WITH_TOKEN 1
+#define WL_WINDOWMANAGER_UPDATE_GENERIC_PROPERTY 2
+
+static inline struct wl_windowmanager *
+wl_windowmanager_create(struct wl_display *display, uint32_t id, uint32_t version)
+{
+ wl_display_bind(display, id, "wl_windowmanager", version);
+
+ return (struct wl_windowmanager *)
+ wl_proxy_create_for_id(display, &wl_windowmanager_interface, id);
+}
+
+static inline void
+wl_windowmanager_set_user_data(struct wl_windowmanager *wl_windowmanager, void *user_data)
+{
+ wl_proxy_set_user_data((struct wl_proxy *) wl_windowmanager, user_data);
+}
+
+static inline void *
+wl_windowmanager_get_user_data(struct wl_windowmanager *wl_windowmanager)
+{
+ return wl_proxy_get_user_data((struct wl_proxy *) wl_windowmanager);
+}
+
+static inline void
+wl_windowmanager_destroy(struct wl_windowmanager *wl_windowmanager)
+{
+ wl_proxy_destroy((struct wl_proxy *) wl_windowmanager);
+}
+
+static inline void
+wl_windowmanager_map_client_to_process(struct wl_windowmanager *wl_windowmanager, uint32_t processid)
+{
+ wl_proxy_marshal((struct wl_proxy *) wl_windowmanager,
+ WL_WINDOWMANAGER_MAP_CLIENT_TO_PROCESS, processid);
+}
+
+static inline void
+wl_windowmanager_authenticate_with_token(struct wl_windowmanager *wl_windowmanager, const char *processid)
+{
+ wl_proxy_marshal((struct wl_proxy *) wl_windowmanager,
+ WL_WINDOWMANAGER_AUTHENTICATE_WITH_TOKEN, processid);
+}
+
+static inline void
+wl_windowmanager_update_generic_property(struct wl_windowmanager *wl_windowmanager, struct wl_surface *surface, const char *name, struct wl_array *value)
+{
+ wl_proxy_marshal((struct wl_proxy *) wl_windowmanager,
+ WL_WINDOWMANAGER_UPDATE_GENERIC_PROPERTY, surface, name, value);
+}
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/src/plugins/platforms/wayland/windowmanager_integration/wayland-windowmanager-protocol.c b/src/plugins/platforms/wayland/windowmanager_integration/wayland-windowmanager-protocol.c
index 8125dec4d3..1d231f5d22 100644
--- a/src/plugins/platforms/wayland/windowmanager_integration/wayland-windowmanager-protocol.c
+++ b/src/plugins/platforms/wayland/windowmanager_integration/wayland-windowmanager-protocol.c
@@ -1,38 +1,29 @@
-/*
- * Copyright © 2010 Kristian Høgsberg
- *
- * Permission to use, copy, modify, distribute, and sell this software and its
- * documentation for any purpose is hereby granted without fee, provided that
- * the above copyright notice appear in all copies and that both that copyright
- * notice and this permission notice appear in supporting documentation, and
- * that the name of the copyright holders not be used in advertising or
- * publicity pertaining to distribution of the software without specific,
- * written prior permission. The copyright holders make no representations
- * about the suitability of this software for any purpose. It is provided "as
- * is" without express or implied warranty.
- *
- * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
- * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
- * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
- * OF THIS SOFTWARE.
- */
-
-
#include <stdlib.h>
#include <stdint.h>
#include "wayland-util.h"
+extern const struct wl_interface wl_surface_interface;
+
+static const struct wl_interface *types[] = {
+ NULL,
+ &wl_surface_interface,
+ NULL,
+ NULL,
+ &wl_surface_interface,
+ NULL,
+ NULL,
+};
+
static const struct wl_message wl_windowmanager_requests[] = {
- { "map_client_to_process", "u", NULL },
- { "authenticate_with_token", "s", NULL },
+ { "map_client_to_process", "u", types + 0 },
+ { "authenticate_with_token", "s", types + 0 },
+ { "update_generic_property", "osa", types + 1 },
};
static const struct wl_message wl_windowmanager_events[] = {
- { "client_onscreen_visibility", "i", NULL },
- { "set_screen_rotation", "i", NULL },
+ { "client_onscreen_visibility", "i", types + 0 },
+ { "set_screen_rotation", "i", types + 0 },
+ { "set_generic_property", "osa", types + 4 },
};
WL_EXPORT const struct wl_interface wl_windowmanager_interface = {
diff --git a/src/plugins/platforms/wayland/windowmanager_integration/windowmanager_integration.pri b/src/plugins/platforms/wayland/windowmanager_integration/windowmanager_integration.pri
index a28218272d..45118b5d50 100644
--- a/src/plugins/platforms/wayland/windowmanager_integration/windowmanager_integration.pri
+++ b/src/plugins/platforms/wayland/windowmanager_integration/windowmanager_integration.pri
@@ -3,7 +3,7 @@ DEFINES += QT_WAYLAND_WINDOWMANAGER_SUPPORT
contains(DEFINES, QT_WAYLAND_WINDOWMANAGER_SUPPORT) {
HEADERS += \
- $$PWD/qwaylandwindowmanager-client-protocol.h \
+ $$PWD/wayland-windowmanager-client-protocol.h \
$$PWD/qwaylandwindowmanagerintegration.h
SOURCES += \
diff --git a/src/src.pro b/src/src.pro
index a531355ae9..4263c0eb92 100644
--- a/src/src.pro
+++ b/src/src.pro
@@ -15,7 +15,7 @@ nacl: SRC_SUBDIRS -= src_network src_testlib
!symbian:contains(QT_CONFIG, dbus):SRC_SUBDIRS += src_dbus
contains(QT_CONFIG, no-gui): SRC_SUBDIRS -= src_gui
-!contains(QT_CONFIG, no-v8): SRC_SUBDIRS += src_v8
+contains(QT_CONFIG, v8): SRC_SUBDIRS += src_v8
contains(QT_CONFIG, opengl)|contains(QT_CONFIG, opengles1)|contains(QT_CONFIG, opengles2): SRC_SUBDIRS += src_opengl
SRC_SUBDIRS += src_plugins
diff --git a/src/testlib/qabstracttestlogger.cpp b/src/testlib/qabstracttestlogger.cpp
index d71addb655..e2f253c22e 100644
--- a/src/testlib/qabstracttestlogger.cpp
+++ b/src/testlib/qabstracttestlogger.cpp
@@ -54,18 +54,8 @@
QT_BEGIN_NAMESPACE
-void QAbstractTestLogger::outputString(const char *msg)
+QAbstractTestLogger::QAbstractTestLogger(const char *filename)
{
- QTEST_ASSERT(stream);
-
- ::fputs(msg, stream);
- ::fflush(stream);
-}
-
-void QAbstractTestLogger::startLogging(const char *filename)
-{
- QTEST_ASSERT(!stream);
-
if (!filename) {
stream = stdout;
return;
@@ -81,7 +71,7 @@ void QAbstractTestLogger::startLogging(const char *filename)
}
}
-void QAbstractTestLogger::stopLogging()
+QAbstractTestLogger::~QAbstractTestLogger()
{
QTEST_ASSERT(stream);
if (stream != stdout) {
@@ -97,6 +87,22 @@ void QAbstractTestLogger::stopLogging()
stream = 0;
}
+void QAbstractTestLogger::outputString(const char *msg)
+{
+ QTEST_ASSERT(stream);
+
+ ::fputs(msg, stream);
+ ::fflush(stream);
+}
+
+void QAbstractTestLogger::startLogging()
+{
+}
+
+void QAbstractTestLogger::stopLogging()
+{
+}
+
namespace QTest
{
diff --git a/src/testlib/qabstracttestlogger_p.h b/src/testlib/qabstracttestlogger_p.h
index 3ac6787754..3e11863012 100644
--- a/src/testlib/qabstracttestlogger_p.h
+++ b/src/testlib/qabstracttestlogger_p.h
@@ -80,10 +80,10 @@ public:
Info
};
- QAbstractTestLogger() : stream(0) {}
- virtual ~QAbstractTestLogger() {}
+ QAbstractTestLogger(const char *filename);
+ virtual ~QAbstractTestLogger();
- virtual void startLogging(const char *filename);
+ virtual void startLogging();
virtual void stopLogging();
virtual void enterTestFunction(const char *function) = 0;
@@ -98,7 +98,7 @@ public:
void outputString(const char *msg);
-private:
+protected:
FILE *stream;
};
diff --git a/src/testlib/qbenchmark.cpp b/src/testlib/qbenchmark.cpp
index 1cb10a7ac6..49fad5da4d 100644
--- a/src/testlib/qbenchmark.cpp
+++ b/src/testlib/qbenchmark.cpp
@@ -119,7 +119,6 @@ QBenchmarkTestMethodData *QBenchmarkTestMethodData::current;
QBenchmarkTestMethodData::QBenchmarkTestMethodData()
:resultAccepted(false), runOnce(false), iterationCount(-1)
{
-
}
QBenchmarkTestMethodData::~QBenchmarkTestMethodData()
@@ -134,7 +133,6 @@ void QBenchmarkTestMethodData::beginDataRun()
void QBenchmarkTestMethodData::endDataRun()
{
-
}
int QBenchmarkTestMethodData::adjustIterationCount(int suggestion)
@@ -164,7 +162,7 @@ void QBenchmarkTestMethodData::setResult(
accepted = true;
}
- // Test the result directly without calling the measurer if the minimum time
+ // Test the result directly without calling the measurer if the minimum time
// has been specified on the command line with -minimumvalue.
else if (QBenchmarkGlobalData::current->walltimeMinimum != -1)
accepted = (value > QBenchmarkGlobalData::current->walltimeMinimum);
@@ -196,7 +194,7 @@ QTest::QBenchmarkIterationController::QBenchmarkIterationController(RunMode runM
{
i = 0;
if (runMode == RunOnce)
- QBenchmarkTestMethodData::current->runOnce = true;
+ QBenchmarkTestMethodData::current->runOnce = true;
QTest::beginBenchmarkMeasurement();
}
@@ -265,16 +263,16 @@ void QTest::beginBenchmarkMeasurement()
quint64 QTest::endBenchmarkMeasurement()
{
// the clock is ticking before the line below, don't add code here.
- return QBenchmarkGlobalData::current->measurer->stop();
+ return QBenchmarkGlobalData::current->measurer->stop();
}
/*!
Sets the benchmark result for this test function to \a result.
-
+
Use this function if you want to report benchmark results without
using the QBENCHMARK macro. Use \a metric to specify how QTestLib
should interpret the results.
-
+
The context for the result will be the test function name and any
data tag from the _data function. This function can only be called
once in each test function, subsequent calls will replace the
diff --git a/src/testlib/qbenchmark_p.h b/src/testlib/qbenchmark_p.h
index e5e07c0035..36e4b35493 100644
--- a/src/testlib/qbenchmark_p.h
+++ b/src/testlib/qbenchmark_p.h
@@ -58,7 +58,7 @@
#include <QtCore/qglobal.h>
#if (defined(Q_OS_LINUX) || defined Q_OS_MAC) && !defined(QT_NO_PROCESS)
-#define QTESTLIB_USE_VALGRIND
+#define QTESTLIB_USE_VALGRIND
#else
#undef QTESTLIB_USE_VALGRIND
#endif
@@ -119,7 +119,7 @@ public:
, valid(true)
{ }
- bool operator<(const QBenchmarkResult &other) const
+ bool operator<(const QBenchmarkResult &other) const
{
return (value / iterations) < (other.value / other.iterations);
}
diff --git a/src/testlib/qbenchmarkevent_p.h b/src/testlib/qbenchmarkevent_p.h
index fc0729e82f..2cf17ea6a2 100644
--- a/src/testlib/qbenchmarkevent_p.h
+++ b/src/testlib/qbenchmarkevent_p.h
@@ -69,12 +69,12 @@ public:
bool isMeasurementAccepted(qint64 measurement);
int adjustIterationCount(int suggestion);
int adjustMedianCount(int suggestion);
- bool repeatCount() { return 1; }
+ bool repeatCount() { return 1; }
QTest::QBenchmarkMetric metricType();
static bool eventCountingMechanism(void *message);
static qint64 eventCounter;
};
QT_END_NAMESPACE
-
+
#endif // QBENCHMARKEVENT_H
diff --git a/src/testlib/qbenchmarkmeasurement.cpp b/src/testlib/qbenchmarkmeasurement.cpp
index 4aad71da34..2c14f5d3fe 100644
--- a/src/testlib/qbenchmarkmeasurement.cpp
+++ b/src/testlib/qbenchmarkmeasurement.cpp
@@ -60,7 +60,7 @@ qint64 QBenchmarkTimeMeasurer::checkpoint()
}
qint64 QBenchmarkTimeMeasurer::stop()
-{
+{
return time.elapsed();
}
@@ -70,8 +70,8 @@ bool QBenchmarkTimeMeasurer::isMeasurementAccepted(qint64 measurement)
}
int QBenchmarkTimeMeasurer::adjustIterationCount(int suggestion)
-{
- return suggestion;
+{
+ return suggestion;
}
bool QBenchmarkTimeMeasurer::needsWarmupIteration()
@@ -80,8 +80,8 @@ bool QBenchmarkTimeMeasurer::needsWarmupIteration()
}
int QBenchmarkTimeMeasurer::adjustMedianCount(int)
-{
- return 1;
+{
+ return 1;
}
QTest::QBenchmarkMetric QBenchmarkTimeMeasurer::metricType()
@@ -114,18 +114,18 @@ bool QBenchmarkTickMeasurer::isMeasurementAccepted(qint64)
}
int QBenchmarkTickMeasurer::adjustIterationCount(int)
-{
- return 1;
+{
+ return 1;
}
int QBenchmarkTickMeasurer::adjustMedianCount(int)
-{
- return 1;
+{
+ return 1;
}
bool QBenchmarkTickMeasurer::needsWarmupIteration()
-{
- return true;
+{
+ return true;
}
QTest::QBenchmarkMetric QBenchmarkTickMeasurer::metricType()
diff --git a/src/testlib/qbenchmarkmeasurement_p.h b/src/testlib/qbenchmarkmeasurement_p.h
index 8242365f20..6d7d8c6c0d 100644
--- a/src/testlib/qbenchmarkmeasurement_p.h
+++ b/src/testlib/qbenchmarkmeasurement_p.h
@@ -72,8 +72,8 @@ public:
virtual bool isMeasurementAccepted(qint64 measurement) = 0;
virtual int adjustIterationCount(int suggestion) = 0;
virtual int adjustMedianCount(int suggestion) = 0;
- virtual bool repeatCount() { return 1; }
- virtual bool needsWarmupIteration() { return false; }
+ virtual bool repeatCount() { return 1; }
+ virtual bool needsWarmupIteration() { return false; }
virtual QTest::QBenchmarkMetric metricType() = 0;
};
diff --git a/src/testlib/qbenchmarkmetric.cpp b/src/testlib/qbenchmarkmetric.cpp
index d4efe84989..fb7f8f857a 100644
--- a/src/testlib/qbenchmarkmetric.cpp
+++ b/src/testlib/qbenchmarkmetric.cpp
@@ -46,7 +46,7 @@
\since 4.7
This enum lists all the things that can be benchmarked.
-
+
\value FramesPerSecond Frames per second
\value BitsPerSecond Bits per second
\value BytesPerSecond Bytes per second
diff --git a/src/testlib/qbenchmarkvalgrind.cpp b/src/testlib/qbenchmarkvalgrind.cpp
index 4b260e8597..7e43d555e0 100644
--- a/src/testlib/qbenchmarkvalgrind.cpp
+++ b/src/testlib/qbenchmarkvalgrind.cpp
@@ -238,7 +238,7 @@ qint64 QBenchmarkCallgrindMeasurer::checkpoint()
}
qint64 QBenchmarkCallgrindMeasurer::stop()
-{
+{
return checkpoint();
}
@@ -249,17 +249,17 @@ bool QBenchmarkCallgrindMeasurer::isMeasurementAccepted(qint64 measurement)
}
int QBenchmarkCallgrindMeasurer::adjustIterationCount(int)
-{
+{
return 1;
}
int QBenchmarkCallgrindMeasurer::adjustMedianCount(int)
-{
+{
return 1;
}
bool QBenchmarkCallgrindMeasurer::needsWarmupIteration()
-{
+{
return true;
}
diff --git a/src/testlib/qplaintestlogger.cpp b/src/testlib/qplaintestlogger.cpp
index bd1bc11582..14fa752c40 100644
--- a/src/testlib/qplaintestlogger.cpp
+++ b/src/testlib/qplaintestlogger.cpp
@@ -211,7 +211,7 @@ void QPlainTestLogger::outputMessage(const char *str)
OutputDebugString((wchar_t*)tmp.utf16());
strUtf16.remove(0, maxOutputLength);
} while (!strUtf16.isEmpty());
- if (QTestLog::outputFileName())
+ if (stream != stdout)
#elif defined(Q_OS_WIN)
EnterCriticalSection(&QTest::outputCriticalSection);
// OutputDebugString is not threadsafe
@@ -344,7 +344,8 @@ void QPlainTestLogger::printBenchmarkResult(const QBenchmarkResult &result)
outputMessage(buf);
}
-QPlainTestLogger::QPlainTestLogger()
+QPlainTestLogger::QPlainTestLogger(const char *filename)
+ : QAbstractTestLogger(filename)
{
#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE)
InitializeCriticalSection(&QTest::outputCriticalSection);
@@ -358,9 +359,9 @@ QPlainTestLogger::~QPlainTestLogger()
#endif
}
-void QPlainTestLogger::startLogging(const char *filename)
+void QPlainTestLogger::startLogging()
{
- QAbstractTestLogger::startLogging(filename);
+ QAbstractTestLogger::startLogging();
char buf[1024];
if (QTestLog::verboseLevel() < 0) {
diff --git a/src/testlib/qplaintestlogger_p.h b/src/testlib/qplaintestlogger_p.h
index baa1e24828..432e900320 100644
--- a/src/testlib/qplaintestlogger_p.h
+++ b/src/testlib/qplaintestlogger_p.h
@@ -60,10 +60,10 @@ QT_BEGIN_NAMESPACE
class QPlainTestLogger : public QAbstractTestLogger
{
public:
- QPlainTestLogger();
+ QPlainTestLogger(const char *filename);
~QPlainTestLogger();
- void startLogging(const char *filename);
+ void startLogging();
void stopLogging();
void enterTestFunction(const char *function);
diff --git a/src/testlib/qtestassert.h b/src/testlib/qtestassert.h
index fa1ee0caec..24edab278d 100644
--- a/src/testlib/qtestassert.h
+++ b/src/testlib/qtestassert.h
@@ -50,9 +50,9 @@ QT_BEGIN_NAMESPACE
QT_MODULE(Test)
-#define QTEST_ASSERT(cond) do {if(!(cond))qt_assert(#cond,__FILE__,__LINE__);} while (0)
+#define QTEST_ASSERT(cond) do { if (!(cond)) qt_assert(#cond,__FILE__,__LINE__); } while (0)
-#define QTEST_ASSERT_X(cond, where, what) do {if(!(cond))qt_assert_x(where, what,__FILE__,__LINE__);} while (0)
+#define QTEST_ASSERT_X(cond, where, what) do { if (!(cond)) qt_assert_x(where, what,__FILE__,__LINE__); } while (0)
QT_END_NAMESPACE
diff --git a/src/testlib/qtestbasicstreamer.cpp b/src/testlib/qtestbasicstreamer.cpp
deleted file mode 100644
index d371b4d08e..0000000000
--- a/src/testlib/qtestbasicstreamer.cpp
+++ /dev/null
@@ -1,165 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtTest module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qtestbasicstreamer.h"
-#include "qtestlogger_p.h"
-#include "qtestelement.h"
-#include "qtestelementattribute.h"
-#include "qtestassert.h"
-
-#include <stdio.h>
-#include <stdlib.h>
-
-#ifndef Q_OS_WIN
-#include <unistd.h>
-#endif
-
-QT_BEGIN_NAMESPACE
-
-QTestBasicStreamer::QTestBasicStreamer(QTestLogger *logger)
- :testLogger(logger)
-{
- QTEST_ASSERT(testLogger);
-}
-
-QTestBasicStreamer::~QTestBasicStreamer()
-{}
-
-void QTestBasicStreamer::formatStart(const QTestElement *element, QTestCharBuffer *formatted) const
-{
- if(!element || !formatted )
- return;
- formatted->data()[0] = '\0';
-}
-
-void QTestBasicStreamer::formatEnd(const QTestElement *element, QTestCharBuffer *formatted) const
-{
- if(!element || !formatted )
- return;
- formatted->data()[0] = '\0';
-}
-
-void QTestBasicStreamer::formatBeforeAttributes(const QTestElement *element, QTestCharBuffer *formatted) const
-{
- if(!element || !formatted )
- return;
- formatted->data()[0] = '\0';
-}
-
-void QTestBasicStreamer::formatAfterAttributes(const QTestElement *element, QTestCharBuffer *formatted) const
-{
- if(!element || !formatted )
- return;
- formatted->data()[0] = '\0';
-}
-
-void QTestBasicStreamer::formatAttributes(const QTestElement *, const QTestElementAttribute *attribute, QTestCharBuffer *formatted) const
-{
- if(!attribute || !formatted )
- return;
- formatted->data()[0] = '\0';
-}
-
-void QTestBasicStreamer::output(QTestElement *element) const
-{
- if(!element)
- return;
-
- outputElements(element);
-}
-
-void QTestBasicStreamer::outputElements(QTestElement *element, bool) const
-{
- QTestCharBuffer buf;
- bool hasChildren;
- /*
- Elements are in reverse order of occurrence, so start from the end and work
- our way backwards.
- */
- while (element && element->nextElement()) {
- element = element->nextElement();
- }
- while (element) {
- hasChildren = element->childElements();
-
- formatStart(element, &buf);
- outputString(buf.data());
-
- formatBeforeAttributes(element, &buf);
- outputString(buf.data());
-
- outputElementAttributes(element, element->attributes());
-
- formatAfterAttributes(element, &buf);
- outputString(buf.data());
-
- if(hasChildren)
- outputElements(element->childElements(), true);
-
- formatEnd(element, &buf);
- outputString(buf.data());
-
- element = element->previousElement();
- }
-}
-
-void QTestBasicStreamer::outputElementAttributes(const QTestElement* element, QTestElementAttribute *attribute) const
-{
- QTestCharBuffer buf;
- while(attribute){
- formatAttributes(element, attribute, &buf);
- outputString(buf.data());
- attribute = attribute->nextElement();
- }
-}
-
-void QTestBasicStreamer::outputString(const char *msg) const
-{
- testLogger->outputString(msg);
-}
-
-QTestLogger *QTestBasicStreamer::logger() const
-{
- return testLogger;
-}
-
-QT_END_NAMESPACE
-
diff --git a/src/testlib/qtestbasicstreamer.h b/src/testlib/qtestbasicstreamer.h
deleted file mode 100644
index 04bc40638f..0000000000
--- a/src/testlib/qtestbasicstreamer.h
+++ /dev/null
@@ -1,87 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtTest module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QTESTBASICSTREAMER_H
-#define QTESTBASICSTREAMER_H
-
-#include <QtCore/qglobal.h>
-
-QT_BEGIN_HEADER
-
-QT_BEGIN_NAMESPACE
-
-QT_MODULE(Test)
-
-class QTestElement;
-class QTestElementAttribute;
-class QTestLogger;
-struct QTestCharBuffer;
-
-class QTestBasicStreamer
-{
- public:
- QTestBasicStreamer(QTestLogger *logger);
- virtual ~QTestBasicStreamer();
-
- virtual void output(QTestElement *element) const;
-
- void outputString(const char *msg) const;
-
- QTestLogger *logger() const;
-
- protected:
- virtual void formatStart(const QTestElement *element, QTestCharBuffer *formatted) const;
- virtual void formatEnd(const QTestElement *element, QTestCharBuffer *formatted) const;
- virtual void formatBeforeAttributes(const QTestElement *element, QTestCharBuffer *formatted) const;
- virtual void formatAfterAttributes(const QTestElement *element, QTestCharBuffer *formatted) const;
- virtual void formatAttributes(const QTestElement *element, const QTestElementAttribute *attribute, QTestCharBuffer *formatted) const;
- virtual void outputElements(QTestElement *element, bool isChildElement = false) const;
- virtual void outputElementAttributes(const QTestElement *element, QTestElementAttribute *attribute) const;
-
- private:
- QTestLogger *testLogger;
-};
-
-QT_END_NAMESPACE
-
-QT_END_HEADER
-
-#endif
diff --git a/src/testlib/qtestcase.cpp b/src/testlib/qtestcase.cpp
index 3802794281..9bb591989d 100644
--- a/src/testlib/qtestcase.cpp
+++ b/src/testlib/qtestcase.cpp
@@ -1000,40 +1000,44 @@ static int qToInt(char *str)
Q_TESTLIB_EXPORT void qtest_qParseArgs(int argc, char *argv[], bool qml)
{
+ QTestLog::LogMode logFormat = QTestLog::Plain;
+ const char *logFilename = 0;
+
const char *testOptions =
- " options:\n"
- " -functions : Returns a list of current testfunctions\n"
- " -xunitxml : Outputs results as XML XUnit document\n"
- " -xml : Outputs results as XML document\n"
- " -lightxml : Outputs results as stream of XML tags\n"
- " -flush : Flushes the results\n"
- " -o filename: Writes all output into a file\n"
- " -silent : Only outputs warnings and failures\n"
- " -v1 : Print enter messages for each testfunction\n"
- " -v2 : Also print out each QVERIFY/QCOMPARE/QTEST\n"
- " -vs : Print every signal emitted\n"
- " -eventdelay ms : Set default delay for mouse and keyboard simulation to ms milliseconds\n"
- " -keydelay ms : Set default delay for keyboard simulation to ms milliseconds\n"
- " -mousedelay ms : Set default delay for mouse simulation to ms milliseconds\n"
- " -keyevent-verbose : Turn on verbose messages for keyboard simulation\n"
- " -maxwarnings n : Sets the maximum amount of messages to output.\n"
- " 0 means unlimited, default: 2000\n"
+ " Output options:\n"
+ " -xunitxml : Outputs results as XML XUnit document\n"
+ " -xml : Outputs results as XML document\n"
+ " -lightxml : Outputs results as stream of XML tags\n"
+ " -o filename : Writes all output into a file\n"
+ " -silent : Only outputs warnings and failures\n"
+ " -v1 : Print enter messages for each testfunction\n"
+ " -v2 : Also print out each QVERIFY/QCOMPARE/QTEST\n"
+ " -vs : Print every signal emitted\n"
+ "\n"
+ " Testing options:\n"
+ " -functions : Returns a list of current testfunctions\n"
+ " -eventdelay ms : Set default delay for mouse and keyboard simulation to ms milliseconds\n"
+ " -keydelay ms : Set default delay for keyboard simulation to ms milliseconds\n"
+ " -mousedelay ms : Set default delay for mouse simulation to ms milliseconds\n"
+ " -keyevent-verbose : Turn on verbose messages for keyboard simulation\n"
+ " -maxwarnings n : Sets the maximum amount of messages to output.\n"
+ " 0 means unlimited, default: 2000\n"
#if defined(Q_OS_UNIX) && !defined(Q_OS_SYMBIAN)
- " -nocrashhandler : Disables the crash handler\n"
+ " -nocrashhandler : Disables the crash handler\n"
#endif
"\n"
- " Benchmark related options:\n"
+ " Benchmarking options:\n"
#ifdef QTESTLIB_USE_VALGRIND
- " -callgrind : Use callgrind to time benchmarks\n"
+ " -callgrind : Use callgrind to time benchmarks\n"
#endif
#ifdef HAVE_TICK_COUNTER
- " -tickcounter : Use CPU tick counters to time benchmarks\n"
+ " -tickcounter : Use CPU tick counters to time benchmarks\n"
#endif
- " -eventcounter : Counts events received during benchmarks\n"
- " -minimumvalue n : Sets the minimum acceptable measurement value\n"
- " -iterations n : Sets the number of accumulation iterations.\n"
- " -median n : Sets the number of median iterations.\n"
- " -vb : Print out verbose benchmarking information.\n";
+ " -eventcounter : Counts events received during benchmarks\n"
+ " -minimumvalue n : Sets the minimum acceptable measurement value\n"
+ " -iterations n : Sets the number of accumulation iterations.\n"
+ " -median n : Sets the number of median iterations.\n"
+ " -vb : Print out verbose benchmarking information.\n";
for (int i = 1; i < argc; ++i) {
if (strcmp(argv[i], "-help") == 0 || strcmp(argv[i], "--help") == 0
@@ -1043,15 +1047,16 @@ Q_TESTLIB_EXPORT void qtest_qParseArgs(int argc, char *argv[], bool qml)
"%s", argv[0], testOptions);
if (qml) {
- printf ("\nqmltest related options:\n"
- " -import : Specify an import directory.\n"
- " -input : Specify the root directory for test cases.\n"
- " -qtquick1 : Run with QtQuick 1 rather than QtQuick 2.\n"
+ printf ("\n"
+ " QmlTest options:\n"
+ " -import : Specify an import directory.\n"
+ " -input : Specify the root directory for test cases.\n"
+ " -qtquick1 : Run with QtQuick 1 rather than QtQuick 2.\n"
);
}
printf("\n"
- " -help : This help\n");
+ " -help : This help\n");
exit(0);
} else if (strcmp(argv[i], "-functions") == 0) {
if (qml) {
@@ -1060,14 +1065,12 @@ Q_TESTLIB_EXPORT void qtest_qParseArgs(int argc, char *argv[], bool qml)
qPrintTestSlots(stdout);
exit(0);
}
- } else if(strcmp(argv[i], "-xunitxml") == 0){
- QTestLog::setLogMode(QTestLog::XunitXML);
+ } else if (strcmp(argv[i], "-xunitxml") == 0) {
+ logFormat = QTestLog::XunitXML;
} else if (strcmp(argv[i], "-xml") == 0) {
- QTestLog::setLogMode(QTestLog::XML);
+ logFormat = QTestLog::XML;
} else if (strcmp(argv[i], "-lightxml") == 0) {
- QTestLog::setLogMode(QTestLog::LightXML);
- } else if (strcmp(argv[i], "-flush") == 0){
- QTestLog::setFlushMode(QTestLog::FlushOn);
+ logFormat = QTestLog::LightXML;
} else if (strcmp(argv[i], "-silent") == 0) {
QTestLog::setVerboseLevel(-1);
} else if (strcmp(argv[i], "-v1") == 0) {
@@ -1081,7 +1084,7 @@ Q_TESTLIB_EXPORT void qtest_qParseArgs(int argc, char *argv[], bool qml)
fprintf(stderr, "-o needs an extra parameter specifying the filename\n");
exit(1);
} else {
- QTestLog::redirectOutput(argv[++i]);
+ logFilename = argv[++i];
}
} else if (strcmp(argv[i], "-eventdelay") == 0) {
if (i + 1 >= argc) {
@@ -1192,7 +1195,7 @@ Q_TESTLIB_EXPORT void qtest_qParseArgs(int argc, char *argv[], bool qml)
// we load the QML files. So just store the data for now.
int colon = -1;
int offset;
- for(offset = 0; *(argv[i]+offset); ++offset) {
+ for (offset = 0; *(argv[i]+offset); ++offset) {
if (*(argv[i]+offset) == ':') {
if (*(argv[i]+offset+1) == ':') {
// "::" is used as a test name separator.
@@ -1221,13 +1224,13 @@ Q_TESTLIB_EXPORT void qtest_qParseArgs(int argc, char *argv[], bool qml)
int colon = -1;
char buf[512], *data=0;
int off;
- for(off = 0; *(argv[i]+off); ++off) {
+ for (off = 0; *(argv[i]+off); ++off) {
if (*(argv[i]+off) == ':') {
colon = off;
break;
}
}
- if(colon != -1) {
+ if (colon != -1) {
data = qstrdup(argv[i]+colon+1);
}
QTest::qt_snprintf(buf, qMin(512, off + 1), "%s", argv[i]); // copy text before the ':' into buf
@@ -1244,6 +1247,9 @@ Q_TESTLIB_EXPORT void qtest_qParseArgs(int argc, char *argv[], bool qml)
QTEST_ASSERT(QTest::testFuncCount < 512);
}
}
+
+ // Create the logger
+ QTestLog::initLogger(logFormat, logFilename);
}
QBenchmarkResult qMedian(const QList<QBenchmarkResult> &container)
@@ -1428,7 +1434,7 @@ static bool qInvokeTestMethod(const char *slotName, const char *data=0)
if (data && !foundFunction) {
fprintf(stderr, "Unknown testdata for function %s: '%s'\n", slotName, data);
fprintf(stderr, "Available testdata:\n");
- for(int i = 0; i < table.dataCount(); ++i)
+ for (int i = 0; i < table.dataCount(); ++i)
fprintf(stderr, "%s\n", table.testData(i)->dataTag());
return false;
}
@@ -1479,7 +1485,7 @@ void *fetchData(QTestData *data, const char *tagName, int typeId)
*/
char *toHexRepresentation(const char *ba, int length)
{
- if(length == 0)
+ if (length == 0)
return qstrdup("");
/* We output at maximum about maxLen characters in order to avoid
@@ -1493,7 +1499,7 @@ char *toHexRepresentation(const char *ba, int length)
const int len = qMin(maxLen, length);
char *result = 0;
- if(length > maxLen) {
+ if (length > maxLen) {
const int size = len * 3 + 4;
result = new char[size];
@@ -1514,7 +1520,7 @@ char *toHexRepresentation(const char *ba, int length)
int i = 0;
int o = 0;
- while(true) {
+ while (true) {
const char at = ba[i];
result[o] = toHex[(at >> 4) & 0x0F];
@@ -1523,7 +1529,7 @@ char *toHexRepresentation(const char *ba, int length)
++i;
++o;
- if(i == len)
+ if (i == len)
break;
else {
result[o] = ' ';
@@ -1552,7 +1558,7 @@ static void qInvokeTestMethods(QObject *testObject)
const bool previousFailed = QTestResult::testFailed();
QTestResult::finishedCurrentTestFunction();
- if(!QTestResult::skipCurrentTest() && !previousFailed) {
+ if (!QTestResult::skipCurrentTest() && !previousFailed) {
if (QTest::testFuncs) {
for (int i = 0; i != QTest::testFuncCount; i++) {
@@ -1725,18 +1731,18 @@ int QTest::qExec(QObject *testObject, int argc, char **argv)
#endif
#ifdef Q_WS_MAC
- bool macNeedsActivate = qApp && (qstrcmp(qApp->metaObject()->className(), "QApplication") == 0);
+ bool macNeedsActivate = qApp && (qstrcmp(qApp->metaObject()->className(), "QApplication") == 0);
#ifdef QT_MAC_USE_COCOA
- IOPMAssertionID powerID;
+ IOPMAssertionID powerID;
#endif
#endif
#ifndef QT_NO_EXCEPTIONS
try {
#endif
- #if defined(Q_OS_WIN) && !defined(Q_OS_WINCE)
- SetErrorMode(SetErrorMode(0) | SEM_NOGPFAULTERRORBOX);
- #endif
+#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE)
+ SetErrorMode(SetErrorMode(0) | SEM_NOGPFAULTERRORBOX);
+#endif
#ifdef Q_WS_MAC
// Starting with Qt 4.4, applications launched from the command line
@@ -1745,13 +1751,13 @@ int QTest::qExec(QObject *testObject, int argc, char **argv)
if (macNeedsActivate) {
ProcessSerialNumber psn = { 0, kCurrentProcess };
SetFrontProcess(&psn);
-# ifdef QT_MAC_USE_COCOA
+#ifdef QT_MAC_USE_COCOA
IOReturn ok = IOPMAssertionCreate(kIOPMAssertionTypeNoDisplaySleep, kIOPMAssertionLevelOn, &powerID);
if (ok != kIOReturnSuccess)
macNeedsActivate = false; // no need to release the assertion on exit.
-# else
+#else
UpdateSystemActivity(1); // Wake the display.
-# endif
+#endif
}
#endif
@@ -1813,7 +1819,7 @@ int QTest::qExec(QObject *testObject, int argc, char **argv)
throw;
return 1;
}
-# endif
+#endif
currentTestObject = 0;
#ifdef QT_MAC_USE_COCOA
@@ -1846,7 +1852,7 @@ int QTest::qExec(QObject *testObject, const QStringList &arguments)
QVector<QByteArray> args;
args.reserve(argc);
- for(int i = 0; i < argc; ++i)
+ for (int i = 0; i < argc; ++i)
{
args.append(arguments.at(i).toLocal8Bit().constData());
argv[i] = args.last().data();
diff --git a/src/testlib/qtestcoreelement.h b/src/testlib/qtestcoreelement.h
index ecd088ad12..1d06c8d8cd 100644
--- a/src/testlib/qtestcoreelement.h
+++ b/src/testlib/qtestcoreelement.h
@@ -87,10 +87,7 @@ QTestCoreElement<ElementType>::~QTestCoreElement()
template <class ElementType>
void QTestCoreElement<ElementType>::addAttribute(const QTest::AttributeIndex attributeIndex, const char *value)
{
- if(attributeIndex == -1)
- return;
-
- if (attribute(attributeIndex))
+ if (attributeIndex == -1 || attribute(attributeIndex))
return;
QTestElementAttribute *testAttribute = new QTestElementAttribute;
@@ -108,7 +105,7 @@ template <class ElementType>
const char *QTestCoreElement<ElementType>::attributeValue(QTest::AttributeIndex index) const
{
const QTestElementAttribute *attrb = attribute(index);
- if(attrb)
+ if (attrb)
return attrb->value();
return 0;
@@ -118,7 +115,7 @@ template <class ElementType>
const char *QTestCoreElement<ElementType>::attributeName(QTest::AttributeIndex index) const
{
const QTestElementAttribute *attrb = attribute(index);
- if(attrb)
+ if (attrb)
return attrb->name();
return 0;
@@ -139,7 +136,7 @@ const char *QTestCoreElement<ElementType>::elementName() const
"system-err"
};
- if(type != QTest::LET_Undefined)
+ if (type != QTest::LET_Undefined)
return xmlElementNames[type];
return 0;
@@ -155,8 +152,8 @@ template <class ElementType>
const QTestElementAttribute *QTestCoreElement<ElementType>::attribute(QTest::AttributeIndex index) const
{
QTestElementAttribute *iterator = listOfAttributes;
- while(iterator){
- if(iterator->index() == index)
+ while (iterator) {
+ if (iterator->index() == index)
return iterator;
iterator = iterator->nextElement();
diff --git a/src/testlib/qtestcorelist.h b/src/testlib/qtestcorelist.h
index 0790ea5c39..5027e4fcf9 100644
--- a/src/testlib/qtestcorelist.h
+++ b/src/testlib/qtestcorelist.h
@@ -70,8 +70,8 @@ class QTestCoreList
template <class T>
QTestCoreList<T>::QTestCoreList()
-:next(0)
-,prev(0)
+ : next(0)
+ , prev(0)
{
}
@@ -121,7 +121,7 @@ int QTestCoreList<T>::count()
int numOfElements = 0;
T *it = next;
- while(it){
+ while (it) {
++numOfElements;
it = it->nextElement();
}
diff --git a/src/testlib/qtestdata.cpp b/src/testlib/qtestdata.cpp
index d32a591eff..6797abf1d0 100644
--- a/src/testlib/qtestdata.cpp
+++ b/src/testlib/qtestdata.cpp
@@ -53,7 +53,7 @@ QT_BEGIN_NAMESPACE
class QTestDataPrivate
{
public:
- QTestDataPrivate(): tag(0), parent(0), data(0), dataCount(0) {}
+ QTestDataPrivate() : tag(0), parent(0), data(0), dataCount(0) {}
char *tag;
QTestTable *parent;
diff --git a/src/testlib/qtestelement.cpp b/src/testlib/qtestelement.cpp
index 3dc5ba60a8..a3c002f964 100644
--- a/src/testlib/qtestelement.cpp
+++ b/src/testlib/qtestelement.cpp
@@ -44,9 +44,9 @@
QT_BEGIN_NAMESPACE
QTestElement::QTestElement(int type)
- :QTestCoreElement<QTestElement>(type),
- listOfChildren(0),
- parent(0)
+ : QTestCoreElement<QTestElement>(type)
+ , listOfChildren(0)
+ , parent(0)
{
}
@@ -57,10 +57,10 @@ QTestElement::~QTestElement()
bool QTestElement::addLogElement(QTestElement *element)
{
- if(!element)
+ if (!element)
return false;
- if(element->elementType() != QTest::LET_Undefined){
+ if (element->elementType() != QTest::LET_Undefined) {
element->addToList(&listOfChildren);
element->setParent(this);
return true;
diff --git a/src/testlib/qtestelementattribute.cpp b/src/testlib/qtestelementattribute.cpp
index dcd518ca2a..9799ade577 100644
--- a/src/testlib/qtestelementattribute.cpp
+++ b/src/testlib/qtestelementattribute.cpp
@@ -50,37 +50,37 @@ QT_BEGIN_NAMESPACE
This enum numbers the different tests.
\value AI_Undefined
-
+
\value AI_Name
-
+
\value AI_Result
-
+
\value AI_Tests
-
+
\value AI_Failures
-
+
\value AI_Errors
-
+
\value AI_Type
-
+
\value AI_Description
-
+
\value AI_PropertyValue
-
+
\value AI_QTestVersion
-
+
\value AI_QtVersion
-
+
\value AI_File
-
+
\value AI_Line
-
+
\value AI_Metric
-
+
\value AI_Tag
-
+
\value AI_Value
-
+
\value AI_Iterations
*/
@@ -144,7 +144,7 @@ const char *QTestElementAttribute::name() const
"iterations"
};
- if(attributeIndex != QTest::AI_Undefined)
+ if (attributeIndex != QTest::AI_Undefined)
return AttributeNames[attributeIndex];
return 0;
@@ -162,7 +162,7 @@ bool QTestElementAttribute::isNull() const
bool QTestElementAttribute::setPair(QTest::AttributeIndex index, const char *value)
{
- if(!value)
+ if (!value)
return false;
delete[] attributeValue;
diff --git a/src/testlib/qtestkeyboard.h b/src/testlib/qtestkeyboard.h
index be141642e8..9f8bf2536a 100644
--- a/src/testlib/qtestkeyboard.h
+++ b/src/testlib/qtestkeyboard.h
@@ -75,7 +75,7 @@ namespace QTest
if (delay == -1 || delay < defaultKeyDelay())
delay = defaultKeyDelay();
- if(delay > 0)
+ if (delay > 0)
QTest::qWait(delay);
QKeyEvent a(press ? QEvent::KeyPress : QEvent::KeyRelease, code, modifier, text, repeat);
diff --git a/src/testlib/qtestlightxmlstreamer.cpp b/src/testlib/qtestlightxmlstreamer.cpp
deleted file mode 100644
index c0010cc522..0000000000
--- a/src/testlib/qtestlightxmlstreamer.cpp
+++ /dev/null
@@ -1,179 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtTest module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qtestlightxmlstreamer.h"
-#include "qtestelement.h"
-#include "qtestelementattribute.h"
-#include "qtestlogger_p.h"
-
-#include "QtTest/private/qtestlog_p.h"
-#include "QtTest/private/qtestresult_p.h"
-#include "QtTest/private/qxmltestlogger_p.h"
-
-#include <string.h>
-
-QT_BEGIN_NAMESPACE
-
-QTestLightXmlStreamer::QTestLightXmlStreamer(QTestLogger *logger)
- : QTestBasicStreamer(logger)
-{
-}
-
-QTestLightXmlStreamer::~QTestLightXmlStreamer()
-{}
-
-void QTestLightXmlStreamer::formatStart(const QTestElement *element, QTestCharBuffer *formatted) const
-{
- if(!element || !formatted)
- return;
-
- switch(element->elementType()){
- case QTest::LET_TestCase: {
- QTestCharBuffer quotedTf;
- QXmlTestLogger::xmlQuote(&quotedTf, element->attributeValue(QTest::AI_Name));
-
- QTest::qt_asprintf(formatted, "<TestFunction name=\"%s\">\n", quotedTf.constData());
- break;
- }
- case QTest::LET_Failure: {
- QTestCharBuffer cdataDesc;
- QXmlTestLogger::xmlCdata(&cdataDesc, element->attributeValue(QTest::AI_Description));
-
- QTest::qt_asprintf(formatted, " <Description><![CDATA[%s]]></Description>\n",
- cdataDesc.constData());
- break;
- }
- case QTest::LET_Error: {
- // assuming type and attribute names don't need quoting
- QTestCharBuffer quotedFile;
- QTestCharBuffer cdataDesc;
- QXmlTestLogger::xmlQuote(&quotedFile, element->attributeValue(QTest::AI_File));
- QXmlTestLogger::xmlCdata(&cdataDesc, element->attributeValue(QTest::AI_Description));
-
- QTest::qt_asprintf(formatted, "<Message type=\"%s\" %s=\"%s\" %s=\"%s\">\n <Description><![CDATA[%s]]></Description>\n</Message>\n",
- element->attributeValue(QTest::AI_Type),
- element->attributeName(QTest::AI_File),
- quotedFile.constData(),
- element->attributeName(QTest::AI_Line),
- element->attributeValue(QTest::AI_Line),
- cdataDesc.constData());
- break;
- }
- case QTest::LET_Benchmark: {
- // assuming value and iterations don't need quoting
- QTestCharBuffer quotedMetric;
- QTestCharBuffer quotedTag;
- QXmlTestLogger::xmlQuote(&quotedMetric, element->attributeValue(QTest::AI_Metric));
- QXmlTestLogger::xmlQuote(&quotedTag, element->attributeValue(QTest::AI_Tag));
-
- QTest::qt_asprintf(formatted, "<BenchmarkResult %s=\"%s\" %s=\"%s\" %s=\"%s\" %s=\"%s\" />\n",
- element->attributeName(QTest::AI_Metric),
- quotedMetric.constData(),
- element->attributeName(QTest::AI_Tag),
- quotedTag.constData(),
- element->attributeName(QTest::AI_Value),
- element->attributeValue(QTest::AI_Value),
- element->attributeName(QTest::AI_Iterations),
- element->attributeValue(QTest::AI_Iterations) );
- break;
- }
- default:
- formatted->data()[0] = '\0';
- }
-}
-
-void QTestLightXmlStreamer::formatEnd(const QTestElement *element, QTestCharBuffer *formatted) const
-{
- if(!element || !formatted)
- return;
-
- if (element->elementType() == QTest::LET_TestCase) {
- if( element->attribute(QTest::AI_Result) && element->childElements())
- QTest::qt_asprintf(formatted, "</Incident>\n</TestFunction>\n");
- else
- QTest::qt_asprintf(formatted, "</TestFunction>\n");
- } else {
- formatted->data()[0] = '\0';
- }
-}
-
-void QTestLightXmlStreamer::formatBeforeAttributes(const QTestElement *element, QTestCharBuffer *formatted) const
-{
- if(!element || !formatted)
- return;
-
- if (element->elementType() == QTest::LET_TestCase && element->attribute(QTest::AI_Result)) {
- QTestCharBuffer buf;
- QTestCharBuffer quotedFile;
- QXmlTestLogger::xmlQuote(&quotedFile, element->attributeValue(QTest::AI_File));
-
- QTest::qt_asprintf(&buf, "%s=\"%s\" %s=\"%s\"",
- element->attributeName(QTest::AI_File),
- quotedFile.constData(),
- element->attributeName(QTest::AI_Line),
- element->attributeValue(QTest::AI_Line));
-
- if( !element->childElements() )
- QTest::qt_asprintf(formatted, "<Incident type=\"%s\" %s/>\n",
- element->attributeValue(QTest::AI_Result), buf.constData());
- else
- QTest::qt_asprintf(formatted, "<Incident type=\"%s\" %s>\n",
- element->attributeValue(QTest::AI_Result), buf.constData());
- } else {
- formatted->data()[0] = '\0';
- }
-}
-
-void QTestLightXmlStreamer::output(QTestElement *element) const
-{
- QTestCharBuffer buf;
- QTest::qt_asprintf(&buf, "<Environment>\n <QtVersion>%s</QtVersion>\n <QTestVersion>%s</QTestVersion>\n",
- qVersion(), QTEST_VERSION_STR );
- outputString(buf.constData());
-
- QTest::qt_asprintf(&buf, "</Environment>\n");
- outputString(buf.constData());
-
- QTestBasicStreamer::output(element);
-}
-
-QT_END_NAMESPACE
-
diff --git a/src/testlib/qtestlightxmlstreamer.h b/src/testlib/qtestlightxmlstreamer.h
deleted file mode 100644
index b3076c1623..0000000000
--- a/src/testlib/qtestlightxmlstreamer.h
+++ /dev/null
@@ -1,72 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtTest module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QTESTLIGHTXMLSTREAMER_H
-#define QTESTLIGHTXMLSTREAMER_H
-
-#include <QtTest/qtestbasicstreamer.h>
-
-QT_BEGIN_HEADER
-
-QT_BEGIN_NAMESPACE
-
-QT_MODULE(Test)
-
-class QTestElement;
-class QTestElementAttribute;
-
-class QTestLightXmlStreamer: public QTestBasicStreamer
-{
- public:
- QTestLightXmlStreamer(QTestLogger *logger);
- ~QTestLightXmlStreamer();
-
- void formatStart(const QTestElement *element, QTestCharBuffer *formatted) const;
- void formatEnd(const QTestElement *element, QTestCharBuffer *formatted) const;
- void formatBeforeAttributes(const QTestElement *element, QTestCharBuffer *formatted) const;
- void output(QTestElement *element) const;
-};
-
-QT_END_NAMESPACE
-
-QT_END_HEADER
-
-#endif
diff --git a/src/testlib/qtestlog.cpp b/src/testlib/qtestlog.cpp
index 0a87a4ce14..d53b00ca7f 100644
--- a/src/testlib/qtestlog.cpp
+++ b/src/testlib/qtestlog.cpp
@@ -45,7 +45,7 @@
#include "QtTest/private/qtestresult_p.h"
#include "QtTest/private/qabstracttestlogger_p.h"
#include "QtTest/private/qplaintestlogger_p.h"
-#include "QtTest/private/qtestlogger_p.h"
+#include "QtTest/private/qxunittestlogger_p.h"
#include "QtTest/private/qxmltestlogger_p.h"
#include <QtCore/qatomic.h>
#include <QtCore/qbytearray.h>
@@ -83,12 +83,10 @@ namespace QTest {
static IgnoreResultList *ignoreResultList = 0;
static QTestLog::LogMode logMode = QTestLog::Plain;
- static QTestLog::FlushMode flushMode = QTestLog::NoFlush;
static int verbosity = 0;
static int maxWarnings = 2002;
static QAbstractTestLogger *testLogger = 0;
- static const char *outFile = 0;
static QtMsgHandler oldMessageHandler;
@@ -165,30 +163,6 @@ namespace QTest {
break;
}
}
-
- void initLogger()
- {
- switch (QTest::logMode) {
- case QTestLog::Plain:
- QTest::testLogger = new QPlainTestLogger;
- break;
- case QTestLog::XML:
- if (QTest::flushMode == QTestLog::FlushOn)
- QTest::testLogger = new QXmlTestLogger(QXmlTestLogger::Complete);
- else
- QTest::testLogger = new QTestLogger(QTestLogger::TLF_XML);
- break;
- case QTestLog::LightXML:
- if (QTest::flushMode == QTestLog::FlushOn)
- QTest::testLogger = new QXmlTestLogger(QXmlTestLogger::Light);
- else
- QTest::testLogger = new QTestLogger(QTestLogger::TLF_LightXml);
- break;
- case QTestLog::XunitXML:
- QTest::testLogger = new QTestLogger(QTestLogger::TLF_XunitXml);
- }
- }
-
}
void QTestLog::enterTestFunction(const char* function)
@@ -283,9 +257,8 @@ void QTestLog::addBenchmarkResult(const QBenchmarkResult &result)
void QTestLog::startLogging()
{
- QTEST_ASSERT(!QTest::testLogger);
- QTest::initLogger();
- QTest::testLogger->startLogging(QTest::outFile);
+ QTEST_ASSERT(QTest::testLogger);
+ QTest::testLogger->startLogging();
QTest::oldMessageHandler = qInstallMsgHandler(QTest::messageHandler);
}
@@ -299,6 +272,27 @@ void QTestLog::stopLogging()
QTest::testLogger = 0;
}
+void QTestLog::initLogger(LogMode mode, const char *filename)
+{
+ QTest::logMode = mode;
+
+ switch (mode) {
+ case QTestLog::Plain:
+ QTest::testLogger = new QPlainTestLogger(filename);
+ break;
+ case QTestLog::XML:
+ QTest::testLogger = new QXmlTestLogger(QXmlTestLogger::Complete, filename);
+ break;
+ case QTestLog::LightXML:
+ QTest::testLogger = new QXmlTestLogger(QXmlTestLogger::Light, filename);
+ break;
+ case QTestLog::XunitXML:
+ QTest::testLogger = new QXunitTestLogger(filename);
+ break;
+ }
+ QTEST_ASSERT(QTest::testLogger);
+}
+
void QTestLog::warn(const char *msg)
{
QTEST_ASSERT(QTest::testLogger);
@@ -315,11 +309,6 @@ void QTestLog::info(const char *msg, const char *file, int line)
QTest::testLogger->addMessage(QAbstractTestLogger::Info, msg, file, line);
}
-void QTestLog::setLogMode(LogMode mode)
-{
- QTest::logMode = mode;
-}
-
QTestLog::LogMode QTestLog::logMode()
{
return QTest::logMode;
@@ -351,26 +340,9 @@ void QTestLog::addIgnoreMessage(QtMsgType type, const char *msg)
list->next = item;
}
-void QTestLog::redirectOutput(const char *fileName)
-{
- QTEST_ASSERT(fileName);
-
- QTest::outFile = fileName;
-}
-
-const char *QTestLog::outputFileName()
-{
- return QTest::outFile;
-}
-
void QTestLog::setMaxWarnings(int m)
{
QTest::maxWarnings = m <= 0 ? INT_MAX : m + 2;
}
-void QTestLog::setFlushMode(FlushMode mode)
-{
- QTest::flushMode = mode;
-}
-
QT_END_NAMESPACE
diff --git a/src/testlib/qtestlog_p.h b/src/testlib/qtestlog_p.h
index 9b580eb8cc..f06382978f 100644
--- a/src/testlib/qtestlog_p.h
+++ b/src/testlib/qtestlog_p.h
@@ -63,7 +63,6 @@ class Q_TESTLIB_EXPORT QTestLog
{
public:
enum LogMode { Plain = 0, XML, LightXML, XunitXML };
- enum FlushMode { NoFlush = 0, FlushOn };
static void enterTestFunction(const char* function);
static void leaveTestFunction();
@@ -84,18 +83,15 @@ public:
static void startLogging();
static void stopLogging();
- static void setLogMode(LogMode mode);
+ static void initLogger(LogMode mode, const char *filename);
+
static LogMode logMode();
static void setVerboseLevel(int level);
static int verboseLevel();
- static void redirectOutput(const char *fileName);
- static const char *outputFileName();
-
static void setMaxWarnings(int max);
- static void setFlushMode(FlushMode mode);
private:
QTestLog();
~QTestLog();
diff --git a/src/testlib/qtestmouse.h b/src/testlib/qtestmouse.h
index c8fe0b4849..1bdb0241c0 100644
--- a/src/testlib/qtestmouse.h
+++ b/src/testlib/qtestmouse.h
@@ -76,7 +76,7 @@ namespace QTest
if (delay == -1 || delay < defaultMouseDelay())
delay = defaultMouseDelay();
- if(delay > 0)
+ if (delay > 0)
QTest::qWait(delay);
if (pos.isNull())
diff --git a/src/testlib/qtestxmlstreamer.cpp b/src/testlib/qtestxmlstreamer.cpp
deleted file mode 100644
index 47c4463b5a..0000000000
--- a/src/testlib/qtestxmlstreamer.cpp
+++ /dev/null
@@ -1,222 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtTest module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qtestxmlstreamer.h"
-#include "qtestelement.h"
-#include "qtestelementattribute.h"
-#include "qtestlogger_p.h"
-
-#include "QtTest/private/qtestlog_p.h"
-#include "QtTest/private/qtestresult_p.h"
-#include "QtTest/private/qxmltestlogger_p.h"
-
-#include <string.h>
-#include <stdio.h>
-
-QT_BEGIN_NAMESPACE
-
-QTestXmlStreamer::QTestXmlStreamer(QTestLogger *logger)
- : QTestBasicStreamer(logger)
-{
-}
-
-QTestXmlStreamer::~QTestXmlStreamer()
-{}
-
-void QTestXmlStreamer::formatStart(const QTestElement *element, QTestCharBuffer *formatted) const
-{
- if(!element || !formatted)
- return;
-
- switch(element->elementType()){
- case QTest::LET_TestCase: {
- QTestCharBuffer quotedTf;
- QXmlTestLogger::xmlQuote(&quotedTf, element->attributeValue(QTest::AI_Name));
-
- QTest::qt_asprintf(formatted, "<TestFunction name=\"%s\">\n", quotedTf.constData());
- break;
- }
- case QTest::LET_Failure: {
- QTestCharBuffer cdataDesc;
- QXmlTestLogger::xmlCdata(&cdataDesc, element->attributeValue(QTest::AI_Description));
-
- QTestCharBuffer location;
- QTestCharBuffer quotedFile;
- QXmlTestLogger::xmlQuote(&quotedFile, element->attributeValue(QTest::AI_File));
-
- QTest::qt_asprintf(&location, "%s=\"%s\" %s=\"%s\"",
- element->attributeName(QTest::AI_File),
- quotedFile.constData(),
- element->attributeName(QTest::AI_Line),
- element->attributeValue(QTest::AI_Line));
-
- if (element->attribute(QTest::AI_Tag)) {
- QTestCharBuffer cdataTag;
- QXmlTestLogger::xmlCdata(&cdataTag, element->attributeValue(QTest::AI_Tag));
- QTest::qt_asprintf(formatted, "<Incident type=\"%s\" %s>\n"
- " <DataTag><![CDATA[%s]]></DataTag>\n"
- " <Description><![CDATA[%s]]></Description>\n"
- "</Incident>\n", element->attributeValue(QTest::AI_Result),
- location.constData(), cdataTag.constData(), cdataDesc.constData());
- }
- else {
- QTest::qt_asprintf(formatted, "<Incident type=\"%s\" %s>\n"
- " <Description><![CDATA[%s]]></Description>\n"
- "</Incident>\n", element->attributeValue(QTest::AI_Result),
- location.constData(), cdataDesc.constData());
- }
- break;
- }
- case QTest::LET_Error: {
- // assuming type and attribute names don't need quoting
- QTestCharBuffer quotedFile;
- QTestCharBuffer cdataDesc;
- QXmlTestLogger::xmlQuote(&quotedFile, element->attributeValue(QTest::AI_File));
- QXmlTestLogger::xmlCdata(&cdataDesc, element->attributeValue(QTest::AI_Description));
-
- QTestCharBuffer tagbuf;
- if (element->attribute(QTest::AI_Tag)) {
- QTestCharBuffer cdataTag;
- QXmlTestLogger::xmlCdata(&cdataTag, element->attributeValue(QTest::AI_Tag));
- QTest::qt_asprintf(&tagbuf, " <DataTag><![CDATA[%s]]></DataTag>\n", cdataTag.constData());
- }
-
- QTest::qt_asprintf(formatted, "<Message type=\"%s\" %s=\"%s\" %s=\"%s\">\n%s <Description><![CDATA[%s]]></Description>\n</Message>\n",
- element->attributeValue(QTest::AI_Type),
- element->attributeName(QTest::AI_File),
- quotedFile.constData(),
- element->attributeName(QTest::AI_Line),
- element->attributeValue(QTest::AI_Line),
- tagbuf.constData(),
- cdataDesc.constData());
- break;
- }
- case QTest::LET_Benchmark: {
- // assuming value and iterations don't need quoting
- QTestCharBuffer quotedMetric;
- QTestCharBuffer quotedTag;
- QXmlTestLogger::xmlQuote(&quotedMetric, element->attributeValue(QTest::AI_Metric));
- QXmlTestLogger::xmlQuote(&quotedTag, element->attributeValue(QTest::AI_Tag));
-
- QTest::qt_asprintf(formatted, "<BenchmarkResult %s=\"%s\" %s=\"%s\" %s=\"%s\" %s=\"%s\" />\n",
- element->attributeName(QTest::AI_Metric),
- quotedMetric.constData(),
- element->attributeName(QTest::AI_Tag),
- quotedTag.constData(),
- element->attributeName(QTest::AI_Value),
- element->attributeValue(QTest::AI_Value),
- element->attributeName(QTest::AI_Iterations),
- element->attributeValue(QTest::AI_Iterations) );
- break;
- }
- default:
- formatted->data()[0] = '\0';
- }
-}
-
-void QTestXmlStreamer::formatEnd(const QTestElement *element, QTestCharBuffer *formatted) const
-{
- if(!element || !formatted)
- return;
-
- if (element->elementType() == QTest::LET_TestCase) {
- bool failed = false;
- for (QTestElement* child = element->childElements(); child; child = child->nextElement()) {
- if ( child->elementType() == QTest::LET_Failure
- && child->attribute(QTest::AI_Result)
- && ( !strcmp(child->attributeValue(QTest::AI_Result), "fail")
- || !strcmp(child->attributeValue(QTest::AI_Result), "xpass"))
- )
- {
- failed = true;
- break;
- }
- }
-
- // For passing functions, no Incident has been output yet.
- // For failing functions, we already output one.
- // Please note: we are outputting "pass" even if there was an xfail etc.
- // This is by design (arguably bad design, but dangerous to change now!)
- if (element->attribute(QTest::AI_Result) && !failed) {
- QTest::qt_asprintf(formatted, "<Incident type=\"pass\" file=\"\" line=\"0\" />\n</TestFunction>\n");
- }
- else {
- QTest::qt_asprintf(formatted, "</TestFunction>\n");
- }
- } else {
- formatted->data()[0] = '\0';
- }
-}
-
-void QTestXmlStreamer::formatBeforeAttributes(const QTestElement *element, QTestCharBuffer *formatted) const
-{
- Q_UNUSED(element);
- if (!formatted)
- return;
-
- formatted->data()[0] = '\0';
-}
-
-void QTestXmlStreamer::output(QTestElement *element) const
-{
- QTestCharBuffer buf;
- QTestCharBuffer quotedTc;
- QXmlTestLogger::xmlQuote(&quotedTc, QTestResult::currentTestObjectName());
-
- QTest::qt_asprintf(&buf, "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>\n<TestCase name=\"%s\">\n",
- quotedTc.constData());
- outputString(buf.constData());
-
- QTest::qt_asprintf(&buf, "<Environment>\n <QtVersion>%s</QtVersion>\n <QTestVersion>%s</QTestVersion>\n",
- qVersion(), QTEST_VERSION_STR );
- outputString(buf.constData());
-
- QTest::qt_asprintf(&buf, "</Environment>\n");
- outputString(buf.constData());
-
- QTestBasicStreamer::output(element);
-
- QTest::qt_asprintf(&buf, "</TestCase>\n");
- outputString(buf.constData());
-}
-
-QT_END_NAMESPACE
-
diff --git a/src/testlib/qtestxmlstreamer.h b/src/testlib/qtestxmlstreamer.h
deleted file mode 100644
index 96e8246779..0000000000
--- a/src/testlib/qtestxmlstreamer.h
+++ /dev/null
@@ -1,72 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtTest module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QTESTXMLSTREAMER_H
-#define QTESTXMLSTREAMER_H
-
-#include <QtTest/qtestbasicstreamer.h>
-
-QT_BEGIN_HEADER
-
-QT_BEGIN_NAMESPACE
-
-QT_MODULE(Test)
-
-class QTestElement;
-class QTestElementAttribute;
-
-class QTestXmlStreamer: public QTestBasicStreamer
-{
- public:
- QTestXmlStreamer(QTestLogger *logger);
- ~QTestXmlStreamer();
-
- void formatStart(const QTestElement *element, QTestCharBuffer *formatted) const;
- void formatEnd(const QTestElement *element, QTestCharBuffer *formatted) const;
- void formatBeforeAttributes(const QTestElement *element, QTestCharBuffer *formatted) const;
- void output(QTestElement *element) const;
-};
-
-QT_END_NAMESPACE
-
-QT_END_HEADER
-
-#endif
diff --git a/src/testlib/qtestxunitstreamer.cpp b/src/testlib/qtestxunitstreamer.cpp
index fb9699eef1..3e9c2feffc 100644
--- a/src/testlib/qtestxunitstreamer.cpp
+++ b/src/testlib/qtestxunitstreamer.cpp
@@ -40,7 +40,10 @@
****************************************************************************/
#include "qtestxunitstreamer.h"
+#include "qxunittestlogger_p.h"
#include "qtestelement.h"
+#include "qtestelementattribute.h"
+#include "qtestassert.h"
#include "QtTest/private/qtestlog_p.h"
#include "QtTest/private/qtestresult_p.h"
@@ -48,9 +51,11 @@
QT_BEGIN_NAMESPACE
-QTestXunitStreamer::QTestXunitStreamer(QTestLogger *logger)
- : QTestBasicStreamer(logger)
-{}
+QTestXunitStreamer::QTestXunitStreamer(QXunitTestLogger *logger)
+ : testLogger(logger)
+{
+ QTEST_ASSERT(testLogger);
+}
QTestXunitStreamer::~QTestXunitStreamer()
{}
@@ -75,7 +80,7 @@ void QTestXunitStreamer::indentForElement(const QTestElement* element, char* buf
void QTestXunitStreamer::formatStart(const QTestElement *element, QTestCharBuffer *formatted) const
{
- if(!element || !formatted )
+ if (!element || !formatted )
return;
char indent[20];
@@ -99,7 +104,7 @@ void QTestXunitStreamer::formatEnd(const QTestElement *element, QTestCharBuffer
if (!element || !formatted )
return;
- if (!element->childElements()){
+ if (!element->childElements()) {
formatted->data()[0] = '\0';
return;
}
@@ -112,7 +117,7 @@ void QTestXunitStreamer::formatEnd(const QTestElement *element, QTestCharBuffer
void QTestXunitStreamer::formatAttributes(const QTestElement* element, const QTestElementAttribute *attribute, QTestCharBuffer *formatted) const
{
- if(!attribute || !formatted )
+ if (!attribute || !formatted )
return;
QTest::AttributeIndex attrindex = attribute->index();
@@ -144,7 +149,7 @@ void QTestXunitStreamer::formatAttributes(const QTestElement* element, const QTe
void QTestXunitStreamer::formatAfterAttributes(const QTestElement *element, QTestCharBuffer *formatted) const
{
- if(!element || !formatted )
+ if (!element || !formatted )
return;
// Errors are written as CDATA within system-err, comments elsewhere
@@ -157,7 +162,7 @@ void QTestXunitStreamer::formatAfterAttributes(const QTestElement *element, QTes
return;
}
- if(!element->childElements())
+ if (!element->childElements())
QTest::qt_asprintf(formatted, "/>\n");
else
QTest::qt_asprintf(formatted, ">\n");
@@ -165,8 +170,10 @@ void QTestXunitStreamer::formatAfterAttributes(const QTestElement *element, QTes
void QTestXunitStreamer::output(QTestElement *element) const
{
+ QTEST_ASSERT(element);
+
outputString("<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n");
- QTestBasicStreamer::output(element);
+ outputElements(element);
}
void QTestXunitStreamer::outputElements(QTestElement *element, bool) const
@@ -183,19 +190,16 @@ void QTestXunitStreamer::outputElements(QTestElement *element, bool) const
while (element) {
hasChildren = element->childElements();
- if(element->elementType() != QTest::LET_Benchmark){
+ if (element->elementType() != QTest::LET_Benchmark) {
formatStart(element, &buf);
outputString(buf.data());
- formatBeforeAttributes(element, &buf);
- outputString(buf.data());
-
outputElementAttributes(element, element->attributes());
formatAfterAttributes(element, &buf);
outputString(buf.data());
- if(hasChildren)
+ if (hasChildren)
outputElements(element->childElements(), true);
formatEnd(element, &buf);
@@ -205,5 +209,19 @@ void QTestXunitStreamer::outputElements(QTestElement *element, bool) const
}
}
-QT_END_NAMESPACE
+void QTestXunitStreamer::outputElementAttributes(const QTestElement* element, QTestElementAttribute *attribute) const
+{
+ QTestCharBuffer buf;
+ while (attribute) {
+ formatAttributes(element, attribute, &buf);
+ outputString(buf.data());
+ attribute = attribute->nextElement();
+ }
+}
+void QTestXunitStreamer::outputString(const char *msg) const
+{
+ testLogger->outputString(msg);
+}
+
+QT_END_NAMESPACE
diff --git a/src/testlib/qtestxunitstreamer.h b/src/testlib/qtestxunitstreamer.h
index 4d1cb2734a..127c9b1780 100644
--- a/src/testlib/qtestxunitstreamer.h
+++ b/src/testlib/qtestxunitstreamer.h
@@ -42,7 +42,7 @@
#ifndef QTESTXUNITSTREAMER_H
#define QTESTXUNITSTREAMER_H
-#include <QtTest/qtestbasicstreamer.h>
+#include <QtCore/qglobal.h>
QT_BEGIN_HEADER
@@ -50,12 +50,15 @@ QT_BEGIN_NAMESPACE
QT_MODULE(Test)
-class QTestLogger;
+class QTestElement;
+class QTestElementAttribute;
+class QXunitTestLogger;
+struct QTestCharBuffer;
-class QTestXunitStreamer: public QTestBasicStreamer
+class QTestXunitStreamer
{
public:
- QTestXunitStreamer(QTestLogger *logger);
+ QTestXunitStreamer(QXunitTestLogger *logger);
~QTestXunitStreamer();
void formatStart(const QTestElement *element, QTestCharBuffer *formatted) const;
@@ -64,10 +67,15 @@ class QTestXunitStreamer: public QTestBasicStreamer
void formatAttributes(const QTestElement *element, const QTestElementAttribute *attribute, QTestCharBuffer *formatted) const;
void output(QTestElement *element) const;
void outputElements(QTestElement *element, bool isChildElement = false) const;
+ void outputElementAttributes(const QTestElement *element, QTestElementAttribute *attribute) const;
+
+ void outputString(const char *msg) const;
private:
void displayXunitXmlHeader() const;
static void indentForElement(const QTestElement* element, char* buf, int size);
+
+ QXunitTestLogger *testLogger;
};
QT_END_NAMESPACE
diff --git a/src/testlib/qxmltestlogger.cpp b/src/testlib/qxmltestlogger.cpp
index 5ed7079ab6..304cd0a0ef 100644
--- a/src/testlib/qxmltestlogger.cpp
+++ b/src/testlib/qxmltestlogger.cpp
@@ -92,8 +92,8 @@ namespace QTest {
}
-QXmlTestLogger::QXmlTestLogger(XmlMode mode )
- : xmlmode(mode)
+QXmlTestLogger::QXmlTestLogger(XmlMode mode, const char *filename)
+ : QAbstractTestLogger(filename), xmlmode(mode)
{
}
@@ -101,9 +101,9 @@ QXmlTestLogger::~QXmlTestLogger()
{
}
-void QXmlTestLogger::startLogging(const char *filename)
+void QXmlTestLogger::startLogging()
{
- QAbstractTestLogger::startLogging(filename);
+ QAbstractTestLogger::startLogging();
QTestCharBuffer buf;
if (xmlmode == QXmlTestLogger::Complete) {
@@ -115,7 +115,7 @@ void QXmlTestLogger::startLogging(const char *filename)
outputString(buf.constData());
}
- QTest::qt_asprintf(&buf,
+ QTest::qt_asprintf(&buf,
"<Environment>\n"
" <QtVersion>%s</QtVersion>\n"
" <QTestVersion>"QTEST_VERSION_STR"</QTestVersion>\n"
diff --git a/src/testlib/qxmltestlogger_p.h b/src/testlib/qxmltestlogger_p.h
index c08f5e469e..c273493c48 100644
--- a/src/testlib/qxmltestlogger_p.h
+++ b/src/testlib/qxmltestlogger_p.h
@@ -63,10 +63,10 @@ class QXmlTestLogger : public QAbstractTestLogger
public:
enum XmlMode { Complete = 0, Light };
- QXmlTestLogger(XmlMode mode = Complete);
+ QXmlTestLogger(XmlMode mode, const char *filename);
~QXmlTestLogger();
- void startLogging(const char *filename);
+ void startLogging();
void stopLogging();
void enterTestFunction(const char *function);
diff --git a/src/testlib/qtestlogger.cpp b/src/testlib/qxunittestlogger.cpp
index 385fb866c2..f923b2334b 100644
--- a/src/testlib/qtestlogger.cpp
+++ b/src/testlib/qxunittestlogger.cpp
@@ -39,11 +39,9 @@
**
****************************************************************************/
-#include "qtestlogger_p.h"
+#include "qxunittestlogger_p.h"
#include "qtestelement.h"
#include "qtestxunitstreamer.h"
-#include "qtestxmlstreamer.h"
-#include "qtestlightxmlstreamer.h"
#include "QtTest/qtestcase.h"
#include "QtTest/private/qtestresult_p.h"
@@ -53,102 +51,84 @@
QT_BEGIN_NAMESPACE
-QTestLogger::QTestLogger(int fm)
- : listOfTestcases(0)
+QXunitTestLogger::QXunitTestLogger(const char *filename)
+ : QAbstractTestLogger(filename)
+ , listOfTestcases(0)
, currentLogElement(0)
, errorLogElement(0)
, logFormatter(0)
- , format( (TestLoggerFormat)fm )
, testCounter(0)
, failureCounter(0)
, errorCounter(0)
{
}
-QTestLogger::~QTestLogger()
+QXunitTestLogger::~QXunitTestLogger()
{
- if(format == TLF_XunitXml)
- delete currentLogElement;
- else
- delete listOfTestcases;
-
+ delete currentLogElement;
delete logFormatter;
}
-void QTestLogger::startLogging(const char *filename)
+void QXunitTestLogger::startLogging()
{
- QAbstractTestLogger::startLogging(filename);
+ QAbstractTestLogger::startLogging();
- switch(format){
- case TLF_LightXml:
- logFormatter = new QTestLightXmlStreamer(this);
- break;
- case TLF_XML:
- logFormatter = new QTestXmlStreamer(this);
- break;
- case TLF_XunitXml:
- logFormatter = new QTestXunitStreamer(this);
- delete errorLogElement;
- errorLogElement = new QTestElement(QTest::LET_SystemError);
- break;
- }
+ logFormatter = new QTestXunitStreamer(this);
+ delete errorLogElement;
+ errorLogElement = new QTestElement(QTest::LET_SystemError);
}
-void QTestLogger::stopLogging()
+void QXunitTestLogger::stopLogging()
{
QTestElement *iterator = listOfTestcases;
- if(format == TLF_XunitXml ){
- char buf[10];
+ char buf[10];
- currentLogElement = new QTestElement(QTest::LET_TestSuite);
- currentLogElement->addAttribute(QTest::AI_Name, QTestResult::currentTestObjectName());
+ currentLogElement = new QTestElement(QTest::LET_TestSuite);
+ currentLogElement->addAttribute(QTest::AI_Name, QTestResult::currentTestObjectName());
- QTest::qt_snprintf(buf, sizeof(buf), "%i", testCounter);
- currentLogElement->addAttribute(QTest::AI_Tests, buf);
+ QTest::qt_snprintf(buf, sizeof(buf), "%i", testCounter);
+ currentLogElement->addAttribute(QTest::AI_Tests, buf);
- QTest::qt_snprintf(buf, sizeof(buf), "%i", failureCounter);
- currentLogElement->addAttribute(QTest::AI_Failures, buf);
+ QTest::qt_snprintf(buf, sizeof(buf), "%i", failureCounter);
+ currentLogElement->addAttribute(QTest::AI_Failures, buf);
- QTest::qt_snprintf(buf, sizeof(buf), "%i", errorCounter);
- currentLogElement->addAttribute(QTest::AI_Errors, buf);
+ QTest::qt_snprintf(buf, sizeof(buf), "%i", errorCounter);
+ currentLogElement->addAttribute(QTest::AI_Errors, buf);
- QTestElement *property;
- QTestElement *properties = new QTestElement(QTest::LET_Properties);
+ QTestElement *property;
+ QTestElement *properties = new QTestElement(QTest::LET_Properties);
- property = new QTestElement(QTest::LET_Property);
- property->addAttribute(QTest::AI_Name, "QTestVersion");
- property->addAttribute(QTest::AI_PropertyValue, QTEST_VERSION_STR);
- properties->addLogElement(property);
+ property = new QTestElement(QTest::LET_Property);
+ property->addAttribute(QTest::AI_Name, "QTestVersion");
+ property->addAttribute(QTest::AI_PropertyValue, QTEST_VERSION_STR);
+ properties->addLogElement(property);
- property = new QTestElement(QTest::LET_Property);
- property->addAttribute(QTest::AI_Name, "QtVersion");
- property->addAttribute(QTest::AI_PropertyValue, qVersion());
- properties->addLogElement(property);
+ property = new QTestElement(QTest::LET_Property);
+ property->addAttribute(QTest::AI_Name, "QtVersion");
+ property->addAttribute(QTest::AI_PropertyValue, qVersion());
+ properties->addLogElement(property);
- currentLogElement->addLogElement(properties);
+ currentLogElement->addLogElement(properties);
- currentLogElement->addLogElement(iterator);
+ currentLogElement->addLogElement(iterator);
- /* For correct indenting, make sure every testcase knows its parent */
- QTestElement* testcase = iterator;
- while (testcase) {
- testcase->setParent(currentLogElement);
- testcase = testcase->nextElement();
- }
+ /* For correct indenting, make sure every testcase knows its parent */
+ QTestElement* testcase = iterator;
+ while (testcase) {
+ testcase->setParent(currentLogElement);
+ testcase = testcase->nextElement();
+ }
- currentLogElement->addLogElement(errorLogElement);
+ currentLogElement->addLogElement(errorLogElement);
- QTestElement *it = currentLogElement;
- logFormatter->output(it);
- }else{
- logFormatter->output(iterator);
- }
+ QTestElement *it = currentLogElement;
+ logFormatter->output(it);
QAbstractTestLogger::stopLogging();
}
-void QTestLogger::enterTestFunction(const char *function)
+void QXunitTestLogger::enterTestFunction(const char *function)
{
currentLogElement = new QTestElement(QTest::LET_TestCase);
currentLogElement->addAttribute(QTest::AI_Name, function);
@@ -157,12 +137,12 @@ void QTestLogger::enterTestFunction(const char *function)
++testCounter;
}
-void QTestLogger::leaveTestFunction()
+void QXunitTestLogger::leaveTestFunction()
{
}
-void QTestLogger::addIncident(IncidentTypes type, const char *description,
- const char *file, int line)
+void QXunitTestLogger::addIncident(IncidentTypes type, const char *description,
+ const char *file, int line)
{
const char *typeBuf = 0;
char buf[100];
@@ -187,11 +167,10 @@ void QTestLogger::addIncident(IncidentTypes type, const char *description,
break;
}
- if (type == QAbstractTestLogger::Fail || type == QAbstractTestLogger::XPass
- || ((format != TLF_XunitXml) && (type == QAbstractTestLogger::XFail))) {
+ if (type == QAbstractTestLogger::Fail || type == QAbstractTestLogger::XPass) {
QTestElement *failureElement = new QTestElement(QTest::LET_Failure);
failureElement->addAttribute(QTest::AI_Result, typeBuf);
- if(file)
+ if (file)
failureElement->addAttribute(QTest::AI_File, file);
else
failureElement->addAttribute(QTest::AI_File, "");
@@ -229,7 +208,7 @@ void QTestLogger::addIncident(IncidentTypes type, const char *description,
currentLogElement->addAttribute(QTest::AI_Result, typeBuf);
}
- if(file)
+ if (file)
currentLogElement->addAttribute(QTest::AI_File, file);
else
currentLogElement->addAttribute(QTest::AI_File, "");
@@ -241,12 +220,12 @@ void QTestLogger::addIncident(IncidentTypes type, const char *description,
Since XFAIL does not add a failure to the testlog in xunitxml, add a message, so we still
have some information about the expected failure.
*/
- if (format == TLF_XunitXml && type == QAbstractTestLogger::XFail) {
- QTestLogger::addMessage(QAbstractTestLogger::Info, description, file, line);
+ if (type == QAbstractTestLogger::XFail) {
+ QXunitTestLogger::addMessage(QAbstractTestLogger::Info, description, file, line);
}
}
-void QTestLogger::addBenchmarkResult(const QBenchmarkResult &result)
+void QXunitTestLogger::addBenchmarkResult(const QBenchmarkResult &result)
{
QTestElement *benchmarkElement = new QTestElement(QTest::LET_Benchmark);
@@ -262,7 +241,7 @@ void QTestLogger::addBenchmarkResult(const QBenchmarkResult &result)
currentLogElement->addLogElement(benchmarkElement);
}
-void QTestLogger::addTag(QTestElement* element)
+void QXunitTestLogger::addTag(QTestElement* element)
{
const char *tag = QTestResult::currentDataTag();
const char *gtag = QTestResult::currentGlobalDataTag();
@@ -283,7 +262,7 @@ void QTestLogger::addTag(QTestElement* element)
element->addAttribute(QTest::AI_Tag, buf.constData());
}
-void QTestLogger::addMessage(MessageTypes type, const char *message, const char *file, int line)
+void QXunitTestLogger::addMessage(MessageTypes type, const char *message, const char *file, int line)
{
QTestElement *errorElement = new QTestElement(QTest::LET_Error);
const char *typeBuf = 0;
@@ -319,7 +298,7 @@ void QTestLogger::addMessage(MessageTypes type, const char *message, const char
errorElement->addAttribute(QTest::AI_Description, message);
addTag(errorElement);
- if(file)
+ if (file)
errorElement->addAttribute(QTest::AI_File, file);
else
errorElement->addAttribute(QTest::AI_File, "");
diff --git a/src/testlib/qtestlogger_p.h b/src/testlib/qxunittestlogger_p.h
index 5e5b0f2f3f..a51d70533d 100644
--- a/src/testlib/qtestlogger_p.h
+++ b/src/testlib/qxunittestlogger_p.h
@@ -57,23 +57,16 @@
QT_BEGIN_NAMESPACE
-class QTestBasicStreamer;
+class QTestXunitStreamer;
class QTestElement;
-class QTestLogger : public QAbstractTestLogger
+class QXunitTestLogger : public QAbstractTestLogger
{
public:
- QTestLogger(int fm = 0);
- ~QTestLogger();
+ QXunitTestLogger(const char *filename);
+ ~QXunitTestLogger();
- enum TestLoggerFormat
- {
- TLF_XML = 0,
- TLF_LightXml = 1,
- TLF_XunitXml = 2
- };
-
- void startLogging(const char *filename);
+ void startLogging();
void stopLogging();
void enterTestFunction(const char *function);
@@ -91,8 +84,7 @@ class QTestLogger : public QAbstractTestLogger
QTestElement *listOfTestcases;
QTestElement *currentLogElement;
QTestElement *errorLogElement;
- QTestBasicStreamer *logFormatter;
- TestLoggerFormat format;
+ QTestXunitStreamer *logFormatter;
int testCounter;
int failureCounter;
diff --git a/src/testlib/testlib.pro b/src/testlib/testlib.pro
index a65510f567..e8858ea1c4 100644
--- a/src/testlib/testlib.pro
+++ b/src/testlib/testlib.pro
@@ -18,7 +18,6 @@ HEADERS = qbenchmark.h \
qsignalspy.h \
qtestaccessible.h \
qtestassert.h \
- qtestbasicstreamer.h \
qtestcase.h \
qtestcoreelement.h \
qtestcorelist.h \
@@ -31,12 +30,10 @@ HEADERS = qbenchmark.h \
qtest_gui.h \
qtest.h \
qtestkeyboard.h \
- qtestlightxmlstreamer.h \
qtestmouse.h \
qtestspontaneevent.h \
qtestsystem.h \
qtesttouch.h \
- qtestxmlstreamer.h \
qtestxunitstreamer.h
SOURCES = qtestcase.cpp \
qtestlog.cpp \
@@ -55,11 +52,8 @@ SOURCES = qtestcase.cpp \
qbenchmarkmetric.cpp \
qtestelement.cpp \
qtestelementattribute.cpp \
- qtestbasicstreamer.cpp \
qtestxunitstreamer.cpp \
- qtestxmlstreamer.cpp \
- qtestlightxmlstreamer.cpp \
- qtestlogger.cpp
+ qxunittestlogger.cpp
DEFINES *= QT_NO_CAST_TO_ASCII \
QT_NO_CAST_FROM_ASCII \
QTESTLIB_MAKEDLL \
diff --git a/src/tools/uic/qclass_lib_map.h b/src/tools/uic/qclass_lib_map.h
index 2d176552a8..09d275d8a1 100644
--- a/src/tools/uic/qclass_lib_map.h
+++ b/src/tools/uic/qclass_lib_map.h
@@ -514,7 +514,6 @@ QT_CLASS_LIB(QTest, QtTest, qtest.h)
QT_CLASS_LIB(QtTestGui, QtTest, qtest_gui.h)
QT_CLASS_LIB(QTestAccessibilityEvent, QtTest, qtestaccessible.h)
QT_CLASS_LIB(QTestAccessibility, QtTest, qtestaccessible.h)
-QT_CLASS_LIB(QTestBasicStreamer, QtTest, qtestbasicstreamer.h)
QT_CLASS_LIB(QTestCoreElement, QtTest, qtestcoreelement.h)
QT_CLASS_LIB(QTestCoreList, QtTest, qtestcorelist.h)
QT_CLASS_LIB(QTestData, QtTest, qtestdata.h)
@@ -527,11 +526,9 @@ QT_CLASS_LIB(QTestMouseEvent, QtTest, qtestevent.h)
QT_CLASS_LIB(QTestDelayEvent, QtTest, qtestevent.h)
QT_CLASS_LIB(QTestEventList, QtTest, qtestevent.h)
QT_CLASS_LIB(QTestEventLoop, QtTest, qtesteventloop.h)
-QT_CLASS_LIB(QTestLightXmlStreamer, QtTest, qtestlightxmlstreamer.h)
QT_CLASS_LIB(QEventSizeOfChecker, QtTest, qtestspontaneevent.h)
QT_CLASS_LIB(QEventSizeOfChecker, QtTest, qtestspontaneevent.h)
QT_CLASS_LIB(QSpontaneKeyEvent, QtTest, qtestspontaneevent.h)
-QT_CLASS_LIB(QTestXmlStreamer, QtTest, qtestxmlstreamer.h)
QT_CLASS_LIB(QTestXunitStreamer, QtTest, qtestxunitstreamer.h)
QT_CLASS_LIB(QDBusAbstractAdaptor, QtDBus, qdbusabstractadaptor.h)
QT_CLASS_LIB(QDBusAbstractInterfaceBase, QtDBus, qdbusabstractinterface.h)
diff --git a/src/v8/0001-Add-hashing-and-comparison-methods-to-v8-String.patch b/src/v8/0001-Add-hashing-and-comparison-methods-to-v8-String.patch
index 54a35fda9f..4ec44e3547 100644
--- a/src/v8/0001-Add-hashing-and-comparison-methods-to-v8-String.patch
+++ b/src/v8/0001-Add-hashing-and-comparison-methods-to-v8-String.patch
@@ -1,7 +1,7 @@
From e13ce09287a56c920d5ffdc5d4662d49f1838f16 Mon Sep 17 00:00:00 2001
From: Aaron Kennedy <aaron.kennedy@nokia.com>
Date: Mon, 23 May 2011 15:47:20 +1000
-Subject: [PATCH 01/13] Add hashing and comparison methods to v8::String
+Subject: [PATCH 01/16] Add hashing and comparison methods to v8::String
This allows us to more rapidly search for a v8::String inside
a hash of QStrings.
@@ -339,5 +339,5 @@ index e966b3d..6e26f57 100644
// Maximal memory usage for a single sequential two-byte string.
--
-1.7.2.3
+1.7.6
diff --git a/src/v8/0002-Add-a-bit-field-3-to-Map.patch b/src/v8/0002-Add-a-bit-field-3-to-Map.patch
index dda9fa0dff..4b21317668 100644
--- a/src/v8/0002-Add-a-bit-field-3-to-Map.patch
+++ b/src/v8/0002-Add-a-bit-field-3-to-Map.patch
@@ -1,7 +1,7 @@
From 7c9cfff80b7864d5687432d424074e51712c4a07 Mon Sep 17 00:00:00 2001
From: Aaron Kennedy <aaron.kennedy@nokia.com>
Date: Mon, 23 May 2011 15:55:26 +1000
-Subject: [PATCH 02/13] Add a bit field 3 to Map
+Subject: [PATCH 02/16] Add a bit field 3 to Map
Bit field 3 will be used to add QML specific map flags.
---
@@ -114,5 +114,5 @@ index 6e26f57..07e1089 100644
static const int kCodeCacheEntrySize = 2;
static const int kCodeCacheEntryNameOffset = 0;
--
-1.7.2.3
+1.7.6
diff --git a/src/v8/0003-Add-a-fallback-mode-for-named-property-interceptors.patch b/src/v8/0003-Add-a-fallback-mode-for-named-property-interceptors.patch
index 50f97c7de8..27529ff3da 100644
--- a/src/v8/0003-Add-a-fallback-mode-for-named-property-interceptors.patch
+++ b/src/v8/0003-Add-a-fallback-mode-for-named-property-interceptors.patch
@@ -1,7 +1,7 @@
From ae8688b53d67044f2c9b0cce25fc282b078610c1 Mon Sep 17 00:00:00 2001
From: Aaron Kennedy <aaron.kennedy@nokia.com>
Date: Mon, 23 May 2011 16:21:02 +1000
-Subject: [PATCH 03/13] Add a "fallback" mode for named property interceptors
+Subject: [PATCH 03/16] Add a "fallback" mode for named property interceptors
By default interceptors are called before the normal property
resolution on objects. When an interceptor is installed as a
@@ -360,5 +360,5 @@ index 7335da8..660352c 100644
return isolate->heap()->undefined_value();
}
--
-1.7.2.3
+1.7.6
diff --git a/src/v8/0004-Generalize-external-object-resources.patch b/src/v8/0004-Generalize-external-object-resources.patch
index f44e7b2134..a05aad0889 100644
--- a/src/v8/0004-Generalize-external-object-resources.patch
+++ b/src/v8/0004-Generalize-external-object-resources.patch
@@ -1,7 +1,7 @@
From 4827116b12c50f6662794017c5a662b5dbb2da0b Mon Sep 17 00:00:00 2001
From: Aaron Kennedy <aaron.kennedy@nokia.com>
Date: Mon, 23 May 2011 16:55:35 +1000
-Subject: [PATCH 04/13] Generalize external object resources
+Subject: [PATCH 04/16] Generalize external object resources
V8 was already able to manage and finalize an external string
resource. This change generalizes that mechanism to handle a
@@ -890,5 +890,5 @@ index a209cd0..1bdb5c7 100644
--
-1.7.2.3
+1.7.6
diff --git a/src/v8/0005-Introduce-a-QML-compilation-mode.patch b/src/v8/0005-Introduce-a-QML-compilation-mode.patch
index b464e61266..3c1cab2497 100644
--- a/src/v8/0005-Introduce-a-QML-compilation-mode.patch
+++ b/src/v8/0005-Introduce-a-QML-compilation-mode.patch
@@ -1,7 +1,7 @@
From fd7d475e298e5b63cd6383c78cc900635c82aa38 Mon Sep 17 00:00:00 2001
From: Aaron Kennedy <aaron.kennedy@nokia.com>
Date: Mon, 23 May 2011 18:26:19 +1000
-Subject: [PATCH 05/13] Introduce a QML compilation mode
+Subject: [PATCH 05/16] Introduce a QML compilation mode
In QML mode, there is a second global object - known as the QML
global object. During property resolution, if a property is not
@@ -1773,5 +1773,5 @@ index 4c17720..aa284ed 100644
static inline Operand StackSpaceOperand(int index) {
#ifdef _WIN64
--
-1.7.2.3
+1.7.6
diff --git a/src/v8/0006-Allow-access-to-the-calling-script-data.patch b/src/v8/0006-Allow-access-to-the-calling-script-data.patch
index d4acdf7a42..50529d67b1 100644
--- a/src/v8/0006-Allow-access-to-the-calling-script-data.patch
+++ b/src/v8/0006-Allow-access-to-the-calling-script-data.patch
@@ -1,7 +1,7 @@
From f890f0d1a1e5bd62711815489c87755a4f382436 Mon Sep 17 00:00:00 2001
From: Aaron Kennedy <aaron.kennedy@nokia.com>
Date: Wed, 25 May 2011 10:36:13 +1000
-Subject: [PATCH 06/13] Allow access to the calling script data
+Subject: [PATCH 06/16] Allow access to the calling script data
---
include/v8.h | 1 +
@@ -44,5 +44,5 @@ index 39767f4..ff74efb 100644
v8::Local<v8::Object> Context::Global() {
if (IsDeadCheck(i::Isolate::Current(), "v8::Context::Global()")) {
--
-1.7.2.3
+1.7.6
diff --git a/src/v8/0007-Fix-warnings.patch b/src/v8/0007-Fix-warnings.patch
index 26141c8ae8..fe6fa59517 100644
--- a/src/v8/0007-Fix-warnings.patch
+++ b/src/v8/0007-Fix-warnings.patch
@@ -1,7 +1,7 @@
From dac5d9db84cf20564621c679937ca7b9c6a8e880 Mon Sep 17 00:00:00 2001
From: Aaron Kennedy <aaron.kennedy@nokia.com>
Date: Fri, 27 May 2011 13:04:15 +1000
-Subject: [PATCH 07/13] Fix warnings
+Subject: [PATCH 07/16] Fix warnings
---
include/v8.h | 16 ++++++++--------
@@ -42,5 +42,5 @@ index 9aba4a8..8891dab 100644
} // namespace internal
--
-1.7.2.3
+1.7.6
diff --git a/src/v8/0008-Add-custom-object-compare-callback.patch b/src/v8/0008-Add-custom-object-compare-callback.patch
index d7ef5c434d..a6973969fe 100644
--- a/src/v8/0008-Add-custom-object-compare-callback.patch
+++ b/src/v8/0008-Add-custom-object-compare-callback.patch
@@ -1,7 +1,7 @@
From bec11b8b7f89d135e7d9a823ac4fe98c70d017cf Mon Sep 17 00:00:00 2001
From: Aaron Kennedy <aaron.kennedy@nokia.com>
Date: Mon, 27 Jun 2011 14:57:28 +1000
-Subject: [PATCH 08/13] Add custom object compare callback
+Subject: [PATCH 08/16] Add custom object compare callback
A global custom object comparison callback can be set with:
V8::SetUserObjectComparisonCallbackFunction()
@@ -485,5 +485,5 @@ index d923494..10b9b56 100644
ASSERT(GetCondition() == equal);
__ subq(rax, rdx);
--
-1.7.2.3
+1.7.6
diff --git a/src/v8/0009-Add-CallAsFunction-method-to-the-Object-class-in-the.patch b/src/v8/0009-Add-CallAsFunction-method-to-the-Object-class-in-the.patch
index d197ac9e48..242161358f 100644
--- a/src/v8/0009-Add-CallAsFunction-method-to-the-Object-class-in-the.patch
+++ b/src/v8/0009-Add-CallAsFunction-method-to-the-Object-class-in-the.patch
@@ -1,7 +1,8 @@
From 4183b973ed3bd603784c798dfa63ba48f6b68003 Mon Sep 17 00:00:00 2001
-From: ager@chromium.org <ager@chromium.org>
+From: "ager@chromium.org" <ager@chromium.org>
Date: Wed, 4 May 2011 13:03:08 +0000
-Subject: [PATCH 09/13] Add CallAsFunction method to the Object class in the API
+Subject: [PATCH 09/16] Add CallAsFunction method to the Object class in the
+ API
Patch by Peter Varga.
@@ -282,5 +283,5 @@ index d7621d1..693d51e 100644
--
-1.7.2.3
+1.7.6
diff --git a/src/v8/0010-Implement-CallAsConstructor-method-for-Object-in-the.patch b/src/v8/0010-Implement-CallAsConstructor-method-for-Object-in-the.patch
index cb4dd186d6..ea3802b96d 100644
--- a/src/v8/0010-Implement-CallAsConstructor-method-for-Object-in-the.patch
+++ b/src/v8/0010-Implement-CallAsConstructor-method-for-Object-in-the.patch
@@ -1,7 +1,8 @@
From 3d6d4249878f7960eac4c9c94e0f2529f9a58c4a Mon Sep 17 00:00:00 2001
-From: ager@chromium.org <ager@chromium.org>
+From: "ager@chromium.org" <ager@chromium.org>
Date: Fri, 6 May 2011 11:07:52 +0000
-Subject: [PATCH 10/13] Implement CallAsConstructor method for Object in the API
+Subject: [PATCH 10/16] Implement CallAsConstructor method for Object in the
+ API
Patch by Peter Varga.
@@ -393,5 +394,5 @@ index 693d51e..1334f63 100644
}
}
--
-1.7.2.3
+1.7.6
diff --git a/src/v8/0011-QtScript-V8-Add-new-v8-api-to-check-if-a-value-is-an.patch b/src/v8/0011-QtScript-V8-Add-new-v8-api-to-check-if-a-value-is-an.patch
index 9c0e68352f..aefcae55cd 100644
--- a/src/v8/0011-QtScript-V8-Add-new-v8-api-to-check-if-a-value-is-an.patch
+++ b/src/v8/0011-QtScript-V8-Add-new-v8-api-to-check-if-a-value-is-an.patch
@@ -1,7 +1,8 @@
From f22d0312faeb93ced8747d9aae8c6d77e11b4aba Mon Sep 17 00:00:00 2001
From: Jedrzej Nowacki <jedrzej.nowacki@nokia.com>
Date: Tue, 7 Dec 2010 11:56:42 +0100
-Subject: [PATCH 11/13] QtScript/V8: Add new v8 api to check if a value is an error.
+Subject: [PATCH 11/16] QtScript/V8: Add new v8 api to check if a value is an
+ error.
New function v8::Value::IsError was created.
@@ -59,5 +60,5 @@ index 8cbf378..db90bb9 100644
V(to_string_symbol, "toString") \
V(char_at_symbol, "CharAt") \
--
-1.7.2.3
+1.7.6
diff --git a/src/v8/0012-Add-IsCallable-method-for-Object-in-the-API.patch b/src/v8/0012-Add-IsCallable-method-for-Object-in-the-API.patch
index 77589c8af3..426458dafc 100644
--- a/src/v8/0012-Add-IsCallable-method-for-Object-in-the-API.patch
+++ b/src/v8/0012-Add-IsCallable-method-for-Object-in-the-API.patch
@@ -1,7 +1,8 @@
From 472c04c9e7a64e8734c76d2cf97a7cc5b773b788 Mon Sep 17 00:00:00 2001
-From: ager@chromium.org <ager@chromium.org@ce2b1a6d-e550-0410-aec6-3dcde31c8c00>
+From: "ager@chromium.org"
+ <ager@chromium.org@ce2b1a6d-e550-0410-aec6-3dcde31c8c00>
Date: Mon, 9 May 2011 15:24:48 +0000
-Subject: [PATCH 12/13] Add IsCallable method for Object in the API
+Subject: [PATCH 12/16] Add IsCallable method for Object in the API
Patch by Peter Varga.
@@ -112,5 +113,5 @@ index 1334f63..45db5a1 100644
return v8::HandleScope::NumberOfHandles();
}
--
-1.7.2.3
+1.7.6
diff --git a/src/v8/0013-Remove-execute-flag-from-v8-debug.h.patch b/src/v8/0013-Remove-execute-flag-from-v8-debug.h.patch
index 6bad561273..f73785d123 100644
--- a/src/v8/0013-Remove-execute-flag-from-v8-debug.h.patch
+++ b/src/v8/0013-Remove-execute-flag-from-v8-debug.h.patch
@@ -1,7 +1,7 @@
From dc2cad4f8fc88c52fcea09b8d0262d35cd32dc44 Mon Sep 17 00:00:00 2001
From: Aaron Kennedy <aaron.kennedy@nokia.com>
Date: Thu, 25 Aug 2011 11:09:58 +1000
-Subject: [PATCH 13/13] Remove execute flag from v8-debug.h
+Subject: [PATCH 13/16] Remove execute flag from v8-debug.h
---
0 files changed, 0 insertions(+), 0 deletions(-)
@@ -11,5 +11,5 @@ diff --git a/include/v8-debug.h b/include/v8-debug.h
old mode 100755
new mode 100644
--
-1.7.2.3
+1.7.6
diff --git a/src/v8/0014-Fix-build-error-suggest-parentheses-around-within.patch b/src/v8/0014-Fix-build-error-suggest-parentheses-around-within.patch
new file mode 100644
index 0000000000..bb26b1493f
--- /dev/null
+++ b/src/v8/0014-Fix-build-error-suggest-parentheses-around-within.patch
@@ -0,0 +1,25 @@
+From d7e876decc00c611d327185bf890a7efecb2cf7e Mon Sep 17 00:00:00 2001
+From: Kent Hansen <kent.hansen@nokia.com>
+Date: Mon, 29 Aug 2011 13:26:13 +0200
+Subject: [PATCH 14/16] Fix build error: "suggest parentheses around '&&'
+ within '||'"
+
+---
+ src/mark-compact.cc | 2 +-
+ 1 files changed, 1 insertions(+), 1 deletions(-)
+
+diff --git a/src/mark-compact.cc b/src/mark-compact.cc
+index 1b1e361..775f787 100644
+--- a/src/mark-compact.cc
++++ b/src/mark-compact.cc
+@@ -1020,7 +1020,7 @@ class SymbolTableCleaner : public ObjectVisitor {
+ // Since no objects have yet been moved we can safely access the map of
+ // the object.
+ if ((*p)->IsExternalString() ||
+- (*p)->IsHeapObject() && HeapObject::cast(*p)->map()->has_external_resource()) {
++ ((*p)->IsHeapObject() && HeapObject::cast(*p)->map()->has_external_resource())) {
+ heap_->FinalizeExternalString(HeapObject::cast(*p));
+ }
+ // Set the entry to null_value (as deleted).
+--
+1.7.6
diff --git a/src/v8/0015-Fix-source-compatibility-where-the-String-Equals-ove.patch b/src/v8/0015-Fix-source-compatibility-where-the-String-Equals-ove.patch
new file mode 100644
index 0000000000..003c430f56
--- /dev/null
+++ b/src/v8/0015-Fix-source-compatibility-where-the-String-Equals-ove.patch
@@ -0,0 +1,25 @@
+From 0af1e15a3d6b28923c262a02a5ace35812c8f5d6 Mon Sep 17 00:00:00 2001
+From: Simon Hausmann <simon.hausmann@nokia.com>
+Date: Thu, 4 Aug 2011 21:28:38 +0200
+Subject: [PATCH 15/16] Fix source compatibility where the String::Equals
+ overloads would shadow the Value::Equals function,
+ breaking the build.
+
+---
+ include/v8.h | 1 +
+ 1 files changed, 1 insertions(+), 0 deletions(-)
+
+diff --git a/include/v8.h b/include/v8.h
+index 4194d4a..5e1ce50 100644
+--- a/include/v8.h
++++ b/include/v8.h
+@@ -1048,6 +1048,7 @@ class String : public Primitive {
+ */
+ V8EXPORT bool Equals(uint16_t *string, int length);
+ V8EXPORT bool Equals(char *string, int length);
++ inline bool Equals(Handle<Value> that) const { return v8::Value::Equals(that); }
+
+ /**
+ * Write the contents of the string to an external buffer.
+--
+1.7.6
diff --git a/src/v8/0016-Fix-deprecated-Python-code.patch b/src/v8/0016-Fix-deprecated-Python-code.patch
new file mode 100644
index 0000000000..4ecf8d7e6f
--- /dev/null
+++ b/src/v8/0016-Fix-deprecated-Python-code.patch
@@ -0,0 +1,50 @@
+From 97cb46d421faebd2b139570bcf9aaf2d5eadc333 Mon Sep 17 00:00:00 2001
+From: Kent Hansen <kent.hansen@nokia.com>
+Date: Fri, 2 Sep 2011 12:03:09 +0200
+Subject: [PATCH 16/16] Fix deprecated Python code
+
+Needed to make the scripts run on Python 3, which is the
+default python interpreter on some newer distros.
+
+Patch from http://code.google.com/p/v8/issues/detail?id=1391
+---
+ tools/js2c.py | 4 ++--
+ tools/jsmin.py | 2 +-
+ 2 files changed, 3 insertions(+), 3 deletions(-)
+
+diff --git a/tools/js2c.py b/tools/js2c.py
+index 2da132f..d13d53d 100755
+--- a/tools/js2c.py
++++ b/tools/js2c.py
+@@ -187,14 +187,14 @@ def ReadMacros(lines):
+ macro_match = MACRO_PATTERN.match(line)
+ if macro_match:
+ name = macro_match.group(1)
+- args = map(string.strip, macro_match.group(2).split(','))
++ args = args = [match.strip() for match in macro_match.group(2).split(',')]
+ body = macro_match.group(3).strip()
+ macros.append((re.compile("\\b%s\\(" % name), TextMacro(args, body)))
+ else:
+ python_match = PYTHON_MACRO_PATTERN.match(line)
+ if python_match:
+ name = python_match.group(1)
+- args = map(string.strip, python_match.group(2).split(','))
++ args = [match.strip() for match in python_match.group(2).split(',')]
+ body = python_match.group(3).strip()
+ fun = eval("lambda " + ",".join(args) + ': ' + body)
+ macros.append((re.compile("\\b%s\\(" % name), PythonMacro(args, fun)))
+diff --git a/tools/jsmin.py b/tools/jsmin.py
+index 646bf14..395441b 100644
+--- a/tools/jsmin.py
++++ b/tools/jsmin.py
+@@ -154,7 +154,7 @@ class JavaScriptMinifier(object):
+ return var_name
+ while True:
+ identifier_first_char = self.identifier_counter % 52
+- identifier_second_char = self.identifier_counter / 52
++ identifier_second_char = self.identifier_counter // 52
+ new_identifier = self.CharFromNumber(identifier_first_char)
+ if identifier_second_char != 0:
+ new_identifier = (
+--
+1.7.6
diff --git a/src/v8/v8.pri b/src/v8/v8.pri
index 2abf52972c..6300ca989e 100644
--- a/src/v8/v8.pri
+++ b/src/v8/v8.pri
@@ -1,3 +1,10 @@
+isEmpty(QT_ARCH) {
+ # We're most likely being parsed in a fromfile() call, in which case the
+ # QMake environment isn't complete. Load qt_config in an attempt to set
+ # the variables we need (QT_ARCH and CONFIG, in particular).
+ load(qt_config)
+}
+
equals(QT_ARCH, x86_64)|contains(CONFIG, x86_64):CONFIG += arch_x86_64
else:equals(QT_ARCH, "i386"):CONFIG += arch_i386
else:equals(QT_ARCH, "arm"):CONFIG += arch_arm
diff --git a/src/widgets/widgets/qmenu_p.h b/src/widgets/widgets/qmenu_p.h
index 9cadb596c8..cfe1ecf2b9 100644
--- a/src/widgets/widgets/qmenu_p.h
+++ b/src/widgets/widgets/qmenu_p.h
@@ -145,6 +145,9 @@ public:
#endif
scroll(0), eventLoop(0), tearoff(0), tornoff(0), tearoffHighlighted(0),
hasCheckableItems(0), sloppyAction(0), doChildEffects(false)
+#ifdef QT3_SUPPORT
+ ,emitHighlighted(false)
+#endif
#ifdef Q_OS_MAC
,mac_menu(0)
#endif
@@ -154,9 +157,6 @@ public:
#ifdef Q_WS_S60
,symbian_menu(0)
#endif
-#ifdef QT3_SUPPORT
- ,emitHighlighted(false)
-#endif
{ }
~QMenuPrivate()
{
diff --git a/src/widgets/widgets/qmenu_symbian.cpp b/src/widgets/widgets/qmenu_symbian.cpp
index 56eca9a425..4250601f98 100644
--- a/src/widgets/widgets/qmenu_symbian.cpp
+++ b/src/widgets/widgets/qmenu_symbian.cpp
@@ -398,12 +398,12 @@ void QMenuPrivate::QSymbianMenuPrivate::rebuild(bool)
{
}
-void QMenuBarPrivate::QSymbianMenuBarPrivate::addAction(QAction *a, QSymbianMenuAction *before)
+void QMenuBarPrivate::QSymbianMenuBarPrivate::addAction(QAction *a, QAction *before)
{
QSymbianMenuAction *action = new QSymbianMenuAction;
action->action = a;
action->command = qt_symbian_menu_static_cmd_id++;
- addAction(action, before);
+ addAction(action, findAction(before));
}
void QMenuBarPrivate::QSymbianMenuBarPrivate::addAction(QSymbianMenuAction *action, QSymbianMenuAction *before)
diff --git a/src/widgets/widgets/qmenu_wince.cpp b/src/widgets/widgets/qmenu_wince.cpp
index 1157fff8a2..b0c6c1bd12 100644
--- a/src/widgets/widgets/qmenu_wince.cpp
+++ b/src/widgets/widgets/qmenu_wince.cpp
@@ -504,12 +504,12 @@ void QMenuPrivate::QWceMenuPrivate::removeAction(QWceMenuAction *action)
rebuild();
}
-void QMenuBarPrivate::QWceMenuBarPrivate::addAction(QAction *a, QWceMenuAction *before)
+void QMenuBarPrivate::QWceMenuBarPrivate::addAction(QAction *a, QAction *before)
{
QWceMenuAction *action = new QWceMenuAction;
action->action = a;
action->command = qt_wce_menu_static_cmd_id++;
- addAction(action, before);
+ addAction(action, findAction(before));
}
void QMenuBarPrivate::QWceMenuBarPrivate::addAction(QWceMenuAction *action, QWceMenuAction *before)