This commit is contained in:
TheUnrealDragon 2026-04-17 15:43:25 +05:30
commit e6d5589cad

View file

@ -19,11 +19,47 @@ Window {
property int font_normal_text_size: 16
property double distance: 0
property int distance_count: 0
property int distance_count_thres: 3
property string mode: "http"
// visibility: Window.FullScreen
Component.onCompleted: {
if(Qt.platform.os !== "android") {
loading_popup.open();
}
Popup {
id: loading_popup
background: Rectangle {
color: "#B0121212"
radius: 5
border.color: root.accent_color
border.width: 1
}
height: parent.height / 10
width: parent.width / 1.1
anchors.centerIn: Overlay.overlay
closePolicy: Popup.NoAutoClose
BusyIndicator {
id: loading_indicator
running: true
anchors {
left: parent.left
verticalCenter: parent.verticalCenter
}
}
Text {
id: loading_text
text: "Loading..."
anchors {
leftMargin: 20
left: loading_indicator.right
verticalCenter: parent.verticalCenter
}
verticalAlignment: Text.AlignVCenter
color: root.accent_color
font.pointSize: root.font_enlarged_text_size
}
}
Rectangle {
@ -687,7 +723,10 @@ Window {
root.distance = listener.distance;
error_text.error_string = "";
console.log("Distance count: ", root.distance_count);
if(root.distance_count >= 5) {
if(root.distance_count >= root.distance_count_thres) {
if(loading_popup.opened) {
loading_popup.close();
}
status_label.text = "Recieving values";
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);
@ -704,7 +743,7 @@ Window {
water_level.color = root.water_color;
}
if(root.distance_count > 1000) {
root.distance_count = 5;
root.distance_count = root.distance_count_thres;
}
console.log("Current reading is: " + current_reading)
console.log("Normalized height is: " + normalized_height)