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
This commit is contained in:
parent
15547cd885
commit
0ca29bc0f2
@ -86,6 +86,7 @@ X-KDE-PluginInfo-Category=
|
||||
X-KDE-PluginInfo-Depends=
|
||||
X-KDE-PluginInfo-License=GPL
|
||||
X-KDE-PluginInfo-EnabledByDefault=true
|
||||
X-Plasma-API=5.0
|
||||
|
||||
[Wallpaper]
|
||||
defaultWallpaperTheme=Elarun
|
||||
|
@ -41,6 +41,7 @@ X-KDE-PluginInfo-Category=
|
||||
X-KDE-PluginInfo-Depends=
|
||||
X-KDE-PluginInfo-License=LGPL
|
||||
X-KDE-PluginInfo-EnabledByDefault=true
|
||||
X-Plasma-API=5.0
|
||||
|
||||
[Wallpaper]
|
||||
defaultWallpaperTheme=Next
|
||||
|
@ -43,6 +43,7 @@ X-KDE-PluginInfo-Category=
|
||||
X-KDE-PluginInfo-Depends=
|
||||
X-KDE-PluginInfo-License=LGPL
|
||||
X-KDE-PluginInfo-EnabledByDefault=true
|
||||
X-Plasma-API=5.0
|
||||
|
||||
[Wallpaper]
|
||||
defaultWallpaperTheme=Next
|
||||
|
@ -82,6 +82,7 @@ X-KDE-PluginInfo-Category=
|
||||
X-KDE-PluginInfo-Depends=
|
||||
X-KDE-PluginInfo-License=GPL
|
||||
X-KDE-PluginInfo-EnabledByDefault=true
|
||||
X-Plasma-API=5.0
|
||||
|
||||
[Wallpaper]
|
||||
defaultWallpaperTheme=Elarun
|
||||
|
@ -66,7 +66,10 @@ ThemePrivate::ThemePrivate(QObject *parent)
|
||||
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 @@ QColor ThemePrivate::color(Theme::ColorRole role, Theme::ColorGroup group) const
|
||||
{
|
||||
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,26 @@ void ThemePrivate::setThemeName(const QString &tempThemeName, bool writeSettings
|
||||
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", QString());
|
||||
apiMajor = 1;
|
||||
apiMinor = 0;
|
||||
apiRevision = 0;
|
||||
if (!apiVersion.isEmpty()) {
|
||||
QStringList parts = apiVersion.split('.');
|
||||
if (!parts.isEmpty()) {
|
||||
apiMajor = parts.value(0).toInt();
|
||||
}
|
||||
if (parts.count() > 1) {
|
||||
apiMinor = parts.value(1).toInt();
|
||||
}
|
||||
if (parts.count() > 2) {
|
||||
apiRevision = parts.value(2).toInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (realTheme && isDefault && writeSettings) {
|
||||
|
@ -153,6 +153,11 @@ public:
|
||||
qreal backgroundIntensity;
|
||||
qreal backgroundSaturation;
|
||||
bool backgroundContrastEnabled;
|
||||
|
||||
//Version number of Plasma the Theme has been designed for
|
||||
int apiMajor;
|
||||
int apiMinor;
|
||||
int apiRevision;
|
||||
};
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user