refactor: Remove most raw accesses into Application (#5104)

This commit is contained in:
pajlada
2024-01-19 17:59:55 +01:00
committed by GitHub
parent 326a402710
commit 4380ef8c5f
82 changed files with 552 additions and 452 deletions
+7 -6
View File
@@ -15,20 +15,21 @@ AccountSwitchWidget::AccountSwitchWidget(QWidget *parent)
this->addItem(ANONYMOUS_USERNAME_LABEL);
for (const auto &userName : app->accounts->twitch.getUsernames())
for (const auto &userName : app->getAccounts()->twitch.getUsernames())
{
this->addItem(userName);
}
this->managedConnections_.managedConnect(
app->accounts->twitch.userListUpdated, [=, this]() {
app->getAccounts()->twitch.userListUpdated, [=, this]() {
this->blockSignals(true);
this->clear();
this->addItem(ANONYMOUS_USERNAME_LABEL);
for (const auto &userName : app->accounts->twitch.getUsernames())
for (const auto &userName :
app->getAccounts()->twitch.getUsernames())
{
this->addItem(userName);
}
@@ -47,11 +48,11 @@ AccountSwitchWidget::AccountSwitchWidget(QWidget *parent)
if (newUsername.compare(ANONYMOUS_USERNAME_LABEL,
Qt::CaseInsensitive) == 0)
{
app->accounts->twitch.currentUsername = "";
app->getAccounts()->twitch.currentUsername = "";
}
else
{
app->accounts->twitch.currentUsername = newUsername;
app->getAccounts()->twitch.currentUsername = newUsername;
}
}
});
@@ -71,7 +72,7 @@ void AccountSwitchWidget::refreshSelection()
{
auto *app = getApp();
auto currentUser = app->accounts->twitch.getCurrent();
auto currentUser = app->getAccounts()->twitch.getCurrent();
if (currentUser->isAnon())
{