Allow setting no default account
This allows the user to select an account to use every time they launch an instance.
This commit is contained in:
@ -93,9 +93,16 @@ MojangAccountPtr MojangAccountList::activeAccount() const
|
||||
void MojangAccountList::setActiveAccount(const QString& username)
|
||||
{
|
||||
beginResetModel();
|
||||
for (MojangAccountPtr account : m_accounts)
|
||||
if (account->username() == username)
|
||||
m_activeAccount = username;
|
||||
if (username.isEmpty())
|
||||
{
|
||||
m_activeAccount = "";
|
||||
}
|
||||
else
|
||||
{
|
||||
for (MojangAccountPtr account : m_accounts)
|
||||
if (account->username() == username)
|
||||
m_activeAccount = username;
|
||||
}
|
||||
endResetModel();
|
||||
onListChanged();
|
||||
}
|
||||
|
@ -122,6 +122,7 @@ public:
|
||||
|
||||
/*!
|
||||
* Sets the given account as the current active account.
|
||||
* If the username given is an empty string, sets the active account to nothing.
|
||||
*/
|
||||
virtual void setActiveAccount(const QString& username);
|
||||
|
||||
|
Reference in New Issue
Block a user