ThmemeProxy is a subclass of Theme

This commit is contained in:
Marco Martin 2013-03-12 16:49:33 +01:00
parent fd97160327
commit dd0cc2464d
2 changed files with 21 additions and 23 deletions

View File

@ -30,7 +30,7 @@
//********** Theme ************* //********** Theme *************
ThemeProxy::ThemeProxy(QObject *parent) ThemeProxy::ThemeProxy(QObject *parent)
: QObject(parent) : Plasma::Theme(parent)
{ {
m_defaultIconSize = KIconLoader::global()->currentSize(KIconLoader::Desktop); 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("small", KIconLoader::global()->currentSize(KIconLoader::Small));
m_iconSizes->insert("dialog", KIconLoader::global()->currentSize(KIconLoader::Dialog)); m_iconSizes->insert("dialog", KIconLoader::global()->currentSize(KIconLoader::Dialog));
m_theme = new Plasma::Theme(this); connect(this, &Plasma::Theme::themeChanged, this, &ThemeProxy::themeChanged);
connect(m_theme, SIGNAL(themeChanged()), this, SIGNAL(themeChanged()));
connect(KIconLoader::global(), SIGNAL(iconLoaderSettingsChanged()), this, SLOT(iconLoaderSettingsChanged())); connect(KIconLoader::global(), SIGNAL(iconLoaderSettingsChanged()), this, SLOT(iconLoaderSettingsChanged()));
connect(KGlobalSettings::self(), &KGlobalSettings::kdisplayFontChanged, this, &ThemeProxy::defaultFontChanged); connect(KGlobalSettings::self(), &KGlobalSettings::kdisplayFontChanged, this, &ThemeProxy::defaultFontChanged);
@ -55,7 +54,7 @@ ThemeProxy::~ThemeProxy()
QString ThemeProxy::themeName() const QString ThemeProxy::themeName() const
{ {
return m_theme->themeName(); return Plasma::Theme::themeName();
} }
QFont ThemeProxy::defaultFont() const QFont ThemeProxy::defaultFont() const
@ -76,87 +75,87 @@ QSizeF ThemeProxy::mSize(const QFont &font) const
bool ThemeProxy::useGlobalSettings() const bool ThemeProxy::useGlobalSettings() const
{ {
return m_theme->useGlobalSettings(); return Plasma::Theme::useGlobalSettings();
} }
QString ThemeProxy::wallpaperPath() const QString ThemeProxy::wallpaperPath() const
{ {
return m_theme->wallpaperPath(); return Plasma::Theme::wallpaperPath();
} }
QString ThemeProxy::wallpaperPathForSize(int width, int height) const 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 QColor ThemeProxy::textColor() const
{ {
return m_theme->color(Plasma::Theme::TextColor); return Plasma::Theme::color(Plasma::Theme::TextColor);
} }
QColor ThemeProxy::highlightColor() const QColor ThemeProxy::highlightColor() const
{ {
return m_theme->color(Plasma::Theme::HighlightColor); return Plasma::Theme::color(Plasma::Theme::HighlightColor);
} }
QColor ThemeProxy::backgroundColor() const QColor ThemeProxy::backgroundColor() const
{ {
return m_theme->color(Plasma::Theme::BackgroundColor); return Plasma::Theme::color(Plasma::Theme::BackgroundColor);
} }
QColor ThemeProxy::buttonTextColor() const QColor ThemeProxy::buttonTextColor() const
{ {
return m_theme->color(Plasma::Theme::ButtonTextColor); return Plasma::Theme::color(Plasma::Theme::ButtonTextColor);
} }
QColor ThemeProxy::buttonBackgroundColor() const QColor ThemeProxy::buttonBackgroundColor() const
{ {
return m_theme->color(Plasma::Theme::ButtonBackgroundColor); return Plasma::Theme::color(Plasma::Theme::ButtonBackgroundColor);
} }
QColor ThemeProxy::linkColor() const QColor ThemeProxy::linkColor() const
{ {
return m_theme->color(Plasma::Theme::LinkColor); return Plasma::Theme::color(Plasma::Theme::LinkColor);
} }
QColor ThemeProxy::visitedLinkColor() const QColor ThemeProxy::visitedLinkColor() const
{ {
return m_theme->color(Plasma::Theme::VisitedLinkColor); return Plasma::Theme::color(Plasma::Theme::VisitedLinkColor);
} }
QColor ThemeProxy::buttonHoverColor() const QColor ThemeProxy::buttonHoverColor() const
{ {
return m_theme->color(Plasma::Theme::ButtonHoverColor); return Plasma::Theme::color(Plasma::Theme::ButtonHoverColor);
} }
QColor ThemeProxy::buttonFocusColor() const QColor ThemeProxy::buttonFocusColor() const
{ {
return m_theme->color(Plasma::Theme::ButtonFocusColor); return Plasma::Theme::color(Plasma::Theme::ButtonFocusColor);
} }
QColor ThemeProxy::viewTextColor() const QColor ThemeProxy::viewTextColor() const
{ {
return m_theme->color(Plasma::Theme::ViewTextColor); return Plasma::Theme::color(Plasma::Theme::ViewTextColor);
} }
QColor ThemeProxy::viewBackgroundColor() const QColor ThemeProxy::viewBackgroundColor() const
{ {
return m_theme->color(Plasma::Theme::ViewBackgroundColor); return Plasma::Theme::color(Plasma::Theme::ViewBackgroundColor);
} }
QColor ThemeProxy::viewHoverColor() const QColor ThemeProxy::viewHoverColor() const
{ {
return m_theme->color(Plasma::Theme::ViewHoverColor); return Plasma::Theme::color(Plasma::Theme::ViewHoverColor);
} }
QColor ThemeProxy::viewFocusColor() const QColor ThemeProxy::viewFocusColor() const
{ {
return m_theme->color(Plasma::Theme::ViewFocusColor); return Plasma::Theme::color(Plasma::Theme::ViewFocusColor);
} }
QString ThemeProxy::styleSheet() const QString ThemeProxy::styleSheet() const
{ {
return m_theme->styleSheet(QString()); return Plasma::Theme::styleSheet(QString());
} }
int ThemeProxy::smallIconSize() const int ThemeProxy::smallIconSize() const

View File

@ -35,7 +35,7 @@ class QQmlPropertyMap;
* *
* Exposed as `Theme` in QML. * Exposed as `Theme` in QML.
*/ */
class ThemeProxy : public QObject class ThemeProxy : public Plasma::Theme
{ {
Q_OBJECT Q_OBJECT
@ -137,7 +137,6 @@ Q_SIGNALS:
private: private:
int m_defaultIconSize; int m_defaultIconSize;
QQmlPropertyMap *m_iconSizes; QQmlPropertyMap *m_iconSizes;
Plasma::Theme *m_theme;
}; };
#endif #endif