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 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()
}
}
}

View File

@ -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()
}
}
}

View File

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