UI: Options: Fix closing after only startup-mode saved.

This commit is contained in:
Nodir Temirkhodjaev 2021-05-13 18:28:36 +03:00
parent 390950efdc
commit 1214581e67
2 changed files with 13 additions and 10 deletions

View File

@ -107,19 +107,19 @@ void OptionsController::save(bool closeOnSuccess)
{
emit aboutToSave();
if (!conf()->anyEdited()) {
const bool isAnyEdited = conf()->anyEdited();
if (isAnyEdited) {
if (!confManager()->saveConf(*conf()))
return;
confManager()->applySavedConf(conf());
} else {
emitEdited(false);
return;
}
if (!confManager()->saveConf(*conf()))
return;
confManager()->applySavedConf(conf());
if (closeOnSuccess) {
closeWindow();
} else {
} else if (isAnyEdited) {
confManager()->initConfToEdit();
resetEdited();
}

View File

@ -222,8 +222,11 @@ QLayout *OptionsPage::setupStartModeLayout()
{
m_labelStartMode = ControlUtil::createLabel();
m_comboStartMode = ControlUtil::createComboBox(
QStringList(), [&](int /*index*/) { ctrl()->emitEdited(); });
m_comboStartMode = ControlUtil::createComboBox(QStringList(), [&](int index) {
if (m_currentStartupMode != index) {
ctrl()->emitEdited();
}
});
m_comboStartMode->setFixedWidth(200);
return ControlUtil::createRowLayout(m_labelStartMode, m_comboStartMode);