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
This commit is contained in:
parent
993cdb54a6
commit
bdda85a40d
@ -125,6 +125,7 @@ PRIVATE
|
||||
KF5::XmlGui #KActionCollection
|
||||
KF5::GlobalAccel #Applet::setGlobalShortcut
|
||||
KF5::Notifications
|
||||
KF5::IconThemes
|
||||
${PLASMA_EXTRA_LIBS}
|
||||
)
|
||||
|
||||
|
@ -346,6 +346,11 @@ void ThemePrivate::scheduledCacheUpdate()
|
||||
|
||||
void ThemePrivate::colorsChanged()
|
||||
{
|
||||
// in the case the theme follows the desktop settings, refetch the colorschemes
|
||||
// and discard the svg pixmap cache
|
||||
if (!colors) {
|
||||
KSharedConfig::openConfig()->reparseConfiguration();
|
||||
}
|
||||
colorScheme = KColorScheme(QPalette::Active, KColorScheme::Window, colors);
|
||||
buttonColorScheme = KColorScheme(QPalette::Active, KColorScheme::Button, colors);
|
||||
viewColorScheme = KColorScheme(QPalette::Active, KColorScheme::View, colors);
|
||||
|
@ -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 @@ QPixmap SvgPrivate::findInCache(const QString &elementId, const QSizeF &s)
|
||||
|
||||
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 @@ QMatrix SvgPrivate::matrixForElement(const QString &elementId)
|
||||
|
||||
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 {
|
||||
|
Loading…
x
Reference in New Issue
Block a user