Browse Source

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.
derrod 4 years ago
parent
commit
fc3f349a31
3 changed files with 36 additions and 7 deletions
  1. 2 1
      UI/data/locale/en-US.ini
  2. 33 6
      UI/window-basic-main.cpp
  3. 1 0
      UI/window-basic-main.hpp

+ 2 - 1
UI/data/locale/en-US.ini

@@ -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>"

+ 33 - 6
UI/window-basic-main.cpp

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

+ 1 - 0
UI/window-basic-main.hpp

@@ -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