QoL Fixes and Changes
This commit is contained in:
parent
b8201398e1
commit
93995959d0
1 changed files with 905 additions and 229 deletions
147
WaterTank.qml
147
WaterTank.qml
|
|
@ -13,6 +13,8 @@ Item {
|
|||
property color tank_base_border_color: "#F0121212"
|
||||
property color text_color: "#F05FAF5F"
|
||||
property double height_max: tank_base.height - 10
|
||||
property int font_normal_text_size: 0
|
||||
property int font_enlarged_text_size: 0
|
||||
property double current_level: 0
|
||||
property double percentage_filled: 0
|
||||
property int distance: 0
|
||||
|
|
@ -21,6 +23,11 @@ Item {
|
|||
property double rate_of_fill: 0
|
||||
property double expected_to_fill: 0
|
||||
property double alert_threshold: 0
|
||||
property bool enable_current_reading: true
|
||||
property bool enable_percentage_reading: true
|
||||
property bool enable_filling_status: true
|
||||
property bool enable_rate_of_fill: true
|
||||
property bool enable_expected_to_fill: true
|
||||
|
||||
Rectangle {
|
||||
id: base
|
||||
|
|
@ -30,7 +37,7 @@ Item {
|
|||
id: tank_lid
|
||||
color: root.tank_lid_color
|
||||
anchors {
|
||||
bottom: tank_base.top
|
||||
top: parent.top
|
||||
horizontalCenter: tank_base.horizontalCenter
|
||||
bottomMargin: -5
|
||||
}
|
||||
|
|
@ -42,9 +49,12 @@ Item {
|
|||
Rectangle {
|
||||
id: tank_base
|
||||
color: root.tank_base_color
|
||||
anchors.centerIn: parent
|
||||
anchors {
|
||||
top: tank_lid.bottom
|
||||
horizontalCenter: parent.horizontalCenter
|
||||
}
|
||||
width: parent.width
|
||||
height: parent.height
|
||||
height: parent.height * 0.55
|
||||
border.color: root.tank_base_border_color
|
||||
border.width: 5
|
||||
radius: 4
|
||||
|
|
@ -72,74 +82,93 @@ Item {
|
|||
}
|
||||
}
|
||||
|
||||
Text {
|
||||
id: water_level_reading
|
||||
text: "Current Reading: " + (root.distance / 10)+ " cm"
|
||||
font.pointSize: 16
|
||||
color: root.text_color
|
||||
ScrollView {
|
||||
id: rect_base_scroll_view
|
||||
anchors {
|
||||
margins: 5
|
||||
top: tank_base.bottom
|
||||
bottom: parent.bottom
|
||||
horizontalCenter: parent.horizontalCenter
|
||||
}
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
width: parent.width
|
||||
|
||||
contentWidth: parent.width
|
||||
contentHeight: settings_column.implicitHeight
|
||||
Column {
|
||||
id: settings_column
|
||||
spacing: 10
|
||||
width: rect_base_scroll_view.width
|
||||
Text {
|
||||
id: water_level_reading
|
||||
text: "Current Reading: " + (root.distance / 10)+ " cm"
|
||||
font.pointSize: root.font_normal_text_size
|
||||
color: root.text_color
|
||||
visible: enable_current_reading
|
||||
anchors {
|
||||
horizontalCenter: parent.horizontalCenter
|
||||
}
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
}
|
||||
|
||||
Text {
|
||||
id: water_level_percentage
|
||||
text: "Percentage: " + root.percentage_filled.toFixed(2) + " %"
|
||||
font.pointSize: root.font_normal_text_size
|
||||
visible: enable_filling_status
|
||||
color: root.text_color
|
||||
anchors {
|
||||
horizontalCenter: parent.horizontalCenter
|
||||
}
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
}
|
||||
|
||||
Text {
|
||||
id: fill_status
|
||||
text: "Filling status: " + (( root.rate_of_fill > 0)? "Filling" : "Discharging")
|
||||
font.pointSize: root.font_normal_text_size
|
||||
color: root.text_color
|
||||
visible: enable_filling_status
|
||||
anchors {
|
||||
horizontalCenter: parent.horizontalCenter
|
||||
}
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
}
|
||||
Text {
|
||||
id: rate_of_fill_label
|
||||
text: "Rate of fill: " + root.rate_of_fill + " cm/s"
|
||||
font.pointSize: root.font_normal_text_size
|
||||
color: root.text_color
|
||||
visible: enable_rate_of_fill
|
||||
anchors {
|
||||
horizontalCenter: parent.horizontalCenter
|
||||
}
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
}
|
||||
Text {
|
||||
id: expected_to_fill_label
|
||||
text: "Expected to fill in: " + root.expected_to_fill + " s"
|
||||
font.pointSize: root.font_normal_text_size
|
||||
color: root.text_color
|
||||
visible: (root.rate_of_fill > 0 && enable_expected_to_fill === true) ? true : false
|
||||
anchors {
|
||||
horizontalCenter: parent.horizontalCenter
|
||||
}
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Text {
|
||||
id: water_level_percentage
|
||||
text: "Percentage: " + root.percentage_filled + " %"
|
||||
font.pointSize: 16
|
||||
color: root.text_color
|
||||
anchors {
|
||||
margins: 5
|
||||
top: water_level_reading.bottom
|
||||
horizontalCenter: parent.horizontalCenter
|
||||
}
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
}
|
||||
|
||||
Text {
|
||||
id: fill_status
|
||||
text: "Filling status: " + (( root.rate_of_fill > 0)? "Filling" : "Discharging")
|
||||
font.pointSize: 16
|
||||
color: root.text_color
|
||||
anchors {
|
||||
margins: 5
|
||||
top: water_level_percentage.bottom
|
||||
horizontalCenter: parent.horizontalCenter
|
||||
}
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
}
|
||||
Text {
|
||||
id: rate_of_fill_label
|
||||
text: "Rate of fill: " + root.rate_of_fill + " cm/s"
|
||||
font.pointSize: 16
|
||||
color: root.text_color
|
||||
anchors {
|
||||
margins: 5
|
||||
top: fill_status.bottom
|
||||
horizontalCenter: parent.horizontalCenter
|
||||
}
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
}
|
||||
Text {
|
||||
id: expected_to_fill_label
|
||||
text: "Expected to fill in: " + root.expected_to_fill + " s"
|
||||
font.pointSize: 16
|
||||
color: root.text_color
|
||||
visible: (root.rate_of_fill > 0) ? true : false
|
||||
anchors {
|
||||
margins: 5
|
||||
top: rate_of_fill_label.bottom
|
||||
horizontalCenter: parent.horizontalCenter
|
||||
}
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
}
|
||||
}
|
||||
function setConfig(config: var) {
|
||||
min_thres_input = config.min;
|
||||
max_thres_input = config.max;
|
||||
alert_threshold = config.alert;
|
||||
enable_current_reading = config.current_reading_enable;
|
||||
enable_percentage_reading = config.percentage_enable;
|
||||
enable_filling_status = config.filling_status_enable;
|
||||
enable_rate_of_fill = config.rate_of_fill_enable;
|
||||
enable_expected_to_fill = config.expected_to_fill_enable;
|
||||
|
||||
}
|
||||
|
||||
function setDistance(distance) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue