UI: Add "Don't show again" checkbox to YT auto start warning

Also modifies the warning message to be more clear about what this
means.
This commit is contained in:
derrod
2021-08-17 19:10:33 +02:00
parent 4ef2a79a19
commit fc3f349a31
3 changed files with 36 additions and 7 deletions

View File

@@ -6136,6 +6136,37 @@ void OBSBasic::YoutubeStreamCheck(const std::string &key)
youtubeStreamCheckThread->deleteLater();
}
void OBSBasic::ShowYouTubeAutoStartWarning()
{
auto msgBox = []() {
QMessageBox msgbox(App()->GetMainWindow());
msgbox.setWindowTitle(QTStr(
"YouTube.Actions.AutoStartStreamingWarning.Title"));
msgbox.setText(
QTStr("YouTube.Actions.AutoStartStreamingWarning"));
msgbox.setIcon(QMessageBox::Icon::Information);
msgbox.addButton(QMessageBox::Ok);
QCheckBox *cb = new QCheckBox(QTStr("DoNotShowAgain"));
msgbox.setCheckBox(cb);
msgbox.exec();
if (cb->isChecked()) {
config_set_bool(App()->GlobalConfig(), "General",
"WarnedAboutYouTubeAutoStart", true);
config_save_safe(App()->GlobalConfig(), "tmp", nullptr);
}
};
bool warned = config_get_bool(App()->GlobalConfig(), "General",
"WarnedAboutYouTubeAutoStart");
if (!warned) {
QMetaObject::invokeMethod(App(), "Exec", Qt::QueuedConnection,
Q_ARG(VoidFunc, msgBox));
}
}
#endif
void OBSBasic::StartStreaming()
@@ -6235,12 +6266,8 @@ void OBSBasic::StartStreaming()
if (replayBufferWhileStreaming)
StartReplayBuffer();
if (!autoStartBroadcast) {
OBSMessageBox::warning(
this, "Warning",
QTStr("YouTube.Actions.AutoStartStreamingWarning"),
false);
}
if (!autoStartBroadcast)
OBSBasic::ShowYouTubeAutoStartWarning();
}
void OBSBasic::BroadcastButtonClicked()