no longer uses plasmarc for the presence or not of those hints but uses

the usual theme specific file.
and expires the cache when system color changes and a tinting is
required.
for some reasons a plasma restart is still required to get colors
applied correctly, some renderer doesn't get properly deleted on theme
change?

svn path=/trunk/KDE/kdelibs/; revision=885241
This commit is contained in:
Marco Martin 2008-11-16 20:53:24 +00:00
parent 34ab711509
commit 5a987e0a0b
3 changed files with 18 additions and 6 deletions

12
svg.cpp
View File

@ -276,14 +276,14 @@ class SvgPrivate
void checkApplyColorHint()
{
KConfigGroup cg(KGlobal::config(), "SvgHints");
QString cgKey = themePath + "-hint-apply-color-scheme";
if (cg.hasKey(cgKey)) {
applyColors = cg.readEntry(cgKey, false);
QRectF elementRect;
bool found = Theme::defaultTheme()->findInRectsCache(themePath, cacheId("hint-apply-color-scheme"), elementRect);
if (found) {
applyColors = elementRect.isValid();
} else {
createRenderer();
findAndCacheElementRect("hint-apply-color-scheme");
applyColors = renderer->elementExists("hint-apply-color-scheme");
cg.writeEntry(cgKey, applyColors);
}
}

View File

@ -102,6 +102,7 @@ public:
QString findInTheme(const QString &image, const QString &theme) const;
void compositingChanged();
void discardCache();
static const char *defaultTheme;
static PackageStructure::Ptr packageStructure;
@ -169,6 +170,11 @@ void ThemePrivate::compositingChanged()
#endif
}
void ThemePrivate::discardCache()
{
pixmapCache->discard();
}
class ThemeSingleton
{
public:
@ -286,10 +292,15 @@ void Theme::setThemeName(const QString &themeName)
disconnect(KGlobalSettings::self(), SIGNAL(kdisplayPaletteChanged()),
this, SIGNAL(themeChanged()));
disconnect(KGlobalSettings::self(), SIGNAL(kdisplayPaletteChanged()),
this, SLOT(discardCache()));
if (colorsFile.isEmpty()) {
d->colors = 0;
connect(KGlobalSettings::self(), SIGNAL(kdisplayPaletteChanged()),
this, SIGNAL(themeChanged()));
connect(KGlobalSettings::self(), SIGNAL(kdisplayPaletteChanged()),
this, SLOT(discardCache()));
} else {
d->colors = KSharedConfig::openConfig(colorsFile);
}

View File

@ -247,6 +247,7 @@ class PLASMA_EXPORT Theme : public QObject
ThemePrivate *const d;
Q_PRIVATE_SLOT(d, void compositingChanged())
Q_PRIVATE_SLOT(d, void discardCache())
};
} // Plasma namespace