Allow selecting a default account to use with an instance

Signed-off-by: Aaron <10217842+byteduck@users.noreply.github.com>
This commit is contained in:
Aaron
2022-12-27 15:00:15 -07:00
parent 4d334b645d
commit 7e2d78bab5
5 changed files with 150 additions and 6 deletions

View File

@ -112,7 +112,19 @@ void LaunchController::decideAccount()
}
}
m_accountToUse = accounts->defaultAccount();
// Select the account to use. If the instance has a specific account set, that will be used. Otherwise, the default account will be used
auto instanceAccountId = m_instance->settings()->get("InstanceAccountId").toString();
auto instanceAccountIndex = accounts->findAccountByProfileId(instanceAccountId);
if (instanceAccountIndex == -1)
{
m_accountToUse = accounts->defaultAccount();
}
else
{
m_accountToUse = accounts->at(instanceAccountIndex);
}
if (!m_accountToUse)
{
// If no default account is set, ask the user which one to use.