Title: [100131] trunk/Source
Revision
100131
Author
[email protected]
Date
2011-11-14 05:01:03 -0800 (Mon, 14 Nov 2011)

Log Message

[Qt] Replace use of QApplication with QGuiApplication.

Reviewed by Tor Arne Vestbø.

Source/_javascript_Core:

* wtf/qt/compat/qguiapplication.h:
(QGuiApplication::styleHints): Introduce styleHints wrapper hack.

Source/WebCore:

Replace use of QApplication by QGuiApplication where applicable.

* platform/qt/RenderThemeQt.cpp:
(WebCore::RenderThemeQt::RenderThemeQt):
(WebCore::RenderThemeQt::platformActiveSelectionBackgroundColor):
(WebCore::RenderThemeQt::platformInactiveSelectionBackgroundColor):
(WebCore::RenderThemeQt::platformActiveSelectionForegroundColor):
(WebCore::RenderThemeQt::platformInactiveSelectionForegroundColor):
(WebCore::RenderThemeQt::platformFocusRingColor):
(WebCore::RenderThemeQt::systemColor):
(WebCore::RenderThemeQt::minimumMenuListSize):
(WebCore::RenderThemeQt::getMediaControlForegroundColor):
(WebCore::RenderThemeQt::paintMediaVolumeSliderTrack):
(WebCore::RenderThemeQt::caretBlinkInterval):

Modified Paths

Diff

Modified: trunk/Source/_javascript_Core/ChangeLog (100130 => 100131)


--- trunk/Source/_javascript_Core/ChangeLog	2011-11-14 12:58:46 UTC (rev 100130)
+++ trunk/Source/_javascript_Core/ChangeLog	2011-11-14 13:01:03 UTC (rev 100131)
@@ -1,3 +1,12 @@
+2011-11-14  Simon Hausmann  <[email protected]>
+
+        [Qt] Replace use of QApplication with QGuiApplication.
+
+        Reviewed by Tor Arne Vestbø.
+
+        * wtf/qt/compat/qguiapplication.h:
+        (QGuiApplication::styleHints): Introduce styleHints wrapper hack.
+
 2011-11-14  Carlos Garcia Campos  <[email protected]>
 
         Unreviewed. Fix make distcheck build.

Modified: trunk/Source/_javascript_Core/wtf/qt/compat/qguiapplication.h (100130 => 100131)


--- trunk/Source/_javascript_Core/wtf/qt/compat/qguiapplication.h	2011-11-14 12:58:46 UTC (rev 100130)
+++ trunk/Source/_javascript_Core/wtf/qt/compat/qguiapplication.h	2011-11-14 13:01:03 UTC (rev 100131)
@@ -22,6 +22,14 @@
 
 #include <QApplication>
 
-typedef QApplication QGuiApplication;
+struct QGuiApplication : public QApplication
+{
+    // Style hints in Qt 5 contain stuff that just used to be in QApplication in Qt 4, hence
+    // this hack.
+    static QApplication* styleHints()
+    {
+        return qApp;
+    }
+};
 
 #endif

Modified: trunk/Source/WebCore/ChangeLog (100130 => 100131)


--- trunk/Source/WebCore/ChangeLog	2011-11-14 12:58:46 UTC (rev 100130)
+++ trunk/Source/WebCore/ChangeLog	2011-11-14 13:01:03 UTC (rev 100131)
@@ -1,3 +1,24 @@
+2011-11-14  Simon Hausmann  <[email protected]>
+
+        [Qt] Replace use of QApplication with QGuiApplication.
+
+        Reviewed by Tor Arne Vestbø.
+
+        Replace use of QApplication by QGuiApplication where applicable.
+
+        * platform/qt/RenderThemeQt.cpp:
+        (WebCore::RenderThemeQt::RenderThemeQt):
+        (WebCore::RenderThemeQt::platformActiveSelectionBackgroundColor):
+        (WebCore::RenderThemeQt::platformInactiveSelectionBackgroundColor):
+        (WebCore::RenderThemeQt::platformActiveSelectionForegroundColor):
+        (WebCore::RenderThemeQt::platformInactiveSelectionForegroundColor):
+        (WebCore::RenderThemeQt::platformFocusRingColor):
+        (WebCore::RenderThemeQt::systemColor):
+        (WebCore::RenderThemeQt::minimumMenuListSize):
+        (WebCore::RenderThemeQt::getMediaControlForegroundColor):
+        (WebCore::RenderThemeQt::paintMediaVolumeSliderTrack):
+        (WebCore::RenderThemeQt::caretBlinkInterval):
+
 2011-11-14  Jaehoon Jeong  <[email protected]>
 
         [CMAKE] Add the UseV8.cmake to WebCore.

Modified: trunk/Source/WebCore/platform/qt/RenderThemeQt.cpp (100130 => 100131)


--- trunk/Source/WebCore/platform/qt/RenderThemeQt.cpp	2011-11-14 12:58:46 UTC (rev 100130)
+++ trunk/Source/WebCore/platform/qt/RenderThemeQt.cpp	2011-11-14 13:01:03 UTC (rev 100131)
@@ -58,11 +58,14 @@
 #include "TimeRanges.h"
 #include "UserAgentStyleSheets.h"
 
-#include <QApplication>
+#include <QGuiApplication>
 #include <QColor>
 #include <QFile>
 #include <QFontMetrics>
 
+#if QT_VERSION >= 0x050000
+#include <QStyleHints>
+#endif
 
 namespace WebCore {
 
@@ -82,7 +85,7 @@
     : RenderTheme()
     , m_page(page)
 {
-    m_buttonFontFamily = QApplication::font().family();
+    m_buttonFontFamily = QGuiApplication::font().family();
 }
 
 bool RenderThemeQt::useMobileTheme()
@@ -204,35 +207,35 @@
 
 Color RenderThemeQt::platformActiveSelectionBackgroundColor() const
 {
-    QPalette pal = QApplication::palette();
+    QPalette pal = QGuiApplication::palette();
     setPaletteFromPageClientIfExists(pal);
     return pal.brush(QPalette::Active, QPalette::Highlight).color();
 }
 
 Color RenderThemeQt::platformInactiveSelectionBackgroundColor() const
 {
-    QPalette pal = QApplication::palette();
+    QPalette pal = QGuiApplication::palette();
     setPaletteFromPageClientIfExists(pal);
     return pal.brush(QPalette::Inactive, QPalette::Highlight).color();
 }
 
 Color RenderThemeQt::platformActiveSelectionForegroundColor() const
 {
-    QPalette pal = QApplication::palette();
+    QPalette pal = QGuiApplication::palette();
     setPaletteFromPageClientIfExists(pal);
     return pal.brush(QPalette::Active, QPalette::HighlightedText).color();
 }
 
 Color RenderThemeQt::platformInactiveSelectionForegroundColor() const
 {
-    QPalette pal = QApplication::palette();
+    QPalette pal = QGuiApplication::palette();
     setPaletteFromPageClientIfExists(pal);
     return pal.brush(QPalette::Inactive, QPalette::HighlightedText).color();
 }
 
 Color RenderThemeQt::platformFocusRingColor() const
 {
-    QPalette pal = QApplication::palette();
+    QPalette pal = QGuiApplication::palette();
     setPaletteFromPageClientIfExists(pal);
     return pal.brush(QPalette::Active, QPalette::Highlight).color();
 }
@@ -244,7 +247,7 @@
 
 Color RenderThemeQt::systemColor(int cssValueId) const
 {
-    QPalette pal = QApplication::palette();
+    QPalette pal = QGuiApplication::palette();
     setPaletteFromPageClientIfExists(pal);
     switch (cssValueId) {
     case CSSValueButtontext:
@@ -259,7 +262,7 @@
 int RenderThemeQt::minimumMenuListSize(RenderStyle*) const
 {
     // FIXME: Later we need a way to query the UI process for the dpi
-    const QFontMetrics &fm = QApplication::fontMetrics();
+    const QFontMetrics fm(QGuiApplication::font());
     return fm.width(QLatin1Char('x'));
 }
 
@@ -585,7 +588,7 @@
         fgColor = fgColor.lighter();
 
     if (!mediaElementCanPlay(o)) {
-        QPalette pal = QApplication::palette();
+        QPalette pal = QGuiApplication::palette();
         setPaletteFromPageClientIfExists(pal);
         fgColor = pal.brush(QPalette::Disabled, QPalette::Text).color();
     }
@@ -724,7 +727,7 @@
     int height = b.height();
 
     // Get the scale color from the page client
-    QPalette pal = QApplication::palette();
+    QPalette pal = QGuiApplication::palette();
     setPaletteFromPageClientIfExists(pal);
     const QColor highlightText = pal.brush(QPalette::Active, QPalette::HighlightedText).color();
     const QColor scaleColor(highlightText.red(), highlightText.green(), highlightText.blue(), mediaControlsBaselineOpacity() * 255);
@@ -839,7 +842,7 @@
 
 double RenderThemeQt::caretBlinkInterval() const
 {
-    return QApplication::cursorFlashTime() / 1000.0 / 2.0;
+    return static_cast<QGuiApplication*>(qApp)->styleHints()->cursorFlashTime() / 1000.0 / 2.0;
 }
 
 String RenderThemeQt::fileListNameForWidth(const Vector<String>& filenames, const Font& font, int width)
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to