UI: Add option to warn on stop recording

OBS has an option to warn before stopping a stream, but it doesn't have
a similar warning for recording. This can result in a recording being
unintentionally stopped.

Add an option to warn when the "Stop Recording" button is pressed.

Note: While OBS also has an option to warn on stream start, this
patch purposefully does not add similar warn on recording start option.
This is because accidentally starting to record isn't risky in the same
way that accidentally starting to stream is.
master
Grant Likely 2019-06-17 15:14:14 +01:00 committed by jp9000
parent 887857b71d
commit 4e3ce938f2
4 changed files with 38 additions and 3 deletions

View File

@ -262,6 +262,10 @@ ConfirmStart.Text="Are you sure you want to start the stream?"
ConfirmStop.Title="Stop Stream?" ConfirmStop.Title="Stop Stream?"
ConfirmStop.Text="Are you sure you want to stop the stream?" ConfirmStop.Text="Are you sure you want to stop the stream?"
# confirm stop record dialog box
ConfirmStopRecord.Title="Stop Recording?"
ConfirmStopRecord.Text="Are you sure you want to stop recording?"
# confirm bandwidth test dialog box # confirm bandwidth test dialog box
ConfirmBWTest.Title="Start Bandwidth Test?" ConfirmBWTest.Title="Start Bandwidth Test?"
ConfirmBWTest.Text="You have OBS configured in bandwidth test mode. This mode allows for network testing without your channel going live. Once you are done testing, you will need to disable it in order for viewers to be able to see your stream.\n\nDo you want to continue?" ConfirmBWTest.Text="You have OBS configured in bandwidth test mode. This mode allows for network testing without your channel going live. Once you are done testing, you will need to disable it in order for viewers to be able to see your stream.\n\nDo you want to continue?"
@ -614,6 +618,7 @@ Basic.Settings.General.EnableAutoUpdates="Automatically check for updates on sta
Basic.Settings.General.OpenStatsOnStartup="Open stats dialog on startup" Basic.Settings.General.OpenStatsOnStartup="Open stats dialog on startup"
Basic.Settings.General.WarnBeforeStartingStream="Show confirmation dialog when starting streams" Basic.Settings.General.WarnBeforeStartingStream="Show confirmation dialog when starting streams"
Basic.Settings.General.WarnBeforeStoppingStream="Show confirmation dialog when stopping streams" Basic.Settings.General.WarnBeforeStoppingStream="Show confirmation dialog when stopping streams"
Basic.Settings.General.WarnBeforeStoppingRecord="Show confirmation dialog when stopping recording"
Basic.Settings.General.Projectors="Projectors" Basic.Settings.General.Projectors="Projectors"
Basic.Settings.General.HideProjectorCursor="Hide cursor over projectors" Basic.Settings.General.HideProjectorCursor="Hide cursor over projectors"
Basic.Settings.General.ProjectorAlwaysOnTop="Make projectors always on top" Basic.Settings.General.ProjectorAlwaysOnTop="Make projectors always on top"

View File

@ -291,13 +291,20 @@
</widget> </widget>
</item> </item>
<item row="2" column="1"> <item row="2" column="1">
<widget class="QCheckBox" name="warnBeforeRecordStop">
<property name="text">
<string>Basic.Settings.General.WarnBeforeStoppingRecord</string>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QCheckBox" name="recordWhenStreaming"> <widget class="QCheckBox" name="recordWhenStreaming">
<property name="text"> <property name="text">
<string>Basic.Settings.General.RecordWhenStreaming</string> <string>Basic.Settings.General.RecordWhenStreaming</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="3" column="1"> <item row="4" column="1">
<widget class="QCheckBox" name="keepRecordStreamStops"> <widget class="QCheckBox" name="keepRecordStreamStops">
<property name="enabled"> <property name="enabled">
<bool>false</bool> <bool>false</bool>
@ -307,14 +314,14 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="4" column="1"> <item row="5" column="1">
<widget class="QCheckBox" name="replayWhileStreaming"> <widget class="QCheckBox" name="replayWhileStreaming">
<property name="text"> <property name="text">
<string>Basic.Settings.General.ReplayBufferWhileStreaming</string> <string>Basic.Settings.General.ReplayBufferWhileStreaming</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="5" column="1"> <item row="6" column="1">
<widget class="QCheckBox" name="keepReplayStreamStops"> <widget class="QCheckBox" name="keepReplayStreamStops">
<property name="enabled"> <property name="enabled">
<bool>false</bool> <bool>false</bool>
@ -5235,6 +5242,7 @@
<tabstop>openStatsOnStartup</tabstop> <tabstop>openStatsOnStartup</tabstop>
<tabstop>warnBeforeStreamStart</tabstop> <tabstop>warnBeforeStreamStart</tabstop>
<tabstop>warnBeforeStreamStop</tabstop> <tabstop>warnBeforeStreamStop</tabstop>
<tabstop>warnBeforeRecordStop</tabstop>
<tabstop>recordWhenStreaming</tabstop> <tabstop>recordWhenStreaming</tabstop>
<tabstop>keepRecordStreamStops</tabstop> <tabstop>keepRecordStreamStops</tabstop>
<tabstop>replayWhileStreaming</tabstop> <tabstop>replayWhileStreaming</tabstop>

View File

@ -5679,6 +5679,20 @@ void OBSBasic::on_streamButton_clicked()
void OBSBasic::on_recordButton_clicked() void OBSBasic::on_recordButton_clicked()
{ {
if (outputHandler->RecordingActive()) { if (outputHandler->RecordingActive()) {
bool confirm = config_get_bool(GetGlobalConfig(), "BasicWindow",
"WarnBeforeStoppingRecord");
if (confirm && isVisible()) {
QMessageBox::StandardButton button =
OBSMessageBox::question(
this, QTStr("ConfirmStopRecord.Title"),
QTStr("ConfirmStopRecord.Text"));
if (button == QMessageBox::No) {
ui->recordButton->setChecked(true);
return;
}
}
StopRecording(); StopRecording();
} else { } else {
if (!NoSourcesConfirmation()) { if (!NoSourcesConfirmation()) {

View File

@ -306,6 +306,7 @@ OBSBasicSettings::OBSBasicSettings(QWidget *parent)
HookWidget(ui->openStatsOnStartup, CHECK_CHANGED, GENERAL_CHANGED); HookWidget(ui->openStatsOnStartup, CHECK_CHANGED, GENERAL_CHANGED);
HookWidget(ui->warnBeforeStreamStart,CHECK_CHANGED, GENERAL_CHANGED); HookWidget(ui->warnBeforeStreamStart,CHECK_CHANGED, GENERAL_CHANGED);
HookWidget(ui->warnBeforeStreamStop, CHECK_CHANGED, GENERAL_CHANGED); HookWidget(ui->warnBeforeStreamStop, CHECK_CHANGED, GENERAL_CHANGED);
HookWidget(ui->warnBeforeRecordStop, CHECK_CHANGED, GENERAL_CHANGED);
HookWidget(ui->hideProjectorCursor, CHECK_CHANGED, GENERAL_CHANGED); HookWidget(ui->hideProjectorCursor, CHECK_CHANGED, GENERAL_CHANGED);
HookWidget(ui->projectorAlwaysOnTop, CHECK_CHANGED, GENERAL_CHANGED); HookWidget(ui->projectorAlwaysOnTop, CHECK_CHANGED, GENERAL_CHANGED);
HookWidget(ui->recordWhenStreaming, CHECK_CHANGED, GENERAL_CHANGED); HookWidget(ui->recordWhenStreaming, CHECK_CHANGED, GENERAL_CHANGED);
@ -1121,6 +1122,10 @@ void OBSBasicSettings::LoadGeneralSettings()
GetGlobalConfig(), "BasicWindow", "WarnBeforeStoppingStream"); GetGlobalConfig(), "BasicWindow", "WarnBeforeStoppingStream");
ui->warnBeforeStreamStop->setChecked(warnBeforeStreamStop); ui->warnBeforeStreamStop->setChecked(warnBeforeStreamStop);
bool warnBeforeRecordStop = config_get_bool(
GetGlobalConfig(), "BasicWindow", "WarnBeforeStoppingRecord");
ui->warnBeforeRecordStop->setChecked(warnBeforeRecordStop);
bool hideProjectorCursor = config_get_bool( bool hideProjectorCursor = config_get_bool(
GetGlobalConfig(), "BasicWindow", "HideProjectorCursor"); GetGlobalConfig(), "BasicWindow", "HideProjectorCursor");
ui->hideProjectorCursor->setChecked(hideProjectorCursor); ui->hideProjectorCursor->setChecked(hideProjectorCursor);
@ -2760,6 +2765,9 @@ void OBSBasicSettings::SaveGeneralSettings()
config_set_bool(GetGlobalConfig(), "BasicWindow", config_set_bool(GetGlobalConfig(), "BasicWindow",
"WarnBeforeStoppingStream", "WarnBeforeStoppingStream",
ui->warnBeforeStreamStop->isChecked()); ui->warnBeforeStreamStop->isChecked());
config_set_bool(GetGlobalConfig(), "BasicWindow",
"WarnBeforeStoppingRecord",
ui->warnBeforeRecordStop->isChecked());
config_set_bool(GetGlobalConfig(), "BasicWindow", "HideProjectorCursor", config_set_bool(GetGlobalConfig(), "BasicWindow", "HideProjectorCursor",
ui->hideProjectorCursor->isChecked()); ui->hideProjectorCursor->isChecked());