mirror of
https://github.com/obsproject/obs-studio.git
synced 2026-09-19 09:41:32 +08:00
UI: Log when starting / stopping via hotkey or timer
This will help resolve incidents where users accidentally started or stopped their stream without knowing what triggered it (usually from hotkeys that were forgotten about).
This commit is contained in:
@@ -40,11 +40,13 @@ void OutputTimer::closeEvent(QCloseEvent*)
|
||||
void OutputTimer::StreamingTimerButton()
|
||||
{
|
||||
if (!obs_frontend_streaming_active()) {
|
||||
blog(LOG_INFO, "Starting stream due to OutputTimer");
|
||||
obs_frontend_streaming_start();
|
||||
} else if (streamingAlreadyActive) {
|
||||
StreamTimerStart();
|
||||
streamingAlreadyActive = false;
|
||||
} else if (obs_frontend_streaming_active()) {
|
||||
blog(LOG_INFO, "Stopping stream due to OutputTimer");
|
||||
obs_frontend_streaming_stop();
|
||||
}
|
||||
}
|
||||
@@ -52,11 +54,13 @@ void OutputTimer::StreamingTimerButton()
|
||||
void OutputTimer::RecordingTimerButton()
|
||||
{
|
||||
if (!obs_frontend_recording_active()) {
|
||||
blog(LOG_INFO, "Starting recording due to OutputTimer");
|
||||
obs_frontend_recording_start();
|
||||
} else if (recordingAlreadyActive) {
|
||||
RecordTimerStart();
|
||||
recordingAlreadyActive = false;
|
||||
} else if (obs_frontend_recording_active()) {
|
||||
blog(LOG_INFO, "Stopping recording due to OutputTimer");
|
||||
obs_frontend_recording_stop();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -841,12 +841,14 @@ retryScene:
|
||||
opt_starting_scene.clear();
|
||||
|
||||
if (opt_start_streaming) {
|
||||
blog(LOG_INFO, "Starting stream due to command line parameter");
|
||||
QMetaObject::invokeMethod(this, "StartStreaming",
|
||||
Qt::QueuedConnection);
|
||||
opt_start_streaming = false;
|
||||
}
|
||||
|
||||
if (opt_start_recording) {
|
||||
blog(LOG_INFO, "Starting recording due to command line parameter");
|
||||
QMetaObject::invokeMethod(this, "StartRecording",
|
||||
Qt::QueuedConnection);
|
||||
opt_start_recording = false;
|
||||
@@ -1632,11 +1634,12 @@ void OBSBasic::CreateHotkeys()
|
||||
obs_data_array_release(array1);
|
||||
};
|
||||
|
||||
#define MAKE_CALLBACK(pred, method) \
|
||||
#define MAKE_CALLBACK(pred, method, log_action) \
|
||||
[](void *data, obs_hotkey_pair_id, obs_hotkey_t*, bool pressed) \
|
||||
{ \
|
||||
OBSBasic &basic = *static_cast<OBSBasic*>(data); \
|
||||
if (pred && pressed) { \
|
||||
blog(LOG_INFO, log_action " due to hotkey"); \
|
||||
method(); \
|
||||
return true; \
|
||||
} \
|
||||
@@ -1649,9 +1652,9 @@ void OBSBasic::CreateHotkeys()
|
||||
"OBSBasic.StopStreaming",
|
||||
Str("Basic.Main.StopStreaming"),
|
||||
MAKE_CALLBACK(!basic.outputHandler->StreamingActive(),
|
||||
basic.StartStreaming),
|
||||
basic.StartStreaming, "Starting stream"),
|
||||
MAKE_CALLBACK(basic.outputHandler->StreamingActive(),
|
||||
basic.StopStreaming),
|
||||
basic.StopStreaming, "Stopping stream"),
|
||||
this, this);
|
||||
LoadHotkeyPair(streamingHotkeys,
|
||||
"OBSBasic.StartStreaming", "OBSBasic.StopStreaming");
|
||||
@@ -1677,9 +1680,9 @@ void OBSBasic::CreateHotkeys()
|
||||
"OBSBasic.StopRecording",
|
||||
Str("Basic.Main.StopRecording"),
|
||||
MAKE_CALLBACK(!basic.outputHandler->RecordingActive(),
|
||||
basic.StartRecording),
|
||||
basic.StartRecording, "Starting recording"),
|
||||
MAKE_CALLBACK(basic.outputHandler->RecordingActive(),
|
||||
basic.StopRecording),
|
||||
basic.StopRecording, "Stopping recording"),
|
||||
this, this);
|
||||
LoadHotkeyPair(recordingHotkeys,
|
||||
"OBSBasic.StartRecording", "OBSBasic.StopRecording");
|
||||
|
||||
Reference in New Issue
Block a user