Simplify settings
Directly use the _settings context property in the Settings page
This commit is contained in:
parent
cae8d54921
commit
220d3bea3f
@ -13,8 +13,6 @@ import org.kde.kirigami 2.12 as Kirigami
|
|||||||
Kirigami.ScrollablePage {
|
Kirigami.ScrollablePage {
|
||||||
title: i18n("Settings")
|
title: i18n("Settings")
|
||||||
|
|
||||||
property QtObject settings
|
|
||||||
|
|
||||||
|
|
||||||
Kirigami.FormLayout {
|
Kirigami.FormLayout {
|
||||||
|
|
||||||
@ -28,13 +26,13 @@ Kirigami.ScrollablePage {
|
|||||||
|
|
||||||
Controls.SpinBox {
|
Controls.SpinBox {
|
||||||
id: deleteAfterCount
|
id: deleteAfterCount
|
||||||
value: settings.deleteAfterCount
|
value: _settings.deleteAfterCount
|
||||||
enabled: deleteAfterType.currentIndex !== 0
|
enabled: deleteAfterType.currentIndex !== 0
|
||||||
}
|
}
|
||||||
|
|
||||||
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")]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -48,7 +46,7 @@ Kirigami.ScrollablePage {
|
|||||||
id: articleFontSizeSpinBox
|
id: articleFontSizeSpinBox
|
||||||
|
|
||||||
enabled: !useSystemFontCheckBox.checked
|
enabled: !useSystemFontCheckBox.checked
|
||||||
value: settings.articleFontSize
|
value: _settings.articleFontSize
|
||||||
Kirigami.FormData.label: i18n("Font size:")
|
Kirigami.FormData.label: i18n("Font size:")
|
||||||
from: 6
|
from: 6
|
||||||
to: 20
|
to: 20
|
||||||
@ -56,18 +54,18 @@ Kirigami.ScrollablePage {
|
|||||||
|
|
||||||
Controls.CheckBox {
|
Controls.CheckBox {
|
||||||
id: useSystemFontCheckBox
|
id: useSystemFontCheckBox
|
||||||
checked: settings.articleFontUseSystem
|
checked: _settings.articleFontUseSystem
|
||||||
text: i18n("Use system default")
|
text: i18n("Use system default")
|
||||||
}
|
}
|
||||||
|
|
||||||
Controls.Button {
|
Controls.Button {
|
||||||
text: i18n("Save")
|
text: i18n("Save")
|
||||||
onClicked: {
|
onClicked: {
|
||||||
settings.deleteAfterCount = deleteAfterCount.value
|
_settings.deleteAfterCount = deleteAfterCount.value
|
||||||
settings.deleteAfterType = deleteAfterType.currentIndex
|
_settings.deleteAfterType = deleteAfterType.currentIndex
|
||||||
settings.articleFontSize = articleFontSizeSpinBox.value
|
_settings.articleFontSize = articleFontSizeSpinBox.value
|
||||||
settings.articleFontUseSystem = useSystemFontCheckBox.checked
|
_settings.articleFontUseSystem = useSystemFontCheckBox.checked
|
||||||
settings.save()
|
_settings.save()
|
||||||
pageStack.pop()
|
pageStack.pop()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -22,7 +22,7 @@ Kirigami.ApplicationWindow {
|
|||||||
Kirigami.Action {
|
Kirigami.Action {
|
||||||
text: i18n("Settings")
|
text: i18n("Settings")
|
||||||
iconName: "settings-configure"
|
iconName: "settings-configure"
|
||||||
onTriggered: pageStack.layers.push("qrc:/SettingsPage.qml", {"settings": _settings})
|
onTriggered: pageStack.layers.push("qrc:/SettingsPage.qml")
|
||||||
enabled: pageStack.layers.currentItem.title !== i18n("Settings")
|
enabled: pageStack.layers.currentItem.title !== i18n("Settings")
|
||||||
},
|
},
|
||||||
Kirigami.Action {
|
Kirigami.Action {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user