Commit 39799e91 authored by Jean-Baptiste Mardelle's avatar Jean-Baptiste Mardelle

Save layout in a specific file: $HOME/.config/kdenlive-layoutsrc

Related to #417
parent b5520d41
Pipeline #22056 passed with stage
in 9 minutes and 53 seconds
......@@ -48,8 +48,20 @@ void LayoutManagement::initializeLayouts()
if (m_loadLayout == nullptr || saveLayout == nullptr) {
return;
}
KSharedConfigPtr config = KSharedConfig::openConfig();
KSharedConfigPtr config = KSharedConfig::openConfig(QStringLiteral("kdenlive-layoutsrc"));
KConfigGroup layoutGroup(config, "Layouts");
// If we don't have any layout saved, check in main config file
if (!layoutGroup.exists()) {
config = KSharedConfig::openConfig();
KConfigGroup layoutGroup2(config, "Layouts");
if (layoutGroup2.exists()) {
// Migrate to new config file
layoutGroup2.copyTo(&layoutGroup);
}
}
if (!layoutGroup.exists()) {
return;
}
QStringList entries = layoutGroup.keyList();
QList<QAction *> loadActions = m_loadLayout->actions();
QList<QAction *> saveActions = saveLayout->actions();
......@@ -89,7 +101,7 @@ void LayoutManagement::slotLoadLayout(QAction *action)
return;
}
KSharedConfigPtr config = KSharedConfig::openConfig();
KSharedConfigPtr config = KSharedConfig::openConfig(QStringLiteral("kdenlive-layoutsrc"));
KConfigGroup layouts(config, "Layouts");
QByteArray state = QByteArray::fromBase64(layouts.readEntry(layoutId).toLatin1());
pCore->window()->restoreState(state);
......@@ -105,7 +117,7 @@ void LayoutManagement::slotSaveLayout(QAction *action)
if (layoutName.isEmpty()) {
return;
}
KSharedConfigPtr config = KSharedConfig::openConfig();
KSharedConfigPtr config = KSharedConfig::openConfig(QStringLiteral("kdenlive-layoutsrc"));
KConfigGroup layouts(config, "Layouts");
layouts.deleteEntry(originallayoutName);
......
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