diff options
Diffstat (limited to 'src/plugins')
-rw-r--r-- | src/plugins/platforms/cocoa/cocoa.pro | 2 | ||||
-rw-r--r-- | src/plugins/platforms/cocoa/main.mm | 4 | ||||
-rw-r--r-- | src/plugins/platforms/cocoa/qcocoaintegration.h | 8 | ||||
-rw-r--r-- | src/plugins/platforms/cocoa/qcocoaintegration.mm | 33 | ||||
-rw-r--r-- | src/plugins/platforms/cocoa/qcocoatheme.h | 66 | ||||
-rw-r--r-- | src/plugins/platforms/cocoa/qcocoatheme.mm | 93 | ||||
-rw-r--r-- | src/plugins/platforms/windows/qwindowsdialoghelpers.cpp | 20 | ||||
-rw-r--r-- | src/plugins/platforms/windows/qwindowsdialoghelpers.h | 4 | ||||
-rw-r--r-- | src/plugins/platforms/windows/qwindowsintegration.cpp | 15 | ||||
-rw-r--r-- | src/plugins/platforms/windows/qwindowsintegration.h | 6 | ||||
-rw-r--r-- | src/plugins/platforms/windows/qwindowstheme.cpp | 61 | ||||
-rw-r--r-- | src/plugins/platforms/windows/qwindowstheme.h | 60 | ||||
-rw-r--r-- | src/plugins/platforms/windows/windows.pro | 18 |
13 files changed, 321 insertions, 69 deletions
diff --git a/src/plugins/platforms/cocoa/cocoa.pro b/src/plugins/platforms/cocoa/cocoa.pro index 5531c49e23..3d42b02df6 100644 --- a/src/plugins/platforms/cocoa/cocoa.pro +++ b/src/plugins/platforms/cocoa/cocoa.pro @@ -4,6 +4,7 @@ DESTDIR = $$QT.gui.plugins/platforms OBJECTIVE_SOURCES += main.mm \ qcocoaintegration.mm \ + qcocoatheme.mm \ qcocoabackingstore.mm \ qcocoawindow.mm \ qnsview.mm \ @@ -26,6 +27,7 @@ OBJECTIVE_SOURCES += main.mm \ qcocoacursor.mm \ HEADERS += qcocoaintegration.h \ + qcocoatheme.h \ qcocoabackingstore.h \ qcocoawindow.h \ qnsview.h \ diff --git a/src/plugins/platforms/cocoa/main.mm b/src/plugins/platforms/cocoa/main.mm index 1ef7d622e8..0be6ebd682 100644 --- a/src/plugins/platforms/cocoa/main.mm +++ b/src/plugins/platforms/cocoa/main.mm @@ -42,7 +42,9 @@ #include <Cocoa/Cocoa.h> #include <QtGui/QPlatformIntegrationPlugin> +#include <QtGui/QPlatformThemePlugin> #include "qcocoaintegration.h" +#include "qcocoatheme.h" QT_BEGIN_NAMESPACE @@ -69,6 +71,6 @@ QPlatformIntegration * QCocoaIntegrationPlugin::create(const QString& system, co return 0; } -Q_EXPORT_PLUGIN2(Cocoa, QCocoaIntegrationPlugin) +Q_EXPORT_PLUGIN2(CocoaIntegration, QCocoaIntegrationPlugin) QT_END_NAMESPACE diff --git a/src/plugins/platforms/cocoa/qcocoaintegration.h b/src/plugins/platforms/cocoa/qcocoaintegration.h index 9cba69da3a..5311eaff83 100644 --- a/src/plugins/platforms/cocoa/qcocoaintegration.h +++ b/src/plugins/platforms/cocoa/qcocoaintegration.h @@ -84,20 +84,18 @@ public: QAbstractEventDispatcher *guiThreadEventDispatcher() const; QPlatformFontDatabase *fontDatabase() const; - QPlatformMenu *createPlatformMenu(QMenu *menu = 0) const; - QPlatformMenuBar *createPlatformMenuBar(QMenuBar *menuBar = 0) const; - - bool usePlatformNativeDialog(QDialog *dialog = 0) const; - QPlatformDialogHelper *createPlatformDialogHelper(QDialog *dialog = 0) const; QPlatformNativeInterface *nativeInterface() const; QPlatformAccessibility *accessibility() const; + + QPlatformTheme *platformTheme() const; private: QPlatformFontDatabase *mFontDb; QAbstractEventDispatcher *mEventDispatcher; QCocoaAutoReleasePool *mPool; QPlatformAccessibility *mAccessibility; + QPlatformTheme *mPlatformTheme; }; QT_END_NAMESPACE diff --git a/src/plugins/platforms/cocoa/qcocoaintegration.mm b/src/plugins/platforms/cocoa/qcocoaintegration.mm index b1926eb6e8..f7f8452e5a 100644 --- a/src/plugins/platforms/cocoa/qcocoaintegration.mm +++ b/src/plugins/platforms/cocoa/qcocoaintegration.mm @@ -51,6 +51,7 @@ #include "qcocoaapplicationdelegate.h" #include "qmenu_mac.h" #include "qcocoafiledialoghelper.h" +#include "qcocoatheme.h" #include <QtGui/qplatformaccessibility_qpa.h> #include <QtCore/qcoreapplication.h> @@ -134,6 +135,7 @@ QCocoaIntegration::QCocoaIntegration() } mAccessibility = new QPlatformAccessibility; + mPlatformTheme = new QCocoaTheme; } QCocoaIntegration::~QCocoaIntegration() @@ -179,16 +181,6 @@ QPlatformFontDatabase *QCocoaIntegration::fontDatabase() const return mFontDb; } -QPlatformMenu *QCocoaIntegration::createPlatformMenu(QMenu *menu) const -{ - return new QCocoaMenu(menu); -} - -QPlatformMenuBar *QCocoaIntegration::createPlatformMenuBar(QMenuBar *menuBar) const -{ - return new QCocoaMenuBar(menuBar); -} - QPlatformNativeInterface *QCocoaIntegration::nativeInterface() const { return new QCocoaNativeInterface(); @@ -199,26 +191,9 @@ QPlatformAccessibility *QCocoaIntegration::accessibility() const return mAccessibility; } -bool QCocoaIntegration::usePlatformNativeDialog(QDialog *dialog) const +QPlatformTheme *QCocoaIntegration::platformTheme() const { - Q_UNUSED(dialog); - return true; -#if 0 - QFileDialog *fileDialog = qobject_cast<QFileDialog*>(dialog); - if (fileDialog) { - return true; - } - return false; -#endif -} - -QPlatformDialogHelper * QCocoaIntegration::createPlatformDialogHelper(QDialog *dialog) const -{ - QFileDialog *fileDialog = qobject_cast<QFileDialog*>(dialog); - if (fileDialog) { - return new QCocoaFileDialogHelper(fileDialog); - } - return 0; + return mPlatformTheme; } QT_END_NAMESPACE diff --git a/src/plugins/platforms/cocoa/qcocoatheme.h b/src/plugins/platforms/cocoa/qcocoatheme.h new file mode 100644 index 0000000000..8a7add73a8 --- /dev/null +++ b/src/plugins/platforms/cocoa/qcocoatheme.h @@ -0,0 +1,66 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QPLATFORMTHEME_COCOA_H +#define QPLATFORMTHEME_COCOA_H + +#include <Cocoa/Cocoa.h> + +#include <QtGui/QPlatformTheme> + +QT_BEGIN_NAMESPACE + +class QCocoaTheme : public QPlatformTheme +{ +public: + QCocoaTheme(); + ~QCocoaTheme(); + + QPlatformMenu *createPlatformMenu(QMenu *menu = 0) const; + QPlatformMenuBar *createPlatformMenuBar(QMenuBar *menuBar = 0) const; + + bool usePlatformNativeDialog(const QDialog *dialog = 0) const; + QPlatformDialogHelper *createPlatformDialogHelper(QDialog *dialog = 0) const; +}; + +QT_END_NAMESPACE + +#endif diff --git a/src/plugins/platforms/cocoa/qcocoatheme.mm b/src/plugins/platforms/cocoa/qcocoatheme.mm new file mode 100644 index 0000000000..ef73cc2abe --- /dev/null +++ b/src/plugins/platforms/cocoa/qcocoatheme.mm @@ -0,0 +1,93 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qcocoatheme.h" + +#include "qmenu_mac.h" +#include "qcocoafiledialoghelper.h" +#include <QtWidgets/QFileDialog> + +QT_BEGIN_NAMESPACE + +QCocoaTheme::QCocoaTheme() +{ + +} + +QCocoaTheme::~QCocoaTheme() +{ + +} + +QPlatformMenu *QCocoaTheme::createPlatformMenu(QMenu *menu) const +{ + return new QCocoaMenu(menu); +} + +QPlatformMenuBar *QCocoaTheme::createPlatformMenuBar(QMenuBar *menuBar) const +{ + return new QCocoaMenuBar(menuBar); +} + + +bool QCocoaTheme::usePlatformNativeDialog(const QDialog *dialog) const +{ + Q_UNUSED(dialog); + return true; +#if 0 + QFileDialog *fileDialog = qobject_cast<QFileDialog*>(dialog); + if (fileDialog) { + return true; + } + return false; +#endif +} + +QPlatformDialogHelper * QCocoaTheme::createPlatformDialogHelper(QDialog *dialog) const +{ + QFileDialog *fileDialog = qobject_cast<QFileDialog*>(dialog); + if (fileDialog) { + return new QCocoaFileDialogHelper(fileDialog); + } + return 0; +} + +QT_END_NAMESPACE diff --git a/src/plugins/platforms/windows/qwindowsdialoghelpers.cpp b/src/plugins/platforms/windows/qwindowsdialoghelpers.cpp index 82fbd8c712..bd10efede1 100644 --- a/src/plugins/platforms/windows/qwindowsdialoghelpers.cpp +++ b/src/plugins/platforms/windows/qwindowsdialoghelpers.cpp @@ -1317,16 +1317,18 @@ namespace QWindowsDialogs { // QWindowsDialogHelperBase creation functions bool useHelper(const QDialog *dialog) { - switch (QWindowsDialogs::dialogType(dialog)) { - case QWindowsDialogs::FileDialog: - return true; - case QWindowsDialogs::ColorDialog: + if (dialog) { + switch (QWindowsDialogs::dialogType(dialog)) { + case QWindowsDialogs::FileDialog: + return true; + case QWindowsDialogs::ColorDialog: #ifdef USE_NATIVE_COLOR_DIALOG - return true; + return true; #endif - case QWindowsDialogs::FontDialog: - case QWindowsDialogs::UnknownType: - break; + case QWindowsDialogs::FontDialog: + case QWindowsDialogs::UnknownType: + break; + } } return false; } @@ -1335,6 +1337,8 @@ QPlatformDialogHelper *createHelper(QDialog *dialog) { if (QWindowsContext::verboseDialogs) qDebug("%s %p %s" , __FUNCTION__, dialog, dialog->metaObject()->className()); + if (!dialog) + return 0; switch (QWindowsDialogs::dialogType(dialog)) { case QWindowsDialogs::FileDialog: diff --git a/src/plugins/platforms/windows/qwindowsdialoghelpers.h b/src/plugins/platforms/windows/qwindowsdialoghelpers.h index 99f3c0b2d2..96c03bbaec 100644 --- a/src/plugins/platforms/windows/qwindowsdialoghelpers.h +++ b/src/plugins/platforms/windows/qwindowsdialoghelpers.h @@ -61,8 +61,8 @@ namespace QWindowsDialogs Type dialogType(const QDialog *dialog); void eatMouseMove(); - bool useHelper(const QDialog *dialog); - QPlatformDialogHelper *createHelper(QDialog *dialog); + bool useHelper(const QDialog *dialog = 0); + QPlatformDialogHelper *createHelper(QDialog *dialog = 0); } // namespace QWindowsDialogs template <class BaseClass> diff --git a/src/plugins/platforms/windows/qwindowsintegration.cpp b/src/plugins/platforms/windows/qwindowsintegration.cpp index 4ffbdb7491..cebb17c9c7 100644 --- a/src/plugins/platforms/windows/qwindowsintegration.cpp +++ b/src/plugins/platforms/windows/qwindowsintegration.cpp @@ -45,6 +45,7 @@ #include "qwindowscontext.h" #include "qwindowsglcontext.h" #include "qwindowsscreen.h" +#include "qwindowstheme.h" #ifndef QT_NO_FREETYPE #include "qwindowsfontdatabase_ft.h" #endif @@ -54,7 +55,6 @@ #include "qwindowsdrag.h" #include "qwindowsinputcontext.h" #include "qwindowsaccessibility.h" -#include "qwindowsdialoghelpers.h" #include <QtGui/QPlatformNativeInterface> #include <QtGui/QWindowSystemInterface> @@ -159,6 +159,7 @@ struct QWindowsIntegrationPrivate QOpenGLStaticContextPtr m_staticOpenGLContext; QWindowsInputContext m_inputContext; QWindowsAccessibility m_accessibility; + QWindowsTheme m_theme; }; QWindowsIntegrationPrivate::QWindowsIntegrationPrivate() @@ -322,17 +323,9 @@ QAbstractEventDispatcher * QWindowsIntegration::guiThreadEventDispatcher() const return d->m_eventDispatcher; } -#ifdef QT_WIDGETS_LIB -bool QWindowsIntegration::usePlatformNativeDialog(QDialog *dialog) const +QPlatformTheme *QWindowsIntegration::platformTheme() const { - return QWindowsDialogs::useHelper(dialog); + return &d->m_theme; } -QPlatformDialogHelper *QWindowsIntegration::createPlatformDialogHelper(QDialog *dialog) const -{ - return QWindowsDialogs::createHelper(dialog); -} - -#endif // QT_WIDGETS_LIB - QT_END_NAMESPACE diff --git a/src/plugins/platforms/windows/qwindowsintegration.h b/src/plugins/platforms/windows/qwindowsintegration.h index ad5493015a..1c2a714fcb 100644 --- a/src/plugins/platforms/windows/qwindowsintegration.h +++ b/src/plugins/platforms/windows/qwindowsintegration.h @@ -69,13 +69,9 @@ public: virtual QPlatformAccessibility *accessibility() const; virtual QPlatformNativeInterface *nativeInterface() const; virtual QPlatformFontDatabase *fontDatabase() const; + virtual QPlatformTheme *platformTheme() const; virtual QVariant styleHint(StyleHint hint) const; -#ifdef QT_WIDGETS_LIB - virtual bool usePlatformNativeDialog(QDialog *dialog = 0) const; - virtual QPlatformDialogHelper *createPlatformDialogHelper(QDialog *dialog = 0) const; -#endif // QT_WIDGETS_LIB - static QWindowsIntegration *instance(); private: diff --git a/src/plugins/platforms/windows/qwindowstheme.cpp b/src/plugins/platforms/windows/qwindowstheme.cpp new file mode 100644 index 0000000000..a7001719fe --- /dev/null +++ b/src/plugins/platforms/windows/qwindowstheme.cpp @@ -0,0 +1,61 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qwindowstheme.h" +#include "qwindowsdialoghelpers.h" + +QT_BEGIN_NAMESPACE + +QWindowsTheme::QWindowsTheme() +{ +} + +bool QWindowsTheme::usePlatformNativeDialog(const QDialog *dialog) const +{ + return QWindowsDialogs::useHelper(dialog); +} + +QPlatformDialogHelper *QWindowsTheme::createPlatformDialogHelper(QDialog *dialog) const +{ + return QWindowsDialogs::createHelper(dialog); +} + +QT_END_NAMESPACE diff --git a/src/plugins/platforms/windows/qwindowstheme.h b/src/plugins/platforms/windows/qwindowstheme.h new file mode 100644 index 0000000000..057e30d262 --- /dev/null +++ b/src/plugins/platforms/windows/qwindowstheme.h @@ -0,0 +1,60 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QWINDOWSTHEME_H +#define QWINDOWSTHEME_H + +#include <QtGui/QPlatformTheme> + +QT_BEGIN_NAMESPACE + +class QWindowsTheme : public QPlatformTheme +{ +public: + QWindowsTheme(); + + virtual bool usePlatformNativeDialog(const QDialog *dialog = 0) const; + virtual QPlatformDialogHelper *createPlatformDialogHelper(QDialog *dialog = 0) const; +}; + +QT_END_NAMESPACE + +#endif // QWINDOWSTHEME_H diff --git a/src/plugins/platforms/windows/windows.pro b/src/plugins/platforms/windows/windows.pro index 627df4ab8e..33ca07d134 100644 --- a/src/plugins/platforms/windows/windows.pro +++ b/src/plugins/platforms/windows/windows.pro @@ -4,6 +4,8 @@ load(qt_plugin) QT *= core-private QT *= gui-private QT *= platformsupport-private +# ### fixme: Remove widgets dependencies of dialog helpers +QT *= widgets INCLUDEPATH += ../../../3rdparty/harfbuzz/src QTDIR_build:DESTDIR = $$QT_BUILD_TREE/plugins/platforms @@ -11,6 +13,8 @@ QTDIR_build:DESTDIR = $$QT_BUILD_TREE/plugins/platforms # Note: OpenGL32 must precede Gdi32 as it overwrites some functions. LIBS *= -lOpenGL32 -lGdi32 -lUser32 -lOle32 -lWinspool -lImm32 -lWinmm -lOleaut32 win32-g++: LIBS *= -luuid +# For the dialog helpers: +LIBS *= -lshlwapi -lShell32 contains(QT_CONFIG, directwrite) { LIBS *= -ldwrite @@ -41,7 +45,9 @@ SOURCES += \ qwindowscursor.cpp \ pixmaputils.cpp \ qwindowsinputcontext.cpp \ - qwindowsaccessibility.cpp + qwindowsaccessibility.cpp \ + qwindowstheme.cpp \ + qwindowsdialoghelpers.cpp HEADERS += \ qwindowsnativeimage.h \ @@ -67,13 +73,9 @@ HEADERS += \ pixmaputils.h \ array.h \ qwindowsinputcontext.h \ - qwindowsaccessibility.h - -# Dialog helper: Should be used only if QtWidgets is built -QT *= widgets -HEADERS += qwindowsdialoghelpers.h -SOURCES += qwindowsdialoghelpers.cpp -LIBS += -lshlwapi -lShell32 + qwindowsaccessibility.h \ + qwindowstheme.h \ + qwindowsdialoghelpers.h contains(QT_CONFIG, freetype) { DEFINES *= QT_NO_FONTCONFIG |