[Qt] Replace use of QApplication with QGuiApplication
authorhausmann@webkit.org <hausmann@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 9 Nov 2011 08:42:44 +0000 (08:42 +0000)
committerhausmann@webkit.org <hausmann@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 9 Nov 2011 08:42:44 +0000 (08:42 +0000)
https://bugs.webkit.org/show_bug.cgi?id=71794

Reviewed by Andreas Kling.

Source/JavaScriptCore:

Add compat headers for use when building with Qt 4: QGuiApplication
is typedef'ed to QApplication.

* wtf/qt/compat/QGuiApplication: Added.
* wtf/qt/compat/qguiapplication.h: Added.

Source/WebCore:

* Target.pri: Add compat include dir when compiling with Qt 4.
* platform/graphics/gstreamer/PlatformVideoWindowQt.cpp:
(FullScreenVideoWindow::closeEvent): Replace use of QApplication with QGuiApplication.
(FullScreenVideoWindow::hideCursor): Ditto.
(FullScreenVideoWindow::showCursor): Ditto.
* platform/graphics/qt/TileQt.cpp: Remove unnecessary inclusion of QApplication.
* platform/qt/ClipboardQt.cpp: Replace use of QApplication with QGuiApplication.
(WebCore::ClipboardQt::ClipboardQt):
(WebCore::ClipboardQt::clearData):
(WebCore::ClipboardQt::clearAllData):
(WebCore::ClipboardQt::setData):
(WebCore::ClipboardQt::declareAndWriteDragImage):
(WebCore::ClipboardQt::writeURL):
(WebCore::ClipboardQt::writeRange):
(WebCore::ClipboardQt::writePlainText):
* platform/qt/PasteboardQt.cpp: Ditto.
(WebCore::Pasteboard::writeSelection):
(WebCore::Pasteboard::canSmartReplace):
(WebCore::Pasteboard::plainText):
(WebCore::Pasteboard::documentFragment):
(WebCore::Pasteboard::writePlainText):
(WebCore::Pasteboard::writeURL):
(WebCore::Pasteboard::writeImage):

Source/WebKit/qt:

* WebCoreSupport/QtWebComboBox.cpp:
(WebCore::QtWebComboBox::showPopupAtCursorPosition): Replace use of QApplication
with QCoreApplication.

Source/WebKit2:

* Platform/CoreIPC/unix/ConnectionUnix.cpp: Remove unnecessary QApplication inclusion.
* Platform/qt/RunLoopQt.cpp: Replace QApplication include with QCoreApplication.
* UIProcess/Launcher/qt/ProcessLauncherQt.cpp: Ditto.
* UIProcess/Launcher/qt/ThreadLauncherQt.cpp: Remove unnecessary QApplication inclusion.
* UIProcess/qt/QtWebPageProxy.cpp:
(QtWebPageProxy::handleMousePressEvent): Replace QApplication usage with QStyleHints.
(QtWebPageProxy::handleMouseDoubleClickEvent): Ditto.

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

17 files changed:
Source/JavaScriptCore/ChangeLog
Source/JavaScriptCore/wtf/qt/compat/QGuiApplication [new file with mode: 0644]
Source/JavaScriptCore/wtf/qt/compat/qguiapplication.h [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/Target.pri
Source/WebCore/platform/graphics/gstreamer/PlatformVideoWindowQt.cpp
Source/WebCore/platform/graphics/qt/TileQt.cpp
Source/WebCore/platform/qt/ClipboardQt.cpp
Source/WebCore/platform/qt/PasteboardQt.cpp
Source/WebKit/qt/ChangeLog
Source/WebKit/qt/WebCoreSupport/QtWebComboBox.cpp
Source/WebKit2/ChangeLog
Source/WebKit2/Platform/CoreIPC/unix/ConnectionUnix.cpp
Source/WebKit2/Platform/qt/RunLoopQt.cpp
Source/WebKit2/UIProcess/Launcher/qt/ProcessLauncherQt.cpp
Source/WebKit2/UIProcess/Launcher/qt/ThreadLauncherQt.cpp
Source/WebKit2/UIProcess/qt/QtWebPageProxy.cpp

index 4fdec7f..b9a0799 100644 (file)
@@ -1,3 +1,16 @@
+2011-11-08  Simon Hausmann  <simon.hausmann@nokia.com>
+
+        [Qt] Replace use of QApplication with QGuiApplication
+        https://bugs.webkit.org/show_bug.cgi?id=71794
+
+        Reviewed by Andreas Kling.
+
+        Add compat headers for use when building with Qt 4: QGuiApplication
+        is typedef'ed to QApplication.
+
+        * wtf/qt/compat/QGuiApplication: Added.
+        * wtf/qt/compat/qguiapplication.h: Added.
+
 2011-11-08  Sheriff Bot  <webkit.review.bot@gmail.com>
 
         Unreviewed, rolling out r99647.
diff --git a/Source/JavaScriptCore/wtf/qt/compat/QGuiApplication b/Source/JavaScriptCore/wtf/qt/compat/QGuiApplication
new file mode 100644 (file)
index 0000000..0337e25
--- /dev/null
@@ -0,0 +1 @@
+#include "qguiapplication.h"
diff --git a/Source/JavaScriptCore/wtf/qt/compat/qguiapplication.h b/Source/JavaScriptCore/wtf/qt/compat/qguiapplication.h
new file mode 100644 (file)
index 0000000..1b7d80d
--- /dev/null
@@ -0,0 +1,27 @@
+/*
+    Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies)
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Library General Public
+    License as published by the Free Software Foundation; either
+    version 2 of the License, or (at your option) any later version.
+
+    This library is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+    Library General Public License for more details.
+
+    You should have received a copy of the GNU Library General Public License
+    along with this library; see the file COPYING.LIB.  If not, write to
+    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+    Boston, MA 02110-1301, USA.
+*/
+
+#ifndef qguiapplication_h
+#define qguiapplication_h
+
+#include <QApplication>
+
+typedef QApplication QGuiApplication;
+
+#endif
index bc8d9ea..52d2237 100644 (file)
@@ -1,3 +1,34 @@
+2011-11-08  Simon Hausmann  <simon.hausmann@nokia.com>
+
+        [Qt] Replace use of QApplication with QGuiApplication
+        https://bugs.webkit.org/show_bug.cgi?id=71794
+
+        Reviewed by Andreas Kling.
+
+        * Target.pri: Add compat include dir when compiling with Qt 4.
+        * platform/graphics/gstreamer/PlatformVideoWindowQt.cpp:
+        (FullScreenVideoWindow::closeEvent): Replace use of QApplication with QGuiApplication.
+        (FullScreenVideoWindow::hideCursor): Ditto.
+        (FullScreenVideoWindow::showCursor): Ditto.
+        * platform/graphics/qt/TileQt.cpp: Remove unnecessary inclusion of QApplication.
+        * platform/qt/ClipboardQt.cpp: Replace use of QApplication with QGuiApplication.
+        (WebCore::ClipboardQt::ClipboardQt):
+        (WebCore::ClipboardQt::clearData):
+        (WebCore::ClipboardQt::clearAllData):
+        (WebCore::ClipboardQt::setData):
+        (WebCore::ClipboardQt::declareAndWriteDragImage):
+        (WebCore::ClipboardQt::writeURL):
+        (WebCore::ClipboardQt::writeRange):
+        (WebCore::ClipboardQt::writePlainText):
+        * platform/qt/PasteboardQt.cpp: Ditto.
+        (WebCore::Pasteboard::writeSelection):
+        (WebCore::Pasteboard::canSmartReplace):
+        (WebCore::Pasteboard::plainText):
+        (WebCore::Pasteboard::documentFragment):
+        (WebCore::Pasteboard::writePlainText):
+        (WebCore::Pasteboard::writeURL):
+        (WebCore::Pasteboard::writeImage):
+
 2011-11-09  Simon Hausmann  <simon.hausmann@nokia.com>
 
         Mac Build fix part 2: Oops, use the correct wtf/ prefix for the WTF include.
index c76663f..d740713 100644 (file)
@@ -28,6 +28,8 @@ haveQt(5) {
     # Add a QtScript dependency for the time being, in order to pull in the include
     # path for QtScript when it's built as a standalone module
     QT += script
+} else {
+    INCLUDEPATH += $$PWD/../JavaScriptCore/wtf/qt/compat
 }
 
 RESOURCES += \
index 7bb66e7..0a6c45b 100644 (file)
@@ -23,7 +23,7 @@
 #include "HTMLVideoElement.h"
 #include "PlatformVideoWindowPrivate.h"
 
-#include <QApplication>
+#include <QGuiApplication>
 #include <QDesktopWidget>
 #include <QKeyEvent>
 #include <QPalette>
@@ -61,7 +61,7 @@ void FullScreenVideoWindow::closeEvent(QCloseEvent*)
     setMouseTracking(false);
     releaseMouse();
 #ifndef QT_NO_CURSOR
-    QApplication::restoreOverrideCursor();
+    QGuiApplication::restoreOverrideCursor();
 #endif
 }
 
@@ -105,14 +105,14 @@ void FullScreenVideoWindow::showFullScreen()
 void FullScreenVideoWindow::hideCursor()
 {
 #ifndef QT_NO_CURSOR
-    QApplication::setOverrideCursor(QCursor(Qt::BlankCursor));
+    QGuiApplication::setOverrideCursor(QCursor(Qt::BlankCursor));
 #endif
 }
 
 void FullScreenVideoWindow::showCursor()
 {
 #ifndef QT_NO_CURSOR
-    QApplication::restoreOverrideCursor();
+    QGuiApplication::restoreOverrideCursor();
     m_cursorTimer.start(gHideMouseCursorDelay);
 #endif
 }
index 223383e..aae456b 100644 (file)
@@ -25,7 +25,6 @@
 #include "GraphicsContext.h"
 #include "TiledBackingStore.h"
 #include "TiledBackingStoreClient.h"
-#include <QApplication>
 #include <QObject>
 #include <QPainter>
 #include <QRegion>
index f46659f..b30f63d 100644 (file)
@@ -48,7 +48,7 @@
 #include "markup.h"
 #include <wtf/text/StringHash.h>
 
-#include <QApplication>
+#include <QGuiApplication>
 #include <QClipboard>
 #include <QList>
 #include <QMimeData>
@@ -96,7 +96,7 @@ ClipboardQt::ClipboardQt(ClipboardAccessPolicy policy, ClipboardType clipboardTy
 #ifndef QT_NO_CLIPBOARD
     if (policy != ClipboardWritable) {
         Q_ASSERT(isForCopyAndPaste());
-        m_readableData = QApplication::clipboard()->mimeData();
+        m_readableData = QGuiApplication::clipboard()->mimeData();
     }
 #endif
 }
@@ -125,7 +125,7 @@ void ClipboardQt::clearData(const String& type)
     }
 #ifndef QT_NO_CLIPBOARD
     if (isForCopyAndPaste())
-        QApplication::clipboard()->setMimeData(m_writableData);
+        QGuiApplication::clipboard()->setMimeData(m_writableData);
 #endif
 }
 
@@ -136,7 +136,7 @@ void ClipboardQt::clearAllData()
 
 #ifndef QT_NO_CLIPBOARD
     if (isForCopyAndPaste())
-        QApplication::clipboard()->setMimeData(0);
+        QGuiApplication::clipboard()->setMimeData(0);
     else
 #endif
         delete m_writableData;
@@ -187,7 +187,7 @@ bool ClipboardQt::setData(const String& type, const String& data)
 
 #ifndef QT_NO_CLIPBOARD
     if (isForCopyAndPaste())
