From ea9350bcbf45bd2c0d37d8f98822c01ca456c3d2 Mon Sep 17 00:00:00 2001 From: gxalpha Date: Fri, 22 Jul 2022 02:42:11 +0200 Subject: [PATCH] UI: Add hotkey to split file Adds a frontend hotkey that splits the current recording file. Ideally, this would only appear if file splitting is enabled like the replay buffer hotkey, however that is an output hotkey which is hidden because the output doesn't exist. This doesn't work here since the recording output is obviously always available, but is unaware of whether file splitting is enabled until the output is started. --- UI/data/locale/en-US.ini | 1 + UI/window-basic-main.cpp | 9 +++++++++ UI/window-basic-main.hpp | 2 +- 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/UI/data/locale/en-US.ini b/UI/data/locale/en-US.ini index a73b7f473..0cb27d27a 100644 --- a/UI/data/locale/en-US.ini +++ b/UI/data/locale/en-US.ini @@ -686,6 +686,7 @@ Basic.Main.StartVirtualCam="Start Virtual Camera" Basic.Main.StopRecording="Stop Recording" Basic.Main.PauseRecording="Pause Recording" Basic.Main.UnpauseRecording="Unpause Recording" +Basic.Main.SplitFile="Split Recording File" Basic.Main.StoppingRecording="Stopping Recording..." Basic.Main.StopReplayBuffer="Stop Replay Buffer" Basic.Main.StoppingReplayBuffer="Stopping Replay Buffer..." diff --git a/UI/window-basic-main.cpp b/UI/window-basic-main.cpp index fb36a36d2..b04552020 100644 --- a/UI/window-basic-main.cpp +++ b/UI/window-basic-main.cpp @@ -2452,6 +2452,15 @@ void OBSBasic::CreateHotkeys() LoadHotkeyPair(pauseHotkeys, "OBSBasic.PauseRecording", "OBSBasic.UnpauseRecording"); + splitFileHotkey = obs_hotkey_register_frontend( + "OBSBasic.SplitFile", Str("Basic.Main.SplitFile"), + [](void *, obs_hotkey_id, obs_hotkey_t *, bool pressed) { + if (pressed) + obs_frontend_recording_split_file(); + }, + this); + LoadHotkey(splitFileHotkey, "OBSBasic.SplitFile"); + replayBufHotkeys = obs_hotkey_pair_register_frontend( "OBSBasic.StartReplayBuffer", Str("Basic.Main.StartReplayBuffer"), diff --git a/UI/window-basic-main.hpp b/UI/window-basic-main.hpp index 3e9695f2a..8540ec9d4 100644 --- a/UI/window-basic-main.hpp +++ b/UI/window-basic-main.hpp @@ -439,7 +439,7 @@ private: obs_hotkey_pair_id streamingHotkeys, recordingHotkeys, pauseHotkeys, replayBufHotkeys, vcamHotkeys, togglePreviewHotkeys, contextBarHotkeys; - obs_hotkey_id forceStreamingStopHotkey; + obs_hotkey_id forceStreamingStopHotkey, splitFileHotkey; void InitDefaultTransitions(); void InitTransition(obs_source_t *transition);