Browse Source

UI: Check selected broadcast when re-opening YT dialog

derrod 4 years ago
parent
commit
136ff7b8a3
3 changed files with 15 additions and 0 deletions
  1. 9 0
      UI/window-youtube-actions.cpp
  2. 5 0
      UI/youtube-api-wrappers.cpp
  3. 1 0
      UI/youtube-api-wrappers.hpp

+ 9 - 0
UI/window-youtube-actions.cpp

@@ -220,6 +220,9 @@ OBSYoutubeActions::OBSYoutubeActions(QWidget *parent, Auth *auth,
 				});
 			ui->scrollAreaWidgetContents->layout()->addWidget(
 				label);
+
+			if (selectedBroadcast == broadcast)
+				label->clicked();
 		});
 	workerThread->start();
 
@@ -229,6 +232,12 @@ OBSYoutubeActions::OBSYoutubeActions(QWidget *parent, Auth *auth,
 	if (rememberSettings)
 		LoadSettings();
 
+	// Switch to events page and select readied broadcast once loaded
+	if (broadcastReady) {
+		ui->tabWidget->setCurrentIndex(1);
+		selectedBroadcast = apiYouTube->GetBroadcastId();
+	}
+
 #ifdef __APPLE__
 	// MacOS theming issues
 	this->resize(this->width() + 200, this->height() + 120);

+ 5 - 0
UI/youtube-api-wrappers.cpp

@@ -409,6 +409,11 @@ void YoutubeApiWrappers::SetBroadcastId(QString &broadcast_id)
 	this->broadcast_id = broadcast_id;
 }
 
+QString YoutubeApiWrappers::GetBroadcastId()
+{
+	return this->broadcast_id;
+}
+
 bool YoutubeApiWrappers::ResetBroadcast(const QString &broadcast_id)
 {
 	lastErrorMessage.clear();

+ 1 - 0
UI/youtube-api-wrappers.hpp

@@ -72,6 +72,7 @@ public:
 	bool StopLatestBroadcast();
 
 	void SetBroadcastId(QString &broadcast_id);
+	QString GetBroadcastId();
 
 	bool FindBroadcast(const QString &id, json11::Json &json_out);
 	bool FindStream(const QString &id, json11::Json &json_out);