Merge "Merge remote-tracking branch 'origin/5.3' into dev" into refs/staging/dev

This commit is contained in:
Frederik Gladhorn 2014-07-30 20:53:29 +02:00 committed by The Qt Project
commit 4010cfbf2d
22 changed files with 189 additions and 27 deletions

10
configure vendored
View File

@ -4623,11 +4623,19 @@ if [ "$CFG_DBUS" != "no" ]; then
if [ -n "$PKG_CONFIG" ] && $PKG_CONFIG --atleast-version="$MIN_DBUS_1_VERSION" dbus-1 2>/dev/null; then
QT_CFLAGS_DBUS=`$PKG_CONFIG --cflags dbus-1 2>/dev/null`
QT_LIBS_DBUS=`$PKG_CONFIG --libs dbus-1 2>/dev/null`
else
QT_LIBS_DBUS="-ldbus-1"
fi
if compileTest unix/dbus "D-Bus" $QT_CFLAGS_DBUS $QT_LIBS_DBUS; then
[ "$CFG_DBUS" = "auto" ] && CFG_DBUS=yes
QMakeVar set QT_CFLAGS_DBUS "$QT_CFLAGS_DBUS"
QMakeVar set QT_LIBS_DBUS "$QT_LIBS_DBUS"
QMakeVar set QT_CFLAGS_DBUS "$QT_CFLAGS_DBUS"
# Try find correct host configuration for dbus tools when cross-compiling
if [ "$QT_CROSS_COMPILE" = "yes" ] && env -i PATH="$PATH" \
pkg-config --atleast-version="$MIN_DBUS_1_VERSION" dbus-1 2>/dev/null; then
QT_CFLAGS_DBUS=`env -i PATH="$PATH" pkg-config --cflags dbus-1 2>/dev/null`
fi
QMakeVar set QT_HOST_CFLAGS_DBUS "$QT_CFLAGS_DBUS"
else
if [ "$CFG_DBUS" = "auto" ]; then
CFG_DBUS=no

View File

