[Qt][WK2] Get rid of the dependency to QtWidgets
authorabecsi@webkit.org <abecsi@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 21 Feb 2012 10:57:13 +0000 (10:57 +0000)
committerabecsi@webkit.org <abecsi@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 21 Feb 2012 10:57:13 +0000 (10:57 +0000)
https://bugs.webkit.org/show_bug.cgi?id=76276

Reviewed by Simon Hausmann.

Source/WebKit2:

* Target.pri:
* UIProcess/API/qt/tests/qmltests/tst_qmltests.cpp:
(main):
* UIProcess/API/qt/tests/qquickwebview/tst_qquickwebview.cpp:
* UIProcess/API/qt/tests/tests.pri:
* UIProcess/API/qt/tests/util.h:

Tools:

* MiniBrowser/qt/MiniBrowser.pro:
* MiniBrowser/qt/MiniBrowserApplication.cpp:
(MiniBrowserApplication::MiniBrowserApplication):
(MiniBrowserApplication::notify):
(MiniBrowserApplication::sendTouchEvent):
* MiniBrowser/qt/MiniBrowserApplication.h:
(MiniBrowserApplication):
* QtTestBrowser/locationedit.h:
* WebKitTestRunner/InjectedBundle/qt/ActivateFontsQt.cpp:
(WTR::activateFonts):
* WebKitTestRunner/qt/PlatformWebViewQt.cpp:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@108328 268f45cc-cd09-0410-ab3c-d52691b4dbfc

13 files changed:
Source/WebKit2/ChangeLog
Source/WebKit2/Target.pri
Source/WebKit2/UIProcess/API/qt/tests/qmltests/tst_qmltests.cpp
Source/WebKit2/UIProcess/API/qt/tests/qquickwebview/tst_qquickwebview.cpp
Source/WebKit2/UIProcess/API/qt/tests/tests.pri
Source/WebKit2/UIProcess/API/qt/tests/util.h
Tools/ChangeLog
Tools/MiniBrowser/qt/MiniBrowser.pro
Tools/MiniBrowser/qt/MiniBrowserApplication.cpp
Tools/MiniBrowser/qt/MiniBrowserApplication.h
Tools/QtTestBrowser/locationedit.h
Tools/WebKitTestRunner/InjectedBundle/qt/ActivateFontsQt.cpp
Tools/WebKitTestRunner/qt/PlatformWebViewQt.cpp

index 1ba2e9e..c3ea1d4 100644 (file)
@@ -1,3 +1,17 @@
+2012-02-21  Andras Becsi  <andras.becsi@nokia.com>
+
+        [Qt][WK2] Get rid of the dependency to QtWidgets
+        https://bugs.webkit.org/show_bug.cgi?id=76276
+
+        Reviewed by Simon Hausmann.
+
+        * Target.pri:
+        * UIProcess/API/qt/tests/qmltests/tst_qmltests.cpp:
+        (main):
+        * UIProcess/API/qt/tests/qquickwebview/tst_qquickwebview.cpp:
+        * UIProcess/API/qt/tests/tests.pri:
+        * UIProcess/API/qt/tests/util.h:
+
 2012-02-20  Martin Robinson  <mrobinson@igalia.com>
 
         [UNIX] Plugin information fields are not interpreted as UTF-8
index 5b2cfb9..cd2d08d 100644 (file)
@@ -12,7 +12,7 @@ load(features)
 include(WebKit2.pri)
 
 WEBKIT += wtf javascriptcore webcore
-QT += declarative quick widgets
+QT += declarative quick
 
 CONFIG += staticlib
 
index a80c5c3..bcc246d 100644 (file)
@@ -21,9 +21,9 @@
 #include "../util.h"
 
 #include "qquickwebview_p.h"
+#include <QGuiApplication>
 #include <QVarLengthArray>
 #include <QtQuickTest/quicktest.h>
-#include <QtWidgets/QApplication>
 
 int main(int argc, char** argv)
 {
@@ -42,7 +42,7 @@ int main(int argc, char** argv)
 
     // Instantiate QApplication to prevent quick_test_main to instantiate a QGuiApplication.
     // This can be removed as soon as we do not use QtWidgets any more.
-    QApplication app(argc, argv);
+    QGuiApplication app(argc, argv);
     qmlRegisterType<ByteArrayTestData>("Test", 1, 0, "ByteArrayTestData");
 
 #ifdef DISABLE_FLICKABLE_VIEWPORT
index 572e9b8..12886b3 100644 (file)
@@ -356,7 +356,7 @@ void tst_QQuickWebView::scrollRequest()
     QVERIFY(webView()->experimental()->contentY() == y);
 }
 
-QTWEBKIT_API_TEST_MAIN(tst_QQuickWebView)
+QTEST_MAIN(tst_QQuickWebView)
 
 #include "tst_qquickwebview.moc"
 
