aboutsummaryrefslogtreecommitdiff
path: root/src/stepCounter/StepCounterPreview.qml
diff options
context:
space:
mode:
authordodoradio <dodoradio@outlook.com>2023-07-20 23:48:37 +0100
committerdodoradio <dodoradio@outlook.com>2023-07-21 00:09:58 +0100
commit69ee975bf761578f59ba41b21575f7c0764b3681 (patch)
treee8b3284dfcca5951888030599f028a9db64e9b24 /src/stepCounter/StepCounterPreview.qml
parentc2632dc90160ad4457fbe65eb1dae5157254cbc7 (diff)
Add steps detail page
Currently this is a direct clone of the heartrate detail page, and isn't specialised for steps in any way
Diffstat (limited to 'src/stepCounter/StepCounterPreview.qml')
-rw-r--r--src/stepCounter/StepCounterPreview.qml92
1 files changed, 51 insertions, 41 deletions
diff --git a/src/stepCounter/StepCounterPreview.qml b/src/stepCounter/StepCounterPreview.qml
index f6a0228..3c2d3f0 100644
--- a/src/stepCounter/StepCounterPreview.qml
+++ b/src/stepCounter/StepCounterPreview.qml
@@ -23,57 +23,67 @@ import org.asteroid.sensorlogd 1.0
import "../graphs"
-Column {
+MouseArea {
+ implicitHeight: contentColumn.implicitHeight
property var weekday: ["Sun","Mon","Tue","Wed","Thu","Fri","Sat"];
+ Column {
+ id: contentColumn
+ width: parent.width
- Label {
- width: parent.width*0.8
- anchors.horizontalCenter: parent.horizontalCenter
- text: stepsDataLoader.getTodayTotal() ? "You've walked " + stepsDataLoader.todayTotal + " steps today, keep it up!" : "You haven't yet logged any steps today"
- wrapMode: Text.WordWrap
- horizontalAlignment: Text.AlignHCenter
- }
+ Label {
+ width: parent.width*0.8
+ anchors.horizontalCenter: parent.horizontalCenter
+ text: stepsDataLoader.getTodayTotal() ? "You've walked " + stepsDataLoader.todayTotal + " steps today, keep it up!" : "You haven't yet logged any steps today"
+ wrapMode: Text.WordWrap
+ horizontalAlignment: Text.AlignHCenter
+ }
- Item { width: parent.width; height: parent.width*0.1}
- Label {
- anchors {
- left: parent.left
- margins: app.width*0.1
+ Item { width: parent.width; height: parent.width*0.1}
+ Label {
+ anchors {
+ left: parent.left
+ margins: app.width*0.1
+ }
+ text: "Steps"
}
- text: "Steps"
- }
- Item { width: parent.width; height: parent.width*0.05}
+ Item { width: parent.width; height: parent.width*0.05}
- BarGraph {
- id: stepsGraph
- anchors.horizontalCenter: parent.horizontalCenter
- width: parent.width*0.85
- height: app.width*3/5
- StepsDataLoader {
- id: stepsDataLoader
- Component.onCompleted: {
- triggerDaemonRecording()
- stepsGraph.loadData()
+ BarGraph {
+ id: stepsGraph
+ anchors.horizontalCenter: parent.horizontalCenter
+ width: parent.width*0.85
+ height: app.width*3/5
+ StepsDataLoader {
+ id: stepsDataLoader
+ Component.onCompleted: {
+ triggerDaemonRecording()
+ stepsGraph.loadData()
+ }
}
- }
- function loadData() {
- var currDate = new Date()
- currDate.setDate(currDate.getDate() - 7)
- for (var i = 0; i < 7; i++) {
- currDate.setDate(currDate.getDate() + 1)
- console.log(currDate)
- var currvalue = stepsDataLoader.getTotalForDate(currDate)
- if (currvalue > 0 || valuesArr.length > 0) {
- if (currvalue > maxValue) {
- maxValue = currvalue
+ function loadData() {
+ var currDate = new Date()
+ currDate.setDate(currDate.getDate() - 7)
+ for (var i = 0; i < 7; i++) {
+ currDate.setDate(currDate.getDate() + 1)
+ console.log(currDate)
+ var currvalue = stepsDataLoader.getTotalForDate(currDate)
+ if (currvalue > 0 || valuesArr.length > 0) {
+ if (currvalue > maxValue) {
+ maxValue = currvalue
+ }
+ valuesArr.push(currvalue)
+ labelsArr.push(weekday[currDate.getDay()])
}
- valuesArr.push(currvalue)
- labelsArr.push(weekday[currDate.getDay()])
}
+ dataLoadingDone()
}
- dataLoadingDone()
+ indicatorLineHeight: loggerSettings.stepGoalEnabled ? loggerSettings.stepGoalTarget : 0
}
- indicatorLineHeight: loggerSettings.stepGoalEnabled ? loggerSettings.stepGoalTarget : 0
+ }
+ onClicked: pageStack.push(detailPage)
+ Component {
+ id: detailPage
+ StepsDetailPage {}
}
}