mirror of
https://github.com/WarmUpTill/SceneSwitcher.git
synced 2026-03-21 17:34:57 -05:00
Only update Twitch tab content when switching to it
This should reduce the potential lag introduced when querying the token status using the Twitch API
This commit is contained in:
parent
69b82ee2a3
commit
3ab2ea9e66
|
|
@ -29,6 +29,12 @@ static void setTabVisible(QTabWidget *tabWidget, bool visible)
|
|||
obs_module_text("AdvSceneSwitcher.twitchConnectionTab.title"));
|
||||
}
|
||||
|
||||
static bool twitchTabIsSelected(QTabWidget *tabWidget)
|
||||
{
|
||||
return tabWidget->tabText(tabWidget->currentIndex()) ==
|
||||
obs_module_text("AdvSceneSwitcher.twitchConnectionTab.title");
|
||||
}
|
||||
|
||||
TwitchConnectionsTable *TwitchConnectionsTable::Create()
|
||||
{
|
||||
tabWidget = new TwitchConnectionsTable();
|
||||
|
|
@ -211,11 +217,11 @@ static void setupTab(QTabWidget *tab)
|
|||
}
|
||||
});
|
||||
|
||||
auto timer = new QTimer(tabWidget);
|
||||
timer->setInterval(1000);
|
||||
QWidget::connect(timer, &QTimer::timeout,
|
||||
[]() { updateConnectionStatus(tabWidget->Table()); });
|
||||
timer->start();
|
||||
QWidget::connect(tab, &QTabWidget::currentChanged, [tab]() {
|
||||
if (twitchTabIsSelected(tab)) {
|
||||
updateConnectionStatus(tabWidget->Table());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
} // namespace advss
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user