diff --git a/qml/cover/CoverPage.qml b/qml/cover/CoverPage.qml index b51bf61..73f6a53 100644 --- a/qml/cover/CoverPage.qml +++ b/qml/cover/CoverPage.qml @@ -30,23 +30,77 @@ import QtQuick 2.0 import Sailfish.Silica 1.0 +import Pw.Unitoo.Backend 1.0 + +import "../pages/js/helpers.js" as Helper CoverBackground { - Label { - id: label - anchors.centerIn: parent - text: qsTr("My Cover") + id: coverPage + + Column{ + width: coverPage.width + + SectionHeader { text: boxingTimer.preset } + + Label { + width: parent.width + horizontalAlignment: Text.AlignHCenter + + font.pixelSize: Theme.fontSizeHuge + text: boxingTimer.remainingTimeToString + color: boxingTimer.status === BoxingTimer.Rest ? Theme.secondaryColor : Theme.primaryColor + } + + Item { width: 25; height: 25 } + + Separator { + height: 10 + horizontalAlignment: Qt.AlignHCenter + + color: boxingTimer.isActive ? "green" : "red" + + anchors { + left: parent.left + right: parent.right + + margins: Theme.paddingMedium + } + } + + Item { width: 25; height: 25 } + + Label { + id: roundLabel + + width: parent.width + horizontalAlignment: Text.AlignHCenter + + font.pixelSize: Theme.fontSizeExtraLarge + text: boxingTimer.roundsToString + } } CoverActionList { id: coverAction CoverAction { - iconSource: "image://theme/icon-cover-next" + iconSource: "image://theme/icon-cover-refresh" + + onTriggered: boxingTimer.status = BoxingTimer.Reset } CoverAction { - iconSource: "image://theme/icon-cover-pause" + iconSource: "image://theme/icon-cover-cancel" + + onTriggered: boxingTimer.status = BoxingTimer.Stop + } + + CoverAction { + iconSource: boxingTimer.isActive ? + "image://theme/icon-cover-pause" : + "image://theme/icon-cover-play" + + onTriggered: Helper.playPauseTimer() } } } diff --git a/qml/pages/TimerPage.qml b/qml/pages/TimerPage.qml index 44bf9e3..234e7aa 100644 --- a/qml/pages/TimerPage.qml +++ b/qml/pages/TimerPage.qml @@ -31,6 +31,7 @@ import QtQuick 2.0 import Sailfish.Silica 1.0 import Pw.Unitoo.Backend 1.0 +import "js/helpers.js" as Helper Page { id: timerPage @@ -88,22 +89,24 @@ Page { } Button { - text: boxingTimer.isActive ? qsTr("Pause") : qsTr("Start") + preferredWidth: Theme.buttonWidthMedium - width: Theme.buttonWidthMedium anchors.horizontalCenter: parent.horizontalCenter - onClicked: { - if (boxingTimer.isActive) { - boxingTimer.status = BoxingTimer.Pause - } else { - boxingTimer.restore() - } - } - } + Image { + anchors { + centerIn: parent - SectionHeader { - text: qsTr("Round") + top: parent.top + bottom: parent.bottom + + margins: Theme.paddingSmall + } + + source: boxingTimer.isActive ? + "image://theme/icon-cover-pause" : + "image://theme/icon-cover-play" + } } Label { @@ -116,6 +119,13 @@ Page { text: boxingTimer.roundsToString } } + + MouseArea { + id: mouseArea + anchors.fill: parent + + onClicked: Helper.playPauseTimer() + } } } diff --git a/qml/pages/js/helpers.js b/qml/pages/js/helpers.js index c3da63a..b023710 100644 --- a/qml/pages/js/helpers.js +++ b/qml/pages/js/helpers.js @@ -3,3 +3,11 @@ function pushPresetListPage() { pageStack.pushAttached(Qt.resolvedUrl("../PresetList.qml")) } } + +function playPauseTimer() { + if (boxingTimer.isActive) { + boxingTimer.status = BoxingTimer.Pause + } else { + boxingTimer.restore() + } +}