mirror of https://github.com/KDE/kasts.git
Directly apply configuration
When a configuration option is changed on the settings page, the new configuration is immediately applied. On application quit, the config file is updated as well.
This commit is contained in:
parent
220d3bea3f
commit
8d850b39df
|
@ -76,6 +76,8 @@ int main(int argc, char *argv[])
|
||||||
|
|
||||||
engine.rootContext()->setContextProperty(QStringLiteral("_settings"), &settings);
|
engine.rootContext()->setContextProperty(QStringLiteral("_settings"), &settings);
|
||||||
|
|
||||||
|
QObject::connect(&app, &QCoreApplication::aboutToQuit, &settings, &AlligatorSettings::save);
|
||||||
|
|
||||||
Database::instance();
|
Database::instance();
|
||||||
|
|
||||||
engine.load(QUrl(QStringLiteral("qrc:///main.qml")));
|
engine.load(QUrl(QStringLiteral("qrc:///main.qml")));
|
||||||
|
|
|
@ -13,7 +13,6 @@ import org.kde.kirigami 2.12 as Kirigami
|
||||||
Kirigami.ScrollablePage {
|
Kirigami.ScrollablePage {
|
||||||
title: i18n("Settings")
|
title: i18n("Settings")
|
||||||
|
|
||||||
|
|
||||||
Kirigami.FormLayout {
|
Kirigami.FormLayout {
|
||||||
|
|
||||||
Kirigami.Heading {
|
Kirigami.Heading {
|
||||||
|
@ -28,12 +27,16 @@ Kirigami.ScrollablePage {
|
||||||
id: deleteAfterCount
|
id: deleteAfterCount
|
||||||
value: _settings.deleteAfterCount
|
value: _settings.deleteAfterCount
|
||||||
enabled: deleteAfterType.currentIndex !== 0
|
enabled: deleteAfterType.currentIndex !== 0
|
||||||
|
|
||||||
|
onValueModified: _settings.deleteAfterCount = value
|
||||||
}
|
}
|
||||||
|
|
||||||
Controls.ComboBox {
|
Controls.ComboBox {
|
||||||
id: deleteAfterType
|
id: deleteAfterType
|
||||||
currentIndex: _settings.deleteAfterType
|
currentIndex: _settings.deleteAfterType
|
||||||
model: [i18n("Never"), i18n("Articles"), i18n("Days"), i18n("Weeks"), i18n("Months")]
|
model: [i18n("Never"), i18n("Articles"), i18n("Days"), i18n("Weeks"), i18n("Months")]
|
||||||
|
|
||||||
|
onActivated: _settings.deleteAfterType = index
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -50,24 +53,18 @@ Kirigami.ScrollablePage {
|
||||||
Kirigami.FormData.label: i18n("Font size:")
|
Kirigami.FormData.label: i18n("Font size:")
|
||||||
from: 6
|
from: 6
|
||||||
to: 20
|
to: 20
|
||||||
|
|
||||||
|
onValueModified: _settings.articleFontSize = value
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Controls.CheckBox {
|
Controls.CheckBox {
|
||||||
id: useSystemFontCheckBox
|
id: useSystemFontCheckBox
|
||||||
checked: _settings.articleFontUseSystem
|
checked: _settings.articleFontUseSystem
|
||||||
text: i18n("Use system default")
|
text: i18n("Use system default")
|
||||||
|
|
||||||
|
onToggled: _settings.articleFontUseSystem = checked
|
||||||
}
|
}
|
||||||
|
|
||||||
Controls.Button {
|
|
||||||
text: i18n("Save")
|
|
||||||
onClicked: {
|
|
||||||
_settings.deleteAfterCount = deleteAfterCount.value
|
|
||||||
_settings.deleteAfterType = deleteAfterType.currentIndex
|
|
||||||
_settings.articleFontSize = articleFontSizeSpinBox.value
|
|
||||||
_settings.articleFontUseSystem = useSystemFontCheckBox.checked
|
|
||||||
_settings.save()
|
|
||||||
pageStack.pop()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue