Improve Settings page loading

This commit is contained in:
Matti Viljanen 2020-03-21 13:12:45 +02:00
parent bfd9c62dcf
commit 366cafde42
No known key found for this signature in database
GPG key ID: CF32A1495158F888

View file

@ -33,16 +33,23 @@ Page {
interval: 10 interval: 10
repeat: false repeat: false
onTriggered: { onTriggered: {
// The only setting that can change outside this page
autoStopCharging.checked = settings.limitEnabled autoStopCharging.checked = settings.limitEnabled
highLimitSlider.value = settings.highLimit console.debug("Charger control enabled updated")
lowLimitSlider.value = settings.lowLimit
notificationsSwitch.checked = settings.notificationsEnabled
highAlertSlider.value = settings.highAlert
lowAlertSlider.value = settings.lowAlert
intervalSlider.value = settings.interval
} }
} }
Component.onCompleted: {
// These we can read only once
highLimitSlider.value = settings.highLimit
lowLimitSlider.value = settings.lowLimit
notificationsSwitch.checked = settings.notificationsEnabled
highAlertSlider.value = settings.highAlert
lowAlertSlider.value = settings.lowAlert
intervalSlider.value = settings.interval
console.debug("SettingsPage values updated")
}
SilicaFlickable { SilicaFlickable {
anchors.fill: parent anchors.fill: parent
contentHeight: header.height + settingsColumn.height + Theme.horizontalPageMargin contentHeight: header.height + settingsColumn.height + Theme.horizontalPageMargin