aboutsummaryrefslogtreecommitdiff
path: root/launcher/dialogs/ProfileSelectDialog.cpp
diff options
context:
space:
mode:
authorPetr Mrázek <peterix@gmail.com>2021-07-26 21:44:11 +0200
committerPetr Mrázek <peterix@gmail.com>2021-08-15 23:18:50 +0200
commit3a53349e332599221bc325f7fac9dc7927194bc2 (patch)
tree2ee40fa6044c241b3b7db27fe0b83931b453c2b2 /launcher/dialogs/ProfileSelectDialog.cpp
parentfca2e9e44cb44004eec7f47c03b186bd5e44dc32 (diff)
downloadPrismLauncher-3a53349e332599221bc325f7fac9dc7927194bc2.tar.gz
PrismLauncher-3a53349e332599221bc325f7fac9dc7927194bc2.tar.bz2
PrismLauncher-3a53349e332599221bc325f7fac9dc7927194bc2.zip
GH-3392 dirty initial MSA support that shares logic with Mojang flows
Both act as the first step of AuthContext.
Diffstat (limited to 'launcher/dialogs/ProfileSelectDialog.cpp')
-rw-r--r--launcher/dialogs/ProfileSelectDialog.cpp32
1 files changed, 16 insertions, 16 deletions
diff --git a/launcher/dialogs/ProfileSelectDialog.cpp b/launcher/dialogs/ProfileSelectDialog.cpp
index ae34709f..e2ad73e4 100644
--- a/launcher/dialogs/ProfileSelectDialog.cpp
+++ b/launcher/dialogs/ProfileSelectDialog.cpp
@@ -33,9 +33,10 @@ ProfileSelectDialog::ProfileSelectDialog(const QString &message, int flags, QWid
m_accounts = MMC->accounts();
auto view = ui->listView;
//view->setModel(m_accounts.get());
- //view->hideColumn(MojangAccountList::ActiveColumn);
+ //view->hideColumn(AccountList::ActiveColumn);
view->setColumnCount(1);
view->setRootIsDecorated(false);
+ // FIXME: use a real model, not this
if(QTreeWidgetItem* header = view->headerItem())
{
header->setText(0, tr("Name"));
@@ -47,20 +48,19 @@ ProfileSelectDialog::ProfileSelectDialog(const QString &message, int flags, QWid
QList <QTreeWidgetItem *> items;
for (int i = 0; i < m_accounts->count(); i++)
{
- MojangAccountPtr account = m_accounts->at(i);
- for (auto profile : account->profiles())
- {
- auto profileLabel = profile.name;
- if(account->isInUse())
- {
- profileLabel += tr(" (in use)");
- }
- auto item = new QTreeWidgetItem(view);
- item->setText(0, profileLabel);
- item->setIcon(0, SkinUtils::getFaceFromCache(profile.id));
- item->setData(0, MojangAccountList::PointerRole, QVariant::fromValue(account));
- items.append(item);
+ MinecraftAccountPtr account = m_accounts->at(i);
+ QString profileLabel;
+ if(account->isInUse()) {
+ profileLabel = tr("%1 (in use)").arg(account->profileName());
}
+ else {
+ profileLabel = account->profileName();
+ }
+ auto item = new QTreeWidgetItem(view);
+ item->setText(0, profileLabel);
+ item->setIcon(0, account->getFace());
+ item->setData(0, AccountList::PointerRole, QVariant::fromValue(account));
+ items.append(item);
}
view->addTopLevelItems(items);
@@ -84,7 +84,7 @@ ProfileSelectDialog::~ProfileSelectDialog()
delete ui;
}
-MojangAccountPtr ProfileSelectDialog::selectedAccount() const
+MinecraftAccountPtr ProfileSelectDialog::selectedAccount() const
{
return m_selected;
}
@@ -105,7 +105,7 @@ void ProfileSelectDialog::on_buttonBox_accepted()
if (selection.size() > 0)
{
QModelIndex selected = selection.first();
- m_selected = selected.data(MojangAccountList::PointerRole).value<MojangAccountPtr>();
+ m_selected = selected.data(AccountList::PointerRole).value<MinecraftAccountPtr>();
}
close();
}