Skip to content

Commit

Permalink
Merge branch 'feature/reset-sound'
Browse files Browse the repository at this point in the history
  • Loading branch information
jgibbon committed Dec 29, 2023
2 parents 9945c8d + a2c9c74 commit 5167b53
Show file tree
Hide file tree
Showing 30 changed files with 279 additions and 76 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ If your device supports it (Jolla1 does not), aliendalvik/android media players
Optionally, an audible notification plays for the last few seconds before pausing your media.


Note: Sounds are CC0, not GPL. [Click here for Details.](qml/assets/sound/LICENSE.txt)
Note: Sounds are CC0, not GPL. [Click here for Details.](main/qml/assets/sound/LICENSE.txt)

[Screenshots:<br />![screenshots](https://i.imgur.com/od8Bfx4m.png)](http://i.imgur.com/od8Bfx4.png)

Expand Down
4 changes: 4 additions & 0 deletions main/qml/assets/sound/LICENSE.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ sea-waves.wav
both the source and this derivative work are licensed as CC0
http://creativecommons.org/publicdomain/zero/1.0/

blip.wav
is based on "Sync Blip.wav" by freesound.org user BIONN
https://freesound.org/people/BIONN/sounds/562773/


Statement of Purpose

Expand Down
Binary file added main/qml/assets/sound/blip.wav
Binary file not shown.
14 changes: 14 additions & 0 deletions main/qml/lib/Globals.qml
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,13 @@ Item {
timerNotificationTrigger.reset()
}
}

onRestarted: {
console.log('restarted')
if(settings.timerSoundOnResetEnabled) {
resetSound.play()
}
}
}


Expand Down Expand Up @@ -202,6 +209,13 @@ Item {
}
}
}
SoundEffect {
id: resetSound
category: 'slumber'
source: '../assets/sound/blip.wav'
volume: settings.timerFadeSoundEffectVolume
}

Loader {
active: settings.timerAutostartOnPlaybackDetection
asynchronous: true
Expand Down
15 changes: 15 additions & 0 deletions main/qml/pages/Options_TimerControl.qml
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,21 @@ Page {
rightMargin: 0
width: parent.columnWidth
}
TextSwitch {
id:timerSoundOnResetEnabledSwitch
//: TextSwitch: Play Sound on reset
text: qsTr( 'Play sound on reset')

checked: settings.timerSoundOnResetEnabled
onClicked: {
settings.timerSoundOnResetEnabled = checked
}
//: TextSwitch description: Reset timer with proximity sensor
description: qsTr('Plays a sound effect when the timer gets reset')
leftMargin: 0
rightMargin: 0
width: parent.columnWidth
}

}

Expand Down
13 changes: 13 additions & 0 deletions main/src/lib/applicationsettings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,19 @@ void ApplicationSettings::setTimerFinalizingSeconds(int value)
}
}

bool ApplicationSettings::getTimerSoundOnResetEnabled() const
{
return settings.value("timerSoundOnResetEnabled", false).toBool();
}

void ApplicationSettings::setTimerSoundOnResetEnabled(bool value)
{
if(getTimerSoundOnResetEnabled() != value) {
settings.setValue("timerSoundOnResetEnabled", value);
emit timerSoundOnResetEnabledChanged();
}
}

bool ApplicationSettings::getTimerMotionEnabled() const
{
return settings.value("timerMotionEnabled", false).toBool();
Expand Down
9 changes: 7 additions & 2 deletions main/src/lib/applicationsettings.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ class ApplicationSettings : public QObject {
Q_PROPERTY(bool timerInhibitScreensaverEnabled READ getTimerInhibitScreensaverEnabled WRITE setTimerInhibitScreensaverEnabled NOTIFY timerInhibitScreensaverEnabledChanged)
Q_PROPERTY(int timerSeconds READ getTimerSeconds WRITE setTimerSeconds NOTIFY timerSecondsChanged)
Q_PROPERTY(int timerFinalizingSeconds READ getTimerFinalizingSeconds WRITE setTimerFinalizingSeconds NOTIFY timerFinalizingSecondsChanged)
Q_PROPERTY(bool timerSoundOnResetEnabled READ getTimerSoundOnResetEnabled WRITE setTimerSoundOnResetEnabled NOTIFY timerSoundOnResetEnabledChanged)
Q_PROPERTY(bool timerMotionEnabled READ getTimerMotionEnabled WRITE setTimerMotionEnabled NOTIFY timerMotionEnabledChanged)
Q_PROPERTY(bool timerWaveMotionEnabled READ getTimerWaveMotionEnabled WRITE setTimerWaveMotionEnabled NOTIFY timerWaveMotionEnabledChanged)
Q_PROPERTY(float timerMotionThreshold READ getTimerMotionThreshold WRITE setTimerMotionThreshold NOTIFY timerMotionThresholdChanged)
Expand Down Expand Up @@ -70,12 +71,15 @@ class ApplicationSettings : public QObject {
int getTimerFinalizingSeconds() const;
void setTimerFinalizingSeconds(int value);

bool getTimerMotionEnabled() const;
void setTimerMotionEnabled(bool value);
bool getTimerSoundOnResetEnabled() const;
void setTimerSoundOnResetEnabled(bool value);

bool getTimerWaveMotionEnabled() const;
void setTimerWaveMotionEnabled(bool value);

bool getTimerMotionEnabled() const;
void setTimerMotionEnabled(bool value);

float getTimerMotionThreshold() const;
void setTimerMotionThreshold(float value);

Expand Down Expand Up @@ -191,6 +195,7 @@ class ApplicationSettings : public QObject {
void timerInhibitScreensaverEnabledChanged();
void timerSecondsChanged();
void timerFinalizingSecondsChanged();
void timerSoundOnResetEnabledChanged();
void timerMotionEnabledChanged();
void timerWaveMotionEnabledChanged();
void timerMotionThresholdChanged();
Expand Down
1 change: 1 addition & 0 deletions main/src/lib/sleeptimer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ void SleepTimer::start()
bool wasActive = isActive();
if(wasActive) {
stop();
emit restarted();
} else {
resetRemainingSeconds();
}
Expand Down
2 changes: 1 addition & 1 deletion main/src/lib/sleeptimer.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ class SleepTimer : public QTimer
void isActiveChanged();
void triggered();
void remainingFactorChanged();
//void reset(); we use activeChanged.
void restarted(); //we use activeChanged.

private slots:
// void onTickTimeout();
Expand Down
14 changes: 13 additions & 1 deletion main/translations/harbour-slumber-de.ts
Original file line number Diff line number Diff line change
Expand Up @@ -466,7 +466,19 @@ ziehe herunter für Einstellungen</translation>
<translation>Starte den Timer neu, indem du die Hand vor den Näherungssensor hältst.</translation>
</message>
<message>
<location filename="../qml/pages/Options_TimerControl.qml" line="194"/>
<location filename="../qml/pages/Options_TimerControl.qml" line="183"/>
<source>Play sound on reset</source>
<extracomment>TextSwitch: Play Sound on reset</extracomment>
<translation>Reset-Ton</translation>
</message>
<message>
<location filename="../qml/pages/Options_TimerControl.qml" line="190"/>
<source>Plays a sound effect when the timer gets reset</source>
<extracomment>TextSwitch description: Reset timer with proximity sensor</extracomment>
<translation>Spiele einen Ton ab, sobald der Timer neugestartet wird</translation>
</message>
<message>
<location filename="../qml/pages/Options_TimerControl.qml" line="209"/>
<source>Amazfish integration</source>
<extracomment>Button text: go to settings page to reset timer with smartwatch events from the amazfish application</extracomment>
<translation>Amazfish-Integration</translation>
Expand Down
14 changes: 13 additions & 1 deletion main/translations/harbour-slumber-en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -466,7 +466,19 @@ pull down for options</translation>
<translation>Reset the timer by holding your hand in front of the screen.</translation>
</message>
<message>
<location filename="../qml/pages/Options_TimerControl.qml" line="194"/>
<location filename="../qml/pages/Options_TimerControl.qml" line="183"/>
<source>Play sound on reset</source>
<extracomment>TextSwitch: Play Sound on reset</extracomment>
<translation>Play sound on reset</translation>
</message>
<message>
<location filename="../qml/pages/Options_TimerControl.qml" line="190"/>
<source>Plays a sound effect when the timer gets reset</source>
<extracomment>TextSwitch description: Reset timer with proximity sensor</extracomment>
<translation>Plays a sound effect when the timer gets reset</translation>
</message>
<message>
<location filename="../qml/pages/Options_TimerControl.qml" line="209"/>
<source>Amazfish integration</source>
<extracomment>Button text: go to settings page to reset timer with smartwatch events from the amazfish application</extracomment>
<translation>Amazfish integration</translation>
Expand Down
14 changes: 13 additions & 1 deletion main/translations/harbour-slumber-es.ts
Original file line number Diff line number Diff line change
Expand Up @@ -466,7 +466,19 @@ tira hacia abajo para opciones</translation>
<translation>Reiniciar el temporizador manteniendo su mano encima de la pantalla.</translation>
</message>
<message>
<location filename="../qml/pages/Options_TimerControl.qml" line="194"/>
<location filename="../qml/pages/Options_TimerControl.qml" line="183"/>
<source>Play sound on reset</source>
<extracomment>TextSwitch: Play Sound on reset</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../qml/pages/Options_TimerControl.qml" line="190"/>
<source>Plays a sound effect when the timer gets reset</source>
<extracomment>TextSwitch description: Reset timer with proximity sensor</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../qml/pages/Options_TimerControl.qml" line="209"/>
<source>Amazfish integration</source>
<extracomment>Button text: go to settings page to reset timer with smartwatch events from the amazfish application</extracomment>
<translation>Integración con Amazfish</translation>
Expand Down
14 changes: 13 additions & 1 deletion main/translations/harbour-slumber-fi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -464,7 +464,19 @@ pull down for options</source>
<translation>Käynnistä ajastin uudelleen heilauttamalla kättäsi näytön edessä.</translation>
</message>
<message>
<location filename="../qml/pages/Options_TimerControl.qml" line="194"/>
<location filename="../qml/pages/Options_TimerControl.qml" line="183"/>
<source>Play sound on reset</source>
<extracomment>TextSwitch: Play Sound on reset</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../qml/pages/Options_TimerControl.qml" line="190"/>
<source>Plays a sound effect when the timer gets reset</source>
<extracomment>TextSwitch description: Reset timer with proximity sensor</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../qml/pages/Options_TimerControl.qml" line="209"/>
<source>Amazfish integration</source>
<extracomment>Button text: go to settings page to reset timer with smartwatch events from the amazfish application</extracomment>
<translation type="unfinished"></translation>
Expand Down
14 changes: 13 additions & 1 deletion main/translations/harbour-slumber-fr.ts
Original file line number Diff line number Diff line change
Expand Up @@ -464,7 +464,19 @@ pull down for options</source>
<translation>Réinitialise le minuteur lorsque votre main est placée près du capteur de proximité.</translation>
</message>
<message>
<location filename="../qml/pages/Options_TimerControl.qml" line="194"/>
<location filename="../qml/pages/Options_TimerControl.qml" line="183"/>
<source>Play sound on reset</source>
<extracomment>TextSwitch: Play Sound on reset</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../qml/pages/Options_TimerControl.qml" line="190"/>
<source>Plays a sound effect when the timer gets reset</source>
<extracomment>TextSwitch description: Reset timer with proximity sensor</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../qml/pages/Options_TimerControl.qml" line="209"/>
<source>Amazfish integration</source>
<extracomment>Button text: go to settings page to reset timer with smartwatch events from the amazfish application</extracomment>
<translation type="unfinished"></translation>
Expand Down
14 changes: 13 additions & 1 deletion main/translations/harbour-slumber-hu.ts
Original file line number Diff line number Diff line change
Expand Up @@ -464,7 +464,19 @@ pull down for options</source>
<translation>Az időzítő visszaállítása a kezed képernyő előtti tartásával.</translation>
</message>
<message>
<location filename="../qml/pages/Options_TimerControl.qml" line="194"/>
<location filename="../qml/pages/Options_TimerControl.qml" line="183"/>
<source>Play sound on reset</source>
<extracomment>TextSwitch: Play Sound on reset</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../qml/pages/Options_TimerControl.qml" line="190"/>
<source>Plays a sound effect when the timer gets reset</source>
<extracomment>TextSwitch description: Reset timer with proximity sensor</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../qml/pages/Options_TimerControl.qml" line="209"/>
<source>Amazfish integration</source>
<extracomment>Button text: go to settings page to reset timer with smartwatch events from the amazfish application</extracomment>
<translation type="unfinished"></translation>
Expand Down
14 changes: 13 additions & 1 deletion main/translations/harbour-slumber-it.ts
Original file line number Diff line number Diff line change
Expand Up @@ -464,7 +464,19 @@ pull down for options</source>
<translation>Riavvia il timer passando con la mano di fronte allo schermo.</translation>
</message>
<message>
<location filename="../qml/pages/Options_TimerControl.qml" line="194"/>
<location filename="../qml/pages/Options_TimerControl.qml" line="183"/>
<source>Play sound on reset</source>
<extracomment>TextSwitch: Play Sound on reset</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../qml/pages/Options_TimerControl.qml" line="190"/>
<source>Plays a sound effect when the timer gets reset</source>
<extracomment>TextSwitch description: Reset timer with proximity sensor</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../qml/pages/Options_TimerControl.qml" line="209"/>
<source>Amazfish integration</source>
<extracomment>Button text: go to settings page to reset timer with smartwatch events from the amazfish application</extracomment>
<translation type="unfinished"></translation>
Expand Down
14 changes: 13 additions & 1 deletion main/translations/harbour-slumber-nl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -464,7 +464,19 @@ pull down for options</source>
<translation>Stel de timer opnieuw in door je hand voor je scherm te houden.</translation>
</message>
<message>
<location filename="../qml/pages/Options_TimerControl.qml" line="194"/>
<location filename="../qml/pages/Options_TimerControl.qml" line="183"/>
<source>Play sound on reset</source>
<extracomment>TextSwitch: Play Sound on reset</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../qml/pages/Options_TimerControl.qml" line="190"/>
<source>Plays a sound effect when the timer gets reset</source>
<extracomment>TextSwitch description: Reset timer with proximity sensor</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../qml/pages/Options_TimerControl.qml" line="209"/>
<source>Amazfish integration</source>
<extracomment>Button text: go to settings page to reset timer with smartwatch events from the amazfish application</extracomment>
<translation type="unfinished"></translation>
Expand Down
14 changes: 13 additions & 1 deletion main/translations/harbour-slumber-nl_BE.ts
Original file line number Diff line number Diff line change
Expand Up @@ -464,7 +464,19 @@ pull down for options</source>
<translation>Stel den timer opnieuw in door uw hand voor uw scherm te houden.</translation>
</message>
<message>
<location filename="../qml/pages/Options_TimerControl.qml" line="194"/>
<location filename="../qml/pages/Options_TimerControl.qml" line="183"/>
<source>Play sound on reset</source>
<extracomment>TextSwitch: Play Sound on reset</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../qml/pages/Options_TimerControl.qml" line="190"/>
<source>Plays a sound effect when the timer gets reset</source>
<extracomment>TextSwitch description: Reset timer with proximity sensor</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../qml/pages/Options_TimerControl.qml" line="209"/>
<source>Amazfish integration</source>
<extracomment>Button text: go to settings page to reset timer with smartwatch events from the amazfish application</extracomment>
<translation type="unfinished"></translation>
Expand Down
14 changes: 13 additions & 1 deletion main/translations/harbour-slumber-pl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -464,7 +464,19 @@ pull down for options</source>
<translation>Reset timera poprzez trzymanie dłoni nad ekranem.</translation>
</message>
<message>
<location filename="../qml/pages/Options_TimerControl.qml" line="194"/>
<location filename="../qml/pages/Options_TimerControl.qml" line="183"/>
<source>Play sound on reset</source>
<extracomment>TextSwitch: Play Sound on reset</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../qml/pages/Options_TimerControl.qml" line="190"/>
<source>Plays a sound effect when the timer gets reset</source>
<extracomment>TextSwitch description: Reset timer with proximity sensor</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../qml/pages/Options_TimerControl.qml" line="209"/>
<source>Amazfish integration</source>
<extracomment>Button text: go to settings page to reset timer with smartwatch events from the amazfish application</extracomment>
<translation>Integracja z Amazifish</translation>
Expand Down
14 changes: 13 additions & 1 deletion main/translations/harbour-slumber-ru.ts
Original file line number Diff line number Diff line change
Expand Up @@ -464,7 +464,19 @@ pull down for options</source>
<translation>Сбрасывает таймер при обнаружении вашей руки перед экраном.</translation>
</message>
<message>
<location filename="../qml/pages/Options_TimerControl.qml" line="194"/>
<location filename="../qml/pages/Options_TimerControl.qml" line="183"/>
<source>Play sound on reset</source>
<extracomment>TextSwitch: Play Sound on reset</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../qml/pages/Options_TimerControl.qml" line="190"/>
<source>Plays a sound effect when the timer gets reset</source>
<extracomment>TextSwitch description: Reset timer with proximity sensor</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../qml/pages/Options_TimerControl.qml" line="209"/>
<source>Amazfish integration</source>
<extracomment>Button text: go to settings page to reset timer with smartwatch events from the amazfish application</extracomment>
<translation type="unfinished"></translation>
Expand Down
14 changes: 13 additions & 1 deletion main/translations/harbour-slumber-sl_SI.ts
Original file line number Diff line number Diff line change
Expand Up @@ -466,7 +466,19 @@ za možnosti potegni navzdol</translation>
<translation>Za ponastavitev odštevalnika za trenutek podržite roko pred zaslonom</translation>
</message>
<message>
<location filename="../qml/pages/Options_TimerControl.qml" line="194"/>
<location filename="../qml/pages/Options_TimerControl.qml" line="183"/>
<source>Play sound on reset</source>
<extracomment>TextSwitch: Play Sound on reset</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../qml/pages/Options_TimerControl.qml" line="190"/>
<source>Plays a sound effect when the timer gets reset</source>
<extracomment>TextSwitch description: Reset timer with proximity sensor</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../qml/pages/Options_TimerControl.qml" line="209"/>
<source>Amazfish integration</source>
<extracomment>Button text: go to settings page to reset timer with smartwatch events from the amazfish application</extracomment>
<translation>Amazfish integracija</translation>
Expand Down
Loading

0 comments on commit 5167b53

Please sign in to comment.