-        QApplication::clipboard()->setMimeData(m_writableData);
+        QGuiApplication::clipboard()->setMimeData(m_writableData);
 #endif
     return true;
 }
@@ -296,7 +296,7 @@ void ClipboardQt::declareAndWriteDragImage(Element* element, const KURL& url, co
     m_writableData->setHtml(createMarkup(element, IncludeNode, 0, ResolveAllURLs));
 #ifndef QT_NO_CLIPBOARD
     if (isForCopyAndPaste())
-        QApplication::clipboard()->setMimeData(m_writableData);
+        QGuiApplication::clipboard()->setMimeData(m_writableData);
 #endif
 }
 
@@ -312,7 +312,7 @@ void ClipboardQt::writeURL(const KURL& url, const String& title, Frame* frame)
     m_writableData->setText(title);
 #ifndef QT_NO_CLIPBOARD
     if (isForCopyAndPaste())
-        QApplication::clipboard()->setMimeData(m_writableData);
+        QGuiApplication::clipboard()->setMimeData(m_writableData);
 #endif
 }
 
@@ -329,7 +329,7 @@ void ClipboardQt::writeRange(Range* range, Frame* frame)
     m_writableData->setHtml(createMarkup(range, 0, AnnotateForInterchange, false, ResolveNonLocalURLs));
 #ifndef QT_NO_CLIPBOARD
     if (isForCopyAndPaste())
-        QApplication::clipboard()->setMimeData(m_writableData);
+        QGuiApplication::clipboard()->setMimeData(m_writableData);
 #endif
 }
 
@@ -342,7 +342,7 @@ void ClipboardQt::writePlainText(const String& str)
     m_writableData->setText(text);
 #ifndef QT_NO_CLIPBOARD
     if (isForCopyAndPaste())
-        QApplication::clipboard()->setMimeData(m_writableData);
+        QGuiApplication::clipboard()->setMimeData(m_writableData);
 #endif
 }
 
index c9e7c1e..050fe13 100644 (file)
@@ -34,7 +34,7 @@
 #include "Image.h"
 #include "RenderImage.h"
 #include "markup.h"
-#include <qapplication.h>
+#include <qguiapplication.h>
 #include <qclipboard.h>
 #include <qdebug.h>
 #include <qmimedata.h>
