[kdecoration] Try falling back to default plugin and Aurorae
If the configured decoration plugin fails to load, we try to load the default decoration plugin. If that also fails to load, we try to load Aurorae, which is shipped with KWin, so the chances are higher that it is available. Also the checks in Aurorae are improved to fall back to the Plastik theme if the selected SVG theme is not available. BUG: 341014 FIXED-IN: 5.2.0 REVIEW: 121859
This commit is contained in:
parent
fcd8cf3ada
commit
c4fb3cd55d
2 changed files with 18 additions and 2 deletions
|
@ -139,7 +139,10 @@ QQmlComponent *Helper::component(const QString &themeName)
|
||||||
m_svgComponent.reset(new QQmlComponent(m_engine.data()));
|
m_svgComponent.reset(new QQmlComponent(m_engine.data()));
|
||||||
m_svgComponent->loadUrl(QUrl(QStandardPaths::locate(QStandardPaths::GenericDataLocation, QStringLiteral("kwin/aurorae/aurorae.qml"))));
|
m_svgComponent->loadUrl(QUrl(QStandardPaths::locate(QStandardPaths::GenericDataLocation, QStringLiteral("kwin/aurorae/aurorae.qml"))));
|
||||||
}
|
}
|
||||||
return m_svgComponent.data();
|
// verify that the theme exists
|
||||||
|
if (!QStandardPaths::locate(QStandardPaths::GenericDataLocation, QStringLiteral("aurorae/themes/%1/%1rc").arg(themeName.mid(16))).isEmpty()) {
|
||||||
|
return m_svgComponent.data();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// try finding the QML package
|
// try finding the QML package
|
||||||
auto it = m_components.constFind(themeName);
|
auto it = m_components.constFind(themeName);
|
||||||
|
|
|
@ -47,6 +47,7 @@ namespace Decoration
|
||||||
{
|
{
|
||||||
|
|
||||||
static const QString s_pluginName = QStringLiteral("org.kde.kdecoration2");
|
static const QString s_pluginName = QStringLiteral("org.kde.kdecoration2");
|
||||||
|
static const QString s_defaultPlugin = QStringLiteral("org.kde.breeze");
|
||||||
|
|
||||||
KWIN_SINGLETON_FACTORY(DecorationBridge)
|
KWIN_SINGLETON_FACTORY(DecorationBridge)
|
||||||
|
|
||||||
|
@ -65,7 +66,7 @@ DecorationBridge::~DecorationBridge()
|
||||||
|
|
||||||
static QString readPlugin()
|
static QString readPlugin()
|
||||||
{
|
{
|
||||||
return KSharedConfig::openConfig(KWIN_CONFIG)->group(s_pluginName).readEntry("library", QStringLiteral("org.kde.breeze"));
|
return KSharedConfig::openConfig(KWIN_CONFIG)->group(s_pluginName).readEntry("library", s_defaultPlugin);
|
||||||
}
|
}
|
||||||
|
|
||||||
QString DecorationBridge::readTheme() const
|
QString DecorationBridge::readTheme() const
|
||||||
|
@ -78,6 +79,18 @@ void DecorationBridge::init()
|
||||||
m_plugin = readPlugin();
|
m_plugin = readPlugin();
|
||||||
m_settings = QSharedPointer<KDecoration2::DecorationSettings>::create(this);
|
m_settings = QSharedPointer<KDecoration2::DecorationSettings>::create(this);
|
||||||
initPlugin();
|
initPlugin();
|
||||||
|
if (!m_factory) {
|
||||||
|
if (m_plugin != s_defaultPlugin) {
|
||||||
|
// try loading default plugin
|
||||||
|
m_plugin = s_defaultPlugin;
|
||||||
|
initPlugin();
|
||||||
|
}
|
||||||
|
// default plugin failed to load, try fallback
|
||||||
|
if (!m_factory) {
|
||||||
|
m_plugin = QStringLiteral("org.kde.kwin.aurorae");
|
||||||
|
initPlugin();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void DecorationBridge::initPlugin()
|
void DecorationBridge::initPlugin()
|
||||||
|
|
Loading…
Reference in a new issue