Implement an advanced method of adding a user to chatterino.

You can now switch between multiple users in the settings dialog.
(Requires a restart for reconnecting etc)
This commit is contained in:
Rasmus Karlsson
2017-08-19 15:37:56 +02:00
parent 60afaa588b
commit 8d2e48f944
13 changed files with 271 additions and 38 deletions
+15
View File
@@ -67,9 +67,24 @@ twitch::TwitchUser &AccountManager::getTwitchUser()
return this->getTwitchAnon();
}
std::string currentUser = pajlada::Settings::Setting<std::string>::get("/accounts/current");
QString currentUsername = QString::fromStdString(currentUser);
for (auto &user : this->twitchUsers) {
if (user.getUserName() == currentUsername) {
return user;
}
}
return this->twitchUsers.front();
}
void AccountManager::setCurrentTwitchUser(const QString &username)
{
pajlada::Settings::Setting<std::string>::set("/accounts/current", username.toStdString());
}
std::vector<twitch::TwitchUser> AccountManager::getTwitchUsers()
{
std::lock_guard<std::mutex> lock(this->twitchUsersMutex);