make svg stylesheet private

there isn't anymore the "SVG" magic parameter in Theme:: styleSheet()
This commit is contained in:
Marco Martin 2013-03-12 21:44:01 +01:00
parent edb2603012
commit aa3652ec86
4 changed files with 31 additions and 25 deletions

View File

@ -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)) {

View File

@ -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:

View File

@ -20,6 +20,7 @@
#include "svg.h"
#include "private/svg_p.h"
#include "private/theme_p.h"
#include <cmath>
@ -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<QString, SharedSvgRenderer::Ptr>::const_iterator it = s_renderers.constFind(styleCrc + path);

View File

@ -34,6 +34,7 @@ namespace Plasma
{
class ThemePrivate;
class SvgPrivate;
/**
* @class Theme plasma/theme.h <Plasma/Theme>
@ -312,7 +313,7 @@ class PLASMA_EXPORT Theme : public QObject
void themeChanged();
private:
friend class ThemeSingleton;
friend class SvgPrivate;
friend class ThemePrivate;
ThemePrivate *d;
};