Now cover is complete.

This commit is contained in:
Claudio Maradonna 2017-08-24 22:27:56 +02:00
parent 08cca3e186
commit 2ec663d48b
3 changed files with 90 additions and 18 deletions

View File

@ -30,23 +30,77 @@
import QtQuick 2.0 import QtQuick 2.0
import Sailfish.Silica 1.0 import Sailfish.Silica 1.0
import Pw.Unitoo.Backend 1.0
import "../pages/js/helpers.js" as Helper
CoverBackground { CoverBackground {
id: coverPage
Column{
width: coverPage.width
SectionHeader { text: boxingTimer.preset }
Label { Label {
id: label width: parent.width
anchors.centerIn: parent horizontalAlignment: Text.AlignHCenter
text: qsTr("My Cover")
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 { CoverActionList {
id: coverAction id: coverAction
CoverAction { CoverAction {
iconSource: "image://theme/icon-cover-next" iconSource: "image://theme/icon-cover-refresh"
onTriggered: boxingTimer.status = BoxingTimer.Reset
} }
CoverAction { 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()
} }
} }
} }

View File

@ -31,6 +31,7 @@
import QtQuick 2.0 import QtQuick 2.0
import Sailfish.Silica 1.0 import Sailfish.Silica 1.0
import Pw.Unitoo.Backend 1.0 import Pw.Unitoo.Backend 1.0
import "js/helpers.js" as Helper
Page { Page {
id: timerPage id: timerPage
@ -88,22 +89,24 @@ Page {
} }
Button { Button {
text: boxingTimer.isActive ? qsTr("Pause") : qsTr("Start") preferredWidth: Theme.buttonWidthMedium
width: Theme.buttonWidthMedium
anchors.horizontalCenter: parent.horizontalCenter anchors.horizontalCenter: parent.horizontalCenter
onClicked: { Image {
if (boxingTimer.isActive) { anchors {
boxingTimer.status = BoxingTimer.Pause centerIn: parent
} else {
boxingTimer.restore() top: parent.top
} bottom: parent.bottom
}
margins: Theme.paddingSmall
} }
SectionHeader { source: boxingTimer.isActive ?
text: qsTr("Round") "image://theme/icon-cover-pause" :
"image://theme/icon-cover-play"
}
} }
Label { Label {
@ -116,6 +119,13 @@ Page {
text: boxingTimer.roundsToString text: boxingTimer.roundsToString
} }
} }
MouseArea {
id: mouseArea
anchors.fill: parent
onClicked: Helper.playPauseTimer()
}
} }
} }

View File

@ -3,3 +3,11 @@ function pushPresetListPage() {
pageStack.pushAttached(Qt.resolvedUrl("../PresetList.qml")) pageStack.pushAttached(Qt.resolvedUrl("../PresetList.qml"))
} }
} }
function playPauseTimer() {
if (boxingTimer.isActive) {
boxingTimer.status = BoxingTimer.Pause
} else {
boxingTimer.restore()
}
}