From 366cafde428a0b8adf2217afe036a063a404057c Mon Sep 17 00:00:00 2001 From: Matti Viljanen Date: Sat, 21 Mar 2020 13:12:45 +0200 Subject: [PATCH] Improve Settings page loading --- qml/pages/SettingsPage.qml | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/qml/pages/SettingsPage.qml b/qml/pages/SettingsPage.qml index a66ab27..7560374 100644 --- a/qml/pages/SettingsPage.qml +++ b/qml/pages/SettingsPage.qml @@ -33,16 +33,23 @@ Page { interval: 10 repeat: false onTriggered: { + // The only setting that can change outside this page autoStopCharging.checked = settings.limitEnabled - 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("Charger control enabled updated") } } + 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 { anchors.fill: parent contentHeight: header.height + settingsColumn.height + Theme.horizontalPageMargin