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

@ -1236,7 +1236,8 @@ YouTube.Actions.Stream.YTStudio="Automatically created by YouTube Studio"
YouTube.Actions.Notify.Title="YouTube"
YouTube.Actions.Notify.CreatingBroadcast="Creating a new Live Broadcast, please wait..."
YouTube.Actions.AutoStartStreamingWarning="Auto start is disabled for this stream, you should click \"GO LIVE\"."
YouTube.Actions.AutoStartStreamingWarning.Title="Manual start required"
YouTube.Actions.AutoStartStreamingWarning="Auto start is disabled for this stream, click the \"GO LIVE\" button to publish your broadcast on YouTube."
YouTube.Actions.AutoStopStreamingWarning="You will not be able to reconnect.<br>Your stream will stop and you will no longer be live."
# YouTube API errors in format "YouTube.Errors.<error reason>"

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()

View file

@ -564,6 +564,7 @@ private:
QPointer<QThread> youtubeStreamCheckThread;
#if YOUTUBE_ENABLED
void YoutubeStreamCheck(const std::string &key);
void ShowYouTubeAutoStartWarning();
void YouTubeActionDialogOk(const QString &id, const QString &key,
bool autostart, bool autostop);
#endif