Merge remote-tracking branch 'origin/stable' into dev

Conflicts:
	src/plugins/platforms/android/qandroidplatformtheme.h

Change-Id: I541bd3069df3ab54c7942d5f4a9e155e3b6566a0
This commit is contained in:
Frederik Gladhorn 2014-02-18 14:19:36 +01:00
commit 6aa09bbce5
14 changed files with 182 additions and 66 deletions

View File

@ -3542,9 +3542,13 @@ bool QUrl::operator ==(const QUrl &url) const
if (!url.d)
return d->isEmpty();
// Compare which sections are present, but ignore Host
// which is set by parsing but not by construction, when empty.
const int mask = QUrlPrivate::FullUrl & ~QUrlPrivate::Host;
// First, compare which sections are present, since it speeds up the
// processing considerably. We just have to ignore the host-is-present flag
// for local files (the "file" protocol), due to the requirements of the
// XDG file URI specification.
int mask = QUrlPrivate::FullUrl;
if (isLocalFile())
mask &= ~QUrlPrivate::Host;
return (d->sectionIsPresent & mask) == (url.d->sectionIsPresent & mask) &&
d->scheme == url.d->scheme &&
d->userName == url.d->userName &&
@ -3575,9 +3579,13 @@ bool QUrl::matches(const QUrl &url, FormattingOptions options) const
if (!url.d)
return d->isEmpty();
// Compare which sections are present, but ignore Host
// which is set by parsing but not by construction, when empty.
int mask = QUrlPrivate::FullUrl & ~QUrlPrivate::Host;
// First, compare which sections are present, since it speeds up the
// processing considerably. We just have to ignore the host-is-present flag
// for local files (the "file" protocol), due to the requirements of the
// XDG file URI specification.
int mask = QUrlPrivate::FullUrl;
if (isLocalFile())
mask &= ~QUrlPrivate::Host;
if (options & QUrl::RemoveScheme)
mask &= ~QUrlPrivate::Scheme;

View File

