Save settings after releasing the sliders
This commit is contained in:
parent
c0e8004cc2
commit
a5d8ae0fa3
2 changed files with 21 additions and 7 deletions
|
@ -103,10 +103,13 @@ Page {
|
|||
valueText: value + "%"
|
||||
highlightDirection: Qt.RightToLeft
|
||||
onValueChanged: {
|
||||
settings.highLimit = value
|
||||
if(lowLimitSlider.value >= value)
|
||||
lowLimitSlider.value = value - 1
|
||||
}
|
||||
onReleased: {
|
||||
settings.lowLimit = lowLimitSlider.value
|
||||
settings.highLimit = value
|
||||
}
|
||||
}
|
||||
MySlider {
|
||||
id: lowLimitSlider
|
||||
|
@ -118,10 +121,13 @@ Page {
|
|||
stepSize: 1
|
||||
valueText: value + "%"
|
||||
onValueChanged: {
|
||||
settings.lowLimit = value
|
||||
if(highLimitSlider.value <= value)
|
||||
highLimitSlider.value = value + 1
|
||||
}
|
||||
onReleased: {
|
||||
settings.lowLimit = value
|
||||
settings.highLimit = highLimitSlider.value
|
||||
}
|
||||
}
|
||||
}
|
||||
Column {
|
||||
|
@ -149,10 +155,13 @@ Page {
|
|||
valueText: value + "%"
|
||||
highlightDirection: Qt.RightToLeft
|
||||
onValueChanged: {
|
||||
settings.highAlert = value
|
||||
if(lowAlertSlider.value >= value)
|
||||
lowAlertSlider.value = value - 1
|
||||
}
|
||||
onReleased: {
|
||||
settings.lowAlert = lowAlertSlider.value
|
||||
settings.highAlert = value
|
||||
}
|
||||
}
|
||||
MySlider {
|
||||
id: lowAlertSlider
|
||||
|
@ -163,10 +172,13 @@ Page {
|
|||
stepSize: 1
|
||||
valueText: value + "%"
|
||||
onValueChanged: {
|
||||
settings.lowAlert = value
|
||||
if(highAlertSlider.value <= value)
|
||||
highAlertSlider.value = value + 1
|
||||
}
|
||||
onReleased: {
|
||||
settings.lowAlert = value
|
||||
settings.highAlert = highAlertSlider.value
|
||||
}
|
||||
}
|
||||
MySlider {
|
||||
id: intervalSlider
|
||||
|
@ -176,7 +188,7 @@ Page {
|
|||
maximumValue: 600
|
||||
stepSize: 10
|
||||
valueText: Math.floor(value / 60) + (value % 60 < 10 ? ":0" + value % 60 : ":" + value % 60)
|
||||
onValueChanged: settings.interval = value
|
||||
onReleased: settings.interval = value
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -82,7 +82,8 @@ QString Settings::getNotificationHighText() { return notificationHighText; }
|
|||
void Settings::setLowAlert(int newLimit) {
|
||||
lowAlert = newLimit;
|
||||
saveInteger(sLowAlert, &lowAlert);
|
||||
mySettings->sync();
|
||||
// Lows and highs are always saved in pairs!
|
||||
//mySettings->sync();
|
||||
emit lowAlertChanged(lowAlert);
|
||||
qDebug() << "Change" << sLowAlert << newLimit;
|
||||
}
|
||||
|
@ -106,7 +107,8 @@ void Settings::setInterval(int newInterval) {
|
|||
void Settings::setLowLimit(int newLimit) {
|
||||
lowLimit = newLimit;
|
||||
saveInteger(sLowLimit, &lowLimit);
|
||||
mySettings->sync();
|
||||
// Lows and highs are always saved in pairs!
|
||||
//mySettings->sync();
|
||||
emit lowLimitChanged(lowLimit);
|
||||
qDebug() << "Change" << sLowLimit << newLimit;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue