Fix color theme lost on AppImage

parent a49facdf
......@@ -674,12 +674,11 @@ void MainWindow::init(const QString &MltPath, const QUrl &Url, const QString &cl
void MainWindow::slotThemeChanged(const QString &theme)
{
disconnect(this, &MainWindow::reloadTheme, this, &MainWindow::slotReloadTheme);
KdenliveSettings::setColortheme(theme);
KSharedConfigPtr config = KSharedConfig::openConfig(theme);
setPalette(KColorScheme::createApplicationPalette(config));
qApp->setPalette(palette());
QPalette plt = palette();
KdenliveSettings::setColortheme(theme);
if (m_effectStack) {
m_effectStack->updatePalette();
m_effectStack->transitionConfig()->updatePalette();
......
......@@ -116,13 +116,30 @@ void ThemeManager::setCurrentTheme(const QString &filename)
return;
}
QString name = d->themeMap.key(filename, d->defaultThemeName);
// In the case of AppImage, the path to the color scheme can be invalid
// on each start as filesystem is mounted with a random path, so check that and correct
if (name.isEmpty()) {
QMapIterator<QString, QString> i(d->themeMap);
while (i.hasNext()) {
i.next();
if (QFileInfo(i.value()).fileName() == QFileInfo(filename).fileName()) {
name = i.key();
}
}
}
bool themeFound = false;
const QList<QAction *> list = d->themeMenuActionGroup->actions();
for (QAction *const action : list) {
if (action->text().remove('&') == name) {
action->setChecked(true);
themeFound = true;
break;
//slotChangePalette();
}
}
if (!themeFound && filename != d->defaultThemeName) {
setCurrentTheme(d->defaultThemeName);
}
}
void ThemeManager::slotChangePalette()
......@@ -138,7 +155,6 @@ void ThemeManager::slotChangePalette()
QString filename = d->themeMap.value(theme);
//qCDebug(KDENLIVE_LOG) << theme << " :: " << filename;
emit signalThemeChanged(filename);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment