NOISSUE mark profile in use also on the main window profile button
This commit is contained in:
parent
12f6534e77
commit
9cf8b42d89
@ -699,6 +699,18 @@ void MainWindow::updateToolsMenu()
|
|||||||
ui->actionLaunchInstance->setMenu(launchMenu);
|
ui->actionLaunchInstance->setMenu(launchMenu);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QString profileInUseFilter(const QString & profile, bool used)
|
||||||
|
{
|
||||||
|
if(used)
|
||||||
|
{
|
||||||
|
return profile + QObject::tr(" (in use)");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return profile;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void MainWindow::repopulateAccountsMenu()
|
void MainWindow::repopulateAccountsMenu()
|
||||||
{
|
{
|
||||||
accountMenu->clear();
|
accountMenu->clear();
|
||||||
@ -709,7 +721,14 @@ void MainWindow::repopulateAccountsMenu()
|
|||||||
QString active_username = "";
|
QString active_username = "";
|
||||||
if (active_account != nullptr)
|
if (active_account != nullptr)
|
||||||
{
|
{
|
||||||
active_username = accounts->activeAccount()->username();
|
active_username = active_account->username();
|
||||||
|
const AccountProfile *profile = active_account->currentProfile();
|
||||||
|
// this can be called before accountMenuButton exists
|
||||||
|
if (profile != nullptr && accountMenuButton)
|
||||||
|
{
|
||||||
|
auto profileLabel = profileInUseFilter(profile->name, active_account->isInUse());
|
||||||
|
accountMenuButton->setText(profileLabel);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (accounts->count() <= 0)
|
if (accounts->count() <= 0)
|
||||||
@ -726,11 +745,7 @@ void MainWindow::repopulateAccountsMenu()
|
|||||||
MojangAccountPtr account = accounts->at(i);
|
MojangAccountPtr account = accounts->at(i);
|
||||||
for (auto profile : account->profiles())
|
for (auto profile : account->profiles())
|
||||||
{
|
{
|
||||||
auto profileLabel = profile.name;
|
auto profileLabel = profileInUseFilter(profile.name, account->isInUse());
|
||||||
if(account->isInUse())
|
|
||||||
{
|
|
||||||
profileLabel += tr(" (in use)");
|
|
||||||
}
|
|
||||||
QAction *action = new QAction(profileLabel, this);
|
QAction *action = new QAction(profileLabel, this);
|
||||||
action->setData(account->username());
|
action->setData(account->username());
|
||||||
action->setCheckable(true);
|
action->setCheckable(true);
|
||||||
@ -798,8 +813,9 @@ void MainWindow::activeAccountChanged()
|
|||||||
const AccountProfile *profile = account->currentProfile();
|
const AccountProfile *profile = account->currentProfile();
|
||||||
if (profile != nullptr)
|
if (profile != nullptr)
|
||||||
{
|
{
|
||||||
|
auto profileLabel = profileInUseFilter(profile->name, account->isInUse());
|
||||||
accountMenuButton->setIcon(SkinUtils::getFaceFromCache(profile->id));
|
accountMenuButton->setIcon(SkinUtils::getFaceFromCache(profile->id));
|
||||||
accountMenuButton->setText(profile->name);
|
accountMenuButton->setText(profileLabel);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -176,16 +176,16 @@ private:
|
|||||||
std::unique_ptr<Ui> ui;
|
std::unique_ptr<Ui> ui;
|
||||||
|
|
||||||
// these are managed by Qt's memory management model!
|
// these are managed by Qt's memory management model!
|
||||||
GroupView *view;
|
GroupView *view = nullptr;
|
||||||
InstanceProxyModel *proxymodel;
|
InstanceProxyModel *proxymodel = nullptr;
|
||||||
LabeledToolButton *renameButton;
|
LabeledToolButton *renameButton = nullptr;
|
||||||
QToolButton *changeIconButton;
|
QToolButton *changeIconButton = nullptr;
|
||||||
QToolButton *newsLabel;
|
QToolButton *newsLabel = nullptr;
|
||||||
QLabel *m_statusLeft;
|
QLabel *m_statusLeft = nullptr;
|
||||||
ServerStatus *m_statusRight;
|
ServerStatus *m_statusRight = nullptr;
|
||||||
QMenu *accountMenu;
|
QMenu *accountMenu = nullptr;
|
||||||
QToolButton *accountMenuButton;
|
QToolButton *accountMenuButton = nullptr;
|
||||||
QAction *manageAccountsAction;
|
QAction *manageAccountsAction = nullptr;
|
||||||
|
|
||||||
unique_qobject_ptr<NetJob> skin_download_job;
|
unique_qobject_ptr<NetJob> skin_download_job;
|
||||||
unique_qobject_ptr<NewsChecker> m_newsChecker;
|
unique_qobject_ptr<NewsChecker> m_newsChecker;
|
||||||
@ -195,5 +195,5 @@ private:
|
|||||||
QString m_currentInstIcon;
|
QString m_currentInstIcon;
|
||||||
|
|
||||||
// managed by the application object
|
// managed by the application object
|
||||||
Task *m_versionLoadTask;
|
Task *m_versionLoadTask = nullptr;
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user