index ed91d39..faf4453 100644 (file)
@@ -9,7 +9,7 @@ SOURCES += ../util.cpp \
            ../bytearraytestdata.cpp
 INCLUDEPATH += $$PWD
 
-QT += testlib declarative widgets quick
+QT += testlib declarative quick
 
 CONFIG += qtwebkit
 
index 007964f..1c052bc 100644 (file)
 void addQtWebProcessToPath();
 bool waitForSignal(QObject*, const char* signal, int timeout = 10000);
 void suppressDebugOutput();
-
-#define QTWEBKIT_API_TEST_MAIN(TestObject) \
-int main(int argc, char** argv) \
-{ \
-    suppressDebugOutput(); \
-    QApplication app(argc, argv); \
-    QTEST_DISABLE_KEYPAD_NAVIGATION \
-    TestObject tc; \
-    return QTest::qExec(&tc, argc, argv); \
-}
index c62b7a3..1148c23 100644 (file)
@@ -1,3 +1,22 @@
+2012-02-21  Andras Becsi  <andras.becsi@nokia.com>
+
+        [Qt][WK2] Get rid of the dependency to QtWidgets
+        https://bugs.webkit.org/show_bug.cgi?id=76276
+
+        Reviewed by Simon Hausmann.
+
+        * MiniBrowser/qt/MiniBrowser.pro:
+        * MiniBrowser/qt/MiniBrowserApplication.cpp:
+        (MiniBrowserApplication::MiniBrowserApplication):
+        (MiniBrowserApplication::notify):
+        (MiniBrowserApplication::sendTouchEvent):
+        * MiniBrowser/qt/MiniBrowserApplication.h:
+        (MiniBrowserApplication):
+        * QtTestBrowser/locationedit.h:
+        * WebKitTestRunner/InjectedBundle/qt/ActivateFontsQt.cpp:
+        (WTR::activateFonts):
+        * WebKitTestRunner/qt/PlatformWebViewQt.cpp:
+
 2012-02-20  Adam Barth  <abarth@webkit.org>
 
         mastercfg_unittest.py fails without simplejson
index 32389f2..f2290c8 100644 (file)
@@ -24,7 +24,7 @@ DESTDIR = $${ROOT_BUILD_DIR}/bin
 
 CONFIG += qtwebkit qtwebkit-private
 
-QT += network declarative widgets quick
+QT += network declarative quick
 macx: QT += xml
 
 RESOURCES += MiniBrowser.qrc
index 57a5592..2ec95ad 100644 (file)
@@ -35,7 +35,6 @@
 #include <QEvent>
 #include <QMouseEvent>
 #include <QTouchEvent>
-#include <QApplication>
 
 static inline bool isTouchEvent(const QEvent* event)
 {
@@ -63,13 +62,14 @@ static inline bool isMouseEvent(const QEvent* event)
 }
 
 MiniBrowserApplication::MiniBrowserApplication(int& argc, char** argv)
-    : QApplication(argc, argv)
+    : QGuiApplication(argc, argv)
     , m_realTouchEventReceived(false)
     , m_pendingFakeTouchEventCount(0)
     , m_isRobotized(false)
     , m_robotTimeoutSeconds(0)
     , m_robotExtraTimeSeconds(0)
     , m_windowOptions(this)
