Change in plasma-framework[master]: restore hint-apply-color-scheme support
Marco Martin (Code Review)
noreply at kde.org
Wed Jan 28 13:57:50 UTC 2015
Marco Martin has uploaded a new change for review.
https://gerrit.vesnicky.cesnet.cz/r/346
Change subject: restore hint-apply-color-scheme support
......................................................................
restore hint-apply-color-scheme support
make hint-apply-color-scheme work (kiconeffect based coloring),
and make sure the kcolorschemes are reloaded when app palette changes
and the theme follows system colors
BUG:343389
Change-Id: I0a7a7eb0f89ed0948e618f1d608521f235aa1959
---
M src/plasma/CMakeLists.txt
M src/plasma/svg.cpp
2 files changed, 24 insertions(+), 1 deletion(-)
git pull ssh://gerrit.vesnicky.cesnet.cz:29418/plasma-framework refs/changes/46/346/1
diff --git a/src/plasma/CMakeLists.txt b/src/plasma/CMakeLists.txt
index 160d09b..1cc9ae3 100644
--- a/src/plasma/CMakeLists.txt
+++ b/src/plasma/CMakeLists.txt
@@ -125,6 +125,7 @@
KF5::XmlGui #KActionCollection
KF5::GlobalAccel #Applet::setGlobalShortcut
KF5::Notifications
+ KF5::IconThemes
${PLASMA_EXTRA_LIBS}
)
diff --git a/src/plasma/svg.cpp b/src/plasma/svg.cpp
index 3e609a5..28393e5 100644
--- a/src/plasma/svg.cpp
+++ b/src/plasma/svg.cpp
@@ -35,6 +35,7 @@
#include <kconfiggroup.h>
#include <QDebug>
#include <kfilterdev.h>
+#include <kiconeffect.h>
#include "applet.h"
#include "package.h"
@@ -382,6 +383,13 @@
renderPainter.end();
+ // Apply current color scheme if the svg asks for it
+ if (applyColors) {
+ QImage itmp = p.toImage();
+ KIconEffect::colorize(itmp, cacheAndColorsTheme()->color(Theme::BackgroundColor), 1.0);
+ p = p.fromImage(itmp);
+ }
+
if (cacheRendering) {
cacheAndColorsTheme()->insertIntoCache(id, p, QString::number((qint64)q, 16) % QLSEP % actualElementId);
}
@@ -550,7 +558,10 @@
void SvgPrivate::checkColorHints()
{
- if (elementRect("current-color-scheme").isValid()) {
+ if (elementRect("hint-apply-color-scheme").isValid()) {
+ applyColors = true;
+ usesColors = true;
+ } else if (elementRect("current-color-scheme").isValid()) {
applyColors = false;
usesColors = true;
} else {
@@ -658,6 +669,17 @@
eraseRenderer();
//qDebug() << "repaint needed from colorsChanged";
+
+ // in the case the theme follows the desktop settings, refetch the colorschemes
+ // and discard the svg pixmap cache
+ if (!theme.data()->d->colors) {
+ KSharedConfig::openConfig()->reparseConfiguration();
+ theme.data()->d->colorScheme = KColorScheme(QPalette::Active, KColorScheme::Window);
+ theme.data()->d->buttonColorScheme = KColorScheme(QPalette::Active, KColorScheme::Button);
+ theme.data()->d->viewColorScheme = KColorScheme(QPalette::Active, KColorScheme::View);
+ theme.data()->d->discardCache(PixmapCache | SvgElementsCache);
+ }
+
emit q->repaintNeeded();
}
--
To view, visit https://gerrit.vesnicky.cesnet.cz/r/346
To unsubscribe, visit https://gerrit.vesnicky.cesnet.cz/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I0a7a7eb0f89ed0948e618f1d608521f235aa1959
Gerrit-PatchSet: 1
Gerrit-Project: plasma-framework
Gerrit-Branch: master
Gerrit-Owner: Marco Martin <notmart at gmail.com>
More information about the Plasma-devel
mailing list