From dd0cc2464d63935737da6d8f07f99f69982143b3 Mon Sep 17 00:00:00 2001 From: Marco Martin Date: Tue, 12 Mar 2013 16:49:33 +0100 Subject: [PATCH] ThmemeProxy is a subclass of Theme --- src/declarativeimports/core/theme.cpp | 41 +++++++++++++-------------- src/declarativeimports/core/theme.h | 3 +- 2 files changed, 21 insertions(+), 23 deletions(-) diff --git a/src/declarativeimports/core/theme.cpp b/src/declarativeimports/core/theme.cpp index 0dc6f43a7..94a39933a 100644 --- a/src/declarativeimports/core/theme.cpp +++ b/src/declarativeimports/core/theme.cpp @@ -30,7 +30,7 @@ //********** Theme ************* ThemeProxy::ThemeProxy(QObject *parent) - : QObject(parent) + : Plasma::Theme(parent) { m_defaultIconSize = KIconLoader::global()->currentSize(KIconLoader::Desktop); @@ -41,8 +41,7 @@ ThemeProxy::ThemeProxy(QObject *parent) m_iconSizes->insert("small", KIconLoader::global()->currentSize(KIconLoader::Small)); m_iconSizes->insert("dialog", KIconLoader::global()->currentSize(KIconLoader::Dialog)); - m_theme = new Plasma::Theme(this); - connect(m_theme, SIGNAL(themeChanged()), this, SIGNAL(themeChanged())); + connect(this, &Plasma::Theme::themeChanged, this, &ThemeProxy::themeChanged); connect(KIconLoader::global(), SIGNAL(iconLoaderSettingsChanged()), this, SLOT(iconLoaderSettingsChanged())); connect(KGlobalSettings::self(), &KGlobalSettings::kdisplayFontChanged, this, &ThemeProxy::defaultFontChanged); @@ -55,7 +54,7 @@ ThemeProxy::~ThemeProxy() QString ThemeProxy::themeName() const { - return m_theme->themeName(); + return Plasma::Theme::themeName(); } QFont ThemeProxy::defaultFont() const @@ -76,87 +75,87 @@ QSizeF ThemeProxy::mSize(const QFont &font) const bool ThemeProxy::useGlobalSettings() const { - return m_theme->useGlobalSettings(); + return Plasma::Theme::useGlobalSettings(); } QString ThemeProxy::wallpaperPath() const { - return m_theme->wallpaperPath(); + return Plasma::Theme::wallpaperPath(); } QString ThemeProxy::wallpaperPathForSize(int width, int height) const { - return m_theme->wallpaperPath(QSize(width, height)); + return Plasma::Theme::wallpaperPath(QSize(width, height)); } QColor ThemeProxy::textColor() const { - return m_theme->color(Plasma::Theme::TextColor); + return Plasma::Theme::color(Plasma::Theme::TextColor); } QColor ThemeProxy::highlightColor() const { - return m_theme->color(Plasma::Theme::HighlightColor); + return Plasma::Theme::color(Plasma::Theme::HighlightColor); } QColor ThemeProxy::backgroundColor() const { - return m_theme->color(Plasma::Theme::BackgroundColor); + return Plasma::Theme::color(Plasma::Theme::BackgroundColor); } QColor ThemeProxy::buttonTextColor() const { - return m_theme->color(Plasma::Theme::ButtonTextColor); + return Plasma::Theme::color(Plasma::Theme::ButtonTextColor); } QColor ThemeProxy::buttonBackgroundColor() const { - return m_theme->color(Plasma::Theme::ButtonBackgroundColor); + return Plasma::Theme::color(Plasma::Theme::ButtonBackgroundColor); } QColor ThemeProxy::linkColor() const { - return m_theme->color(Plasma::Theme::LinkColor); + return Plasma::Theme::color(Plasma::Theme::LinkColor); } QColor ThemeProxy::visitedLinkColor() const { - return m_theme->color(Plasma::Theme::VisitedLinkColor); + return Plasma::Theme::color(Plasma::Theme::VisitedLinkColor); } QColor ThemeProxy::buttonHoverColor() const { - return m_theme->color(Plasma::Theme::ButtonHoverColor); + return Plasma::Theme::color(Plasma::Theme::ButtonHoverColor); } QColor ThemeProxy::buttonFocusColor() const { - return m_theme->color(Plasma::Theme::ButtonFocusColor); + return Plasma::Theme::color(Plasma::Theme::ButtonFocusColor); } QColor ThemeProxy::viewTextColor() const { - return m_theme->color(Plasma::Theme::ViewTextColor); + return Plasma::Theme::color(Plasma::Theme::ViewTextColor); } QColor ThemeProxy::viewBackgroundColor() const { - return m_theme->color(Plasma::Theme::ViewBackgroundColor); + return Plasma::Theme::color(Plasma::Theme::ViewBackgroundColor); } QColor ThemeProxy::viewHoverColor() const { - return m_theme->color(Plasma::Theme::ViewHoverColor); + return Plasma::Theme::color(Plasma::Theme::ViewHoverColor); } QColor ThemeProxy::viewFocusColor() const { - return m_theme->color(Plasma::Theme::ViewFocusColor); + return Plasma::Theme::color(Plasma::Theme::ViewFocusColor); } QString ThemeProxy::styleSheet() const { - return m_theme->styleSheet(QString()); + return Plasma::Theme::styleSheet(QString()); } int ThemeProxy::smallIconSize() const diff --git a/src/declarativeimports/core/theme.h b/src/declarativeimports/core/theme.h index b25f76eac..281183287 100644 --- a/src/declarativeimports/core/theme.h +++ b/src/declarativeimports/core/theme.h @@ -35,7 +35,7 @@ class QQmlPropertyMap; * * Exposed as `Theme` in QML. */ -class ThemeProxy : public QObject +class ThemeProxy : public Plasma::Theme { Q_OBJECT @@ -137,7 +137,6 @@ Q_SIGNALS: private: int m_defaultIconSize; QQmlPropertyMap *m_iconSizes; - Plasma::Theme *m_theme; }; #endif