From cb0ea6a5589cfcdd240bc8cf12ea23ed2e87e298 Mon Sep 17 00:00:00 2001 From: Danfro Date: Thu, 24 Oct 2024 23:04:42 +0200 Subject: [PATCH 1/2] add column with bpm tresholds and use round instead of floor to avoid larger differences to 100% sum --- ui/qml/pages/HeartratePage.qml | 62 ++++++++++++++++++++++------------ 1 file changed, 41 insertions(+), 21 deletions(-) diff --git a/ui/qml/pages/HeartratePage.qml b/ui/qml/pages/HeartratePage.qml index f820ea97..7d2215eb 100644 --- a/ui/qml/pages/HeartratePage.qml +++ b/ui/qml/pages/HeartratePage.qml @@ -85,45 +85,65 @@ PagePL { //Type summary Grid { - columns: 2 + columns: 3 spacing: styler.themePaddingMedium - width: parent.width - LabelPL { text: qsTr("Relaxed") } - Item { width: parent.width * 0.5; height: 50 + width: parent.width - (styler.themePaddingMedium * 2) + LabelPL {text: qsTr("Relaxed")} + Item { + width: parent.width * 0.5 + height: 50 Rectangle { color: "grey"; width: parent.width * (relaxed / total) ; height: parent.height } - LabelPL { text: Math.floor((relaxed / total) * 100) + "%"; anchors.centerIn: parent} + LabelPL { text: Math.round((relaxed / total) * 100) + "%"; anchors.centerIn: parent} } - LabelPL { text: qsTr("Light") } - Item { width: parent.width * 0.5; height: 50 + LabelPL {text: qsTr("<= %1 BPM".arg(Math.round(maxHR()*0.5)))} + + LabelPL {text: qsTr("Light")} + Item { + width: parent.width * 0.5 + height: 50 Rectangle { color: "lightblue"; width: parent.width * (light / total) ; height: parent.height } - LabelPL { text: Math.floor((light / total) * 100) + "%"; anchors.centerIn: parent} + LabelPL { text: Math.round((light / total) * 100) + "%"; anchors.centerIn: parent} } - LabelPL { text: qsTr("Intensive")} - Item { width: parent.width * 0.5; height: 50 + LabelPL {text: qsTr("<= %1 BPM".arg(Math.round(maxHR()*0.6)))} + + LabelPL {text: qsTr("Intensive")} + Item { + width: parent.width * 0.5 + height: 50 Rectangle { color: "green"; width: parent.width * (intensive / total) ; height: parent.height } - LabelPL { text: Math.floor((intensive / total) * 100) + "%"; anchors.centerIn: parent} + LabelPL { text: Math.round((intensive / total) * 100) + "%"; anchors.centerIn: parent} } - LabelPL { text: qsTr("Aerobic")} - Item { width: parent.width * 0.5; height: 50 + LabelPL {text: qsTr("<= %1 BPM".arg(Math.round(maxHR()*0.7)))} + + LabelPL {text: qsTr("Aerobic")} + Item { + width: parent.width * 0.5 + height: 50 Rectangle { color: "yellow"; width: parent.width * (aerobic / total) ; height: parent.height } - LabelPL { text: Math.floor((aerobic / total) * 100) + "%"; anchors.centerIn: parent} + LabelPL { text: Math.round((aerobic / total) * 100) + "%"; anchors.centerIn: parent} } + LabelPL {text: qsTr("<= %1 BPM".arg(Math.round(maxHR()*0.8)))} - LabelPL { text: qsTr("Anerobic")} - Item { width: parent.width * 0.5; height: 50 + LabelPL {text: qsTr("Anerobic")} + Item { + width: parent.width * 0.5 + height: 50 Rectangle { color: "orange"; width: parent.width * (anerobic / total) ; height: parent.height } - LabelPL { text: Math.floor((anerobic / total) * 100) + "%"; anchors.centerIn: parent} + LabelPL { text: Math.round((anerobic / total) * 100) + "%"; anchors.centerIn: parent} } + LabelPL {text: qsTr("<= %1 BPM".arg(Math.round(maxHR()*0.9)))} - LabelPL { text: qsTr("VO2 Max") } - Item { width: parent.width * 0.5; height: 50 + LabelPL {text: qsTr("VO2 Max")} + Item { + width: parent.width * 0.5 + height: 50 Rectangle { color: "red"; width: parent.width * (vo2max / total) ; height: parent.height } - LabelPL { text: Math.floor((vo2max / total) * 100) + "%"; anchors.centerIn: parent} + LabelPL { text: Math.round((vo2max / total) * 100) + "%"; anchors.centerIn: parent} } + LabelPL {text: qsTr("<= %1 BPM".arg(Math.round(maxHR())))} } } - function updateGraphs() { graphHR.updateGraph(day); calculateZones(); From 0c7c9643d936cbbf1d14c7a310af76744f52f201 Mon Sep 17 00:00:00 2001 From: Danfro Date: Fri, 25 Oct 2024 12:55:25 +0200 Subject: [PATCH 2/2] =?UTF-8?q?replace=20<=3D=20with=20=E2=89=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ui/qml/pages/HeartratePage.qml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/ui/qml/pages/HeartratePage.qml b/ui/qml/pages/HeartratePage.qml index 7d2215eb..9bd0e959 100644 --- a/ui/qml/pages/HeartratePage.qml +++ b/ui/qml/pages/HeartratePage.qml @@ -95,7 +95,7 @@ PagePL { Rectangle { color: "grey"; width: parent.width * (relaxed / total) ; height: parent.height } LabelPL { text: Math.round((relaxed / total) * 100) + "%"; anchors.centerIn: parent} } - LabelPL {text: qsTr("<= %1 BPM".arg(Math.round(maxHR()*0.5)))} + LabelPL {text: qsTr("≤ %1 BPM".arg(Math.round(maxHR()*0.5)))} LabelPL {text: qsTr("Light")} Item { @@ -104,7 +104,7 @@ PagePL { Rectangle { color: "lightblue"; width: parent.width * (light / total) ; height: parent.height } LabelPL { text: Math.round((light / total) * 100) + "%"; anchors.centerIn: parent} } - LabelPL {text: qsTr("<= %1 BPM".arg(Math.round(maxHR()*0.6)))} + LabelPL {text: qsTr("≤ %1 BPM".arg(Math.round(maxHR()*0.6)))} LabelPL {text: qsTr("Intensive")} Item { @@ -113,7 +113,7 @@ PagePL { Rectangle { color: "green"; width: parent.width * (intensive / total) ; height: parent.height } LabelPL { text: Math.round((intensive / total) * 100) + "%"; anchors.centerIn: parent} } - LabelPL {text: qsTr("<= %1 BPM".arg(Math.round(maxHR()*0.7)))} + LabelPL {text: qsTr("≤ %1 BPM".arg(Math.round(maxHR()*0.7)))} LabelPL {text: qsTr("Aerobic")} Item { @@ -122,7 +122,7 @@ PagePL { Rectangle { color: "yellow"; width: parent.width * (aerobic / total) ; height: parent.height } LabelPL { text: Math.round((aerobic / total) * 100) + "%"; anchors.centerIn: parent} } - LabelPL {text: qsTr("<= %1 BPM".arg(Math.round(maxHR()*0.8)))} + LabelPL {text: qsTr("≤ %1 BPM".arg(Math.round(maxHR()*0.8)))} LabelPL {text: qsTr("Anerobic")} Item { @@ -131,7 +131,7 @@ PagePL { Rectangle { color: "orange"; width: parent.width * (anerobic / total) ; height: parent.height } LabelPL { text: Math.round((anerobic / total) * 100) + "%"; anchors.centerIn: parent} } - LabelPL {text: qsTr("<= %1 BPM".arg(Math.round(maxHR()*0.9)))} + LabelPL {text: qsTr("≤ %1 BPM".arg(Math.round(maxHR()*0.9)))} LabelPL {text: qsTr("VO2 Max")} Item { @@ -140,7 +140,7 @@ PagePL { Rectangle { color: "red"; width: parent.width * (vo2max / total) ; height: parent.height } LabelPL { text: Math.round((vo2max / total) * 100) + "%"; anchors.centerIn: parent} } - LabelPL {text: qsTr("<= %1 BPM".arg(Math.round(maxHR())))} + LabelPL {text: qsTr("≤ %1 BPM".arg(Math.round(maxHR())))} } }