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:
Richard Stanway 2017-10-12 17:20:19 +02:00
commit 5c9d3dd30d
No known key found for this signature in database
GPG key ID: AAC1E5265D71B3FD
2 changed files with 12 additions and 5 deletions

View file

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