Change in plasma-framework[master]: export a plasma version number in themes
Marco Martin (Code Review)
noreply at kde.org
Tue Dec 2 13:25:45 UTC 2014
Marco Martin has uploaded a new change for review.
https://gerrit.vesnicky.cesnet.cz/r/195
Change subject: export a plasma version number in themes
......................................................................
export a plasma version number in themes
some of the behavior of the theme has changed.
this makes some of the old themes to not work correctly
(like black text on black)
read a version number of the "plasma version this theme has been intended for"
and use it to change the behavior for retrocompatibility
(all themes that don't export this are assumed to be from KDE4)
Change-Id: I4bc20a0c10de9f9a6c3facd63b6c5b6da210039a
---
M src/desktoptheme/air/metadata.desktop
M src/desktoptheme/breeze-dark/metadata.desktop
M src/desktoptheme/breeze/metadata.desktop
M src/desktoptheme/oxygen/metadata.desktop
M src/plasma/private/theme_p.cpp
M src/plasma/private/theme_p.h
6 files changed, 30 insertions(+), 1 deletion(-)
git pull ssh://gerrit.vesnicky.cesnet.cz:29418/plasma-framework refs/changes/95/195/1
diff --git a/src/desktoptheme/air/metadata.desktop b/src/desktoptheme/air/metadata.desktop
index a297bb9..c12fde3 100644
--- a/src/desktoptheme/air/metadata.desktop
+++ b/src/desktoptheme/air/metadata.desktop
@@ -86,6 +86,7 @@
X-KDE-PluginInfo-Depends=
X-KDE-PluginInfo-License=GPL
X-KDE-PluginInfo-EnabledByDefault=true
+X-Plasma-API=5.0
[Wallpaper]
defaultWallpaperTheme=Elarun
diff --git a/src/desktoptheme/breeze-dark/metadata.desktop b/src/desktoptheme/breeze-dark/metadata.desktop
index 9b4d611..52c0041 100644
--- a/src/desktoptheme/breeze-dark/metadata.desktop
+++ b/src/desktoptheme/breeze-dark/metadata.desktop
@@ -41,6 +41,7 @@
X-KDE-PluginInfo-Depends=
X-KDE-PluginInfo-License=LGPL
X-KDE-PluginInfo-EnabledByDefault=true
+X-Plasma-API=5.0
[Wallpaper]
defaultWallpaperTheme=Next
diff --git a/src/desktoptheme/breeze/metadata.desktop b/src/desktoptheme/breeze/metadata.desktop
index ddff6a5..cb15ee8 100644
--- a/src/desktoptheme/breeze/metadata.desktop
+++ b/src/desktoptheme/breeze/metadata.desktop
@@ -43,6 +43,7 @@
X-KDE-PluginInfo-Depends=
X-KDE-PluginInfo-License=LGPL
X-KDE-PluginInfo-EnabledByDefault=true
+X-Plasma-API=5.0
[Wallpaper]
defaultWallpaperTheme=Next
diff --git a/src/desktoptheme/oxygen/metadata.desktop b/src/desktoptheme/oxygen/metadata.desktop
index a1a0c51..96592c1 100644
--- a/src/desktoptheme/oxygen/metadata.desktop
+++ b/src/desktoptheme/oxygen/metadata.desktop
@@ -82,6 +82,7 @@
X-KDE-PluginInfo-Depends=
X-KDE-PluginInfo-License=GPL
X-KDE-PluginInfo-EnabledByDefault=true
+X-Plasma-API=5.0
[Wallpaper]
defaultWallpaperTheme=Elarun
diff --git a/src/plasma/private/theme_p.cpp b/src/plasma/private/theme_p.cpp
index ccd9f91..61cf797 100644
--- a/src/plasma/private/theme_p.cpp
+++ b/src/plasma/private/theme_p.cpp
@@ -66,7 +66,10 @@
useGlobal(true),
hasWallpapers(false),
fixedName(false),
- backgroundContrastEnabled(true)
+ backgroundContrastEnabled(true),
+ apiMajor(1),
+ apiMinor(0),
+ apiRevision(0)
{
ThemeConfig config;
cacheTheme = config.cacheTheme();
@@ -532,6 +535,13 @@
{
const KColorScheme *scheme = 0;
+ //Before 5.0 Plasma theme really only used Normal and Button
+ //many old themes are built on this assumption and will break
+ //otherwise
+ if (apiMajor < 5 && group != Theme::NormalColorGroup) {
+ group = Theme::ButtonColorGroup;
+ }
+
switch (group) {
case Theme::ButtonColorGroup: {
scheme = &buttonColorScheme;
@@ -796,6 +806,16 @@
KConfig metadata(metadataPath);
processWallpaperSettings(&metadata);
}
+
+ //Check for what Plasma version the theme has been done
+ //There are some behavioral differences between KDE4 Plasma and Plasma 5
+ cg = KConfigGroup(&metadata, "Desktop Entry");
+ const QString apiVersion = cg.readEntry("X-Plasma-API", "1.0");
+ QRegExp exp("(\\d+)\\.{0,1}(\\d*)\\.{0,1}(\\d*)");
+ exp.indexIn(apiVersion);
+ apiMajor = exp.cap(1).toInt();
+ apiMinor = exp.cap(2).toInt();
+ apiRevision = exp.cap(3).toInt();
}
if (realTheme && isDefault && writeSettings) {
diff --git a/src/plasma/private/theme_p.h b/src/plasma/private/theme_p.h
index 309b555..96e98ed 100644
--- a/src/plasma/private/theme_p.h
+++ b/src/plasma/private/theme_p.h
@@ -153,6 +153,11 @@
qreal backgroundIntensity;
qreal backgroundSaturation;
bool backgroundContrastEnabled;
+
+ //Version number of Plasma the Theme has been designed for
+ int apiMajor;
+ int apiMinor;
+ int apiRevision;
};
}
--
To view, visit https://gerrit.vesnicky.cesnet.cz/r/195
To unsubscribe, visit https://gerrit.vesnicky.cesnet.cz/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I4bc20a0c10de9f9a6c3facd63b6c5b6da210039a
Gerrit-PatchSet: 1
Gerrit-Project: plasma-framework
Gerrit-Branch: master
Gerrit-Owner: Marco Martin <notmart at gmail.com>
Gerrit-Reviewer: Sebastian Kügler <sebas at kde.org>
More information about the Plasma-devel
mailing list