@@ -74,7 +74,7 @@ void Pasteboard::writeSelection(Range* selectedRange, bool canSmartCopyOrDelete,
 #endif
 
 #ifndef QT_NO_CLIPBOARD
-    QApplication::clipboard()->setMimeData(md, m_selectionMode ? QClipboard::Selection : QClipboard::Clipboard);
+    QGuiApplication::clipboard()->setMimeData(md, m_selectionMode ? QClipboard::Selection : QClipboard::Clipboard);
 #endif
     if (canSmartCopyOrDelete)
         md->setData(QLatin1String("application/vnd.qtwebkit.smartpaste"), QByteArray());
@@ -83,7 +83,7 @@ void Pasteboard::writeSelection(Range* selectedRange, bool canSmartCopyOrDelete,
 bool Pasteboard::canSmartReplace()
 {
 #ifndef QT_NO_CLIPBOARD
-    if (QApplication::clipboard()->mimeData()->hasFormat((QLatin1String("application/vnd.qtwebkit.smartpaste"))))
+    if (QGuiApplication::clipboard()->mimeData()->hasFormat((QLatin1String("application/vnd.qtwebkit.smartpaste"))))
         return true;
 #endif
     return false;
@@ -92,7 +92,7 @@ bool Pasteboard::canSmartReplace()
 String Pasteboard::plainText(Frame*)
 {
 #ifndef QT_NO_CLIPBOARD
-    return QApplication::clipboard()->text(m_selectionMode ? QClipboard::Selection : QClipboard::Clipboard);
+    return QGuiApplication::clipboard()->text(m_selectionMode ? QClipboard::Selection : QClipboard::Clipboard);
 #else
     return String();
 #endif
@@ -102,7 +102,7 @@ PassRefPtr<DocumentFragment> Pasteboard::documentFragment(Frame* frame, PassRefP
                                                           bool allowPlainText, bool& chosePlainText)
 {
 #ifndef QT_NO_CLIPBOARD
-    const QMimeData* mimeData = QApplication::clipboard()->mimeData(
+    const QMimeData* mimeData = QGuiApplication::clipboard()->mimeData(
             m_selectionMode ? QClipboard::Selection : QClipboard::Clipboard);
 
     chosePlainText = false;
@@ -133,7 +133,7 @@ void Pasteboard::writePlainText(const String& text)
     QString qtext = text;
     qtext.replace(QChar(0xa0), QLatin1Char(' '));
     md->setText(qtext);
-    QApplication::clipboard()->setMimeData(md, m_selectionMode ? QClipboard::Selection : QClipboard::Clipboard);
+    QGuiApplication::clipboard()->setMimeData(md, m_selectionMode ? QClipboard::Selection : QClipboard::Clipboard);
 #endif
 }
 
@@ -146,7 +146,7 @@ void Pasteboard::writeURL(const KURL& url, const String&, Frame*)
     QString urlString = url.string();
     md->setText(urlString);
     md->setUrls(QList<QUrl>() << url);
-    QApplication::clipboard()->setMimeData(md, m_selectionMode ? QClipboard::Selection : QClipboard::Clipboard);
+    QGuiApplication::clipboard()->setMimeData(md, m_selectionMode ? QClipboard::Selection : QClipboard::Clipboard);
 #endif
 }
 
@@ -168,7 +168,7 @@ void Pasteboard::writeImage(Node* node, const KURL&, const String&)
     QPixmap* pixmap = image->nativeImageForCurrentFrame();
     if (!pixmap)
         return;
-    QApplication::clipboard()->setPixmap(*pixmap, QClipboard::Clipboard);
+    QGuiApplication::clipboard()->setPixmap(*pixmap, QClipboard::Clipboard);
 #endif
 }
 
index 0d1670c..35f6687 100644 (file)
@@ -1,3 +1,14 @@
+2011-11-08  Simon Hausmann  <simon.hausmann@nokia.com>
+
+        [Qt] Replace use of QApplication with QGuiApplication
+        https://bugs.webkit.org/show_bug.cgi?id=71794
+
+        Reviewed by Andreas Kling.
+
+        * WebCoreSupport/QtWebComboBox.cpp:
+        (WebCore::QtWebComboBox::showPopupAtCursorPosition): Replace use of QApplication
+        with QCoreApplication.
+
 2011-11-07  Adam Barth  <abarth@webkit.org>
 
         Move static "policy" state from SecurityOrigin.cpp to SecurityPolicy.cpp
index 8a06d64..f52465f 100644 (file)
@@ -25,7 +25,7 @@
 #ifndef QT_NO_COMBOBOX
 
 #include <QAbstractItemView>
-#include <QApplication>
+#include <QCoreApplication>
 #include <QtGui/QMouseEvent>
 
 namespace WebCore {
@@ -43,7 +43,7 @@ void QtWebComboBox::showPopupAtCursorPosition()
 {
     QMouseEvent event(QEvent::MouseButtonPress, QCursor::pos(), Qt::LeftButton,
                       Qt::LeftButton, Qt::NoModifier);
-    QApplication::sendEvent(this, &event);
+    QCoreApplication::sendEvent(this, &event);
 }
 
 bool QtWebComboBox::eventFilter(QObject* watched, QEvent* event)
index b74e159..0abef02 100644 (file)
@@ -1,3 +1,18 @@
+2011-11-08  Simon Hausmann  <simon.hausmann@nokia.com>
+
+        [Qt] Replace use of QApplication with QGuiApplication
+        https://bugs.webkit.org/show_bug.cgi?id=71794
+
+        Reviewed by Andreas Kling.
+
+        * Platform/CoreIPC/unix/ConnectionUnix.cpp: Remove unnecessary QApplication inclusion.
+        * Platform/qt/RunLoopQt.cpp: Replace QApplication include with QCoreApplication.
+        * UIProcess/Launcher/qt/ProcessLauncherQt.cpp: Ditto.
+        * UIProcess/Launcher/qt/ThreadLauncherQt.cpp: Remove unnecessary QApplication inclusion.
+        * UIProcess/qt/QtWebPageProxy.cpp:
+        (QtWebPageProxy::handleMousePressEvent): Replace QApplication usage with QStyleHints.
+        (QtWebPageProxy::handleMouseDoubleClickEvent): Ditto.
+
 2011-11-07  Adam Barth  <abarth@webkit.org>
 
         Move static "policy" state from SecurityOrigin.cpp to SecurityPolicy.cpp
index 4e794cf..5a61ed6 100644 (file)
@@ -39,7 +39,6 @@
 #include <wtf/OwnArrayPtr.h>
 
 #if PLATFORM(QT)
-#include <QApplication>
 #include <QSocketNotifier>
 #elif PLATFORM(GTK)
 #include <glib.h>
index b7aea2f..54b2a53 100644 (file)
@@ -29,7 +29,7 @@
 
 #include "WorkItem.h"
 
-#include <QApplication>
+#include <QCoreApplication>
 #include <QAbstractEventDispatcher>
 #include <QObject>
 #include <QMetaMethod>
index 3dd2f0b..9fc1af1 100644 (file)
@@ -30,7 +30,7 @@
 #include "Connection.h"
 #include "RunLoop.h"
 #include "WebProcess.h"
-#include <QApplication>
+#include <QCoreApplication>
 #include <QDebug>
 #include <QFile>
 #include <QLocalServer>
index 87dc20c..7b95ca0 100644 (file)
@@ -33,7 +33,6 @@
 #include <wtf/MainThread.h>
 #include <wtf/Threading.h>
 
-#include <QApplication>
 #include <QDebug>
 #include <QFile>
 #include <QLocalServer>
index 97a6ed0..e7c83c5 100644 (file)
 #include "WebPopupMenuProxyQt.h"
 #include "WKStringQt.h"
 #include "WKURLQt.h"
-#include <QApplication>
+#include <QGuiApplication>
 #include <QGraphicsSceneMouseEvent>
 #include <QJSEngine>
 #include <QMimeData>
+#include <QStyleHints>
 #include <QTouchEvent>
 #include <QUndoStack>
 #include <QtDebug>
@@ -235,7 +236,7 @@ bool QtWebPageProxy::handleMouseMoveEvent(QMouseEvent* ev)
 
 bool QtWebPageProxy::handleMousePressEvent(QMouseEvent* ev)
 {
-    if (m_tripleClickTimer.isActive() && (ev->pos() - m_tripleClick).manhattanLength() < QApplication::startDragDistance()) {
+    if (m_tripleClickTimer.isActive() && (ev->pos() - m_tripleClick).manhattanLength() < qApp->styleHints()->startDragDistance()) {
         m_webPageProxy->handleMouseEvent(NativeWebMouseEvent(ev, /*eventClickCount=*/3));
         return ev->isAccepted();
     }
@@ -254,7 +255,7 @@ bool QtWebPageProxy::handleMouseDoubleClickEvent(QMouseEvent* ev)
 {
     m_webPageProxy->handleMouseEvent(NativeWebMouseEvent(ev, /*eventClickCount=*/2));
 
-    m_tripleClickTimer.start(QApplication::doubleClickInterval(), this);
+    m_tripleClickTimer.start(qApp->styleHints()->mouseDoubleClickInterval(), this);
     m_tripleClick = ev->localPos().toPoint();
     return ev->isAccepted();
 }