From 5da67a5a227b8ebbaf7a8dd2699cc1a70f5fa7aa Mon Sep 17 00:00:00 2001 From: Matti Viljanen Date: Sat, 10 Apr 2021 01:42:08 +0300 Subject: [PATCH] Set percentage ranges to 5%...100% --- application/qml/pages/SettingsPage.qml | 12 ++++++------ application/src/settings.cpp | 8 ++++---- service/src/settings.cpp | 8 ++++---- 3 files changed, 14 insertions(+), 14 deletions(-) diff --git a/application/qml/pages/SettingsPage.qml b/application/qml/pages/SettingsPage.qml index 5bc279a..47b001a 100644 --- a/application/qml/pages/SettingsPage.qml +++ b/application/qml/pages/SettingsPage.qml @@ -181,8 +181,8 @@ Page { MySlider { id: highLimitSlider - minimumValue: 21 - maximumValue: 95 + minimumValue: 6 + maximumValue: 100 stepSize: 1 valueText: value + "%" onValueChanged: { @@ -206,8 +206,8 @@ Page { MySlider { id: lowLimitSlider - minimumValue: 20 - maximumValue: 94 + minimumValue: 5 + maximumValue: 99 stepSize: 1 valueText: value + "%" onValueChanged: { @@ -260,7 +260,7 @@ Page { MySlider { id: highAlertSlider - minimumValue: 11 + minimumValue: 6 maximumValue: 100 stepSize: 1 valueText: value + "%" @@ -285,7 +285,7 @@ Page { MySlider { id: lowAlertSlider - minimumValue: 10 + minimumValue: 5 maximumValue: 99 stepSize: 1 valueText: value + "%" diff --git a/application/src/settings.cpp b/application/src/settings.cpp index 680441d..3c00ac0 100644 --- a/application/src/settings.cpp +++ b/application/src/settings.cpp @@ -23,13 +23,13 @@ Settings::Settings(QObject *parent) : QObject(parent) qDebug() << "Using" << mySettings->fileName(); // Read in the values - loadInteger(sLowAlert, &lowAlert, 10, 99); - loadInteger(sHighAlert, &highAlert, 11, 100); + loadInteger(sLowAlert, &lowAlert, 5, 99); + loadInteger(sHighAlert, &highAlert, 6, 100); loadInteger(sHighNotificationsInterval, &highNotificationsInterval, 50, 610); loadInteger(sLowNotificationsInterval, &lowNotificationsInterval, 50, 610); loadInteger(sLimitEnabled, &limitEnabled, 0, 1); - loadInteger(sLowLimit, &lowLimit, 20, 94); - loadInteger(sHighLimit, &highLimit, 21, 95); + loadInteger(sLowLimit, &lowLimit, 5, 99); + loadInteger(sHighLimit, &highLimit, 6, 100); notificationTitle = tr("Battery charge %1%"); notificationLowText = tr("Please connect the charger."); diff --git a/service/src/settings.cpp b/service/src/settings.cpp index 3a41322..94a0356 100644 --- a/service/src/settings.cpp +++ b/service/src/settings.cpp @@ -108,13 +108,13 @@ void Settings::updateConfig(QString path) { // Read in the values bool restartTimers = false; - loadInteger(sLowAlert, &lowAlert, 10, 99); - loadInteger(sHighAlert, &highAlert, 11, 100); + loadInteger(sLowAlert, &lowAlert, 5, 99); + loadInteger(sHighAlert, &highAlert, 6, 100); restartTimers |= loadInteger(sHighNotificationsInterval, &highNotificationsInterval, 50, 610); restartTimers |= loadInteger(sLowNotificationsInterval, &lowNotificationsInterval, 50, 610); loadInteger(sLimitEnabled, &limitEnabled, 0, 1); - loadInteger(sLowLimit, &lowLimit, 20, 94); - loadInteger(sHighLimit, &highLimit, 21, 95); + loadInteger(sLowLimit, &lowLimit, 5, 99); + loadInteger(sHighLimit, &highLimit, 6, 100); // These are translated in the GUI application // and delivered here via the config file