diff --git a/main.qml b/main.qml index 0be6c5b..717b853 100644 --- a/main.qml +++ b/main.qml @@ -74,6 +74,74 @@ Window { } } + Timer { + id: next_actionTimer + + property string action + property double started_at + + running: false + repeat: false + onRunningChanged: { + if(!running){ + started_at = 0 + if(action == "NONE"){ + time.text = "0.000 sec" + } + return + } + + if(action === "at_marks"){ + started_at = new Date().getTime() + time.text = "at your\nmarks" + } + else if(action === "ready"){ + started_at = new Date().getTime() + time.text = "ready" + } + } + + onTriggered: { + if(action === "at_marks"){ + at_marksSound.play() + } + else if(action === "ready"){ + action = "NONE" + readySound.play() + } + + } + } + + SoundEffect { + id: at_marksSound + source: "qrc:/sounds/at_marks_1.wav" + + onPlayingChanged: { + if(!playing){ + if(_cppAppSettings.loadSetting("ready_en") === "true"){ + next_actionTimer.action = "ready" + next_actionTimer.interval = _cppAppSettings.loadSetting("ready_delay") + next_actionTimer.start() + //readySound.play() + } + else{ + startSound.play() + } + } + } + } + + SoundEffect { + id: readySound + source: "qrc:/sounds/ready_1.wav" + onPlayingChanged: { + if(!playing){ + startSound.play() + } + } + } + SoundEffect { //start sound id: startSound @@ -172,6 +240,19 @@ Window { root.state = "IDLE" case "IDLE": root.state = "STARTING" + if(_cppAppSettings.loadSetting("at_marks_en") === "true"){ + next_actionTimer.action = "at_marks" + next_actionTimer.interval = _cppAppSettings.loadSetting("at_marks_delay") + next_actionTimer.start() + return + } + if(_cppAppSettings.loadSetting("ready_en") === "true"){ + next_actionTimer.action = "ready" + next_actionTimer.interval = _cppAppSettings.loadSetting("ready_delay") + next_actionTimer.start() + return + } + startSound.play() break case "RUNNING": @@ -184,7 +265,30 @@ Window { break } } + } + ProgressCircle { + id: prog + anchors.fill: startButt + opacity: next_actionTimer.started_at > 0 ? 1:0 + lineWidth: 5 + + arcBegin: 0 + arcEnd: 360 * (( next_actionTimer.interval - ( new Date().getTime() - next_actionTimer.started_at ) ) / next_actionTimer.interval) + + colorCircle: "grey" + + animationDuration: 0 + + Timer { + id: prog_refresh + running: parent.opacity === 1 + interval: 1 + repeat: true + onTriggered: { + prog.arcEnd = 360 * (( next_actionTimer.interval - ( new Date().getTime() - next_actionTimer.started_at ) ) / next_actionTimer.interval) + } + } } /*---------------------- @@ -205,7 +309,7 @@ Window { scale: 0 width: height - enabled: startSound.playing + enabled: root.state === "STARTING" onPressedChanged: { if(pressed){ background.color = "lightgrey" @@ -216,6 +320,9 @@ Window { } onClicked: { + next_actionTimer.stop() + at_marksSound.stop() + readySound.stop() startSound.stop() root.stoppedTime = 0 time.text = "false start" diff --git a/shared.qrc b/shared.qrc index 478f9bb..f77686e 100644 --- a/shared.qrc +++ b/shared.qrc @@ -9,5 +9,9 @@ graphics/icons/menu.png graphics/icons/drawer.png graphics/icons/back.png + sounds/ready_1.wav + sounds/at_marks_1.wav + sounds/ready_2.wav + sounds/at_marks_2.wav diff --git a/sounds/at_marks_1.wav b/sounds/at_marks_1.wav new file mode 100644 index 0000000..f73c703 Binary files /dev/null and b/sounds/at_marks_1.wav differ diff --git a/sounds/at_marks_2.wav b/sounds/at_marks_2.wav new file mode 100644 index 0000000..54494c0 Binary files /dev/null and b/sounds/at_marks_2.wav differ diff --git a/sounds/ready_1.wav b/sounds/ready_1.wav new file mode 100644 index 0000000..42f0867 Binary files /dev/null and b/sounds/ready_1.wav differ diff --git a/sounds/ready_2.wav b/sounds/ready_2.wav new file mode 100644 index 0000000..abe5032 Binary files /dev/null and b/sounds/ready_2.wav differ diff --git a/sounds/sounds.aup b/sounds/sounds.aup new file mode 100644 index 0000000..65a9068 --- /dev/null +++ b/sounds/sounds.aup @@ -0,0 +1,85 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sounds/sounds_data/e00/d00/e0000260.au b/sounds/sounds_data/e00/d00/e0000260.au new file mode 100644 index 0000000..2a99728 Binary files /dev/null and b/sounds/sounds_data/e00/d00/e0000260.au differ diff --git a/sounds/sounds_data/e00/d00/e0000290.au b/sounds/sounds_data/e00/d00/e0000290.au new file mode 100644 index 0000000..ecea0e6 Binary files /dev/null and b/sounds/sounds_data/e00/d00/e0000290.au differ diff --git a/sounds/sounds_data/e00/d00/e0000457.au b/sounds/sounds_data/e00/d00/e0000457.au new file mode 100644 index 0000000..2a99728 Binary files /dev/null and b/sounds/sounds_data/e00/d00/e0000457.au differ diff --git a/sounds/sounds_data/e00/d00/e0000542.au b/sounds/sounds_data/e00/d00/e0000542.au new file mode 100644 index 0000000..fbc4417 Binary files /dev/null and b/sounds/sounds_data/e00/d00/e0000542.au differ diff --git a/sounds/sounds_data/e00/d00/e0000714.au b/sounds/sounds_data/e00/d00/e0000714.au new file mode 100644 index 0000000..9ed3dfc Binary files /dev/null and b/sounds/sounds_data/e00/d00/e0000714.au differ diff --git a/sounds/sounds_data/e00/d00/e0000996.au b/sounds/sounds_data/e00/d00/e0000996.au new file mode 100644 index 0000000..ecea0e6 Binary files /dev/null and b/sounds/sounds_data/e00/d00/e0000996.au differ diff --git a/sounds/sounds_data/e00/d00/e00009d0.au b/sounds/sounds_data/e00/d00/e00009d0.au new file mode 100644 index 0000000..9ed3dfc Binary files /dev/null and b/sounds/sounds_data/e00/d00/e00009d0.au differ diff --git a/sounds/sounds_data/e00/d00/e0000ce4.au b/sounds/sounds_data/e00/d00/e0000ce4.au new file mode 100644 index 0000000..fbc4417 Binary files /dev/null and b/sounds/sounds_data/e00/d00/e0000ce4.au differ