mirror of
https://github.com/Chatterino/chatterino2.git
synced 2024-11-13 19:49:51 +01:00
48 lines
861 B
C++
48 lines
861 B
C++
#include "singletons/accountmanager.hpp"
|
|
|
|
namespace chatterino {
|
|
namespace singletons {
|
|
|
|
namespace {
|
|
|
|
inline QString getEnvString(const char *target)
|
|
{
|
|
char *val = std::getenv(target);
|
|
if (val == nullptr) {
|
|
return QString();
|
|
}
|
|
|
|
return QString(val);
|
|
}
|
|
|
|
} // namespace
|
|
|
|
AccountManager::AccountManager()
|
|
{
|
|
}
|
|
|
|
AccountManager &AccountManager::getInstance()
|
|
{
|
|
static AccountManager instance;
|
|
return instance;
|
|
}
|
|
|
|
void AccountManager::load()
|
|
{
|
|
this->Twitch.reloadUsers();
|
|
|
|
auto currentUser = this->Twitch.findUserByUsername(
|
|
QString::fromStdString(this->Twitch.currentUsername.getValue()));
|
|
|
|
if (currentUser) {
|
|
this->Twitch.currentUser = currentUser;
|
|
} else {
|
|
this->Twitch.currentUser = this->Twitch.anonymousUser;
|
|
}
|
|
|
|
this->Twitch.userChanged.invoke();
|
|
}
|
|
|
|
} // namespace chatterino
|
|
}
|