提交 bbbdd444 编写于 作者: J jp9000

UI: Add options to enable/disable stream confirm dialogs

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.
上级 213d8ce1
......@@ -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?"
......@@ -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"
......
......@@ -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">
......@@ -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">
......
......@@ -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();
}
}
......
......@@ -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);
......@@ -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;
}
......@@ -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()
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册