summaryrefslogtreecommitdiff
path: root/src/components/qt_hmi/qml_model_qt5/models/MediaClockModel.qml
diff options
context:
space:
mode:
Diffstat (limited to 'src/components/qt_hmi/qml_model_qt5/models/MediaClockModel.qml')
-rw-r--r--src/components/qt_hmi/qml_model_qt5/models/MediaClockModel.qml37
1 files changed, 22 insertions, 15 deletions
diff --git a/src/components/qt_hmi/qml_model_qt5/models/MediaClockModel.qml b/src/components/qt_hmi/qml_model_qt5/models/MediaClockModel.qml
index 3712ca4c31..cae82c36f1 100644
--- a/src/components/qt_hmi/qml_model_qt5/models/MediaClockModel.qml
+++ b/src/components/qt_hmi/qml_model_qt5/models/MediaClockModel.qml
@@ -73,22 +73,28 @@ QtObject {
function onTimer () {
switch (updateMode) {
case Internal.MediaClockUpdateMode.MCU_COUNTUP:
- console.debug("count up")
- if (startTime < endTime) {
- startTime++
+ if (endTime !== -1) {
+ if (startTime < endTime) {
+ startTime++
+ } else {
+ timer.stop()
+ runningMode = Internal.MediaClockRunningMode.MCR_STOPPED
+ console.debug("count Up timer stopped")
+ }
} else {
- timer.stop()
- runningMode = Internal.MediaClockRunningMode.MCR_STOPPED
- console.debug("count Up timer stopped")
+ if (startTime < upperTimeLimit) {
+ startTime++
+ } else {
+ startTime = 0
+ }
}
break
case Internal.MediaClockUpdateMode.MCU_COUNTDOWN:
console.debug("count down")
- if (startTime > endTime) {
- startTime--
- } else {
+ if (--startTime === 0) {
timer.stop()
runningMode = Internal.MediaClockRunningMode.MCR_STOPPED
+ startTime = endTime = -1
console.debug("count Down timer stopped")
}
break
@@ -106,12 +112,13 @@ QtObject {
function onProgress () {
if (startTime === -1) {
progress = 0
- }
- else if (endTime != -1 && endTime === startTimeForProgress) {
- progress = 1
- }
- else {
- progress = (startTime - startTimeForProgress) / (endTime - startTimeForProgress)
+ } else {
+ if (updateMode === Internal.MediaClockUpdateMode.MCU_COUNTUP) {
+ progress = (endTime !== -1) ? (startTime / endTime) : (startTime / upperTimeLimit)
+ } else {
+ progress = (endTime !== -1) ? ( (startTime - endTime) / (startTimeForProgress - endTime) )
+ : (startTime / startTimeForProgress)
+ }
}
}
}