From aa3652ec868447f0ac156d0b2d849bb3f92f944d Mon Sep 17 00:00:00 2001 From: Marco Martin Date: Tue, 12 Mar 2013 21:44:01 +0100 Subject: [PATCH] make svg stylesheet private there isn't anymore the "SVG" magic parameter in Theme:: styleSheet() --- src/plasma/private/theme_p.cpp | 49 ++++++++++++++++++---------------- src/plasma/private/theme_p.h | 1 + src/plasma/svg.cpp | 3 ++- src/plasma/theme.h | 3 ++- 4 files changed, 31 insertions(+), 25 deletions(-) diff --git a/src/plasma/private/theme_p.cpp b/src/plasma/private/theme_p.cpp index f171abc6d..77e7e0c66 100644 --- a/src/plasma/private/theme_p.cpp +++ b/src/plasma/private/theme_p.cpp @@ -289,29 +289,6 @@ const QString ThemePrivate::processStyleSheet(const QString &css) cachedStyleSheets.insert(DEFAULTSTYLE, stylesheet); } - return stylesheet; - } else if (css == "SVG") { - stylesheet = cachedStyleSheets.value(SVGSTYLE); - if (stylesheet.isEmpty()) { - QString skel = ".ColorScheme-%1{color:%2;}"; - - stylesheet += skel.arg("Text","%textcolor"); - stylesheet += skel.arg("Background","%backgroundcolor"); - - stylesheet += skel.arg("ButtonText","%buttontextcolor"); - stylesheet += skel.arg("ButtonBackground","%buttonbackgroundcolor"); - stylesheet += skel.arg("ButtonHover","%buttonhovercolor"); - stylesheet += skel.arg("ButtonFocus","%buttonfocuscolor"); - - stylesheet += skel.arg("ViewText","%viewtextcolor"); - stylesheet += skel.arg("ViewBackground","%viewbackgroundcolor"); - stylesheet += skel.arg("ViewHover","%viewhovercolor"); - stylesheet += skel.arg("ViewFocus","%viewfocuscolor"); - - stylesheet = processStyleSheet(stylesheet); - cachedStyleSheets.insert(SVGSTYLE, stylesheet); - } - return stylesheet; } else { stylesheet = css; @@ -348,6 +325,32 @@ const QString ThemePrivate::processStyleSheet(const QString &css) return stylesheet; } +const QString ThemePrivate::svgStyleSheet() +{ + QString stylesheet = cachedStyleSheets.value(SVGSTYLE); + if (stylesheet.isEmpty()) { + QString skel = ".ColorScheme-%1{color:%2;}"; + + stylesheet += skel.arg("Text","%textcolor"); + stylesheet += skel.arg("Background","%backgroundcolor"); + + stylesheet += skel.arg("ButtonText","%buttontextcolor"); + stylesheet += skel.arg("ButtonBackground","%buttonbackgroundcolor"); + stylesheet += skel.arg("ButtonHover","%buttonhovercolor"); + stylesheet += skel.arg("ButtonFocus","%buttonfocuscolor"); + + stylesheet += skel.arg("ViewText","%viewtextcolor"); + stylesheet += skel.arg("ViewBackground","%viewbackgroundcolor"); + stylesheet += skel.arg("ViewHover","%viewhovercolor"); + stylesheet += skel.arg("ViewFocus","%viewfocuscolor"); + + stylesheet = processStyleSheet(stylesheet); + cachedStyleSheets.insert(SVGSTYLE, stylesheet); + } + + return stylesheet; +} + void ThemePrivate::settingsFileChanged(const QString &file) { if (file.endsWith(themeRcFile)) { diff --git a/src/plasma/private/theme_p.h b/src/plasma/private/theme_p.h index aaf040bcf..c3e7f4e5d 100644 --- a/src/plasma/private/theme_p.h +++ b/src/plasma/private/theme_p.h @@ -78,6 +78,7 @@ public: void processWallpaperSettings(KConfigBase *metadata); const QString processStyleSheet(const QString &css); + const QString svgStyleSheet(); QColor color(Theme::ColorRole role) const; public Q_SLOTS: diff --git a/src/plasma/svg.cpp b/src/plasma/svg.cpp index dc61937a7..9af75c119 100644 --- a/src/plasma/svg.cpp +++ b/src/plasma/svg.cpp @@ -20,6 +20,7 @@ #include "svg.h" #include "private/svg_p.h" +#include "private/theme_p.h" #include @@ -413,7 +414,7 @@ void SvgPrivate::createRenderer() //kDebug() << "FAIL! **************************"; //kDebug() << path << "**"; - QString styleSheet = cacheAndColorsTheme()->styleSheet("SVG"); + QString styleSheet = cacheAndColorsTheme()->d->svgStyleSheet(); styleCrc = qChecksum(styleSheet.toUtf8(), styleSheet.size()); QHash::const_iterator it = s_renderers.constFind(styleCrc + path); diff --git a/src/plasma/theme.h b/src/plasma/theme.h index e1c294d2b..0f1cf9dd5 100644 --- a/src/plasma/theme.h +++ b/src/plasma/theme.h @@ -34,6 +34,7 @@ namespace Plasma { class ThemePrivate; +class SvgPrivate; /** * @class Theme plasma/theme.h @@ -312,7 +313,7 @@ class PLASMA_EXPORT Theme : public QObject void themeChanged(); private: - friend class ThemeSingleton; + friend class SvgPrivate; friend class ThemePrivate; ThemePrivate *d; };