@ -230,7 +230,7 @@
/*! \fn OutputIterator qCopy(InputIterator begin1, InputIterator end1, OutputIterator begin2)
\relates <QtAlgorithms>
\obsolete
\deprecated
Use std::copy instead.
@ -249,7 +249,7 @@
/*! \fn BiIterator2 qCopyBackward(BiIterator1 begin1, BiIterator1 end1, BiIterator2 end2)
\relates <QtAlgorithms>
\obsolete
\deprecated
Use std::copy_backward instead.
@ -268,7 +268,7 @@
/*! \fn bool qEqual(InputIterator1 begin1, InputIterator1 end1, InputIterator2 begin2)
\relates <QtAlgorithms>
\obsolete
\deprecated
Use std::equal instead.
@ -287,7 +287,7 @@
/*! \fn void qFill(ForwardIterator begin, ForwardIterator end, const T &value)
\relates <QtAlgorithms>
\obsolete
\deprecated
Use std::fill instead.
@ -301,7 +301,7 @@
/*! \fn void qFill(Container &container, const T &value)
\relates <QtAlgorithms>
\obsolete
\deprecated
\overload
Use std::fill instead.
@ -311,7 +311,7 @@
/*! \fn InputIterator qFind(InputIterator begin, InputIterator end, const T &value)
\relates <QtAlgorithms>
\obsolete
\deprecated
Use std::find instead.
@ -334,7 +334,7 @@
/*! \fn void qFind(const Container &container, const T &value)
\relates <QtAlgorithms>
\obsolete
\deprecated
\overload
Use std::find instead.
@ -344,7 +344,7 @@
/*! \fn void qCount(InputIterator begin, InputIterator end, const T &value, Size &n)
\relates <QtAlgorithms>
\obsolete
\deprecated
Use std::count instead.
@ -364,7 +364,7 @@
/*! \fn void qCount(const Container &container, const T &value, Size &n)
\relates <QtAlgorithms>
\obsolete
\deprecated
\overload
Use std::count instead.
@ -376,7 +376,7 @@
/*! \fn void qSwap(T &var1, T &var2)
\relates <QtAlgorithms>
\obsolete
\deprecated
Use std::swap instead.
@ -388,7 +388,7 @@
/*! \fn void qSort(RandomAccessIterator begin, RandomAccessIterator end)
\relates <QtAlgorithms>
\obsolete
\deprecated
Use std::sort instead.
@ -413,7 +413,7 @@
/*! \fn void qSort(RandomAccessIterator begin, RandomAccessIterator end, LessThan lessThan)
\relates <QtAlgorithms>
\obsolete
\deprecated
\overload
Use std::sort instead.
@ -449,7 +449,7 @@
/*! \fn void qSort(Container &container)
\relates <QtAlgorithms>
\obsolete
\deprecated
\overload
Use std::sort instead.
@ -460,7 +460,7 @@
/*!
\fn void qStableSort(RandomAccessIterator begin, RandomAccessIterator end)
\relates <QtAlgorithms>
\obsolete
\deprecated
Use std::stable_sort instead.
@ -487,7 +487,7 @@
/*!
\fn void qStableSort(RandomAccessIterator begin, RandomAccessIterator end, LessThan lessThan)
\relates <QtAlgorithms>
\obsolete
\deprecated
\overload
Use std::stable_sort instead.
@ -519,7 +519,7 @@
/*!
\fn void qStableSort(Container &container)
\relates <QtAlgorithms>
\obsolete
\deprecated
\overload
Use std::stable_sort instead.
@ -529,7 +529,7 @@
/*! \fn RandomAccessIterator qLowerBound(RandomAccessIterator begin, RandomAccessIterator end, const T &value)
\relates <QtAlgorithms>
\obsolete
\deprecated
Use std::lower_bound instead.
@ -558,7 +558,7 @@
/*!
\fn RandomAccessIterator qLowerBound(RandomAccessIterator begin, RandomAccessIterator end, const T &value, LessThan lessThan)
\relates <QtAlgorithms>
\obsolete
\deprecated
\overload
Use std::lower_bound instead.
@ -573,7 +573,7 @@
/*!
\fn void qLowerBound(const Container &container, const T &value)
\relates <QtAlgorithms>
\obsolete
\deprecated
\overload
Use std::lower_bound instead.
@ -586,7 +586,7 @@
/*! \fn RandomAccessIterator qUpperBound(RandomAccessIterator begin, RandomAccessIterator end, const T &value)
\relates <QtAlgorithms>
\obsolete
\deprecated
Use std::upper_bound instead.
@ -615,7 +615,7 @@
/*!
\fn RandomAccessIterator qUpperBound(RandomAccessIterator begin, RandomAccessIterator end, const T &value, LessThan lessThan)
\relates <QtAlgorithms>
\obsolete
\deprecated
\overload
Use std::upper_bound instead.
@ -630,7 +630,7 @@
/*!
\fn void qUpperBound(const Container &container, const T &value)
\relates <QtAlgorithms>
\obsolete
\deprecated
\overload
Use std::upper_bound instead.
@ -641,7 +641,7 @@
/*! \fn RandomAccessIterator qBinaryFind(RandomAccessIterator begin, RandomAccessIterator end, const T &value)
\relates <QtAlgorithms>
\obsolete
\deprecated
Use std::binary_search or std::lower_bound instead.
@ -667,7 +667,7 @@
/*! \fn RandomAccessIterator qBinaryFind(RandomAccessIterator begin, RandomAccessIterator end, const T &value, LessThan lessThan)
\relates <QtAlgorithms>
\obsolete
\deprecated
\overload
Use std::binary_search or std::lower_bound instead.
@ -682,7 +682,7 @@
/*!
\fn void qBinaryFind(const Container &container, const T &value)
\relates <QtAlgorithms>
\obsolete
\deprecated
\overload
Use std::binary_search or std::lower_bound instead.
@ -725,7 +725,7 @@
/*! \fn LessThan qLess()
\relates <QtAlgorithms>
\obsolete
\deprecated
Use std::less instead.
@ -741,7 +741,7 @@
/*! \fn LessThan qGreater()
\relates <QtAlgorithms>
\obsolete
\deprecated
Use std::greater instead.

View File

@ -3696,7 +3696,7 @@ bool QString::contains(const QRegularExpression &re) const
If the match is successful and \a match is not a null pointer, it also
writes the results of the match into the QRegularExpressionMatch object
pointed by \a match.
pointed to by \a match.
\sa QRegularExpression::match()
*/

