Merge pull request #130 from davispuh/profile

Fix profileInUseFilter
This commit is contained in:
Sebastian
2021-12-10 17:56:32 -05:00
committed by GitHub

View File

@@ -94,15 +94,16 @@
#include "MMCTime.h" #include "MMCTime.h"
namespace { namespace {
QString getProfileDisplay(MinecraftAccountPtr account) QString profileInUseFilter(const QString & profile, bool used)
{ {
QString additionalPart = account->typeString(); if(used)
if(account->isInUse())
{ {
additionalPart += ", in use"; return QObject::tr("%1 (in use)").arg(profile);
}
else
{
return profile;
} }
return ((QString)"%1 (%2)").arg(account->profileName(), additionalPart);
} }
} }
@@ -1051,7 +1052,7 @@ void MainWindow::repopulateAccountsMenu()
for (int i = 0; i < accounts->count(); i++) for (int i = 0; i < accounts->count(); i++)
{ {
MinecraftAccountPtr account = accounts->at(i); MinecraftAccountPtr account = accounts->at(i);
auto profileLabel = getProfileDisplay(account); auto profileLabel = profileInUseFilter(account->profileName(), account->isInUse());
QAction *action = new QAction(profileLabel, this); QAction *action = new QAction(profileLabel, this);
action->setData(i); action->setData(i);
action->setCheckable(true); action->setCheckable(true);
@@ -1129,7 +1130,7 @@ void MainWindow::defaultAccountChanged()
// FIXME: this needs adjustment for MSA // FIXME: this needs adjustment for MSA
if (account && account->profileName() != "") if (account && account->profileName() != "")
{ {
auto profileLabel = getProfileDisplay(account); auto profileLabel = profileInUseFilter(account->profileName(), account->isInUse());
accountMenuButton->setText(profileLabel); accountMenuButton->setText(profileLabel);
auto face = account->getFace(); auto face = account->getFace();
if(face.isNull()) { if(face.isNull()) {