First commit
This commit is contained in:
53
qml/cover/CoverPage.qml
Normal file
53
qml/cover/CoverPage.qml
Normal file
@@ -0,0 +1,53 @@
|
||||
/*
|
||||
Copyright (C) 2013 Jolla Ltd.
|
||||
Contact: Thomas Perl <thomas.perl@jollamobile.com>
|
||||
All rights reserved.
|
||||
|
||||
You may use this file under the terms of BSD license as follows:
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
* Neither the name of the Jolla Ltd nor the
|
||||
names of its contributors may be used to endorse or promote products
|
||||
derived from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR
|
||||
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
import QtQuick 2.0
|
||||
import Sailfish.Silica 1.0
|
||||
|
||||
CoverBackground {
|
||||
Label {
|
||||
id: label
|
||||
anchors.centerIn: parent
|
||||
text: qsTr("My Cover")
|
||||
}
|
||||
|
||||
CoverActionList {
|
||||
id: coverAction
|
||||
|
||||
CoverAction {
|
||||
iconSource: "image://theme/icon-cover-next"
|
||||
}
|
||||
|
||||
CoverAction {
|
||||
iconSource: "image://theme/icon-cover-pause"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
58
qml/harbour-boxing-timer.qml
Normal file
58
qml/harbour-boxing-timer.qml
Normal file
@@ -0,0 +1,58 @@
|
||||
/*
|
||||
Copyright (C) 2013 Jolla Ltd.
|
||||
Contact: Thomas Perl <thomas.perl@jollamobile.com>
|
||||
All rights reserved.
|
||||
|
||||
You may use this file under the terms of BSD license as follows:
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
* Neither the name of the Jolla Ltd nor the
|
||||
names of its contributors may be used to endorse or promote products
|
||||
derived from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR
|
||||
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
import QtQuick 2.0
|
||||
import Sailfish.Silica 1.0
|
||||
import Pw.Unitoo.Backend 1.0
|
||||
import "pages"
|
||||
|
||||
ApplicationWindow {
|
||||
BoxingTimer {
|
||||
id: boxingTimer
|
||||
}
|
||||
|
||||
BoxingSettings {
|
||||
id: settings
|
||||
|
||||
onPresetChanged: {
|
||||
boxingTimer.loadPreset(preset)
|
||||
boxingTimer.status = BoxingTimer.Stop
|
||||
}
|
||||
}
|
||||
|
||||
initialPage: firstPage
|
||||
cover: Qt.resolvedUrl("cover/CoverPage.qml")
|
||||
allowedOrientations: Orientation.Portrait
|
||||
|
||||
TimerPage {
|
||||
id: firstPage
|
||||
}
|
||||
}
|
||||
|
6
qml/pages/AboutPage.qml
Normal file
6
qml/pages/AboutPage.qml
Normal file
@@ -0,0 +1,6 @@
|
||||
import QtQuick 2.2
|
||||
import Sailfish.Silica 1.0
|
||||
|
||||
Page {
|
||||
|
||||
}
|
58
qml/pages/PresetList.qml
Normal file
58
qml/pages/PresetList.qml
Normal file
@@ -0,0 +1,58 @@
|
||||
import QtQuick 2.2
|
||||
import Sailfish.Silica 1.0
|
||||
|
||||
Page {
|
||||
onStatusChanged: {
|
||||
if (status === PageStatus.Activating) {
|
||||
var list = settings.presetsList()
|
||||
for(var key in list) {
|
||||
listModel.append({ name: list[key] });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Column {
|
||||
PageHeader { title: qsTr("Saved presets") }
|
||||
|
||||
width: parent.width
|
||||
spacing: Theme.paddingLarge
|
||||
|
||||
SilicaListView {
|
||||
id: presetsList
|
||||
|
||||
width: parent.width; height: 800
|
||||
|
||||
model: listModel
|
||||
|
||||
delegate: BackgroundItem {
|
||||
width: parent.width
|
||||
height: Theme.itemSizeSmall
|
||||
|
||||
onClicked: {
|
||||
settings.preset = presetsList.model.get(index).name
|
||||
|
||||
pageStack.pop(firstPage)
|
||||
}
|
||||
|
||||
Label {
|
||||
text: name
|
||||
|
||||
color: highlighted ? Theme.highlightColor : Theme.primaryColor
|
||||
|
||||
anchors {
|
||||
left: parent.left
|
||||
right: parent.right
|
||||
|
||||
verticalCenter: parent.verticalCenter
|
||||
|
||||
margins: Theme.paddingLarge
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ListModel {
|
||||
id: listModel
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
155
qml/pages/SettingsPage.qml
Normal file
155
qml/pages/SettingsPage.qml
Normal file
@@ -0,0 +1,155 @@
|
||||
/*
|
||||
Copyright (C) 2013 Jolla Ltd.
|
||||
Contact: Thomas Perl <thomas.perl@jollamobile.com>
|
||||
All rights reserved.
|
||||
|
||||
You may use this file under the terms of BSD license as follows:
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
* Neither the name of the Jolla Ltd nor the
|
||||
names of its contributors may be used to endorse or promote products
|
||||
derived from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR
|
||||
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
import QtQuick 2.2
|
||||
import Sailfish.Silica 1.0
|
||||
import Pw.Unitoo.Backend 1.0
|
||||
|
||||
import "js/converter.js" as Converter
|
||||
|
||||
Page {
|
||||
id: settingsPage
|
||||
|
||||
allowedOrientations: Orientation.Portrait
|
||||
|
||||
property string mPreset: settings.preset
|
||||
|
||||
property string mPresetName: settings.presetName
|
||||
property int mRounds: settings.rounds
|
||||
property int mRoundMs: settings.roundsMs
|
||||
property int mRestMs: settings.restMs
|
||||
|
||||
function pushPopPresetListPage() {
|
||||
if (settings.presetsList().length > 0) {
|
||||
pageStack.pushAttached(Qt.resolvedUrl("PresetList.qml"))
|
||||
} else {
|
||||
pageStack.popAttached()
|
||||
}
|
||||
}
|
||||
|
||||
onStatusChanged: {
|
||||
if (status === PageStatus.Active) {
|
||||
pushPopPresetListPage();
|
||||
}
|
||||
}
|
||||
|
||||
SilicaFlickable {
|
||||
anchors.fill: parent
|
||||
|
||||
PullDownMenu {
|
||||
MenuItem {
|
||||
text: qsTr("Save")
|
||||
|
||||
onClicked: {
|
||||
settings.savePreset(
|
||||
presetName.text,
|
||||
roundsSlider.value,
|
||||
roundsTimeSlider.value,
|
||||
Converter.sToMs(restSlider.value)
|
||||
)
|
||||
|
||||
pushPopPresetListPage();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
PushUpMenu {
|
||||
MenuItem {
|
||||
text: qsTr("Delete")
|
||||
onClicked: {
|
||||
settings.deletePreset(presetName.text)
|
||||
|
||||
pushPopPresetListPage();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
contentHeight: settingsColumn.height
|
||||
|
||||
Column {
|
||||
id: settingsColumn
|
||||
|
||||
width: settingsPage.width
|
||||
spacing: Theme.paddingLarge
|
||||
|
||||
PageHeader { title: qsTr("Settings") }
|
||||
|
||||
SectionHeader { text: qsTr("Round's settings") }
|
||||
|
||||
TextField {
|
||||
id: presetName
|
||||
|
||||
width: parent.width
|
||||
|
||||
label: qsTr("Preset name")
|
||||
text: mPresetName
|
||||
}
|
||||
|
||||
Slider {
|
||||
id: roundsTimeSlider
|
||||
|
||||
width: parent.width
|
||||
|
||||
minimumValue: Converter.sToMs(30); maximumValue: Converter.sToMs(300); stepSize: Converter.sToMs(10)
|
||||
|
||||
value: mRoundMs
|
||||
valueText: Converter.msToTime(value)
|
||||
|
||||
label: qsTr("Duration")
|
||||
}
|
||||
|
||||
Slider {
|
||||
id: restSlider
|
||||
|
||||
width: parent.width
|
||||
|
||||
minimumValue: 5; maximumValue: 60; stepSize: 5
|
||||
|
||||
value: Converter.msToS(mRestMs)
|
||||
valueText: value + "s"
|
||||
|
||||
label: qsTr("Rest")
|
||||
}
|
||||
|
||||
Slider {
|
||||
id: roundsSlider
|
||||
|
||||
width: parent.width
|
||||
|
||||
minimumValue: 0; maximumValue: 15; stepSize: 1
|
||||
|
||||
value: mRounds
|
||||
valueText: value
|
||||
|
||||
label: qsTr("Total rounds")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
124
qml/pages/TimerPage.qml
Normal file
124
qml/pages/TimerPage.qml
Normal file
@@ -0,0 +1,124 @@
|
||||
/*
|
||||
Copyright (C) 2013 Jolla Ltd.
|
||||
Contact: Thomas Perl <thomas.perl@jollamobile.com>
|
||||
All rights reserved.
|
||||
|
||||
You may use this file under the terms of BSD license as follows:
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
* Neither the name of the Jolla Ltd nor the
|
||||
names of its contributors may be used to endorse or promote products
|
||||
derived from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR
|
||||
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
import QtQuick 2.0
|
||||
import Sailfish.Silica 1.0
|
||||
import Pw.Unitoo.Backend 1.0
|
||||
|
||||
Page {
|
||||
id: timerPage
|
||||
|
||||
allowedOrientations: Orientation.Portrait
|
||||
|
||||
SilicaFlickable {
|
||||
anchors.fill: parent
|
||||
|
||||
// PullDownMenu and PushUpMenu must be declared in SilicaFlickable, SilicaListView or SilicaGridView
|
||||
PullDownMenu {
|
||||
MenuItem {
|
||||
text: qsTr("About")
|
||||
onClicked: pageStack.push(Qt.resolvedUrl("AboutPage.qml"))
|
||||
}
|
||||
|
||||
MenuItem {
|
||||
text: qsTr("Settings")
|
||||
onClicked: {
|
||||
boxingTimer.status = BoxingTimer.Pause
|
||||
|
||||
pageStack.push(Qt.resolvedUrl("SettingsPage.qml"))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
PushUpMenu {
|
||||
MenuItem {
|
||||
text: qsTr("Stop")
|
||||
onClicked: boxingTimer.status = BoxingTimer.Stop
|
||||
}
|
||||
MenuItem {
|
||||
text: qsTr("Reset")
|
||||
onClicked: boxingTimer.status = BoxingTimer.Reset
|
||||
}
|
||||
}
|
||||
|
||||
contentHeight: column.height
|
||||
|
||||
Column {
|
||||
id: column
|
||||
|
||||
width: timerPage.width
|
||||
spacing: Theme.paddingLarge
|
||||
|
||||
PageHeader { title: qsTr("Boxing timer") }
|
||||
SectionHeader { text: boxingTimer.preset }
|
||||
|
||||
Label {
|
||||
id: labelTimer
|
||||
|
||||
width: parent.width
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
|
||||
font.pixelSize: 244
|
||||
text: boxingTimer.remainingTimeToString
|
||||
color: boxingTimer.status == BoxingTimer.Rest ? Theme.secondaryColor : Theme.primaryColor
|
||||
}
|
||||
|
||||
Button {
|
||||
text: boxingTimer.isActive ? qsTr("Pause") : qsTr("Start")
|
||||
|
||||
width: Theme.buttonWidthMedium
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
|
||||
onClicked: {
|
||||
if (boxingTimer.isActive) {
|
||||
boxingTimer.status = BoxingTimer.Pause
|
||||
} else {
|
||||
boxingTimer.restore()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
SectionHeader {
|
||||
text: qsTr("Round")
|
||||
}
|
||||
|
||||
Label {
|
||||
id: roundLabel
|
||||
|
||||
width: parent.width
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
|
||||
font.pixelSize: 196
|
||||
text: boxingTimer.roundsToString
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
25
qml/pages/js/converter.js
Normal file
25
qml/pages/js/converter.js
Normal file
@@ -0,0 +1,25 @@
|
||||
function msToS(ms) {
|
||||
return ms / 1000;
|
||||
}
|
||||
|
||||
function sToMs(s) {
|
||||
return s * 1000;
|
||||
}
|
||||
|
||||
function msToTime(ms) {
|
||||
var d = new Date(ms);
|
||||
var s = "";
|
||||
|
||||
var minutes = d.getMinutes();
|
||||
var seconds = d.getSeconds();
|
||||
|
||||
if (minutes > 0) {
|
||||
s += minutes + "m ";
|
||||
}
|
||||
|
||||
if (seconds > 0) {
|
||||
s += seconds + "s";
|
||||
}
|
||||
|
||||
return s;
|
||||
}
|
Reference in New Issue
Block a user