View File

@ -464,20 +464,65 @@ static QWindowGeometrySpecification windowGeometrySpecification;
\note \a argc and \a argv might be changed as Qt removes command line
arguments that it recognizes.
\section1 Supported Command Line Options
All Qt programs automatically support the following command line options:
\list
\li -reverse, sets the application's layout direction to
Qt::RightToLeft
\li -qmljsdebugger=, activates the QML/JS debugger with a specified port.
The value must be of format port:1234[,block], where block is optional
\li \c{-platform} \e {platformName[:options]}, specifies the
\l{Qt Platform Abstraction} (QPA) plugin.
Overridden by the \c QT_QPA_PLATFORM environment variable.
\li \c{-platformpluginpath} \e path, specifies the path to platform
plugins.
Overridden by the \c QT_QPA_PLATFORM_PLUGIN_PATH environment
variable.
\li \c{-platformtheme} \e platformTheme, specifies the platform theme.
Overridden by the \c QT_QPA_PLATFORMTHEME environment variable.
\li \c{-qmljsdebugger=}, activates the QML/JS debugger with a specified port.
The value must be of format \c{port:1234}\e{[,block]}, where
\e block is optional
and will make the application wait until a debugger connects to it.
\li -session \e session, restores the application from an earlier
\li \c {-qwindowgeometry} \e geometry, specifies window geometry for
the main window using the X11-syntax. For example:
\c {-qwindowgeometry 100x100+50+50}
\li \c{-reverse}, sets the application's layout direction to
Qt::RightToLeft
\li \c{-session} \e session, restores the application from an earlier
\l{Session Management}{session}.
\li -qwindowgeometry, sets the geometry of the first window
\li -qwindowtitle, sets the title of the first window
\endlist
\sa arguments()
The following standard command line options are available for X11:
\list
\li \c {-display} \e {hostname:screen_number}, switches displays on X11.
\li \c {-geometry} \e geometry, same as \c {-qwindowgeometry}.
\endlist
\section1 Platform-Specific Arguments
You can specify platform-specific arguments for the \c{-platform} option.
Place them after the platform plugin name following a colon as a
comma-separated list. For example,
\c{-platform windows:dialogs=xp,fontengine=freetype}.
The following parameters are available for \c {-platform windows}:
\list
\li \c {dialogs=[xp|none]}, \c xp uses XP-style native dialogs and
\c none disables them.
\li \c {fontengine=freetype}, uses the FreeType font engine.
\endlist
For more information about the platform-specific arguments available for
embedded Linux platforms, see \l{Qt for Embedded Linux}.
\sa arguments() QGuiApplication::platformName
*/
#ifdef Q_QDOC
QGuiApplication::QGuiApplication(int &argc, char **argv)
@ -885,8 +930,35 @@ QWindow *QGuiApplication::topLevelAt(const QPoint &pos)
\property QGuiApplication::platformName
\brief The name of the underlying platform plugin.
Examples: "xcb" (for X11), "Cocoa" (for Mac OS X), "windows", "qnx",
"directfb", "kms", "MinimalEgl", "LinuxFb", "EglFS", "OpenWFD"...
The QPA platform plugins are located in \c {qtbase\src\plugins\platforms}.
At the time of writing, the following platform plugin names are supported:
\list
\li \c android
\li \c cocoa is a platform plugin for Mac OS X.
\li \c directfb
\li \c eglfs is a platform plugin for running Qt5 applications on top of
EGL and OpenGL ES 2.0 without an actual windowing system (like X11
or Wayland). For more information, see \l{EGLFS}.
\li \c ios
\li \c kms is an experimental platform plugin using kernel modesetting
and \l{http://dri.freedesktop.org/wiki/DRM}{DRM} (Direct Rendering
Manager).
\li \c linuxfb writes directly to the framebuffer. For more information,
see \l{LinuxFB}.
\li \c minimal is provided as an examples for developers who want to
write their own platform plugins. However, you can use the plugin to
run GUI applications in environments without a GUI, such as servers.
\li \c minimalegl is an example plugin.
\li \c offscreen
\li \c openwfd
\li \c qnx
\li \c windows
\li \c xcb is the X11 plugin used on regular desktop Linux platforms.
\endlist
For more information about the platform plugins for embedded Linux devices,
see \l{Qt for Embedded Linux}.
*/
QString QGuiApplication::platformName()

