UI: Show loading indicator while fetching YouTube Events
This commit is contained in:
@@ -1223,6 +1223,7 @@ YouTube.Actions.Error.NoStreamCreated="No stream created. Please relink your acc
|
||||
YouTube.Actions.Error.YouTubeApi="YouTube API Error. Please see the log file for more information."
|
||||
YouTube.Actions.Error.BroadcastNotFound="The selected broadcast was not found."
|
||||
|
||||
YouTube.Actions.EventsLoading="Loading list of events..."
|
||||
YouTube.Actions.EventCreated.Title="Event Created"
|
||||
YouTube.Actions.EventCreated.Text="Event successfully created."
|
||||
|
||||
|
@@ -135,6 +135,22 @@ OBSYoutubeActions::OBSYoutubeActions(QWidget *parent, Auth *auth)
|
||||
qDeleteAll(ui->scrollAreaWidgetContents->findChildren<QWidget *>(
|
||||
QString(), Qt::FindDirectChildrenOnly));
|
||||
|
||||
// Add label indicating loading state
|
||||
QLabel *loadingLabel = new QLabel();
|
||||
loadingLabel->setTextFormat(Qt::RichText);
|
||||
loadingLabel->setAlignment(Qt::AlignHCenter);
|
||||
loadingLabel->setText(
|
||||
QString("<big>%1</big>")
|
||||
.arg(QTStr("YouTube.Actions.EventsLoading")));
|
||||
ui->scrollAreaWidgetContents->layout()->addWidget(loadingLabel);
|
||||
|
||||
// Delete "loading..." label on completion
|
||||
connect(workerThread, &WorkerThread::finished, this, [&] {
|
||||
QLayoutItem *item =
|
||||
ui->scrollAreaWidgetContents->layout()->takeAt(0);
|
||||
item->widget()->deleteLater();
|
||||
});
|
||||
|
||||
connect(workerThread, &WorkerThread::failed, this, [&]() {
|
||||
auto last_error = apiYouTube->GetLastError();
|
||||
if (last_error.isEmpty())
|
||||
|
Reference in New Issue
Block a user