summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xconfigure10
-rw-r--r--qmake/doc/src/qmake-manual.qdoc12
-rw-r--r--src/corelib/global/qnamespace.qdoc10
-rw-r--r--src/corelib/tools/qstring.cpp2
-rw-r--r--src/gui/image/qpixmap_raster.cpp1
-rw-r--r--src/network/access/qnetworkreplyhttpimpl.cpp19
-rw-r--r--src/network/access/qnetworkreplyhttpimpl_p.h4
-rw-r--r--src/network/socket/qhttpsocketengine.cpp3
-rw-r--r--src/network/ssl/qsslcontext.cpp2
-rw-r--r--src/network/ssl/qsslsocket_openssl_symbols.cpp4
-rw-r--r--src/network/ssl/qsslsocket_openssl_symbols_p.h2
-rw-r--r--src/printsupport/dialogs/qpagesetupdialog_win.cpp5
-rw-r--r--src/sql/doc/src/sql-driver.qdoc5
-rw-r--r--src/tools/bootstrap-dbus/bootstrap-dbus.pro2
-rw-r--r--src/tools/qdbuscpp2xml/qdbuscpp2xml.pro2
-rw-r--r--src/tools/qdbusxml2cpp/qdbusxml2cpp.pro2
-rw-r--r--tests/auto/corelib/tools/qhash/tst_qhash.cpp11
-rw-r--r--tests/auto/corelib/tools/qmap/tst_qmap.cpp11
-rw-r--r--tests/auto/corelib/tools/qset/tst_qset.cpp2
-rw-r--r--tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp92
-rw-r--r--tools/configure/configureapp.cpp14
-rw-r--r--tools/configure/configureapp.h1
22 files changed, 189 insertions, 27 deletions
diff --git a/configure b/configure
index dbd0c32107..8b95c805b7 100755
--- a/configure
+++ b/configure
@@ -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
diff --git a/qmake/doc/src/qmake-manual.qdoc b/qmake/doc/src/qmake-manual.qdoc
index 26fe0d62f1..ad08f729a7 100644
--- a/qmake/doc/src/qmake-manual.qdoc
+++ b/qmake/doc/src/qmake-manual.qdoc
@@ -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.
diff --git a/src/corelib/global/qnamespace.qdoc b/src/corelib/global/qnamespace.qdoc
index e5c708e29a..be569bcffe 100644
--- a/src/corelib/global/qnamespace.qdoc
+++ b/src/corelib/global/qnamespace.qdoc
@@ -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.
diff --git a/src/corelib/tools/qstring.cpp b/src/corelib/tools/qstring.cpp
index b8aa98b160..e8eb04b598 100644
--- a/src/corelib/tools/qstring.cpp
+++ b/src/corelib/tools/qstring.cpp
@@ -9557,7 +9557,7 @@ QByteArray QStringRef::toUtf8() const
if (isNull())
return QByteArray();
- return QUtf8::convertFromUnicode(constData(), length(), 0);
+ return QUtf8::convertFromUnicode(constData(), length());
}
/*!
diff --git a/src/gui/image/qpixmap_raster.cpp b/src/gui/image/qpixmap_raster.cpp
index d879a5cb61..639650dd89 100644
--- a/src/gui/image/qpixmap_raster.cpp
+++ b/src/gui/image/qpixmap_raster.cpp
@@ -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();
diff --git a/src/network/access/qnetworkreplyhttpimpl.cpp b/src/network/access/qnetworkreplyhttpimpl.cpp
index 3ac8b8f56f..c5cf849a55 100644
--- a/src/network/access/qnetworkreplyhttpimpl.cpp
+++ b/src/network/access/qnetworkreplyhttpimpl.cpp
@@ -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/
*/
diff --git a/src/network/access/qnetworkreplyhttpimpl_p.h b/src/network/access/qnetworkreplyhttpimpl_p.h
index d21659ce82..06a5383ae4 100644
--- a/src/network/access/qnetworkreplyhttpimpl_p.h
+++ b/src/network/access/qnetworkreplyhttpimpl_p.h
@@ -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)
};
diff --git a/src/network/socket/qhttpsocketengine.cpp b/src/network/socket/qhttpsocketengine.cpp
index 2e920ad69f..0a25815752 100644
--- a/src/network/socket/qhttpsocketengine.cpp
+++ b/src/network/socket/qhttpsocketengine.cpp
@@ -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) {
diff --git a/src/network/ssl/qsslcontext.cpp b/src/network/ssl/qsslcontext.cpp
index f5e5352d5e..addf7a2ff5 100644
--- a/src/network/ssl/qsslcontext.cpp
+++ b/src/network/ssl/qsslcontext.cpp
@@ -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;
}
diff --git a/src/network/ssl/qsslsocket_openssl_symbols.cpp b/src/network/ssl/qsslsocket_openssl_symbols.cpp
index ca692510c1..6f22ab726f 100644
--- a/src/network/ssl/qsslsocket_openssl_symbols.cpp
+++ b/src/network/ssl/qsslsocket_openssl_symbols.cpp
@@ -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)
diff --git a/src/network/ssl/qsslsocket_openssl_symbols_p.h b/src/network/ssl/qsslsocket_openssl_symbols_p.h
index 34c0040e56..66f45f4706 100644
--- a/src/network/ssl/qsslsocket_openssl_symbols_p.h
+++ b/src/network/ssl/qsslsocket_openssl_symbols_p.h
@@ -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);
diff --git a/src/printsupport/dialogs/qpagesetupdialog_win.cpp b/src/printsupport/dialogs/qpagesetupdialog_win.cpp
index 5da87cce18..fd3a676369 100644
--- a/src/printsupport/dialogs/qpagesetupdialog_win.cpp
+++ b/src/printsupport/dialogs/qpagesetupdialog_win.cpp
@@ -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) {
diff --git a/src/sql/doc/src/sql-driver.qdoc b/src/sql/doc/src/sql-driver.qdoc
index 9858e30ff9..71d2fb4f85 100644
--- a/src/sql/doc/src/sql-driver.qdoc
+++ b/src/sql/doc/src/sql-driver.qdoc
@@ -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
diff --git a/src/tools/bootstrap-dbus/bootstrap-dbus.pro b/src/tools/bootstrap-dbus/bootstrap-dbus.pro
index 62f9f96a9b..fb06b4d8a2 100644
--- a/src/tools/bootstrap-dbus/bootstrap-dbus.pro
+++ b/src/tools/bootstrap-dbus/bootstrap-dbus.pro
@@ -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 \
diff --git a/src/tools/qdbuscpp2xml/qdbuscpp2xml.pro b/src/tools/qdbuscpp2xml/qdbuscpp2xml.pro
index 655158e457..d65b5ce6ef 100644
--- a/src/tools/qdbuscpp2xml/qdbuscpp2xml.pro
+++ b/src/tools/qdbuscpp2xml/qdbuscpp2xml.pro
@@ -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)
diff --git a/src/tools/qdbusxml2cpp/qdbusxml2cpp.pro b/src/tools/qdbusxml2cpp/qdbusxml2cpp.pro
index dcc36c7913..6efcf323b8 100644
--- a/src/tools/qdbusxml2cpp/qdbusxml2cpp.pro
+++ b/src/tools/qdbusxml2cpp/qdbusxml2cpp.pro
@@ -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
diff --git a/tests/auto/corelib/tools/qhash/tst_qhash.cpp b/tests/auto/corelib/tools/qhash/tst_qhash.cpp
index 9c96aaf78d..77baed87c2 100644
--- a/tests/auto/corelib/tools/qhash/tst_qhash.cpp
+++ b/tests/auto/corelib/tools/qhash/tst_qhash.cpp
@@ -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);
diff --git a/tests/auto/corelib/tools/qmap/tst_qmap.cpp b/tests/auto/corelib/tools/qmap/tst_qmap.cpp
index 00e669c1d8..3daab73cc2 100644
--- a/tests/auto/corelib/tools/qmap/tst_qmap.cpp
+++ b/tests/auto/corelib/tools/qmap/tst_qmap.cpp
@@ -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);
diff --git a/tests/auto/corelib/tools/qset/tst_qset.cpp b/tests/auto/corelib/tools/qset/tst_qset.cpp
index eaa1c018ba..5ef1b44b6f 100644
--- a/tests/auto/corelib/tools/qset/tst_qset.cpp
+++ b/tests/auto/corelib/tools/qset/tst_qset.cpp
@@ -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));
diff --git a/tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp b/tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp
index 0509eb9a77..480eeecb63 100644
--- a/tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp
+++ b/tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp
@@ -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()
{
diff --git a/tools/configure/configureapp.cpp b/tools/configure/configureapp.cpp
index 33531252bf..4ed88939a1 100644
--- a/tools/configure/configureapp.cpp
+++ b/tools/configure/configureapp.cpp
@@ -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);
diff --git a/tools/configure/configureapp.h b/tools/configure/configureapp.h
index 9c14d5e63b..71ef210e89 100644
--- a/tools/configure/configureapp.h
+++ b/tools/configure/configureapp.h
@@ -133,6 +133,7 @@ private:
QString opensslLibsRelease;
QString opensslPath;
QString dbusPath;
+ QString dbusHostPath;
QString mysqlPath;
QString psqlLibs;
QString zlibLibs;