Fix instance account selector face for offline accounts
This commit is contained in:
parent
e0e3d4d8fe
commit
160dd09fc2
@ -466,7 +466,7 @@ void InstanceSettingsPage::updateAccountsMenu()
|
|||||||
|
|
||||||
if (defaultAccount) {
|
if (defaultAccount) {
|
||||||
ui->instanceAccountSelector->setText(defaultAccount->profileName());
|
ui->instanceAccountSelector->setText(defaultAccount->profileName());
|
||||||
ui->instanceAccountSelector->setIcon(defaultAccount->getFace());
|
ui->instanceAccountSelector->setIcon(getFaceForAccount(defaultAccount));
|
||||||
} else {
|
} else {
|
||||||
ui->instanceAccountSelector->setText(tr("No default account"));
|
ui->instanceAccountSelector->setText(tr("No default account"));
|
||||||
ui->instanceAccountSelector->setIcon(APPLICATION->getThemedIcon("noaccount"));
|
ui->instanceAccountSelector->setIcon(APPLICATION->getThemedIcon("noaccount"));
|
||||||
@ -480,19 +480,21 @@ void InstanceSettingsPage::updateAccountsMenu()
|
|||||||
if (accountIndex == i) {
|
if (accountIndex == i) {
|
||||||
action->setChecked(true);
|
action->setChecked(true);
|
||||||
}
|
}
|
||||||
|
action->setIcon(getFaceForAccount(account));
|
||||||
auto face = account->getFace();
|
|
||||||
if (!face.isNull()) {
|
|
||||||
action->setIcon(face);
|
|
||||||
} else {
|
|
||||||
action->setIcon(APPLICATION->getThemedIcon("noaccount"));
|
|
||||||
}
|
|
||||||
|
|
||||||
accountMenu->addAction(action);
|
accountMenu->addAction(action);
|
||||||
connect(action, SIGNAL(triggered(bool)), this, SLOT(changeInstanceAccount()));
|
connect(action, SIGNAL(triggered(bool)), this, SLOT(changeInstanceAccount()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QIcon InstanceSettingsPage::getFaceForAccount(MinecraftAccountPtr account)
|
||||||
|
{
|
||||||
|
if (auto face = account->getFace(); !face.isNull()) {
|
||||||
|
return face;
|
||||||
|
}
|
||||||
|
|
||||||
|
return APPLICATION->getThemedIcon("noaccount");
|
||||||
|
}
|
||||||
|
|
||||||
void InstanceSettingsPage::changeInstanceAccount()
|
void InstanceSettingsPage::changeInstanceAccount()
|
||||||
{
|
{
|
||||||
QAction* sAction = (QAction*)sender();
|
QAction* sAction = (QAction*)sender();
|
||||||
@ -506,11 +508,7 @@ void InstanceSettingsPage::changeInstanceAccount()
|
|||||||
m_settings->set("InstanceAccountId", account->profileId());
|
m_settings->set("InstanceAccountId", account->profileId());
|
||||||
|
|
||||||
ui->instanceAccountSelector->setText(account->profileName());
|
ui->instanceAccountSelector->setText(account->profileName());
|
||||||
if (auto face = account->getFace(); !face.isNull()) {
|
ui->instanceAccountSelector->setIcon(getFaceForAccount(account));
|
||||||
ui->instanceAccountSelector->setIcon(face);
|
|
||||||
} else {
|
|
||||||
ui->instanceAccountSelector->setIcon(APPLICATION->getThemedIcon("noaccount"));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void InstanceSettingsPage::on_maxMemSpinBox_valueChanged(int i)
|
void InstanceSettingsPage::on_maxMemSpinBox_valueChanged(int i)
|
||||||
|
@ -94,6 +94,7 @@ private slots:
|
|||||||
void globalSettingsButtonClicked(bool checked);
|
void globalSettingsButtonClicked(bool checked);
|
||||||
|
|
||||||
void updateAccountsMenu();
|
void updateAccountsMenu();
|
||||||
|
QIcon getFaceForAccount(MinecraftAccountPtr account);
|
||||||
void changeInstanceAccount();
|
void changeInstanceAccount();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
Loading…
Reference in New Issue
Block a user