summaryrefslogtreecommitdiff
path: root/Userland/Applications/Piano
diff options
context:
space:
mode:
authorJunior Rantila <junior.rantila@gmail.com>2021-12-20 18:26:20 +0100
committerBrian Gianforcaro <b.gianfo@gmail.com>2021-12-20 10:39:37 -0800
commit105f741131f345aea5c737c58dc5bd1dfd2ff363 (patch)
tree942536b7a9d5a4e71169016824bb29038ebb6954 /Userland/Applications/Piano
parentbb7f32376cee30f81520101ccbd22574396cf736 (diff)
downloadserenity-105f741131f345aea5c737c58dc5bd1dfd2ff363.zip
Piano: Make `Key_Space` shortcut to toggle playback
Diffstat (limited to 'Userland/Applications/Piano')
-rw-r--r--Userland/Applications/Piano/MainWidget.cpp3
-rw-r--r--Userland/Applications/Piano/PlayerWidget.cpp5
-rw-r--r--Userland/Applications/Piano/PlayerWidget.h1
3 files changed, 9 insertions, 0 deletions
diff --git a/Userland/Applications/Piano/MainWidget.cpp b/Userland/Applications/Piano/MainWidget.cpp
index 571a86de98..2c83269f73 100644
--- a/Userland/Applications/Piano/MainWidget.cpp
+++ b/Userland/Applications/Piano/MainWidget.cpp
@@ -119,6 +119,9 @@ void MainWidget::special_key_action(int key_code)
case Key_C:
m_knobs_widget->cycle_waveform();
break;
+ case Key_Space:
+ m_player_widget->toggle_paused();
+ break;
}
}
diff --git a/Userland/Applications/Piano/PlayerWidget.cpp b/Userland/Applications/Piano/PlayerWidget.cpp
index 50201e9747..2ef688431f 100644
--- a/Userland/Applications/Piano/PlayerWidget.cpp
+++ b/Userland/Applications/Piano/PlayerWidget.cpp
@@ -112,3 +112,8 @@ void PlayerWidget::next_track()
{
m_track_dropdown->set_selected_index(m_track_manager.next_track_index());
}
+
+void PlayerWidget::toggle_paused()
+{
+ m_play_button->click();
+}
diff --git a/Userland/Applications/Piano/PlayerWidget.h b/Userland/Applications/Piano/PlayerWidget.h
index 19a6198392..2164d0b2c7 100644
--- a/Userland/Applications/Piano/PlayerWidget.h
+++ b/Userland/Applications/Piano/PlayerWidget.h
@@ -18,6 +18,7 @@ public:
void add_track();
void next_track();
+ void toggle_paused();
private:
explicit PlayerWidget(TrackManager&, AudioPlayerLoop&);