chore: remove Singleton & replace getIApp with getApp (#5514)
This commit is contained in:
@@ -183,7 +183,7 @@ void rebuildReplyThreadHighlight(Settings &settings,
|
||||
void rebuildMessageHighlights(Settings &settings,
|
||||
std::vector<HighlightCheck> &checks)
|
||||
{
|
||||
auto currentUser = getIApp()->getAccounts()->twitch.getCurrent();
|
||||
auto currentUser = getApp()->getAccounts()->twitch.getCurrent();
|
||||
QString currentUsername = currentUser->getUserName();
|
||||
|
||||
if (settings.enableSelfHighlight && !currentUsername.isEmpty() &&
|
||||
@@ -442,9 +442,11 @@ std::ostream &operator<<(std::ostream &os, const HighlightResult &result)
|
||||
return os;
|
||||
}
|
||||
|
||||
void HighlightController::initialize(Settings &settings,
|
||||
const Paths & /*paths*/)
|
||||
HighlightController::HighlightController(Settings &settings,
|
||||
AccountController *accounts)
|
||||
{
|
||||
assert(accounts != nullptr);
|
||||
|
||||
this->rebuildListener_.addSetting(settings.enableSelfHighlight);
|
||||
this->rebuildListener_.addSetting(settings.enableSelfHighlightSound);
|
||||
this->rebuildListener_.addSetting(settings.enableSelfHighlightTaskbar);
|
||||
@@ -507,12 +509,12 @@ void HighlightController::initialize(Settings &settings,
|
||||
this->rebuildChecks(settings);
|
||||
});
|
||||
|
||||
getIApp()->getAccounts()->twitch.currentUserChanged.connect(
|
||||
[this, &settings] {
|
||||
this->bConnections.emplace_back(
|
||||
accounts->twitch.currentUserChanged.connect([this, &settings] {
|
||||
qCDebug(chatterinoHighlights)
|
||||
<< "Rebuild checks because user swapped accounts";
|
||||
this->rebuildChecks(settings);
|
||||
});
|
||||
}));
|
||||
|
||||
this->rebuildChecks(settings);
|
||||
}
|
||||
@@ -550,7 +552,7 @@ std::pair<bool, HighlightResult> HighlightController::check(
|
||||
// Access for checking
|
||||
const auto checks = this->checks_.accessConst();
|
||||
|
||||
auto currentUser = getIApp()->getAccounts()->twitch.getCurrent();
|
||||
auto currentUser = getApp()->getAccounts()->twitch.getCurrent();
|
||||
auto self = (senderName == currentUser->getUserName());
|
||||
|
||||
for (const auto &check : *checks)
|
||||
|
||||
Reference in New Issue
Block a user