View File

@ -2883,11 +2883,11 @@ void QTextDocumentLayout::documentChanged(int from, int oldLength, int length)
{
Q_D(QTextDocumentLayout);
QTextBlock blockIt = document()->findBlock(from);
QTextBlock startIt = document()->findBlock(from);
QTextBlock endIt = document()->findBlock(qMax(0, from + length - 1));
if (endIt.isValid())
endIt = endIt.next();
for (; blockIt.isValid() && blockIt != endIt; blockIt = blockIt.next())
for (QTextBlock blockIt = startIt; blockIt.isValid() && blockIt != endIt; blockIt = blockIt.next())
blockIt.clearLayout();
if (d->docPrivate->pageSize.isNull())
@ -2929,6 +2929,9 @@ void QTextDocumentLayout::documentChanged(int from, int oldLength, int length)
d->insideDocumentChange = false;
for (QTextBlock blockIt = startIt; blockIt.isValid() && blockIt != endIt; blockIt = blockIt.next())
emit updateBlock(blockIt);
if (d->showLayoutProgress) {
const QSizeF newSize = dynamicDocumentSize();
if (newSize != d->lastReportedSize) {

View File

@ -63,7 +63,6 @@
#include "androidjnimenu.h"
#include "qandroidplatformdialoghelpers.h"
#include "qandroidplatformintegration.h"
#include <QtWidgets/QApplication>
#include <qabstracteventdispatcher.h>

View File

@ -39,8 +39,6 @@
**
****************************************************************************/
#include <QtWidgets/QApplication>
#include <QtWidgets/QStyle>
#include "qandroidplatformdialoghelpers.h"
#include "androidjnimain.h"
#include <private/qguiapplication_p.h>

View File

@ -45,7 +45,6 @@
#include <qpa/qplatformintegration.h>
#include <qpa/qplatformmenu.h>
#include <qpa/qplatformnativeinterface.h>
#include <QtWidgets/QAction>
#include <EGL/egl.h>
#include <jni.h>

View File

@ -43,7 +43,7 @@
#define QANDROIDPLATFORMTHEME_H
#include <qpa/qplatformtheme.h>
#include <QPalette>
#include <QtGui/qpalette.h>
class QAndroidPlatformNativeInterface;
class QAndroidPlatformTheme: public QPlatformTheme

View File

@ -217,7 +217,7 @@
\section1 Using models and views
The following sections explain how to use the model/view pattern
in Qt. Each section includes an an example and is followed by a
in Qt. Each section includes an example and is followed by a
section showing how to create new components.
\section2 Two models included in Qt

View File

@ -169,6 +169,7 @@ private slots:
void fileName();
void isEmptyForEncodedUrl();
void toEncodedNotUsingUninitializedPath();
void emptyAuthorityRemovesExistingAuthority_data();
void emptyAuthorityRemovesExistingAuthority();
void acceptEmptyAuthoritySegments();
void lowercasesScheme();
@ -3033,31 +3034,56 @@ void tst_QUrl::resolvedWithAbsoluteSchemes_data() const
<< QUrl::fromEncoded("http://andreas:hemmelig@www.vg.no/?my=query&your=query#yougotfragged");
}
void tst_QUrl::emptyAuthorityRemovesExistingAuthority_data()
{
QTest::addColumn<QString>("input");
QTest::addColumn<QString>("expected");
QTest::newRow("regular") << "foo://example.com/something" << "foo:/something";
QTest::newRow("empty") << "foo:///something" << "foo:/something";
}
void tst_QUrl::emptyAuthorityRemovesExistingAuthority()
{
QUrl url("http://example.com/something");
QFETCH(QString, input);
QFETCH(QString, expected);
QUrl url(input);
QUrl orig = url;
url.setAuthority(QString());
QCOMPARE(url.authority(), QString());
QVERIFY(url != orig);
QCOMPARE(url.toString(), expected);
QCOMPARE(url, QUrl(expected));
}
void tst_QUrl::acceptEmptyAuthoritySegments()
{
QCOMPARE(QUrl("remote://").toString(), QString::fromLatin1("remote://"));
// Verify that foo:///bar is not mangled to foo:/bar
// Verify that foo:///bar is not mangled to foo:/bar nor vice-versa
QString foo_triple_bar("foo:///bar"), foo_uni_bar("foo:/bar");
QCOMPARE(foo_triple_bar, QUrl(foo_triple_bar).toString());
QCOMPARE(foo_triple_bar, QString::fromUtf8(QUrl(foo_triple_bar).toEncoded()));
QVERIFY(QUrl(foo_triple_bar) != QUrl(foo_uni_bar));
QCOMPARE(foo_uni_bar, QUrl(foo_uni_bar).toString());
QCOMPARE(foo_uni_bar, QString::fromUtf8(QUrl(foo_uni_bar).toEncoded()));
QCOMPARE(QUrl(foo_triple_bar).toString(), foo_triple_bar);
QCOMPARE(QUrl(foo_triple_bar).toEncoded(), foo_triple_bar.toLatin1());
QCOMPARE(foo_triple_bar, QUrl(foo_triple_bar, QUrl::StrictMode).toString());
QCOMPARE(foo_triple_bar, QString::fromUtf8(QUrl(foo_triple_bar, QUrl::StrictMode).toEncoded()));
QCOMPARE(QUrl(foo_uni_bar).toString(), foo_uni_bar);
QCOMPARE(QUrl(foo_uni_bar).toEncoded(), foo_uni_bar.toLatin1());
QCOMPARE(foo_uni_bar, QUrl(foo_uni_bar, QUrl::StrictMode).toString());
QCOMPARE(foo_uni_bar, QString::fromUtf8(QUrl(foo_uni_bar, QUrl::StrictMode).toEncoded()));
QCOMPARE(QUrl(foo_triple_bar, QUrl::StrictMode).toString(), foo_triple_bar);
QCOMPARE(QUrl(foo_triple_bar, QUrl::StrictMode).toEncoded(), foo_triple_bar.toLatin1());
QCOMPARE(QUrl(foo_uni_bar, QUrl::StrictMode).toString(), foo_uni_bar);
QCOMPARE(QUrl(foo_uni_bar, QUrl::StrictMode).toEncoded(), foo_uni_bar.toLatin1());
// However, file:/bar is the same as file:///bar
QString file_triple_bar("file:///bar"), file_uni_bar("file:/bar");
QVERIFY(QUrl(file_triple_bar) == QUrl(file_uni_bar));
QCOMPARE(QUrl(file_uni_bar).toString(), file_triple_bar);
QCOMPARE(QUrl(file_uni_bar, QUrl::StrictMode).toString(), file_triple_bar);
}
void tst_QUrl::effectiveTLDs_data()
@ -3434,6 +3460,12 @@ void tst_QUrl::setComponents_data()
QTest::newRow("host-empty") << QUrl("foo://example.com/path")
<< int(Host) << "" << Tolerant << true
<< PrettyDecoded << QString() << "foo:///path";
QTest::newRow("authority-null") << QUrl("foo://example.com/path")
<< int(Authority) << QString() << Tolerant << true
<< PrettyDecoded << QString() << "foo:/path";
QTest::newRow("authority-empty") << QUrl("foo://example.com/path")
<< int(Authority) << "" << Tolerant << true
<< PrettyDecoded << QString() << "foo:///path";
QTest::newRow("query-null") << QUrl("http://example.com/?q=foo")
<< int(Query) << QString() << Tolerant << true
<< PrettyDecoded << QString() << "http://example.com/";

View File

@ -646,7 +646,7 @@ QString getPlatformGenericFont(const char* genericName)
static inline QByteArray msgNotAcceptableFont(const QString &defaultFamily, const QStringList &acceptableFamilies)
{
QString res = QString::fromLatin1("Font family '%1' is not one of the following accaptable results: ").arg(defaultFamily);
QString res = QString::fromLatin1("Font family '%1' is not one of the following acceptable results: ").arg(defaultFamily);
Q_FOREACH (const QString &family, acceptableFamilies)
res += QString::fromLatin1("\n %1").arg(family);
return res.toLocal8Bit();

View File

@ -50,6 +50,8 @@
#include <QtNetwork/qnetworksession.h>
#endif
#include <algorithm>
#define TESTFILE QString("http://%1/qtest/cgi-bin/").arg(QtNetworkSettings::serverName())
class tst_QAbstractNetworkCache : public QObject
@ -334,8 +336,8 @@ void tst_QAbstractNetworkCache::runTest()
if (fetchFromCache) {
QList<QByteArray> rawHeaderList = reply->rawHeaderList();
QList<QByteArray> rawHeaderList2 = reply2->rawHeaderList();
qSort(rawHeaderList);
qSort(rawHeaderList2);
std::sort(rawHeaderList.begin(), rawHeaderList.end());
std::sort(rawHeaderList2.begin(), rawHeaderList2.end());
}
QCOMPARE(diskCache->gotData, fetchFromCache);
}
@ -388,8 +390,8 @@ void tst_QAbstractNetworkCache::checkSynchronous()
if (fetchFromCache) {
QList<QByteArray> rawHeaderList = reply->rawHeaderList();
QList<QByteArray> rawHeaderList2 = reply2->rawHeaderList();
qSort(rawHeaderList);
qSort(rawHeaderList2);
std::sort(rawHeaderList.begin(), rawHeaderList.end());
std::sort(rawHeaderList2.begin(), rawHeaderList2.end());
}
QCOMPARE(diskCache->gotData, fetchFromCache);
}

View File

@ -43,6 +43,9 @@
#include <QtTest/QtTest>
#include <QtNetwork/QtNetwork>
#include <qnetworkdiskcache.h>
#include <algorithm>
#define EXAMPLE_URL "http://user:pass@www.example.com/#foo"
//cached objects are organized into these many subdirs
#define NUM_SUBDIRECTORIES 16
@ -464,7 +467,7 @@ void tst_QNetworkDiskCache::expire()
cacheList.append(metaData.url().toString());
}
}
qSort(cacheList);
std::sort(cacheList.begin(), cacheList.end());
for (int i = 0; i < cacheList.count(); ++i) {
QString fileName = cacheList[i];
QCOMPARE(fileName, QString("http://www.foo.com/%1").arg(i + 6));