stopwatchtrigger.restart()
}
+ allowResize: true
+
+ property int _maximumItems: height >= Theme.coverSizeLarge.height
+ ? 2
+ : height >= Theme.coverSizeSmall.height ? 1 : 0
+
+
Item {
id: stopwatch
property int seconds: 0
yScale: root.height / contents.height
}
- ClockView {
- id: clockView
-
- anchors {
- top: parent.top
- left: parent.left
- right: parent.right
- margins: Theme.paddingLarge
- }
- height: width
- }
+ ClockView {
+ id: clockView
- LargeItem {
- id: stopwatchView
-
- anchors {
- top: clockView.bottom
- topMargin: Theme.paddingMedium
- leftMargin: Theme.paddingLarge
- rightMargin: Theme.paddingLarge
+ anchors {
+ top: parent.top
+ left: parent.left
+ right: parent.right
+ margins: Theme.paddingLarge
+ }
+ height: width
}
- textVisible: root.update
+ LargeItem {
+ id: stopwatchView
- title: qsTr("Pedalo")
+ anchors {
+ top: clockView.bottom
+ topMargin: Theme.paddingMedium
+ leftMargin: Theme.paddingLarge
+ rightMargin: Theme.paddingLarge
+ }
- text: {
- if (stopwatch.seconds < 60) {
- return qsTr("%n seconds", "", stopwatch.seconds)
- } else if (stopwatch.seconds < 60*60) {
- return qsTr("%1 minutes").arg(Math.floor(stopwatch.seconds/60))
- } else {
- var minutes = Math.floor(stopwatch.seconds/60)
- var hours = Math.floor(minutes/60)
- minutes = minutes % 60
- return qsTrId("%1h %2min").arg(hours).arg(minutes)
+ titleVisible: ((!root.update) && _maximumItems > 0) || (_maximumItems > 1)
+ textVisible: (root.update && (_maximumItems > 0))
+
+ title: qsTr("Pedalo")
+
+ text: {
+ if (stopwatch.seconds < 60) {
+ return qsTr("%n seconds", "", stopwatch.seconds)
+ } else if (stopwatch.seconds < 60*60) {
+ return qsTr("%1 minutes").arg(Math.floor(stopwatch.seconds/60))
+ } else {
+ var minutes = Math.floor(stopwatch.seconds/60)
+ var hours = Math.floor(minutes/60)
+ minutes = minutes % 60
+ return qsTrId("%1h %2min").arg(hours).arg(minutes)
+ }
}
}
}
- }
CoverActionList {
id: coverAction
double Status::getAverageDuration() const {
quint64 time = getTimeSpentCycling();
quint64 count = Status::getJourneyCount();
+ double average = 0.0;
- return ((double)time / (double)count);
+ if (count > 0) {
+ average = ((double)time / (double)count);
+ }
+ else {
+ average = 0.0;
+ }
+
+ return average;
}
double Status::getSpeedPercentile() const {
overtakenby += journey.getOvertakenBy();
}
- percentile = (double)overtook / (double)(overtook + overtakenby);
+ if (overtook + overtakenby > 0.0) {
+ percentile = (double)overtook / (double)(overtook + overtakenby);
+ }
+ else {
+ percentile = 0.0;
+ }
return percentile;
}
}
}
+ if (formatted == "") {
+ formatted = "None";
+ }
+
return formatted;
}
<source>About Pedalo</source>
<translation type="unfinished"></translation>
</message>
- <message>
- <source>Compare your pedalo performance with others</source>
- <translation type="unfinished"></translation>
- </message>
<message>
<source>Version:</source>
<translation type="unfinished"></translation>
<source>Email</source>
<translation type="unfinished"></translation>
</message>
+ <message>
+ <source>Compare your relative pedalo performance with others in a privacy-preserving way</source>
+ <translation type="unfinished"></translation>
+ </message>
</context>
<context>
<name>CoverPage</name>
<source>About Pedalo</source>
<translation type="unfinished"></translation>
</message>
- <message>
- <source>Compare your pedalo performance with others</source>
- <translation type="unfinished"></translation>
- </message>
<message>
<source>Version:</source>
<translation type="unfinished"></translation>
<source>Email</source>
<translation type="unfinished"></translation>
</message>
+ <message>
+ <source>Compare your relative pedalo performance with others in a privacy-preserving way</source>
+ <translation type="unfinished"></translation>
+ </message>
</context>
<context>
<name>CoverPage</name>