Added audio resources like ring bells
This commit is contained in:
parent
882ed92bc7
commit
01d5dd2f9c
|
@ -5,6 +5,8 @@ DEFINES += APP_RELEASE=\\\"$$RELEASE\\\"
|
|||
|
||||
CONFIG += sailfishapp
|
||||
|
||||
QT += multimedia
|
||||
|
||||
SOURCES += src/harbour-boxing-timer.cpp \
|
||||
src/boxingtimer.cpp \
|
||||
src/boxingsettings.cpp
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
<RCC>
|
||||
<qresource prefix="/audio">
|
||||
<file>resources/bell.wav</file>
|
||||
<file>resources/play.wav</file>
|
||||
<file>resources/rest.wav</file>
|
||||
<file>resources/stop.wav</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
|
|
|
@ -37,12 +37,6 @@ import "pages"
|
|||
ApplicationWindow {
|
||||
BoxingTimer {
|
||||
id: boxingTimer
|
||||
|
||||
onStatusChanged: {
|
||||
if (status === BoxingTimer.Start) {
|
||||
bell.play()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
BoxingSettings {
|
||||
|
@ -54,12 +48,6 @@ ApplicationWindow {
|
|||
}
|
||||
}
|
||||
|
||||
SoundEffect {
|
||||
id: bell
|
||||
|
||||
source: "qrc:/audio/resources/bell.wav"
|
||||
}
|
||||
|
||||
initialPage: firstPage
|
||||
cover: Qt.resolvedUrl("cover/CoverPage.qml")
|
||||
allowedOrientations: Orientation.Portrait
|
||||
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -1,6 +1,7 @@
|
|||
#include <QObject>
|
||||
#include <QTime>
|
||||
#include <QSettings>
|
||||
#include <QSound>
|
||||
|
||||
#include "boxingtimer.h"
|
||||
#include "boxingsettings.h"
|
||||
|
@ -11,9 +12,8 @@ BoxingTimer::BoxingTimer() :
|
|||
mOldStatus(Status::Default) {
|
||||
this->setTimerType(Qt::VeryCoarseTimer);
|
||||
|
||||
settings = new BoxingSettings();
|
||||
|
||||
mRemainingMilliseconds = settings->getRoundMilliseconds();
|
||||
this->settings = new BoxingSettings();
|
||||
this->mRemainingMilliseconds = settings->getRoundMilliseconds();
|
||||
|
||||
QObject::connect(this, SIGNAL(statusChanged()), this, SLOT(applyStatus()));
|
||||
QObject::connect(this, SIGNAL(timeout()), this, SLOT(updateRemainingMilliseconds()));
|
||||
|
@ -58,6 +58,8 @@ void BoxingTimer::start(const int &milliseconds) {
|
|||
}
|
||||
|
||||
void BoxingTimer::applyStatus() {
|
||||
this->songsBell();
|
||||
|
||||
switch (this->mStatus) {
|
||||
case Status::Reset:
|
||||
if (this->mOldStatus == Status::Start) {
|
||||
|
@ -105,6 +107,8 @@ void BoxingTimer::updateRemainingMilliseconds() {
|
|||
|
||||
this->nextRound();
|
||||
}
|
||||
|
||||
this->songsBell();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -150,3 +154,13 @@ void BoxingTimer::loadPreset(const QString &preset) {
|
|||
emit roundsToStringChanged();
|
||||
emit remainingTimeToStringChanged();
|
||||
}
|
||||
|
||||
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");
|
||||
} else if (this->mStatus == Status::Stop) {
|
||||
QSound::play(":/audio/resources/stop.wav");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -157,6 +157,8 @@ class BoxingTimer : public QTimer {
|
|||
void setRemainingMilliseconds(const int &milliseconds);
|
||||
void setRound(const int &round);
|
||||
|
||||
void songsBell();
|
||||
|
||||
Status mStatus;
|
||||
Status mOldStatus;
|
||||
|
||||
|
|
Loading…
Reference in New Issue