Now about page is good. Fixed BUG with play of bells
This commit is contained in:
parent
01d5dd2f9c
commit
08cca3e186
|
@ -37,7 +37,8 @@ DISTFILES += \
|
|||
qml/pages/PresetList.qml \
|
||||
qml/pages/AboutPage.qml \
|
||||
COPYING \
|
||||
rpm/harbour-boxing-timer.changes
|
||||
rpm/harbour-boxing-timer.changes \
|
||||
qml/pages/js/helpers.js
|
||||
|
||||
HEADERS += \
|
||||
src/boxingtimer.h \
|
||||
|
|
|
@ -30,7 +30,6 @@
|
|||
|
||||
import QtQuick 2.0
|
||||
import Sailfish.Silica 1.0
|
||||
import QtMultimedia 5.0
|
||||
import Pw.Unitoo.Backend 1.0
|
||||
import "pages"
|
||||
|
||||
|
@ -42,10 +41,7 @@ ApplicationWindow {
|
|||
BoxingSettings {
|
||||
id: settings
|
||||
|
||||
onPresetChanged: {
|
||||
boxingTimer.loadPreset(preset)
|
||||
boxingTimer.status = BoxingTimer.Stop
|
||||
}
|
||||
onPresetChanged: boxingTimer.loadPreset(preset)
|
||||
}
|
||||
|
||||
initialPage: firstPage
|
||||
|
|
|
@ -2,5 +2,126 @@ import QtQuick 2.2
|
|||
import Sailfish.Silica 1.0
|
||||
|
||||
Page {
|
||||
id: aboutPage
|
||||
|
||||
SilicaFlickable {
|
||||
anchors.fill: parent
|
||||
|
||||
contentHeight: column.height
|
||||
|
||||
Column {
|
||||
id: column
|
||||
|
||||
width: aboutPage.width
|
||||
|
||||
spacing: Theme.paddingLarge
|
||||
|
||||
PageHeader { title: qsTr("About") }
|
||||
|
||||
Label {
|
||||
anchors {
|
||||
left: parent.left
|
||||
right: parent.right
|
||||
|
||||
leftMargin: Theme.paddingLarge
|
||||
rightMargin: Theme.paddingLarge
|
||||
}
|
||||
|
||||
wrapMode: Text.Wrap
|
||||
|
||||
font.pixelSize: Theme.fontSizeSmall
|
||||
text: qsTr("
|
||||
\"Boxing Timer\" is a customizable timer for fighting sports like boxe.
|
||||
|
||||
You can set duration, rest and number of rounds. If you set 0 rounds, timer loops and count number of rounds.
|
||||
|
||||
You can save, load and delete your settings giving a name to them.
|
||||
")
|
||||
}
|
||||
|
||||
SectionHeader { text: qsTr("Developers") }
|
||||
Label {
|
||||
anchors {
|
||||
left: parent.left
|
||||
right: parent.right
|
||||
|
||||
leftMargin: Theme.paddingLarge
|
||||
rightMargin: Theme.paddingLarge
|
||||
}
|
||||
|
||||
wrapMode: Text.Wrap
|
||||
|
||||
font.pixelSize: Theme.fontSizeSmall
|
||||
text: qsTr("
|
||||
Copyright (C) 2017 Claudio Maradonna
|
||||
Unitoo Team, Italy
|
||||
")
|
||||
}
|
||||
|
||||
Repeater {
|
||||
model: ListModel {
|
||||
ListElement { label: "Email" ; value: "claudio@unitoo.pw" }
|
||||
ListElement { label: "Diaspora" ; value: "claudiounitoo@framasphere.org" }
|
||||
ListElement { label: "Mastodon" ; value: "@unitoo" }
|
||||
ListElement { label: "XMPP" ; value: "unitoo@fysh.in" }
|
||||
}
|
||||
|
||||
delegate: Row {
|
||||
width: aboutPage.width
|
||||
|
||||
spacing: Theme.paddingLarge
|
||||
|
||||
Label {
|
||||
width: parent.width * 0.2; height: 25
|
||||
|
||||
font.pixelSize: Theme.fontSizeTiny
|
||||
text: label
|
||||
|
||||
horizontalAlignment: Text.AlignRight
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
|
||||
color: Theme.secondaryColor
|
||||
}
|
||||
|
||||
Label {
|
||||
height: 30
|
||||
|
||||
font.pixelSize: Theme.fontSizeSmall
|
||||
text: value
|
||||
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
SectionHeader { text: qsTr("License") }
|
||||
Label {
|
||||
anchors {
|
||||
left: parent.left
|
||||
right: parent.right
|
||||
|
||||
leftMargin: Theme.paddingLarge
|
||||
rightMargin: Theme.paddingLarge
|
||||
}
|
||||
|
||||
wrapMode: Text.Wrap
|
||||
|
||||
font.pixelSize: Theme.fontSizeSmall
|
||||
text: qsTr("
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
import QtQuick 2.2
|
||||
import Sailfish.Silica 1.0
|
||||
|
||||
import "js/helpers.js" as Helper
|
||||
|
||||
Page {
|
||||
onStatusChanged: {
|
||||
if (status === PageStatus.Activating) {
|
||||
|
@ -14,19 +16,19 @@ Page {
|
|||
Column {
|
||||
PageHeader { title: qsTr("Saved presets") }
|
||||
|
||||
width: parent.width
|
||||
width: parent.width; height: parent.height
|
||||
|
||||
spacing: Theme.paddingLarge
|
||||
|
||||
SilicaListView {
|
||||
id: presetsList
|
||||
|
||||
width: parent.width; height: 800
|
||||
width: parent.width; height: parent.height
|
||||
|
||||
model: listModel
|
||||
|
||||
delegate: BackgroundItem {
|
||||
delegate: ListItem {
|
||||
width: parent.width
|
||||
height: Theme.itemSizeSmall
|
||||
|
||||
onClicked: {
|
||||
settings.preset = presetsList.model.get(index).name
|
||||
|
@ -34,6 +36,20 @@ Page {
|
|||
pageStack.pop(firstPage)
|
||||
}
|
||||
|
||||
menu: ContextMenu {
|
||||
MenuItem {
|
||||
text: qsTr("Delete")
|
||||
|
||||
onClicked: {
|
||||
settings.deletePreset(presetsList.model.get(index).name)
|
||||
|
||||
if (settings.presetsList().length < 1) {
|
||||
pageStack.popAttached()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Label {
|
||||
text: name
|
||||
|
||||
|
|
|
@ -33,6 +33,7 @@ import Sailfish.Silica 1.0
|
|||
import Pw.Unitoo.Backend 1.0
|
||||
|
||||
import "js/converter.js" as Converter
|
||||
import "js/helpers.js" as Helper
|
||||
|
||||
Page {
|
||||
id: settingsPage
|
||||
|
@ -46,17 +47,9 @@ Page {
|
|||
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();
|
||||
Helper.pushPresetListPage();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -75,18 +68,9 @@ Page {
|
|||
Converter.sToMs(restSlider.value)
|
||||
)
|
||||
|
||||
pushPopPresetListPage();
|
||||
}
|
||||
}
|
||||
}
|
||||
boxingTimer.loadPreset(presetName.text)
|
||||
|
||||
PushUpMenu {
|
||||
MenuItem {
|
||||
text: qsTr("Delete")
|
||||
onClicked: {
|
||||
settings.deletePreset(presetName.text)
|
||||
|
||||
pushPopPresetListPage();
|
||||
Helper.pushPresetListPage();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -40,7 +40,6 @@ Page {
|
|||
SilicaFlickable {
|
||||
anchors.fill: parent
|
||||
|
||||
// PullDownMenu and PushUpMenu must be declared in SilicaFlickable, SilicaListView or SilicaGridView
|
||||
PullDownMenu {
|
||||
MenuItem {
|
||||
text: qsTr("About")
|
||||
|
@ -80,12 +79,10 @@ Page {
|
|||
SectionHeader { text: boxingTimer.preset }
|
||||
|
||||
Label {
|
||||
id: labelTimer
|
||||
|
||||
width: parent.width
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
|
||||
font.pixelSize: 244
|
||||
font.pixelSize: Theme.fontSizeHuge * 3.3
|
||||
text: boxingTimer.remainingTimeToString
|
||||
color: boxingTimer.status == BoxingTimer.Rest ? Theme.secondaryColor : Theme.primaryColor
|
||||
}
|
||||
|
@ -115,7 +112,7 @@ Page {
|
|||
width: parent.width
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
|
||||
font.pixelSize: 196
|
||||
font.pixelSize: Theme.fontSizeHuge * 2.6
|
||||
text: boxingTimer.roundsToString
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
function pushPresetListPage() {
|
||||
if (settings.presetsList().length > 0) {
|
||||
pageStack.pushAttached(Qt.resolvedUrl("../PresetList.qml"))
|
||||
}
|
||||
}
|
|
@ -15,6 +15,10 @@ BoxingTimer::BoxingTimer() :
|
|||
this->settings = new BoxingSettings();
|
||||
this->mRemainingMilliseconds = settings->getRoundMilliseconds();
|
||||
|
||||
this->playBell = new QSound(":/audio/resources/play.wav");
|
||||
this->restBell = new QSound(":/audio/resources/rest.wav");
|
||||
this->stopBell = new QSound(":/audio/resources/stop.wav");
|
||||
|
||||
QObject::connect(this, SIGNAL(statusChanged()), this, SLOT(applyStatus()));
|
||||
QObject::connect(this, SIGNAL(timeout()), this, SLOT(updateRemainingMilliseconds()));
|
||||
}
|
||||
|
@ -149,6 +153,8 @@ const QString BoxingTimer::roundsToString() {
|
|||
|
||||
void BoxingTimer::loadPreset(const QString &preset) {
|
||||
this->settings->setPreset(preset);
|
||||
this->mRemainingMilliseconds = settings->getRoundMilliseconds();
|
||||
this->mStatus = Status::Stop;
|
||||
|
||||
emit presetChanged();
|
||||
emit roundsToStringChanged();
|
||||
|
@ -157,10 +163,10 @@ void BoxingTimer::loadPreset(const QString &preset) {
|
|||
|
||||
void BoxingTimer::songsBell() {
|
||||
if (this->mStatus == Status::Start) {
|
||||
QSound::play(":/audio/resources/play.wav");
|
||||
} else if (this->mStatus == Status::Rest || this->mStatus == Status::Pause) {
|
||||
QSound::play(":/audio/resources/rest.wav");
|
||||
this->playBell->play();
|
||||
} else if (this->mStatus == Status::Rest) {
|
||||
this->restBell->play();
|
||||
} else if (this->mStatus == Status::Stop) {
|
||||
QSound::play(":/audio/resources/stop.wav");
|
||||
this->stopBell->play();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -13,6 +13,7 @@
|
|||
* @defgroup QML What interacts with view
|
||||
*/
|
||||
|
||||
class QSound;
|
||||
class BoxingSettings;
|
||||
|
||||
/**
|
||||
|
@ -157,6 +158,10 @@ class BoxingTimer : public QTimer {
|
|||
void setRemainingMilliseconds(const int &milliseconds);
|
||||
void setRound(const int &round);
|
||||
|
||||
QSound *playBell;
|
||||
QSound *restBell;
|
||||
QSound *stopBell;
|
||||
|
||||
void songsBell();
|
||||
|
||||
Status mStatus;
|
||||
|
|
Loading…
Reference in New Issue