提交 054f00ce 编写于 作者: P Palana

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)
上级 c23c071b
......@@ -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);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册