From f19cb6bb223c58035762eddfb8b2b596cd9eac9f Mon Sep 17 00:00:00 2001 From: Elyse Date: Sat, 30 Oct 2021 21:56:21 -0500 Subject: [PATCH] SoundPlayer: Add keyboard shortcuts for stop and volume These shortcuts allow us to stop the player (key S) and adjust the volume level (key Up and key Down). --- .../SoundPlayer/SoundPlayerWidgetAdvancedView.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/Userland/Applications/SoundPlayer/SoundPlayerWidgetAdvancedView.cpp b/Userland/Applications/SoundPlayer/SoundPlayerWidgetAdvancedView.cpp index 68b7694092..b66f1d1ca3 100644 --- a/Userland/Applications/SoundPlayer/SoundPlayerWidgetAdvancedView.cpp +++ b/Userland/Applications/SoundPlayer/SoundPlayerWidgetAdvancedView.cpp @@ -142,6 +142,15 @@ void SoundPlayerWidgetAdvancedView::keydown_event(GUI::KeyEvent& event) if (event.key() == Key_Space) m_play_button->click(); + if (event.key() == Key_S) + m_stop_button->click(); + + if (event.key() == Key_Up) + m_volume_slider->set_value(m_volume_slider->value() + m_volume_slider->page_step()); + + if (event.key() == Key_Down) + m_volume_slider->set_value(m_volume_slider->value() - m_volume_slider->page_step()); + GUI::Widget::keydown_event(event); }