Commit b2c030c3 authored by Jean-Baptiste Mardelle's avatar Jean-Baptiste Mardelle

Ensure the "Editing" layout is loaded on first run

parent be4d311a
......@@ -132,6 +132,7 @@ void LayoutManagement::initializeLayouts()
layoutOrder.writeEntry(QString::number(j), entry);
j++;
}
config->reparseConfiguration();
}
for (int i = 1; i < 10; i++) {
QString layoutName;
......@@ -171,7 +172,7 @@ void LayoutManagement::activateLayout(QAbstractButton *button)
if (!button) {
return;
}
loadLayout(button->text());
loadLayout(button->text(), false);
}
void LayoutManagement::slotLoadLayout(QAction *action)
......@@ -184,26 +185,10 @@ void LayoutManagement::slotLoadLayout(QAction *action)
if (layoutId.isEmpty()) {
return;
}
if (loadLayout(layoutId)) {
// Activate layout button
QList<QAbstractButton *>buttons = m_containerGrp->buttons();
bool buttonFound = false;
for (auto *button : buttons) {
if (button->text() == layoutId) {
QSignalBlocker bk(m_containerGrp);
button->setChecked(true);
buttonFound = true;
}
}
if (!buttonFound && m_containerGrp->checkedButton()) {
m_containerGrp->setExclusive(false);
m_containerGrp->checkedButton()->setChecked(false);
m_containerGrp->setExclusive(true);
}
}
loadLayout(layoutId, true);
}
bool LayoutManagement::loadLayout(const QString &layoutId)
bool LayoutManagement::loadLayout(const QString &layoutId, bool selectButton)
{
KSharedConfigPtr config = KSharedConfig::openConfig(QStringLiteral("kdenlive-layoutsrc"));
KConfigGroup layouts(config, "Layouts");
......@@ -219,6 +204,23 @@ bool LayoutManagement::loadLayout(const QString &layoutId)
}
pCore->window()->centralWidget()->setHidden(!timelineVisible);
pCore->window()->restoreState(state);
if (selectButton) {
// Activate layout button
QList<QAbstractButton *>buttons = m_containerGrp->buttons();
bool buttonFound = false;
for (auto *button : buttons) {
if (button->text() == layoutId) {
QSignalBlocker bk(m_containerGrp);
button->setChecked(true);
buttonFound = true;
}
}
if (!buttonFound && m_containerGrp->checkedButton()) {
m_containerGrp->setExclusive(false);
m_containerGrp->checkedButton()->setChecked(false);
m_containerGrp->setExclusive(true);
}
}
return true;
}
......
......@@ -26,6 +26,8 @@ class LayoutManagement : public QObject
public:
explicit LayoutManagement(QObject *parent);
/** @brief Load a layout by its name. */
bool loadLayout(const QString &layoutId, bool selectButton);
private slots:
/** @brief Saves the widget layout. */
......@@ -45,8 +47,6 @@ private:
QHBoxLayout *m_containerLayout;
KSelectAction *m_loadLayout;
QList <QAction *> m_layoutActions;
/** @brief Load a layout by its name. */
bool loadLayout(const QString &layoutId);
};
#endif
......@@ -257,7 +257,7 @@ void MainWindow::init()
fr->setLineWidth(1);
ctnLay->addWidget(fr);
setupActions();
new LayoutManagement(this);
LayoutManagement *layoutManager = new LayoutManagement(this);
QDockWidget *libraryDock = addDock(i18n("Library"), QStringLiteral("library"), pCore->library());
......@@ -514,7 +514,7 @@ void MainWindow::init()
if (current->availableSize().height() < 1000) {
resize(current->availableSize());
} else {
resize(current->availableSize() / 1.5);
resize(current->availableSize() / 1.2);
}
}
}
......@@ -743,6 +743,7 @@ void MainWindow::init()
KdenliveSettings::setCurrenttmpfolder(QStandardPaths::writableLocation(QStandardPaths::TempLocation));
updateActionsToolTip();
layoutManager->loadLayout(QStringLiteral("Editing"), true);
QTimer::singleShot(0, this, &MainWindow::GUISetupDone);
#ifdef USE_JOGSHUTTLE
......
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