@ -321,6 +321,12 @@
\header \li Template \li qmake Output
\row \li app (default) \li Makefile to build an application.
\row \li lib \li Makefile to build a library.
\row \li aux \li Makefile to build nothing. Use this if no compiler needs to
be invoked to create the target, for instance because your
project is written in an interpreted language.
\note This template type is only available for Makefile-based
generators. In particular, it will not work with the vcxproj and
Xcode generators.
\row \li subdirs \li Makefile containing rules for the
subdirectories specified using the \l{SUBDIRS}
variable. Each subdirectory must contain its own project file.
@ -2324,6 +2330,12 @@
\row \li subdirs \li Creates a Makefile for building targets in subdirectories.
The subdirectories are specified using the \l{#SUBDIRS}{SUBDIRS}
variable.
\row \li aux \li Creates a Makefile for not building anything. Use this if no compiler
needs to be invoked to create the target, for instance because your
project is written in an interpreted language.
\note This template type is only available for Makefile-based
generators. In particular, it will not work with the vcxproj and
Xcode generators.
\row \li vcapp \li Windows only. Creates an application project for
Visual Studio. See \l{Creating Visual Studio Project Files} for more
information.

View File

@ -500,7 +500,7 @@
the underlines.
\value TextDontPrint Treat this text as "hidden" and don't print it.
\value TextIncludeTrailingSpaces When this option is set,
QTextLine::naturalTextWidth() and naturalTextRect() will
QTextLine::naturalTextWidth() and QTextLine::naturalTextRect() will
return a value that includes the width of trailing spaces in the
text; otherwise this width is excluded.
\value TextJustificationForced Ensures that text lines are justified.
@ -1892,7 +1892,7 @@
menu, and in contrast to \c NoContextMenu, the handling is \e not
deferred to the widget's parent. This means that all right mouse
button events are guaranteed to be delivered to the widget itself
through mousePressEvent(), and mouseReleaseEvent().
through QWidget::mousePressEvent(), and QWidget::mouseReleaseEvent().
\value DefaultContextMenu the widget's QWidget::contextMenuEvent() handler is called.
\value ActionsContextMenu the widget displays its QWidget::actions() as context menu.
\value CustomContextMenu the widget emits the QWidget::customContextMenuRequested() signal.
@ -2248,9 +2248,9 @@
\enum Qt::TextFormat
This enum is used in widgets that can display both plain text and
rich text, e.g. QLabel. It is used for deciding whether a text
rich text, for example QLabel. It is used for deciding whether a text
string should be interpreted as one or the other. This is normally
done by passing one of the enum values to a setTextFormat()
done by passing one of the enum values to a QTextEdit::setTextFormat()
function.
\value PlainText The text string is interpreted as a plain text
@ -2450,7 +2450,7 @@
\value ImSurroundingText The plain text around the input area, for example the current paragraph.
\value ImCurrentSelection The currently selected text.
\value ImMaximumTextLength The maximum number of characters that the widget can hold. If there is no limit,
QVariant() is returned.
QVariant::QVariant() is returned.
\value ImAnchorPosition The position of the selection anchor. This may be less or greater than
\c ImCursorPosition, depending on which side of selection the cursor is.
If there is no selection, it returns the same as \c ImCursorPosition.

View File

@ -9557,7 +9557,7 @@ QByteArray QStringRef::toUtf8() const
if (isNull())
return QByteArray();
return QUtf8::convertFromUnicode(constData(), length(), 0);
return QUtf8::convertFromUnicode(constData(), length());
}
/*!

View File

@ -343,6 +343,7 @@ void QRasterPlatformPixmap::createPixmapForImage(QImage &sourceImage, Qt::ImageC
if (format == QImage::Format_RGB32 && (sourceImage.format() == QImage::Format_ARGB32
|| sourceImage.format() == QImage::Format_ARGB32_Premultiplied))
{
inPlace = inPlace && sourceImage.isDetached();
image = sourceImage;
if (!inPlace)
image.detach();

View File

@ -867,6 +867,11 @@ void QNetworkReplyHttpImplPrivate::postRequest()
forwardUploadDevice->setParent(delegate); // needed to make sure it is moved on moveToThread()
delegate->httpRequest.setUploadByteDevice(forwardUploadDevice);
// If the device in the user thread claims it has more data, keep the flow to HTTP thread going
QObject::connect(uploadByteDevice.data(), SIGNAL(readyRead()),
q, SLOT(uploadByteDeviceReadyReadSlot()),
Qt::QueuedConnection);
// From main thread to user thread:
QObject::connect(q, SIGNAL(haveUploadData(QByteArray,bool,qint64)),
forwardUploadDevice, SLOT(haveDataSlot(QByteArray,bool,qint64)), Qt::QueuedConnection);
@ -1288,6 +1293,13 @@ void QNetworkReplyHttpImplPrivate::wantUploadDataSlot(qint64 maxSize)
// call readPointer
qint64 currentUploadDataLength = 0;
char *data = const_cast<char*>(uploadByteDevice->readPointer(maxSize, currentUploadDataLength));
if (currentUploadDataLength == 0) {
// No bytes from upload byte device. There will be bytes later, it will emit readyRead()
// and our uploadByteDeviceReadyReadSlot() is called.
return;
}
// Let's make a copy of this data
QByteArray dataArray(data, currentUploadDataLength);
@ -1295,6 +1307,13 @@ void QNetworkReplyHttpImplPrivate::wantUploadDataSlot(qint64 maxSize)
emit q->haveUploadData(dataArray, uploadByteDevice->atEnd(), uploadByteDevice->size());
}
void QNetworkReplyHttpImplPrivate::uploadByteDeviceReadyReadSlot()
{
// Start the flow between this thread and the HTTP thread again by triggering a upload.
wantUploadDataSlot(1024);
}
/*
A simple web page that can be used to test us: http://www.procata.com/cachetest/
*/

View File

@ -129,6 +129,7 @@ public:
Q_PRIVATE_SLOT(d_func(), void resetUploadDataSlot(bool *r))
Q_PRIVATE_SLOT(d_func(), void wantUploadDataSlot(qint64))
Q_PRIVATE_SLOT(d_func(), void sentUploadDataSlot(qint64))
Q_PRIVATE_SLOT(d_func(), void uploadByteDeviceReadyReadSlot())
Q_PRIVATE_SLOT(d_func(), void emitReplyUploadProgress(qint64, qint64))
Q_PRIVATE_SLOT(d_func(), void _q_cacheSaveDeviceAboutToClose())
@ -300,6 +301,9 @@ public:
void wantUploadDataSlot(qint64);
void sentUploadDataSlot(qint64);
// From user's QNonContiguousByteDevice
void uploadByteDeviceReadyReadSlot();
Q_DECLARE_PUBLIC(QNetworkReplyHttpImpl)
};

View File

@ -568,9 +568,6 @@ void QHttpSocketEngine::slotSocketReadNotification()
char dummybuffer[4096];
while (d->pendingResponseData) {
int read = d->socket->read(dummybuffer, qMin(sizeof(dummybuffer), (size_t)d->pendingResponseData));
if (read >= 0)
dummybuffer[read] = 0;
if (read == 0)
return;
if (read == -1) {

View File

@ -315,11 +315,13 @@ init_context:
q_SSL_CTX_set_tmp_dh(sslContext->ctx, dh);
q_DH_free(dh);
#ifndef OPENSSL_NO_EC
// Set temp ECDH params
EC_KEY *ecdh = 0;
ecdh = q_EC_KEY_new_by_curve_name(NID_X9_62_prime256v1);
q_SSL_CTX_set_tmp_ecdh(sslContext->ctx, ecdh);
q_EC_KEY_free(ecdh);
#endif // OPENSSL_NO_EC
return sslContext;
}

View File

@ -369,8 +369,10 @@ DEFINEFUNC3(void, SSL_get0_next_proto_negotiated, const SSL *s, s,
DEFINEFUNC(DH *, DH_new, DUMMYARG, DUMMYARG, return 0, return)
DEFINEFUNC(void, DH_free, DH *dh, dh, return, DUMMYARG)
DEFINEFUNC3(BIGNUM *, BN_bin2bn, const unsigned char *s, s, int len, len, BIGNUM *ret, ret, return 0, return)
#ifndef OPENSSL_NO_EC
DEFINEFUNC(EC_KEY *, EC_KEY_new_by_curve_name, int nid, nid, return 0, return)
DEFINEFUNC(void, EC_KEY_free, EC_KEY *ecdh, ecdh, return, DUMMYARG)
#endif // OPENSSL_NO_EC
DEFINEFUNC5(int, PKCS12_parse, PKCS12 *p12, p12, const char *pass, pass, EVP_PKEY **pkey, pkey, \
X509 **cert, cert, STACK_OF(X509) **ca, ca, return 1, return);
@ -858,8 +860,10 @@ bool q_resolveOpenSslSymbols()
RESOLVEFUNC(DH_new)
RESOLVEFUNC(DH_free)
RESOLVEFUNC(BN_bin2bn)
#ifndef OPENSSL_NO_EC
RESOLVEFUNC(EC_KEY_new_by_curve_name)
RESOLVEFUNC(EC_KEY_free)
#endif // OPENSSL_NO_EC
RESOLVEFUNC(PKCS12_parse)
RESOLVEFUNC(d2i_PKCS12_bio)
RESOLVEFUNC(PKCS12_free)

View File

@ -438,10 +438,12 @@ void q_DH_free(DH *dh);
BIGNUM *q_BN_bin2bn(const unsigned char *s, int len, BIGNUM *ret);
#define q_SSL_CTX_set_tmp_dh(ctx, dh) q_SSL_CTX_ctrl((ctx), SSL_CTRL_SET_TMP_DH, 0, (char *)dh)
#ifndef OPENSSL_NO_EC
// EC Diffie-Hellman support
EC_KEY *q_EC_KEY_new_by_curve_name(int nid);
void q_EC_KEY_free(EC_KEY *ecdh);
#define q_SSL_CTX_set_tmp_ecdh(ctx, ecdh) q_SSL_CTX_ctrl((ctx), SSL_CTRL_SET_TMP_ECDH, 0, (char *)ecdh)
#endif // OPENSSL_NO_EC
// PKCS#12 support
int q_PKCS12_parse(PKCS12 *p12, const char *pass, EVP_PKEY **pkey, X509 **cert, STACK_OF(X509) **ca);

View File

@ -137,9 +137,8 @@ int QPageSetupDialog::exec()
QDialog::setVisible(false);
if (result) {
engine->setGlobalDevMode(psd.hDevNames, psd.hDevMode);
d->printer->setPageMargins(QMarginsF(psd.rtMargin.left / multiplier, psd.rtMargin.right / multiplier,
psd.rtMargin.top / multiplier, psd.rtMargin.bottom / multiplier),
layout.units());
const QMarginsF margins(psd.rtMargin.left, psd.rtMargin.top, psd.rtMargin.right, psd.rtMargin.bottom);
d->printer->setPageMargins(margins / multiplier, layout.units());
// copy from our temp DEVMODE struct
if (!engine->globalDevMode() && hDevMode) {

View File

@ -700,7 +700,10 @@
system. On Unix, run the command \c{ldd} and pass the name of the
plugin as parameter, for example \c{ldd libqsqlmysql.so}. You will
get a warning if any of the client libraries couldn't be found.
On Windows, you can use Visual Studio's dependency walker.
On Windows, you can use Visual Studio's dependency walker. With
Qt Creator, you can update the \c PATH environment variable in the
\gui Run section of the \gui Project panel to include the path to
the folder containing the client libraries.
\li Compile Qt with \c{QT_DEBUG_COMPONENT} defined to get very verbose
debug output when loading plugins.
\endlist

View File

@ -15,7 +15,7 @@ MODULE_PRIVATE_INCLUDES = \
load(qt_module)
QMAKE_CXXFLAGS += $$QT_CFLAGS_DBUS
QMAKE_CXXFLAGS += $$QT_HOST_CFLAGS_DBUS
SOURCES = \
../../dbus/qdbusintrospection.cpp \

View File

@ -3,7 +3,7 @@ QT = core-private
force_bootstrap: QT += bootstrap_dbus-private
else: QT += dbus-private
DEFINES += QT_NO_CAST_FROM_ASCII
QMAKE_CXXFLAGS += $$QT_CFLAGS_DBUS
QMAKE_CXXFLAGS += $$QT_HOST_CFLAGS_DBUS
include(../moc/moc.pri)

View File

@ -3,7 +3,7 @@ QT = core-private
force_bootstrap: QT += bootstrap_dbus-private
else: QT += dbus-private
DEFINES += QT_NO_CAST_FROM_ASCII
QMAKE_CXXFLAGS += $$QT_CFLAGS_DBUS
QMAKE_CXXFLAGS += $$QT_HOST_CFLAGS_DBUS
SOURCES = qdbusxml2cpp.cpp

View File

@ -1327,10 +1327,15 @@ void tst_QHash::twoArguments_qHash()
void tst_QHash::initializerList()
{
#ifdef Q_COMPILER_INITIALIZER_LISTS
QHash<int, QString> hash{{1, "hello"}, {2, "initializer_list"}};
QHash<int, QString> hash = {{1, "bar"}, {1, "hello"}, {2, "initializer_list"}};
QCOMPARE(hash.count(), 2);
QVERIFY(hash[1] == "hello");
QVERIFY(hash[2] == "initializer_list");
QCOMPARE(hash[1], QString("hello"));
QCOMPARE(hash[2], QString("initializer_list"));
// note the difference to std::unordered_map:
// std::unordered_map<int, QString> stdh = {{1, "bar"}, {1, "hello"}, {2, "initializer_list"}};
// QCOMPARE(stdh.size(), 2UL);
// QCOMPARE(stdh[1], QString("bar"));
QMultiHash<QString, int> multiHash{{"il", 1}, {"il", 2}, {"il", 3}};
QCOMPARE(multiHash.count(), 3);

View File

@ -1179,10 +1179,15 @@ void tst_QMap::checkMostLeftNode()
void tst_QMap::initializerList()
{
#ifdef Q_COMPILER_INITIALIZER_LISTS
QMap<int, QString> map{{1, "hello"}, {2, "initializer_list"}};
QMap<int, QString> map = {{1, "bar"}, {1, "hello"}, {2, "initializer_list"}};
QCOMPARE(map.count(), 2);
QVERIFY(map[1] == "hello");
QVERIFY(map[2] == "initializer_list");
QCOMPARE(map[1], QString("hello"));
QCOMPARE(map[2], QString("initializer_list"));
// note the difference to std::map:
// std::map<int, QString> stdm = {{1, "bar"}, {1, "hello"}, {2, "initializer_list"}};
// QCOMPARE(stdm.size(), 2UL);
// QCOMPARE(stdm[1], QString("bar"));
QMultiMap<QString, int> multiMap{{"il", 1}, {"il", 2}, {"il", 3}};
QCOMPARE(multiMap.count(), 3);

View File

@ -922,7 +922,7 @@ void tst_QSet::makeSureTheComfortFunctionsCompile()
void tst_QSet::initializerList()
{
#ifdef Q_COMPILER_INITIALIZER_LISTS
QSet<int> set{1, 2, 3, 4, 5};
QSet<int> set = {1, 1, 2, 3, 4, 5};
QCOMPARE(set.count(), 5);
QVERIFY(set.contains(1));
QVERIFY(set.contains(2));

View File

@ -461,6 +461,8 @@ private Q_SLOTS:
void backgroundRequestConnectInBackground();
#endif
void putWithRateLimiting();
// NOTE: This test must be last!
void parentingRepliesToTheApp();
private:
@ -7776,6 +7778,96 @@ void tst_QNetworkReply::backgroundRequestConnectInBackground()
}
#endif
class RateLimitedUploadDevice : public QIODevice
{
Q_OBJECT
public:
QByteArray data;
QBuffer buffer;
qint64 read;
qint64 bandwidthQuota;
QTimer timer;
RateLimitedUploadDevice(QByteArray d) : QIODevice(),data(d),read(0),bandwidthQuota(0) {
buffer.setData(data);
buffer.open(QIODevice::ReadOnly);
timer.setInterval(200);
QObject::connect(&timer, SIGNAL(timeout()), this, SLOT(timeoutSlot()));
timer.start();
}
virtual qint64 writeData(const char* , qint64 ) {
Q_ASSERT(false);
return 0;
}
virtual qint64 readData(char* data, qint64 maxlen) {
//qDebug() << Q_FUNC_INFO << maxlen << bandwidthQuota;
maxlen = qMin(maxlen, buffer.bytesAvailable());
maxlen = qMin(maxlen, bandwidthQuota);
if (maxlen <= 0) { // no quota or at end
return 0;
}
bandwidthQuota -= maxlen; // reduce quota
qint64 ret = buffer.read(data, maxlen);
if (ret == -1) {
return -1;
}
read += ret;
//qDebug() << Q_FUNC_INFO << maxlen << bandwidthQuota << read << ret << buffer.bytesAvailable();
return ret;
}
virtual bool atEnd() const {
return buffer.atEnd();
}
virtual qint64 size() const{
return data.length();
}
qint64 bytesAvailable() const
{
return buffer.bytesAvailable() + QIODevice::bytesAvailable();
}
virtual bool isSequential() const{ // random access, we can seek
return false;
}
virtual bool seek ( qint64 pos ) {
return buffer.seek(pos);
}
protected slots:
void timeoutSlot() {
//qDebug() << Q_FUNC_INFO;
bandwidthQuota = 8*1024; // fill quota
emit readyRead();
}
};
void tst_QNetworkReply::putWithRateLimiting()
{
QFile reference(testDataDir + "/rfc3252.txt");
reference.open(QIODevice::ReadOnly);
QByteArray data = reference.readAll();
QVERIFY(data.length() > 0);
QUrl url = QUrl::fromUserInput("http://" + QtNetworkSettings::serverName()+ "/qtest/cgi-bin/echo.cgi?");
QNetworkRequest request(url);
QNetworkReplyPtr reply;
RateLimitedUploadDevice rateLimitedUploadDevice(data);
rateLimitedUploadDevice.open(QIODevice::ReadOnly);
RUN_REQUEST(runCustomRequest(request, reply,QByteArray("POST"), &rateLimitedUploadDevice));
QCOMPARE(reply->error(), QNetworkReply::NoError);
QCOMPARE(reply->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt(), 200);
QByteArray uploadedData = reply->readAll();
QCOMPARE(uploadedData.length(), data.length());
QCOMPARE(uploadedData, data);
}
// NOTE: This test must be last testcase in tst_qnetworkreply!
void tst_QNetworkReply::parentingRepliesToTheApp()
{

View File

@ -995,6 +995,8 @@ void Configure::parseCmdLine()
sybaseLibs = configCmdLine.at(i);
} else if (configCmdLine.at(i).startsWith("DBUS_PATH=")) {
dbusPath = QDir::fromNativeSeparators(configCmdLine.at(i).section("=", 1));
} else if (configCmdLine.at(i).startsWith("DBUS_HOST_PATH=")) {
dbusHostPath = QDir::fromNativeSeparators(configCmdLine.at(i).section("=", 1));
} else if (configCmdLine.at(i).startsWith("MYSQL_PATH=")) {
mysqlPath = QDir::fromNativeSeparators(configCmdLine.at(i).section("=", 1));
} else if (configCmdLine.at(i).startsWith("ZLIB_LIBS=")) {
@ -2928,9 +2930,15 @@ void Configure::generateOutputVars()
qmakeVars += QString("OPENSSL_LIBS += -L%1/lib").arg(opensslPath);
}
}
if (dictionary[ "DBUS" ] != "no" && !dbusPath.isEmpty()) {
qmakeVars += QString("QT_CFLAGS_DBUS = -I%1/include").arg(dbusPath);
qmakeVars += QString("QT_LIBS_DBUS = -L%1/lib").arg(dbusPath);
if (dictionary[ "DBUS" ] != "no") {
if (!dbusPath.isEmpty()) {
qmakeVars += QString("QT_CFLAGS_DBUS = -I%1/include").arg(dbusPath);
qmakeVars += QString("QT_LIBS_DBUS = -L%1/lib").arg(dbusPath);
if (dbusHostPath.isEmpty())
qmakeVars += QString("QT_HOST_CFLAGS_DBUS = -I%1/include").arg(dbusPath);
}
if (!dbusHostPath.isEmpty())
qmakeVars += QString("QT_HOST_CFLAGS_DBUS = -I%1/include").arg(dbusHostPath);
}
if (dictionary[ "SQL_MYSQL" ] != "no" && !mysqlPath.isEmpty()) {
qmakeVars += QString("QT_CFLAGS_MYSQL = -I%1/include").arg(mysqlPath);

View File

@ -133,6 +133,7 @@ private:
QString opensslLibsRelease;
QString opensslPath;
QString dbusPath;
QString dbusHostPath;
QString mysqlPath;
QString psqlLibs;
QString zlibLibs;