Display overall statistics
[harbour-pedalo.git] / qml / pages / DurationEditDialog.qml
1 import QtQuick 2.0
2 import Sailfish.Silica 1.0
3 //import "editdialog"
4 //import "../common"
5
6 // Amended version of /usr/share/jolla-clock/pages/ClockEditDialog.qml
7 Dialog {
8     id: dialog
9
10     property alias hour: timePicker.hour
11     property alias minute: timePicker.minute
12
13     property Item timePicker: timePicker
14     //: Can have two values: "LTR" if remaining time in timer item should be written in "[value] [unit]" order i.e. "2 min", or "RTL" i.e. right-to-left like in Arabic writing systems
15     property bool leftToRight: qsTr("LTR") !== "RTL"
16
17     canAccept: true
18
19     // The effective value will be restricted by ApplicationWindow.allowedOrientations
20     allowedOrientations: Orientation.All
21
22     SilicaFlickable {
23         anchors.fill: parent
24         contentHeight: column.height
25         flickableDirection: Flickable.VerticalFlick
26
27         Column {
28             id: column
29
30             width: parent.width
31             spacing: Theme.paddingLarge
32
33             DialogHeader {
34                 id: header
35             }
36             Item {
37                 height: childrenRect.height
38                 width: parent.width
39                 TimePicker {
40                     id: timePicker
41                     anchors.horizontalCenter: parent.horizontalCenter
42                     // otherwise in 12h mode this caused timer 00:00 to display as 12:00am
43                     hourMode: DateTime.TwentyFourHours
44
45                     Column {
46                         id: timerLabelColumn
47                         anchors.centerIn: parent
48
49                         spacing: -Theme.paddingMedium
50                         Row {
51                             spacing: Theme.paddingSmall
52                             anchors.horizontalCenter: parent.horizontalCenter
53                             layoutDirection: leftToRight ? Qt.LeftToRight : Qt.RightToLeft
54                             Label {
55                                 id: hours
56                                 text: timePicker.hour.toLocaleString()
57                                 font.pixelSize: Theme.fontSizeHuge
58                                 height: Math.min(implicitHeight, (timePicker.height*0.4 - timerLabelColumn.spacing)/2)
59                                 fontSizeMode: Text.VerticalFit
60                             }
61                             Label {
62                                 id: hoursLabel
63                                 //: "Hour abbrevation. Should be short form if possible."
64                                 text: qsTr("h")
65                                 anchors.baseline: hours.baseline
66                                 opacity: 0.7
67                             }
68                         }
69                         Row {
70                             spacing: Theme.paddingSmall
71                             anchors.horizontalCenter: parent.horizontalCenter
72                             layoutDirection: leftToRight ? Qt.LeftToRight : Qt.RightToLeft
73                             Label {
74                                 id: minutes
75                                 text: timePicker.minute.toLocaleString()
76                                 font.pixelSize: Theme.fontSizeHuge
77                                 height: Math.min(implicitHeight, (timePicker.height*0.4 - timerLabelColumn.spacing)/2)
78                                 fontSizeMode: Text.VerticalFit
79                             }
80                             Label {
81                                 id: minuteLabel
82                                 //: "Minute abbrevation. Should be short form if possible."
83                                 text: qsTr("min")
84                                 anchors.baseline: minutes.baseline
85                                 verticalAlignment: Text.AlignBottom
86                                 opacity: 0.7
87                             }
88                         }
89                     }
90                 }
91             }
92         }
93     }
94 }