v0.0.9
This commit is contained in:
parent
f59704545b
commit
69086d8093
1 changed files with 370 additions and 134 deletions
48
Main.qml
48
Main.qml
|
|
@ -634,19 +634,29 @@ Window {
|
|||
}
|
||||
}
|
||||
Timer {
|
||||
property int count: 0
|
||||
id: init_timer
|
||||
running: true
|
||||
repeat: false
|
||||
repeat: true
|
||||
interval: 1000
|
||||
onTriggered: {
|
||||
console.log("Timer triggered saving config, hope everything is loaded by now");
|
||||
let current_min_reading = Math.max(0, (parseFloat(min_thres_input.text)));
|
||||
let effective_max_reading = Math.max(0, (parseFloat(max_thres_input.text)) - current_min_reading);
|
||||
let alert = parseFloat(alert_thres_input.text);
|
||||
let alert_effective_reading = (effective_max_reading * (100 - alert) / 100) + current_min_reading;
|
||||
console.log("Setting initial configs: ", alert_effective_reading, config.flipBits , config.mode, config.url);
|
||||
listener.setConfig(alert_effective_reading, config.flipBits , config.mode, config.url);
|
||||
http_url_input.cursorPosition = 0;
|
||||
if(count === 0) {
|
||||
listener.startService();
|
||||
count++;
|
||||
return;
|
||||
}
|
||||
else {
|
||||
console.log("Timer triggered saving config, hope everything is loaded by now");
|
||||
let current_min_reading = Math.max(0, (parseFloat(min_thres_input.text)));
|
||||
let effective_max_reading = Math.max(0, (parseFloat(max_thres_input.text)) - current_min_reading);
|
||||
let alert = parseFloat(alert_thres_input.text);
|
||||
let alert_effective_reading = (effective_max_reading * (100 - alert) / 100) + current_min_reading;
|
||||
console.log("Setting initial configs: ", alert_effective_reading, config.flipBits , config.mode, config.url);
|
||||
listener.setConfig(alert_effective_reading, config.flipBits , config.mode, config.url);
|
||||
http_url_input.cursorPosition = 0;
|
||||
init_timer.repeat = false;
|
||||
init_timer.stop();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -658,9 +668,18 @@ Window {
|
|||
error_text.error_string = err;
|
||||
}
|
||||
|
||||
onLastUpdatedChanged: (update) => {
|
||||
onLastUpdatedChanged: (update, warn) => {
|
||||
console.log("QML Last Updated: ", update);
|
||||
last_updated_text.last_updated = update;
|
||||
if(!warn)
|
||||
{
|
||||
last_updated_text.last_updated = update;
|
||||
last_updated_text.color = root.accent_color;
|
||||
}
|
||||
else
|
||||
{
|
||||
last_updated_text.last_updated = update;
|
||||
last_updated_text.color = root.danger_color;
|
||||
}
|
||||
}
|
||||
|
||||
onDistanceChanged: {
|
||||
|
|
@ -722,9 +741,12 @@ Window {
|
|||
}
|
||||
}
|
||||
|
||||
onClosing:(close)=> {
|
||||
onClosing: (close)=> {
|
||||
if(Qt.platform.os === "android"){
|
||||
close.accepted = false
|
||||
// close.accepted = false
|
||||
// listener.moveAppToBackground();
|
||||
// console.log("Moving to backgound");
|
||||
close.accepted = true;
|
||||
} else {
|
||||
close.accepted = true
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue