65
objectName: "labelStopwatch"
67
anchors { left: parent.left; top: parent.top; topMargin: units.gu(5); right: parent.right }
69
horizontalAlignment: Text.AlignHCenter
70
verticalAlignment: Text.AlignVCenter
73
text: labelStopwatch.text = SScript.intervalToString(analogStopwatch.hours, analogStopwatch.minutes, analogStopwatch.seconds, analogStopwatch.milliseconds)
76
61
// Items within this container will move up/down depending on the state.
77
62
AnimationContainer {
78
63
id: stopwatchAnimationContainer
80
65
// FIXME: The y is given a arbitary value which needs to be fixed by ensuring that the outerglow is not drawn outside the clock face area.
81
initYPos: units.gu(5);
82
finalYPos: -listLap.height;
84
anchors { left: parent.left; top: labelStopwatch.bottom; right: parent.right; bottom: parent.bottom }
66
initYPos: units.gu(0);
67
finalYPos: -listViewLap.height;
71
// Label to show the current time
75
z: analogStopwatch.z + 1;
76
width: analogStopwatch.innerDimension; height: width;
77
anchors.centerIn: analogStopwatch;
82
objectName: "labelStopwatch"
84
anchors.centerIn: parent
85
horizontalAlignment: Text.AlignHCenter
86
verticalAlignment: Text.AlignVCenter
87
color: Constants.brightWhite;
90
text: labelStopwatch.text = SScript.intervalToString(analogStopwatch.hours, analogStopwatch.minutes, analogStopwatch.seconds, analogStopwatch.milliseconds)
86
94
// Component which draws the analog stopwatch face, controls the timer and calculates the time.
88
96
id: analogStopwatch
90
anchors { top: parent.top; horizontalCenter: parent.horizontalCenter }
93
// Bottom row to display Start, Reset buttons and lap information.
95
id: rowButtonStopwatch
98
anchors { top: analogStopwatch.bottom; topMargin: units.gu(8); horizontalCenter: parent.horizontalCenter }
99
height: childrenRect.height
103
objectName: "buttonStopwatch"
105
width: units.gu(12); height: units.gu(5)
107
color: Constants.green
108
text: i18n.tr("Start")
111
if(analogStopwatch.timerStatus == false) {
112
analogStopwatch.start()
113
stopWatchLabelUpdate.start()
114
if (analogStopwatch.flag) {
115
analogStopwatch.startTime = SScript.timeToMs(new Date());
116
analogStopwatch.flag = false;
119
analogStopwatch.delay = Math.abs(SScript.timeToMs(new Date()) - analogStopwatch.stopTime);
120
console.log(analogStopwatch.startTime + "| " + analogStopwatch.delay);
121
analogStopwatch.startTime = analogStopwatch.startTime + analogStopwatch.delay;
122
console.log(analogStopwatch.startTime);
124
text = i18n.tr("Stop");
125
color = Constants.ubuntuOrange;
126
buttonReset.state = "LAP";
128
analogStopwatch.stop()
129
stopWatchLabelUpdate.stop()
130
analogStopwatch.stopTime = SScript.timeToMs(new Date());
131
console.log(analogStopwatch.stopTime)
132
text = i18n.tr("Start");
133
color = Constants.green;
134
buttonReset.state = "RESET";
141
objectName: "lapCount"
143
anchors.verticalCenter: buttonStopwatch.verticalCenter
144
color: Constants.brightWhite
145
textColor: Constants.ubuntuOrange
146
text: Utils.numberToLocaleString(laps.count)
148
onClicked: stopwatchAnimationContainer.swipeView()
153
objectName: "lapButton"
155
width: units.gu(12); height: units.gu(5)
156
color: Constants.normalGrey
157
text: i18n.tr("Reset")
160
if(buttonReset.state == "RESET") {
161
analogStopwatch.reset();
162
labelStopwatch.text = SScript.intervalToString(0, 0, 0, 0);
165
} else if (buttonReset.state == "LAP") {
167
analogStopwatch.blipLocation = analogStopwatch.seconds
168
analogStopwatch.blipVisible = true
175
PropertyChanges { target: buttonReset; text: i18n.tr("Reset") }
176
PropertyChanges { target: buttonReset; color: Constants.normalGrey }
181
PropertyChanges { target: buttonReset; text: i18n.tr("Lap") }
182
PropertyChanges { target: buttonReset; color: Constants.brightWhite }
98
anchors { top: parent.top; topMargin: units.gu(9); horizontalCenter: parent.horizontalCenter }
100
if(analogStopwatch.timerStatus == false) {
101
analogStopwatch.start()
102
stopWatchLabelUpdate.start()
103
if (analogStopwatch.flag) {
104
analogStopwatch.startTime = SScript.timeToMs(new Date());
105
analogStopwatch.flag = false;
108
analogStopwatch.delay = Math.abs(SScript.timeToMs(new Date()) - analogStopwatch.stopTime);
109
analogStopwatch.startTime = analogStopwatch.startTime + analogStopwatch.delay;
112
analogStopwatch.stop()
113
stopWatchLabelUpdate.stop()
114
analogStopwatch.stopTime = SScript.timeToMs(new Date());
122
anchors { top: analogStopwatch.bottom; topMargin: units.gu(4); left: parent.left; leftMargin: units.gu(4) }
123
buttonImage: Qt.resolvedUrl("../images/add_icon.png");
124
buttonLabel: i18n.tr("Reset");
126
activated: analogStopwatch.timerStatus == false ? true : false;
129
analogStopwatch.reset();
130
labelStopwatch.text = SScript.intervalToString(0, 0, 0, 0);
139
anchors { top: analogStopwatch.bottom; topMargin: units.gu(4); right: parent.right; rightMargin: units.gu(4) }
140
buttonImage: Qt.resolvedUrl("../images/add_icon.png");
141
buttonLabel: i18n.tr("Lap");
144
activated: analogStopwatch.timerStatus == true ? true : false;
148
analogStopwatch.blipLocation = analogStopwatch.seconds
149
analogStopwatch.blipVisible = true