diff options
author | Linus Groh <mail@linusgroh.de> | 2022-05-29 12:20:29 +0100 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2022-05-29 15:27:03 +0200 |
commit | 094487b5d49f9a0a647c25a560d1e1562407b252 (patch) | |
tree | ad864844eb260c4cc7bff7cac48aed883fd9e8a1 | |
parent | 1940363e0b6bf664e79dd76d507f87d6057951d7 (diff) | |
download | serenity-094487b5d49f9a0a647c25a560d1e1562407b252.zip |
SoundPlayer: Replace two manual key event checks with action shortcut
-rw-r--r-- | Userland/Applications/SoundPlayer/SoundPlayerWidgetAdvancedView.cpp | 10 |
1 files changed, 2 insertions, 8 deletions
diff --git a/Userland/Applications/SoundPlayer/SoundPlayerWidgetAdvancedView.cpp b/Userland/Applications/SoundPlayer/SoundPlayerWidgetAdvancedView.cpp index b4bf495131..c57cff6c7b 100644 --- a/Userland/Applications/SoundPlayer/SoundPlayerWidgetAdvancedView.cpp +++ b/Userland/Applications/SoundPlayer/SoundPlayerWidgetAdvancedView.cpp @@ -62,13 +62,13 @@ SoundPlayerWidgetAdvancedView::SoundPlayerWidgetAdvancedView(GUI::Window& window auto& toolbar_container = m_player_view->add<GUI::ToolbarContainer>(); auto& menubar = toolbar_container.add<GUI::Toolbar>(); - m_play_action = GUI::Action::create("Play", m_play_icon, [&](auto&) { + m_play_action = GUI::Action::create("Play", { Key_Space }, m_play_icon, [&](auto&) { toggle_pause(); }); m_play_action->set_enabled(false); menubar.add_action(*m_play_action); - m_stop_action = GUI::Action::create("Stop", m_stop_icon, [&](auto&) { + m_stop_action = GUI::Action::create("Stop", { Key_S }, m_stop_icon, [&](auto&) { stop(); }); m_stop_action->set_enabled(false); @@ -132,15 +132,9 @@ void SoundPlayerWidgetAdvancedView::drop_event(GUI::DropEvent& event) void SoundPlayerWidgetAdvancedView::keydown_event(GUI::KeyEvent& event) { - if (event.key() == Key_Space) - m_play_action->activate(); - if (event.key() == Key_M) toggle_mute(); - if (event.key() == Key_S) - m_stop_action->activate(); - if (event.key() == Key_Up) m_volume_slider->increase_slider_by_page_steps(1); |