summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorQt Continuous Integration System <qt-info@nokia.com>2010-03-04 20:50:46 (GMT)
committerQt Continuous Integration System <qt-info@nokia.com>2010-03-04 20:50:46 (GMT)
commitac192ca74b90e059f96d6c24c4bb8295778d1eaa (patch)
tree28dbc4aca33bb6e90805e6b4e0980c3ae7002c10
parentf5b52405ea347a5cde4562f0375f1bed0f0d4b5d (diff)
parent95786655e304a22bd922b40184d314eddb72b002 (diff)
downloadQt-ac192ca74b90e059f96d6c24c4bb8295778d1eaa.zip
Qt-ac192ca74b90e059f96d6c24c4bb8295778d1eaa.tar.gz
Qt-ac192ca74b90e059f96d6c24c4bb8295778d1eaa.tar.bz2
Merge branch '4.6' of scm.dev.nokia.troll.no:qt/oslo-staging-1 into 4.6-integration
* '4.6' of scm.dev.nokia.troll.no:qt/oslo-staging-1: tst_qhostinfo: Compile fix Document some stuff in QHostInfo and QAbstractSocket tst_qhostinfo: Mixed up descriptions for test case data qhostinfo benchmark: Use local _data instead of _global DNS Cache: Also check inside the DNS threads qhostinfo benchmark: Benchmark the with-cache and without-cache tst_qftp: Do not use 1.2.3.4 as IP Dont use gestures if there is no touch screen. showFullscreen() broken if UnifiedTitleAndToolBarOnMac is enabled Fix atk warning on startup in Qt apps wit QGtkStyle Do not use realpath() with uclibc
-rw-r--r--src/corelib/io/qfsfileengine.cpp3
-rw-r--r--src/gui/kernel/qapplication_p.h1
-rw-r--r--src/gui/kernel/qapplication_win.cpp35
-rw-r--r--src/gui/kernel/qgesturemanager.cpp4
-rw-r--r--src/gui/kernel/qwidget_win.cpp2
-rw-r--r--src/gui/kernel/qwinnativepangesturerecognizer_win_p.h32
-rw-r--r--src/gui/styles/qgtkstyle_p.cpp2
-rw-r--r--src/gui/widgets/qmainwindowlayout_mac.mm2
-rw-r--r--src/network/kernel/qhostinfo.cpp31
-rw-r--r--src/network/socket/qabstractsocket.cpp8
-rw-r--r--tests/auto/qftp/tst_qftp.cpp2
-rw-r--r--tests/auto/qhostinfo/tst_qhostinfo.cpp11
-rw-r--r--tests/benchmarks/network/kernel/qhostinfo/main.cpp24
13 files changed, 143 insertions, 14 deletions
diff --git a/src/corelib/io/qfsfileengine.cpp b/src/corelib/io/qfsfileengine.cpp
index c842e49..eeee970 100644
--- a/src/corelib/io/qfsfileengine.cpp
+++ b/src/corelib/io/qfsfileengine.cpp
@@ -145,6 +145,8 @@ QString QFSFileEnginePrivate::canonicalized(const QString &path)
#endif
// Mac OS X 10.5.x doesn't support the realpath(X,0) extenstion we use here.
#if defined(Q_OS_LINUX) || defined(Q_OS_SYMBIAN)
+ // ... but Linux with uClibc does not have it
+#if !defined(__UCLIBC__)
char *ret = realpath(path.toLocal8Bit().constData(), (char*)0);
if (ret) {
QString canonicalPath = QDir::cleanPath(QString::fromLocal8Bit(ret));
@@ -152,6 +154,7 @@ QString QFSFileEnginePrivate::canonicalized(const QString &path)
return canonicalPath;
}
#endif
+#endif
QFileInfo fi;
const QChar slash(QLatin1Char('/'));
diff --git a/src/gui/kernel/qapplication_p.h b/src/gui/kernel/qapplication_p.h
index b3ec732..ce39334 100644
--- a/src/gui/kernel/qapplication_p.h
+++ b/src/gui/kernel/qapplication_p.h
@@ -530,6 +530,7 @@ public:
const QList<QTouchEvent::TouchPoint> &touchPoints);
#if defined(Q_WS_WIN)
+ static bool HasTouchSupport;
static PtrRegisterTouchWindow RegisterTouchWindow;
static PtrGetTouchInputInfo GetTouchInputInfo;
static PtrCloseTouchInputHandle CloseTouchInputHandle;
diff --git a/src/gui/kernel/qapplication_win.cpp b/src/gui/kernel/qapplication_win.cpp
index da6869d..49cb0f2 100644
--- a/src/gui/kernel/qapplication_win.cpp
+++ b/src/gui/kernel/qapplication_win.cpp
@@ -115,6 +115,8 @@ extern void qt_wince_hide_taskbar(HWND hwnd); //defined in qguifunctions_wince.c
# include <winable.h>
#endif
+#include "private/qwinnativepangesturerecognizer_win_p.h"
+
#ifndef WM_TOUCH
# define WM_TOUCH 0x0240
@@ -4000,12 +4002,45 @@ void QSessionManager::cancel()
#endif //QT_NO_SESSIONMANAGER
+bool QApplicationPrivate::HasTouchSupport = false;
PtrRegisterTouchWindow QApplicationPrivate::RegisterTouchWindow = 0;
PtrGetTouchInputInfo QApplicationPrivate::GetTouchInputInfo = 0;
PtrCloseTouchInputHandle QApplicationPrivate::CloseTouchInputHandle = 0;
void QApplicationPrivate::initializeMultitouch_sys()
{
+ static const IID QT_IID_IInkTablets = {0x112086D9, 0x7779, 0x4535, {0xA6, 0x99, 0x86, 0x2B, 0x43, 0xAC, 0x18, 0x63} };
+ static const IID QT_IID_IInkTablet2 = {0x90c91ad2, 0xfa36, 0x49d6, {0x95, 0x16, 0xce, 0x8d, 0x57, 0x0f, 0x6f, 0x85} };
+ static const CLSID QT_CLSID_InkTablets = {0x6E4FCB12, 0x510A, 0x4d40, {0x93, 0x04, 0x1D, 0xA1, 0x0A, 0xE9, 0x14, 0x7C} };
+
+ IInkTablets *iInkTablets = 0;
+ HRESULT hr = CoCreateInstance(QT_CLSID_InkTablets, NULL, CLSCTX_ALL, QT_IID_IInkTablets, (void**)&iInkTablets);
+ if (SUCCEEDED(hr)) {
+ long count = 0;
+ iInkTablets->get_Count(&count);
+ for (long i = 0; i < count; ++i) {
+ IInkTablet *iInkTablet = 0;
+ hr = iInkTablets->Item(i, &iInkTablet);
+ if (FAILED(hr))
+ continue;
+ IInkTablet2 *iInkTablet2 = 0;
+ hr = iInkTablet->QueryInterface(QT_IID_IInkTablet2, (void**)&iInkTablet2);
+ iInkTablet->Release();
+ if (FAILED(hr))
+ continue;
+ TabletDeviceKind kind;
+ hr = iInkTablet2->get_DeviceKind(&kind);
+ iInkTablet2->Release();
+ if (FAILED(hr))
+ continue;
+ if (kind == TDK_Touch) {
+ QApplicationPrivate::HasTouchSupport = true;
+ break;
+ }
+ }
+ iInkTablets->Release();
+ }
+
QLibrary library(QLatin1String("user32"));
// MinGW (g++ 3.4.5) accepts only C casts.
RegisterTouchWindow = (PtrRegisterTouchWindow)(library.resolve("RegisterTouchWindow"));
diff --git a/src/gui/kernel/qgesturemanager.cpp b/src/gui/kernel/qgesturemanager.cpp
index 89ad94d..aa6720e 100644
--- a/src/gui/kernel/qgesturemanager.cpp
+++ b/src/gui/kernel/qgesturemanager.cpp
@@ -45,6 +45,7 @@
#include "private/qgesture_p.h"
#include "private/qgraphicsitem_p.h"
#include "private/qevent_p.h"
+#include "private/qapplication_p.h"
#include "qgesture.h"
#include "qevent.h"
#include "qgraphicsitem.h"
@@ -86,7 +87,8 @@ QGestureManager::QGestureManager(QObject *parent)
#endif
#if defined(Q_OS_WIN)
#if !defined(QT_NO_NATIVE_GESTURES)
- registerGestureRecognizer(new QWinNativePanGestureRecognizer);
+ if (QApplicationPrivate::HasTouchSupport)
+ registerGestureRecognizer(new QWinNativePanGestureRecognizer);
#endif
#else
registerGestureRecognizer(new QTapAndHoldGestureRecognizer);
diff --git a/src/gui/kernel/qwidget_win.cpp b/src/gui/kernel/qwidget_win.cpp
index 10522ed..9acfb70 100644
--- a/src/gui/kernel/qwidget_win.cpp
+++ b/src/gui/kernel/qwidget_win.cpp
@@ -2052,6 +2052,8 @@ void QWidgetPrivate::winSetupGestures()
if (!q || !q->isVisible() || !nativeGesturePanEnabled)
return;
+ if (!QApplicationPrivate::HasTouchSupport)
+ return;
QApplicationPrivate *qAppPriv = QApplicationPrivate::instance();
if (!qAppPriv->SetGestureConfig)
return;
diff --git a/src/gui/kernel/qwinnativepangesturerecognizer_win_p.h b/src/gui/kernel/qwinnativepangesturerecognizer_win_p.h
index c65fa50..146b067 100644
--- a/src/gui/kernel/qwinnativepangesturerecognizer_win_p.h
+++ b/src/gui/kernel/qwinnativepangesturerecognizer_win_p.h
@@ -54,6 +54,38 @@
//
#include <QGestureRecognizer>
+#include <objbase.h>
+
+class IInkRectangle;
+class TabletHardwareCapabilities;
+class TabletPropertyMetricUnit;
+DECLARE_INTERFACE_(IInkTablet, IDispatch)
+{
+ STDMETHOD(get_Name)(THIS_ BSTR *Name) PURE;
+ STDMETHOD(get_PlugAndPlayId)(THIS_ BSTR *Id) PURE;
+ STDMETHOD(get_MaximumInputRectangle)(THIS_ IInkRectangle **Rectangle) PURE;
+ STDMETHOD(get_HardwareCapabilities)(THIS_ TabletHardwareCapabilities *Capabilities) PURE;
+ STDMETHOD(IsPacketPropertySupported)(THIS_ BSTR packetPropertyName) PURE;
+ STDMETHOD(GetPropertyMetrics)(THIS_ BSTR propertyName, long *Minimum, long *Maximum, TabletPropertyMetricUnit *Units, float *Resolution) PURE;
+};
+enum TabletDeviceKind
+{
+ TDK_Mouse = 0,
+ TDK_Pen = 1,
+ TDK_Touch = 2
+};
+DECLARE_INTERFACE_(IInkTablet2, IDispatch)
+{
+ STDMETHOD(get_DeviceKind)(THIS_ TabletDeviceKind *Kind) PURE;
+};
+DECLARE_INTERFACE_(IInkTablets, IDispatch)
+{
+ STDMETHOD(get_Count)(THIS_ long *Count) PURE;
+ STDMETHOD(get__NewEnum)(THIS_ IUnknown **_NewEnum) PURE;
+ STDMETHOD(get_DefaultTablet)(THIS_ IInkTablet **DefaultTablet) PURE;
+ STDMETHOD(Item)(THIS_ long Index, IInkTablet **Tablet) PURE;
+ STDMETHOD(IsPacketPropertySupported)(THIS_ BSTR packetPropertyName, VARIANT_BOOL *Supported) PURE;
+};
QT_BEGIN_NAMESPACE
diff --git a/src/gui/styles/qgtkstyle_p.cpp b/src/gui/styles/qgtkstyle_p.cpp
index f3c7a5b..ad6746f 100644
--- a/src/gui/styles/qgtkstyle_p.cpp
+++ b/src/gui/styles/qgtkstyle_p.cpp
@@ -530,7 +530,7 @@ void QGtkStylePrivate::initGtkWidgets() const
GtkWidget *gtkButton = QGtkStylePrivate::gtk_button_new();
addWidget(gtkButton);
g_signal_connect(gtkButton, "style-set", G_CALLBACK(gtkStyleSetCallback), 0);
- addWidget(QGtkStylePrivate::gtk_tool_button_new(NULL, NULL));
+ addWidget(QGtkStylePrivate::gtk_tool_button_new(NULL, "Qt"));
addWidget(QGtkStylePrivate::gtk_arrow_new(GTK_ARROW_DOWN, GTK_SHADOW_NONE));
addWidget(QGtkStylePrivate::gtk_hbutton_box_new());
addWidget(QGtkStylePrivate::gtk_check_button_new());
diff --git a/src/gui/widgets/qmainwindowlayout_mac.mm b/src/gui/widgets/qmainwindowlayout_mac.mm
index d92168a..9527057 100644
--- a/src/gui/widgets/qmainwindowlayout_mac.mm
+++ b/src/gui/widgets/qmainwindowlayout_mac.mm
@@ -463,6 +463,8 @@ void QMainWindowLayout::removeFromMacToolbar(QToolBar *toolbar)
NSToolbarItem *item = static_cast<NSToolbarItem *>(it.key());
[[qt_mac_window_for(layoutState.mainWindow->window()) toolbar]
removeItemAtIndex:toolbarItemsCopy.indexOf(item)];
+ unifiedToolbarHash.remove(item);
+ qtoolbarsInUnifiedToolbarList.removeAll(toolbar);
#endif
break;
}
diff --git a/src/network/kernel/qhostinfo.cpp b/src/network/kernel/qhostinfo.cpp
index a65ca50..9092ad6 100644
--- a/src/network/kernel/qhostinfo.cpp
+++ b/src/network/kernel/qhostinfo.cpp
@@ -112,6 +112,13 @@ Q_GLOBAL_STATIC(QHostInfoLookupManager, theHostInfoLookupManager)
To retrieve the name of the local host, use the static
QHostInfo::localHostName() function.
+ \note Since Qt 4.6.1 QHostInfo is using multiple threads for DNS lookup
+ instead of one dedicated DNS thread. This improves performance,
+ but also changes the order of signal emissions when using lookupHost()
+ compared to previous versions of Qt.
+ \note Since Qt 4.6.3 QHostInfo is using a small internal 60 second DNS cache
+ for performance improvements.
+
\sa QAbstractSocket, {http://www.rfc-editor.org/rfc/rfc3492.txt}{RFC 3492}
*/
@@ -435,12 +442,24 @@ void QHostInfoRunnable::run()
return;
}
- // if not in cache: OS lookup
- QHostInfo hostInfo = QHostInfoAgent::fromName(toBeLookedUp);
-
- // save to cache
- if (manager->cache.isEnabled())
- manager->cache.put(toBeLookedUp, hostInfo);
+ QHostInfo hostInfo;
+
+ // QHostInfo::lookupHost already checks the cache. However we need to check
+ // it here too because it might have been cache saved by another QHostInfoRunnable
+ // in the meanwhile while this QHostInfoRunnable was scheduled but not running
+ if (manager->cache.isEnabled()) {
+ // check the cache first
+ bool valid = false;
+ hostInfo = manager->cache.get(toBeLookedUp, &valid);
+ if (!valid) {
+ // not in cache, we need to do the lookup and store the result in the cache
+ hostInfo = QHostInfoAgent::fromName(toBeLookedUp);
+ manager->cache.put(toBeLookedUp, hostInfo);
+ }
+ } else {
+ // cache is not enabled, just do the lookup and continue
+ hostInfo = QHostInfoAgent::fromName(toBeLookedUp);
+ }
// check aborted again
if (manager->wasAborted(id)) {
diff --git a/src/network/socket/qabstractsocket.cpp b/src/network/socket/qabstractsocket.cpp
index d990448..95721ee 100644
--- a/src/network/socket/qabstractsocket.cpp
+++ b/src/network/socket/qabstractsocket.cpp
@@ -172,6 +172,10 @@
This signal is emitted after connectToHost() has been called and
the host lookup has succeeded.
+ \note Since Qt 4.6.3 QAbstractSocket may emit hostFound()
+ directly from the connectToHost() call since a DNS result could have been
+ cached.
+
\sa connected()
*/
@@ -181,6 +185,10 @@
This signal is emitted after connectToHost() has been called and
a connection has been successfully established.
+ \note On some operating systems the connected() signal may
+ be directly emitted from the connectToHost() call for connections
+ to the localhost.
+
\sa connectToHost(), disconnected()
*/
diff --git a/tests/auto/qftp/tst_qftp.cpp b/tests/auto/qftp/tst_qftp.cpp
index 240885d..638c810 100644
--- a/tests/auto/qftp/tst_qftp.cpp
+++ b/tests/auto/qftp/tst_qftp.cpp
@@ -308,7 +308,7 @@ void tst_QFtp::connectToUnresponsiveHost()
if (setProxy)
QSKIP( "This test takes too long if we test with proxies too", SkipSingle );
- QString host = "1.2.3.4";
+ QString host = "192.0.2.42"; // IP out of TEST-NET, should be unreachable
uint port = 21;
ftp = newFtp();
diff --git a/tests/auto/qhostinfo/tst_qhostinfo.cpp b/tests/auto/qhostinfo/tst_qhostinfo.cpp
index cbadcf5..4282062 100644
--- a/tests/auto/qhostinfo/tst_qhostinfo.cpp
+++ b/tests/auto/qhostinfo/tst_qhostinfo.cpp
@@ -213,8 +213,8 @@ void tst_QHostInfo::initTestCase()
// run each testcase with and without test enabled
QTest::addColumn<bool>("cache");
- QTest::newRow("WithCache") << false;
- QTest::newRow("WithoutCache") << true;
+ QTest::newRow("WithCache") << true;
+ QTest::newRow("WithoutCache") << false;
}
void tst_QHostInfo::init()
@@ -484,7 +484,8 @@ void tst_QHostInfo::cache()
// lookup once, wait in event loop, result should not come directly.
bool valid = true;
- QHostInfo result = qt_qhostinfo_lookup("localhost", this, SLOT(resultsReady(QHostInfo)), &valid);
+ int id = -1;
+ QHostInfo result = qt_qhostinfo_lookup("localhost", this, SLOT(resultsReady(QHostInfo)), &valid, &id);
QTestEventLoop::instance().enterLoop(5);
QVERIFY(!QTestEventLoop::instance().timeout());
QVERIFY(valid == false);
@@ -492,7 +493,7 @@ void tst_QHostInfo::cache()
// loopkup second time, result should come directly
valid = false;
- result = qt_qhostinfo_lookup("localhost", this, SLOT(resultsReady(QHostInfo)), &valid);
+ result = qt_qhostinfo_lookup("localhost", this, SLOT(resultsReady(QHostInfo)), &valid, &id);
QVERIFY(valid == true);
QVERIFY(!result.addresses().isEmpty());
@@ -501,7 +502,7 @@ void tst_QHostInfo::cache()
// lookup third time, result should not come directly.
valid = true;
- result = qt_qhostinfo_lookup("localhost", this, SLOT(resultsReady(QHostInfo)), &valid);
+ result = qt_qhostinfo_lookup("localhost", this, SLOT(resultsReady(QHostInfo)), &valid, &id);
QTestEventLoop::instance().enterLoop(5);
QVERIFY(!QTestEventLoop::instance().timeout());
QVERIFY(valid == false);
diff --git a/tests/benchmarks/network/kernel/qhostinfo/main.cpp b/tests/benchmarks/network/kernel/qhostinfo/main.cpp
index 0ae1b7f..f4648d6 100644
--- a/tests/benchmarks/network/kernel/qhostinfo/main.cpp
+++ b/tests/benchmarks/network/kernel/qhostinfo/main.cpp
@@ -48,10 +48,15 @@
#include <qtest.h>
#include <qtesteventloop.h>
+#include "private/qhostinfo_p.h"
+
class tst_qhostinfo : public QObject
{
Q_OBJECT
+public slots:
+ void init();
private slots:
+ void lookupSpeed_data();
void lookupSpeed();
};
@@ -70,14 +75,33 @@ public slots:
}
};
+void tst_qhostinfo::init()
+{
+ // delete the cache so inidividual testcase results are independant from each other
+ qt_qhostinfo_clear_cache();
+}
+
+void tst_qhostinfo::lookupSpeed_data()
+{
+ QTest::addColumn<bool>("cache");
+ QTest::newRow("WithCache") << true;
+ QTest::newRow("WithoutCache") << false;
+}
+
void tst_qhostinfo::lookupSpeed()
{
+ QFETCH(bool, cache);
+ qt_qhostinfo_enable_cache(cache);
+
QStringList hostnameList;
hostnameList << "www.ovi.com" << "www.nokia.com" << "qt.nokia.com" << "www.trolltech.com" << "troll.no"
<< "www.qtcentre.org" << "forum.nokia.com" << "www.forum.nokia.com" << "wiki.forum.nokia.com"
<< "www.nokia.no" << "nokia.de" << "127.0.0.1" << "----";
// also add some duplicates:
hostnameList << "www.nokia.com" << "127.0.0.1" << "www.trolltech.com";
+ // and some more
+ hostnameList << hostnameList;
+
const int COUNT = hostnameList.size();
SignalReceiver receiver(COUNT);