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:
Andrew
2013-11-27 16:14:18 -06:00
parent d794a4d0bf
commit a4c5f0135e
10 changed files with 308 additions and 18 deletions

View File

@ -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();
}

View File

@ -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);