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:
Palana 2014-11-01 21:53:05 +01:00
parent c23c071ba2
commit 054f00ced1
2 changed files with 15 additions and 0 deletions

View file

@ -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"

View file

@ -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);