From 0448a3e122ba55635ae655d56adb0d82b9393d40 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?D=C4=81vis=20Mos=C4=81ns?= Date: Fri, 10 Dec 2021 02:59:29 +0200 Subject: [PATCH] Fix profileInUseFilter --- launcher/ui/MainWindow.cpp | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/launcher/ui/MainWindow.cpp b/launcher/ui/MainWindow.cpp index f8593b56..95d9ae5d 100644 --- a/launcher/ui/MainWindow.cpp +++ b/launcher/ui/MainWindow.cpp @@ -94,15 +94,16 @@ #include "MMCTime.h" namespace { -QString getProfileDisplay(MinecraftAccountPtr account) +QString profileInUseFilter(const QString & profile, bool used) { - QString additionalPart = account->typeString(); - if(account->isInUse()) + if(used) { - 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++) { MinecraftAccountPtr account = accounts->at(i); - auto profileLabel = getProfileDisplay(account); + auto profileLabel = profileInUseFilter(account->profileName(), account->isInUse()); QAction *action = new QAction(profileLabel, this); action->setData(i); action->setCheckable(true); @@ -1129,7 +1130,7 @@ void MainWindow::defaultAccountChanged() // FIXME: this needs adjustment for MSA if (account && account->profileName() != "") { - auto profileLabel = getProfileDisplay(account); + auto profileLabel = profileInUseFilter(account->profileName(), account->isInUse()); accountMenuButton->setText(profileLabel); auto face = account->getFace(); if(face.isNull()) {