aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniel Teske <daniel.teske@theqtcompany.com>2015-01-15 16:34:53 +0100
committerDaniel Teske <daniel.teske@theqtcompany.com>2015-04-14 15:20:46 +0000
commitac31d397a8a82a0a5b5b1276025e55371c3c9972 (patch)
tree4834bb3592666bc15e14da3aaf1437cfdf8827fa
parent181824f2497b3c874acce0f4a54a5580ee64ea90 (diff)
Use qt_subtract_from_timeout instead of duplicating qt_timeout_value
The same function was duplicated 5 times in qtbase, so create one copy to rule them all and use it also in QtDeclarative. Change-Id: I4e39a7ee0541ce4fe9710cea344e537ee011bbe9 Reviewed-by: Kai Koehne <kai.koehne@theqtcompany.com>
-rw-r--r--src/plugins/qmltooling/qmldbg_tcp/qmldbg_tcp.pro2
-rw-r--r--src/plugins/qmltooling/shared/qpacketprotocol.cpp16
-rw-r--r--src/quickwidgets/qquickwidget_p.h2
-rw-r--r--tests/auto/qml/debugger/qdebugmessageservice/qdebugmessageservice.pro2
-rw-r--r--tests/auto/qml/debugger/qpacketprotocol/qpacketprotocol.pro2
-rw-r--r--tests/auto/qml/debugger/qqmldebugclient/qqmldebugclient.pro2
-rw-r--r--tests/auto/qml/debugger/qqmldebugjs/qqmldebugjs.pro2
-rw-r--r--tests/auto/qml/debugger/qqmldebugservice/qqmldebugservice.pro2
-rw-r--r--tests/auto/qml/debugger/qqmlenginecontrol/qqmlenginecontrol.pro2
-rw-r--r--tests/auto/qml/debugger/qqmlenginedebuginspectorintegrationtest/qqmlenginedebuginspectorintegrationtest.pro2
-rw-r--r--tests/auto/qml/debugger/qqmlinspector/qqmlinspector.pro2
-rw-r--r--tests/auto/qml/debugger/qqmlprofilerservice/qqmlprofilerservice.pro2
-rw-r--r--tests/auto/qml/debugger/qv4profilerservice/qv4profilerservice.pro2
-rw-r--r--tools/qmlprofiler/qpacketprotocol.cpp16
14 files changed, 16 insertions, 40 deletions
diff --git a/src/plugins/qmltooling/qmldbg_tcp/qmldbg_tcp.pro b/src/plugins/qmltooling/qmldbg_tcp/qmldbg_tcp.pro
index e9dba5fdaf..e1284b7233 100644
--- a/src/plugins/qmltooling/qmldbg_tcp/qmldbg_tcp.pro
+++ b/src/plugins/qmltooling/qmldbg_tcp/qmldbg_tcp.pro
@@ -1,5 +1,5 @@
TARGET = qmldbg_tcp
-QT = qml-private
+QT = qml-private core-private
PLUGIN_TYPE = qmltooling
PLUGIN_CLASS_NAME = QTcpServerConnection
diff --git a/src/plugins/qmltooling/shared/qpacketprotocol.cpp b/src/plugins/qmltooling/shared/qpacketprotocol.cpp
index e60011c4f7..d52d730a5d 100644
--- a/src/plugins/qmltooling/shared/qpacketprotocol.cpp
+++ b/src/plugins/qmltooling/shared/qpacketprotocol.cpp
@@ -35,6 +35,7 @@
#include <QtCore/QBuffer>
#include <QtCore/QElapsedTimer>
+#include <private/qiodevice_p.h>
QT_BEGIN_NAMESPACE
@@ -318,19 +319,6 @@ QPacket QPacketProtocol::read()
return rv;
}
-/*
- Returns the difference between msecs and elapsed. If msecs is -1,
- however, -1 is returned.
-*/
-static int qt_timeout_value(int msecs, int elapsed)
-{
- if (msecs == -1)
- return -1;
-
- int timeout = msecs - elapsed;
- return timeout < 0 ? 0 : timeout;
-}
-
/*!
This function locks until a new packet is available for reading and the
\l{QIODevice::}{readyRead()} signal has been emitted. The function
@@ -356,7 +344,7 @@ bool QPacketProtocol::waitForReadyRead(int msecs)
return false;
if (!d->waitingForPacket)
return true;
- msecs = qt_timeout_value(msecs, stopWatch.elapsed());
+ msecs = qt_subtract_from_timeout(msecs, stopWatch.elapsed());
} while (true);
}
diff --git a/src/quickwidgets/qquickwidget_p.h b/src/quickwidgets/qquickwidget_p.h
index 57782a6492..c058a08b1d 100644
--- a/src/quickwidgets/qquickwidget_p.h
+++ b/src/quickwidgets/qquickwidget_p.h
@@ -81,7 +81,7 @@ public:
void destroyContext();
void handleContextCreationFailure(const QSurfaceFormat &format, bool isEs);
- QObject *focusObject() Q_DECL_OVERRIDE;
+ QObject *focusObject();
GLuint textureId() const Q_DECL_OVERRIDE;
QImage grabFramebuffer() Q_DECL_OVERRIDE;
diff --git a/tests/auto/qml/debugger/qdebugmessageservice/qdebugmessageservice.pro b/tests/auto/qml/debugger/qdebugmessageservice/qdebugmessageservice.pro
index 3608375771..0d6484f8e6 100644
--- a/tests/auto/qml/debugger/qdebugmessageservice/qdebugmessageservice.pro
+++ b/tests/auto/qml/debugger/qdebugmessageservice/qdebugmessageservice.pro
@@ -1,6 +1,6 @@
CONFIG += testcase
TARGET = tst_qdebugmessageservice
-QT += qml network testlib gui-private
+QT += qml network testlib gui-private core-private
macx:CONFIG -= app_bundle
SOURCES += tst_qdebugmessageservice.cpp
diff --git a/tests/auto/qml/debugger/qpacketprotocol/qpacketprotocol.pro b/tests/auto/qml/debugger/qpacketprotocol/qpacketprotocol.pro
index 98c0fc2542..716d8f0be9 100644
--- a/tests/auto/qml/debugger/qpacketprotocol/qpacketprotocol.pro
+++ b/tests/auto/qml/debugger/qpacketprotocol/qpacketprotocol.pro
@@ -8,5 +8,5 @@ INCLUDEPATH += ../shared
include(../shared/debugutil.pri)
CONFIG += parallel_test
-QT += qml network testlib gui-private
+QT += qml network testlib gui-private core-private
DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
diff --git a/tests/auto/qml/debugger/qqmldebugclient/qqmldebugclient.pro b/tests/auto/qml/debugger/qqmldebugclient/qqmldebugclient.pro
index 38f78e8248..ad431d4871 100644
--- a/tests/auto/qml/debugger/qqmldebugclient/qqmldebugclient.pro
+++ b/tests/auto/qml/debugger/qqmldebugclient/qqmldebugclient.pro
@@ -14,5 +14,5 @@ DEFINES += QT_QML_DEBUG_NO_WARNING
CONFIG += qml_debug
-QT += qml-private testlib gui-private
+QT += qml-private testlib gui-private core-private
DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
diff --git a/tests/auto/qml/debugger/qqmldebugjs/qqmldebugjs.pro b/tests/auto/qml/debugger/qqmldebugjs/qqmldebugjs.pro
index d4ce36dc4a..767d7a3c61 100644
--- a/tests/auto/qml/debugger/qqmldebugjs/qqmldebugjs.pro
+++ b/tests/auto/qml/debugger/qqmldebugjs/qqmldebugjs.pro
@@ -1,6 +1,6 @@
CONFIG += testcase
TARGET = tst_qqmldebugjs
-QT += qml testlib gui-private
+QT += qml testlib gui-private core-private
macx:CONFIG -= app_bundle
SOURCES += tst_qqmldebugjs.cpp
diff --git a/tests/auto/qml/debugger/qqmldebugservice/qqmldebugservice.pro b/tests/auto/qml/debugger/qqmldebugservice/qqmldebugservice.pro
index 5879506a58..573e58d3a6 100644
--- a/tests/auto/qml/debugger/qqmldebugservice/qqmldebugservice.pro
+++ b/tests/auto/qml/debugger/qqmldebugservice/qqmldebugservice.pro
@@ -18,5 +18,5 @@ OTHER_FILES += \
DEFINES += QT_QML_DEBUG_NO_WARNING
-QT += qml-private testlib gui-private
+QT += qml-private testlib gui-private core-private
DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
diff --git a/tests/auto/qml/debugger/qqmlenginecontrol/qqmlenginecontrol.pro b/tests/auto/qml/debugger/qqmlenginecontrol/qqmlenginecontrol.pro
index 09332cc302..901dd229c0 100644
--- a/tests/auto/qml/debugger/qqmlenginecontrol/qqmlenginecontrol.pro
+++ b/tests/auto/qml/debugger/qqmlenginecontrol/qqmlenginecontrol.pro
@@ -10,7 +10,7 @@ include(../shared/debugutil.pri)
TESTDATA = data/*
-QT += core qml testlib gui-private
+QT += core qml testlib gui-private core-private
DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
OTHER_FILES += \
diff --git a/tests/auto/qml/debugger/qqmlenginedebuginspectorintegrationtest/qqmlenginedebuginspectorintegrationtest.pro b/tests/auto/qml/debugger/qqmlenginedebuginspectorintegrationtest/qqmlenginedebuginspectorintegrationtest.pro
index 9da6bda28e..028eb3644d 100644
--- a/tests/auto/qml/debugger/qqmlenginedebuginspectorintegrationtest/qqmlenginedebuginspectorintegrationtest.pro
+++ b/tests/auto/qml/debugger/qqmlenginedebuginspectorintegrationtest/qqmlenginedebuginspectorintegrationtest.pro
@@ -1,7 +1,7 @@
CONFIG += testcase
TARGET = tst_qqmlenginedebuginspectorintegration
-QT += qml testlib gui-private
+QT += qml testlib gui-private core-private
macx:CONFIG -= app_bundle
SOURCES += tst_qqmlenginedebuginspectorintegration.cpp
diff --git a/tests/auto/qml/debugger/qqmlinspector/qqmlinspector.pro b/tests/auto/qml/debugger/qqmlinspector/qqmlinspector.pro
index 4adda35aea..3a1d59f3fa 100644
--- a/tests/auto/qml/debugger/qqmlinspector/qqmlinspector.pro
+++ b/tests/auto/qml/debugger/qqmlinspector/qqmlinspector.pro
@@ -1,7 +1,7 @@
CONFIG += testcase
TARGET = tst_qqmlinspector
-QT += qml testlib gui-private
+QT += qml testlib gui-private core-private
macx:CONFIG -= app_bundle
SOURCES += tst_qqmlinspector.cpp
diff --git a/tests/auto/qml/debugger/qqmlprofilerservice/qqmlprofilerservice.pro b/tests/auto/qml/debugger/qqmlprofilerservice/qqmlprofilerservice.pro
index 1bab614b63..ec84139797 100644
--- a/tests/auto/qml/debugger/qqmlprofilerservice/qqmlprofilerservice.pro
+++ b/tests/auto/qml/debugger/qqmlprofilerservice/qqmlprofilerservice.pro
@@ -10,7 +10,7 @@ include(../shared/debugutil.pri)
TESTDATA = data/*
-QT += core qml testlib gui-private
+QT += core qml testlib gui-private core-private
DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
OTHER_FILES += \
diff --git a/tests/auto/qml/debugger/qv4profilerservice/qv4profilerservice.pro b/tests/auto/qml/debugger/qv4profilerservice/qv4profilerservice.pro
index 459f931f94..a790bb63cd 100644
--- a/tests/auto/qml/debugger/qv4profilerservice/qv4profilerservice.pro
+++ b/tests/auto/qml/debugger/qv4profilerservice/qv4profilerservice.pro
@@ -10,7 +10,7 @@ include(../shared/debugutil.pri)
TESTDATA = data/*
-QT += qml testlib gui-private
+QT += qml testlib gui-private core-private
DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
CONFIG+=insignificant_test
diff --git a/tools/qmlprofiler/qpacketprotocol.cpp b/tools/qmlprofiler/qpacketprotocol.cpp
index dc4df69442..65cb9f15ae 100644
--- a/tools/qmlprofiler/qpacketprotocol.cpp
+++ b/tools/qmlprofiler/qpacketprotocol.cpp
@@ -35,6 +35,7 @@
#include <QtCore/QBuffer>
#include <QtCore/QElapsedTimer>
+#include <private/qiodevice_p.h> // for qt_subtract_from_timeout
static const unsigned int MAX_PACKET_SIZE = 0x7FFFFFFF;
@@ -316,19 +317,6 @@ QPacket QPacketProtocol::read()
return rv;
}
-/*
- Returns the difference between msecs and elapsed. If msecs is -1,
- however, -1 is returned.
-*/
-static int qt_timeout_value(int msecs, int elapsed)
-{
- if (msecs == -1)
- return -1;
-
- int timeout = msecs - elapsed;
- return timeout < 0 ? 0 : timeout;
-}
-
/*!
This function locks until a new packet is available for reading and the
\l{QIODevice::}{readyRead()} signal has been emitted. The function
@@ -354,7 +342,7 @@ bool QPacketProtocol::waitForReadyRead(int msecs)
return false;
if (!d->waitingForPacket)
return true;
- msecs = qt_timeout_value(msecs, stopWatch.elapsed());
+ msecs = qt_subtract_from_timeout(msecs, stopWatch.elapsed());
} while (true);
}