39ccc793dad31a6b5bca016287d4b52dcdda8dc9
[harbour-pedalo.git] / qml / pages / Stats.qml
1 import QtQuick 2.0
2 import Sailfish.Silica 1.0
3 import "../components"
4
5 Page {
6     id: statsPage
7
8     // The effective value will be restricted by ApplicationWindow.allowedOrientations
9     allowedOrientations: Orientation.All
10
11     SilicaFlickable {
12         id: statsView
13         anchors.fill: parent
14         contentHeight: statsColumn.implicitHeight + headerItem.height
15
16         VerticalScrollDecorator {}
17
18         PageHeader {
19             id: headerItem
20             title: qsTr("Stats")
21         }
22
23         Column {
24             id: statsColumn
25             spacing: Theme.paddingLarge
26             width: isPortrait ? parent.width : parent.width * 0.5
27             y: headerItem.height
28
29             InfoRow {
30                 label: qsTr("Journeys:")
31                 value: currentStatus.getJourneyCount()
32                 midlineRatio: 0.7
33                 midlineMin: Theme.fontSizeSmall * 10
34                 midlineMax: Theme.fontSizeSmall * 20
35                 pixelSize: Theme.fontSizeMedium
36                 labelTextBold: true
37                 horizontalAlignment: Text.AlignRight
38             }
39
40             InfoRow {
41                 label: qsTr("Time spent cycling:")
42                 value: currentStatus.getFormattedTime(currentStatus.getTimeSpentCycling(), 0, 5)
43                 midlineRatio: 0.5
44                 midlineMin: Theme.fontSizeSmall * 10
45                 midlineMax: Theme.fontSizeSmall * 20
46                 pixelSize: Theme.fontSizeMedium
47                 labelTextBold: true
48                 horizontalAlignment: Text.AlignRight
49             }
50
51             InfoRow {
52                 label: qsTr("Average journey duration:")
53                 value: currentStatus.getFormattedTime(currentStatus.getAverageDuration(), 1, 5)
54                 midlineRatio: 0.6
55                 midlineMin: Theme.fontSizeSmall * 10
56                 midlineMax: Theme.fontSizeSmall * 20
57                 pixelSize: Theme.fontSizeMedium
58                 labelTextBold: true
59                 horizontalAlignment: Text.AlignRight
60             }
61
62             InfoRow {
63                 label: qsTr("Speed percentile:")
64                 value: Math.round(100.0 - currentStatus.getSpeedPercentile() * 100) + "%"
65                 midlineRatio: 0.7
66                 midlineMin: Theme.fontSizeSmall * 10
67                 midlineMax: Theme.fontSizeSmall * 20
68                 pixelSize: Theme.fontSizeMedium
69                 labelTextBold: true
70                 horizontalAlignment: Text.AlignRight
71             }
72         }
73     }
74 }