mirror of
https://github.com/RGBCube/serenity
synced 2025-05-23 19:05:08 +00:00
SoundPlayer: Add spacebar keyboard shortcut for play/pause
This commit is contained in:
parent
8f2521ce52
commit
8d36893ddf
2 changed files with 13 additions and 0 deletions
|
@ -1,5 +1,6 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2021, Cesar Torres <shortanemoia@protonmail.com>
|
* Copyright (c) 2021, Cesar Torres <shortanemoia@protonmail.com>
|
||||||
|
* Copyright (c) 2021, the SerenityOS developers.
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: BSD-2-Clause
|
* SPDX-License-Identifier: BSD-2-Clause
|
||||||
*/
|
*/
|
||||||
|
@ -236,6 +237,14 @@ void SoundPlayerWidgetAdvancedView::drop_event(GUI::DropEvent& event)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SoundPlayerWidgetAdvancedView::keydown_event(GUI::KeyEvent& event)
|
||||||
|
{
|
||||||
|
if (event.key() == Key_Space)
|
||||||
|
m_play_button->click();
|
||||||
|
|
||||||
|
GUI::Widget::keydown_event(event);
|
||||||
|
}
|
||||||
|
|
||||||
SoundPlayerWidgetAdvancedView::~SoundPlayerWidgetAdvancedView()
|
SoundPlayerWidgetAdvancedView::~SoundPlayerWidgetAdvancedView()
|
||||||
{
|
{
|
||||||
manager().on_load_sample_buffer = nullptr;
|
manager().on_load_sample_buffer = nullptr;
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2021, Cesar Torres <shortanemoia@protonmail.com>
|
* Copyright (c) 2021, Cesar Torres <shortanemoia@protonmail.com>
|
||||||
|
* Copyright (c) 2021, the SerenityOS developers.
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: BSD-2-Clause
|
* SPDX-License-Identifier: BSD-2-Clause
|
||||||
*/
|
*/
|
||||||
|
@ -40,6 +41,9 @@ public:
|
||||||
m_visualization = new_visualization;
|
m_visualization = new_visualization;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected:
|
||||||
|
void keydown_event(GUI::KeyEvent&) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void drop_event(GUI::DropEvent& event) override;
|
void drop_event(GUI::DropEvent& event) override;
|
||||||
GUI::Window& m_window;
|
GUI::Window& m_window;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue