Skip to content

Commit

Permalink
UI: Add options to enable/disable stream confirm dialogs
Browse files Browse the repository at this point in the history
Some streamers would accidentally hit start/stop streaming, which on
certain services would send out mass emails to all their followers.
This just adds options to general settings to optionally enable dialogs
that confirm whether to actually start/stop streaming when the button is
clicked.
  • Loading branch information
jp9000 committed Jan 26, 2016
1 parent 213d8ce commit bbbdd44
Show file tree
Hide file tree
Showing 4 changed files with 69 additions and 2 deletions.
10 changes: 10 additions & 0 deletions obs/data/locale/en-US.ini
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,14 @@ NameExists.Text="The name is already in use."
NoNameEntered.Title="Please enter a valid name"
NoNameEntered.Text="You cannot use empty names."

# confirm start stream dialog box
ConfirmStart.Title="Start Stream?"
ConfirmStart.Text="Are you sure you want to start the stream?"

# confirm stop stream dialog box
ConfirmStop.Title="Stop Stream?"
ConfirmStop.Text="Are you sure you want to stop the stream?"

# confirm exit dialog box
ConfirmExit.Title="Exit OBS?"
ConfirmExit.Text="OBS is currently active. All streams/recordings will be shut down. Are you sure you wish to exit?"
Expand Down Expand Up @@ -300,6 +308,8 @@ Basic.Settings.Confirm="You have unsaved changes. Save changes?"
Basic.Settings.General="General"
Basic.Settings.General.Theme="Theme"
Basic.Settings.General.Language="Language"
Basic.Settings.General.WarnBeforeStartingStream="Show confirmation dialog when starting streams"
Basic.Settings.General.WarnBeforeStoppingStream="Show confirmation dialog when stopping streams"

# basic mode 'stream' settings
Basic.Settings.Stream="Stream"
Expand Down
18 changes: 16 additions & 2 deletions obs/forms/OBSBasicSettings.ui
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,20 @@
<item row="2" column="1">
<widget class="QComboBox" name="theme"/>
</item>
<item row="3" column="1">
<widget class="QCheckBox" name="warnBeforeStreamStart">
<property name="text">
<string>Basic.Settings.General.WarnBeforeStartingStream</string>
</property>
</widget>
</item>
<item row="4" column="1">
<widget class="QCheckBox" name="warnBeforeStreamStop">
<property name="text">
<string>Basic.Settings.General.WarnBeforeStoppingStream</string>
</property>
</widget>
</item>
</layout>
</widget>
<widget class="QWidget" name="streamPage">
Expand Down Expand Up @@ -2663,8 +2677,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>735</width>
<height>618</height>
<width>525</width>
<height>383</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_16">
Expand Down
26 changes: 26 additions & 0 deletions obs/window-basic-main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3267,8 +3267,34 @@ void OBSBasic::RecordingStop(int code)
void OBSBasic::on_streamButton_clicked()
{
if (outputHandler->StreamingActive()) {
bool confirm = config_get_bool(GetGlobalConfig(), "BasicWindow",
"WarnBeforeStoppingStream");

if (confirm) {
QMessageBox::StandardButton button =
QMessageBox::question(this,
QTStr("ConfirmStop.Title"),
QTStr("ConfirmStop.Text"));

if (button == QMessageBox::No)
return;
}

StopStreaming();
} else {
bool confirm = config_get_bool(GetGlobalConfig(), "BasicWindow",
"WarnBeforeStartingStream");

if (confirm) {
QMessageBox::StandardButton button =
QMessageBox::question(this,
QTStr("ConfirmStart.Title"),
QTStr("ConfirmStart.Text"));

if (button == QMessageBox::No)
return;
}

StartStreaming();
}
}
Expand Down
17 changes: 17 additions & 0 deletions obs/window-basic-settings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,8 @@ OBSBasicSettings::OBSBasicSettings(QWidget *parent)

HookWidget(ui->language, COMBO_CHANGED, GENERAL_CHANGED);
HookWidget(ui->theme, COMBO_CHANGED, GENERAL_CHANGED);
HookWidget(ui->warnBeforeStreamStart,CHECK_CHANGED, GENERAL_CHANGED);
HookWidget(ui->warnBeforeStreamStop, CHECK_CHANGED, GENERAL_CHANGED);
HookWidget(ui->outputMode, COMBO_CHANGED, OUTPUTS_CHANGED);
HookWidget(ui->streamType, COMBO_CHANGED, STREAM1_CHANGED);
HookWidget(ui->simpleOutputPath, EDIT_CHANGED, OUTPUTS_CHANGED);
Expand Down Expand Up @@ -741,6 +743,14 @@ void OBSBasicSettings::LoadGeneralSettings()
LoadLanguageList();
LoadThemeList();

bool warnBeforeStreamStart = config_get_bool(GetGlobalConfig(),
"BasicWindow", "WarnBeforeStartingStream");
ui->warnBeforeStreamStart->setChecked(warnBeforeStreamStart);

bool warnBeforeStreamStop = config_get_bool(GetGlobalConfig(),
"BasicWindow", "WarnBeforeStoppingStream");
ui->warnBeforeStreamStop->setChecked(warnBeforeStreamStop);

loading = false;
}

Expand Down Expand Up @@ -1954,6 +1964,13 @@ void OBSBasicSettings::SaveGeneralSettings()
theme.c_str());
App()->SetTheme(theme);
}

config_set_bool(GetGlobalConfig(), "BasicWindow",
"WarnBeforeStartingStream",
ui->warnBeforeStreamStart->isChecked());
config_set_bool(GetGlobalConfig(), "BasicWindow",
"WarnBeforeStoppingStream",
ui->warnBeforeStreamStop->isChecked());
}

void OBSBasicSettings::SaveStream1Settings()
Expand Down

0 comments on commit bbbdd44

Please sign in to comment.