소스 검색

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).
Elyse 3 년 전
부모
커밋
f19cb6bb22
1개의 변경된 파일9개의 추가작업 그리고 0개의 파일을 삭제
  1. 9 0
      Userland/Applications/SoundPlayer/SoundPlayerWidgetAdvancedView.cpp

+ 9 - 0
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);
 }