mirror of
https://github.com/obsproject/obs-studio.git
synced 2024-07-19 17:49:14 +00:00
UI: Add SelectScene hotkey
UI supplied per scene hotkey to allow switching between scenes; this has to be done in the UI since it's up to the application to define what exactly "changing/selecting a scene" means (changing the output of channel 0 may not be enough for other applications)
This commit is contained in:
parent
c23c071ba2
commit
054f00ced1
|
@ -361,6 +361,9 @@ Basic.AdvAudio.AudioTracks="Tracks"
|
|||
Basic.Settings.Hotkeys="Hotkeys"
|
||||
Basic.Settings.Hotkeys.Pair="Key combinations shared with '%1' act as toggles"
|
||||
|
||||
# basic mode hotkeys
|
||||
Basic.Hotkeys.SelectScene="Switch to scene"
|
||||
|
||||
# hotkeys that may lack translation on certain operating systems
|
||||
Hotkeys.Insert="Insert"
|
||||
Hotkeys.Delete="Delete"
|
||||
|
|
|
@ -918,6 +918,18 @@ void OBSBasic::AddScene(OBSSource source)
|
|||
item->setData(Qt::UserRole, QVariant::fromValue(OBSScene(scene)));
|
||||
ui->scenes->addItem(item);
|
||||
|
||||
obs_hotkey_register_source(source, "OBSBasic.SelectScene",
|
||||
Str("Basic.Hotkeys.SelectScene"),
|
||||
[](void *data,
|
||||
obs_hotkey_id, obs_hotkey_t*, bool pressed)
|
||||
{
|
||||
auto potential_source = static_cast<obs_source_t*>(data);
|
||||
auto source = obs_source_get_ref(potential_source);
|
||||
if (source && pressed)
|
||||
obs_set_output_source(0, source);
|
||||
obs_source_release(source);
|
||||
}, static_cast<obs_source_t*>(source));
|
||||
|
||||
signal_handler_t *handler = obs_source_get_signal_handler(source);
|
||||
signal_handler_connect(handler, "item_add",
|
||||
OBSBasic::SceneItemAdded, this);
|
||||
|
|
Loading…
Reference in a new issue