+    , m_holdingControl(false)
 {
     setOrganizationName("Nokia");
     setApplicationName("QtMiniBrowser");
@@ -80,23 +80,28 @@ MiniBrowserApplication::MiniBrowserApplication(int& argc, char** argv)
 
 bool MiniBrowserApplication::notify(QObject* target, QEvent* event)
 {
+    if(QInputEvent* ie = static_cast<QInputEvent*>(event))
+        m_holdingControl = ie->modifiers().testFlag(Qt::ControlModifier);
+    else
+        m_holdingControl = false;
+
     // We try to be smart, if we received real touch event, we are probably on a device
     // with touch screen, and we should not have touch mocking.
 
     if (!event->spontaneous() || m_realTouchEventReceived || !m_windowOptions.touchMockingEnabled())
-        return QApplication::notify(target, event);
+        return QGuiApplication::notify(target, event);
 
     if (isTouchEvent(event) && static_cast<QTouchEvent*>(event)->deviceType() == QTouchEvent::TouchScreen) {
         if (m_pendingFakeTouchEventCount)
             --m_pendingFakeTouchEventCount;
         else
             m_realTouchEventReceived = true;
-        return QApplication::notify(target, event);
+        return QGuiApplication::notify(target, event);
     }
 
     BrowserWindow* browserWindow = qobject_cast<BrowserWindow*>(target);
     if (!browserWindow)
-        return QApplication::notify(target, event);
+        return QGuiApplication::notify(target, event);
 
     // In QML events are propagated through parents. But since the WebView
     // may consume key events, a shortcut might never reach the top QQuickItem.
@@ -139,16 +144,16 @@ bool MiniBrowserApplication::notify(QObject* target, QEvent* event)
             break;
         case QEvent::MouseMove:
             if (!mouseEvent->buttons() || !m_touchPoints.contains(mouseEvent->buttons()))
-                return QApplication::notify(target, event);
+                return QGuiApplication::notify(target, event);
             touchPoint.id = mouseEvent->buttons();
             touchPoint.state = Qt::TouchPointMoved;
             break;
         case QEvent::MouseButtonRelease:
             touchPoint.state = Qt::TouchPointReleased;
             touchPoint.id = mouseEvent->button();
-            if (mouseEvent->modifiers().testFlag(Qt::ControlModifier)) {
+            if (m_holdingControl) {
                 m_heldTouchPoints.insert(touchPoint.id);
-                return QApplication::notify(target, event);
+                return QGuiApplication::notify(target, event);
             }
             break;
         default:
@@ -167,7 +172,7 @@ bool MiniBrowserApplication::notify(QObject* target, QEvent* event)
         sendTouchEvent(browserWindow);
     }
 
-    return QApplication::notify(target, event);
+    return QGuiApplication::notify(target, event);
 }
 
 void MiniBrowserApplication::sendTouchEvent(BrowserWindow* browserWindow)
@@ -182,14 +187,13 @@ void MiniBrowserApplication::sendTouchEvent(BrowserWindow* browserWindow)
     m_pendingFakeTouchEventCount++;
     QWindowSystemInterface::handleTouchEvent(browserWindow, device, m_touchPoints.values());
 
-    bool holdingControl = QApplication::keyboardModifiers().testFlag(Qt::ControlModifier);
     if (QQuickWebViewExperimental::flickableViewportEnabled())
-        browserWindow->updateVisualMockTouchPoints(holdingControl ? m_touchPoints.values() : QList<QWindowSystemInterface::TouchPoint>());
+        browserWindow->updateVisualMockTouchPoints(m_holdingControl ? m_touchPoints.values() : QList<QWindowSystemInterface::TouchPoint>());
 
     // Get rid of touch-points that are no longer valid
     foreach (const QWindowSystemInterface::TouchPoint& touchPoint, m_touchPoints) {
-    if (touchPoint.state ==  Qt::TouchPointReleased)
-        m_touchPoints.remove(touchPoint.id);
+        if (touchPoint.state ==  Qt::TouchPointReleased)
+            m_touchPoints.remove(touchPoint.id);
     }
 }
 
index b556585..0441fad 100644 (file)
@@ -33,7 +33,7 @@
 #include <QObject>
 #include <QStringList>
 #include <QtDeclarative>
-#include <QtWidgets/QApplication>
+#include <QGuiApplication>
 #include <QTouchEvent>
 #include <QUrl>
 #include "qwindowsysteminterface_qpa.h"
@@ -84,7 +84,7 @@ private:
     QSize m_windowSize;
 };
 
-class MiniBrowserApplication : public QApplication {
+class MiniBrowserApplication : public QGuiApplication {
     Q_OBJECT
 
 public:
@@ -113,6 +113,7 @@ private:
     QSet<int> m_heldTouchPoints;
 
     WindowOptions m_windowOptions;
+    bool m_holdingControl;
 };
 
 QML_DECLARE_TYPE(WindowOptions);
index b64474d..54d8a68 100644 (file)
@@ -28,8 +28,6 @@
 #ifndef locationedit_h
 #define locationedit_h
 
-#include <qconfig.h>
-
 #ifndef QT_NO_INPUTDIALOG
 #include <QApplication>
 #include <QIcon>
index ba2ce04..7111724 100644 (file)
@@ -33,7 +33,6 @@
 #include "QtInitializeTestFonts.h"
 
 #include <QApplication>
-#include <QWidget>
 #include <QWindowsStyle>
 
 namespace WTR {
@@ -41,11 +40,7 @@ namespace WTR {
 void activateFonts()
 {
     WebKit::initializeTestFonts();
-
-    QApplication::setGraphicsSystem(QLatin1String("raster"));
-#if HAVE(QSTYLE)
     QApplication::setStyle(new QWindowsStyle);
-#endif
 }
 
 }
index e93691c..efff1ea 100644 (file)
@@ -30,7 +30,7 @@
 #include "qquickwebpage_p.h"
 #include "qquickwebview_p.h"
 
-#include <QApplication>
+#include <QCoreApplication>
 #include <QDeclarativeProperty>
 #include <QEventLoop>
 #include <QtQuick/QQuickView>