mirror of
https://github.com/UltimMC/Launcher.git
synced 2025-12-24 12:32:42 +00:00
Dehardcode account providers (#38)
* Dehardcode account providers * Fix crash on creation * Add dynamic 'add account dialog' provider selector * Fix typo and add newlines * Rename loginType to provider * Rename MojangAccount to Account and MojangAccountList to AccountList * Fix json save error
This commit is contained in:
@@ -33,7 +33,7 @@ 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);
|
||||
if(QTreeWidgetItem* header = view->headerItem())
|
||||
@@ -47,7 +47,7 @@ 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);
|
||||
AccountPtr account = m_accounts->at(i);
|
||||
for (auto profile : account->profiles())
|
||||
{
|
||||
auto profileLabel = profile.name;
|
||||
@@ -58,7 +58,7 @@ ProfileSelectDialog::ProfileSelectDialog(const QString &message, int flags, QWid
|
||||
auto item = new QTreeWidgetItem(view);
|
||||
item->setText(0, profileLabel);
|
||||
item->setIcon(0, SkinUtils::getFaceFromCache(profile.id));
|
||||
item->setData(0, MojangAccountList::PointerRole, QVariant::fromValue(account));
|
||||
item->setData(0, AccountList::PointerRole, QVariant::fromValue(account));
|
||||
items.append(item);
|
||||
}
|
||||
}
|
||||
@@ -84,7 +84,7 @@ ProfileSelectDialog::~ProfileSelectDialog()
|
||||
delete ui;
|
||||
}
|
||||
|
||||
MojangAccountPtr ProfileSelectDialog::selectedAccount() const
|
||||
AccountPtr 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<AccountPtr>();
|
||||
}
|
||||
close();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user