GH-1433 with no default account, show profiles instead of accounts in selection dialog
This commit is contained in:
parent
55544893a3
commit
2f0441b3c1
@ -110,8 +110,8 @@ SET(MULTIMC_SOURCES
|
|||||||
SettingsUI.h
|
SettingsUI.h
|
||||||
|
|
||||||
# Processes
|
# Processes
|
||||||
LaunchInteraction.h
|
LaunchController.h
|
||||||
LaunchInteraction.cpp
|
LaunchController.cpp
|
||||||
|
|
||||||
# page provider for instances
|
# page provider for instances
|
||||||
InstancePageProvider.h
|
InstancePageProvider.h
|
||||||
@ -168,8 +168,8 @@ SET(MULTIMC_SOURCES
|
|||||||
# GUI - dialogs
|
# GUI - dialogs
|
||||||
dialogs/AboutDialog.cpp
|
dialogs/AboutDialog.cpp
|
||||||
dialogs/AboutDialog.h
|
dialogs/AboutDialog.h
|
||||||
dialogs/AccountSelectDialog.cpp
|
dialogs/ProfileSelectDialog.cpp
|
||||||
dialogs/AccountSelectDialog.h
|
dialogs/ProfileSelectDialog.h
|
||||||
dialogs/CopyInstanceDialog.cpp
|
dialogs/CopyInstanceDialog.cpp
|
||||||
dialogs/CopyInstanceDialog.h
|
dialogs/CopyInstanceDialog.h
|
||||||
dialogs/CustomMessageBox.cpp
|
dialogs/CustomMessageBox.cpp
|
||||||
@ -267,7 +267,7 @@ SET(MULTIMC_UIS
|
|||||||
dialogs/VersionSelectDialog.ui
|
dialogs/VersionSelectDialog.ui
|
||||||
dialogs/ProgressDialog.ui
|
dialogs/ProgressDialog.ui
|
||||||
dialogs/IconPickerDialog.ui
|
dialogs/IconPickerDialog.ui
|
||||||
dialogs/AccountSelectDialog.ui
|
dialogs/ProfileSelectDialog.ui
|
||||||
dialogs/EditAccountDialog.ui
|
dialogs/EditAccountDialog.ui
|
||||||
dialogs/ExportInstanceDialog.ui
|
dialogs/ExportInstanceDialog.ui
|
||||||
dialogs/LoginDialog.ui
|
dialogs/LoginDialog.ui
|
||||||
|
@ -16,7 +16,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <QMainWindow>
|
#include <QMainWindow>
|
||||||
#include "LaunchInteraction.h"
|
#include "LaunchController.h"
|
||||||
#include <QObjectPtr.h>
|
#include <QObjectPtr.h>
|
||||||
#include <QSystemTrayIcon>
|
#include <QSystemTrayIcon>
|
||||||
#include "launch/LaunchTask.h"
|
#include "launch/LaunchTask.h"
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
#include "LaunchInteraction.h"
|
#include "LaunchController.h"
|
||||||
#include "MainWindow.h"
|
#include "MainWindow.h"
|
||||||
#include <minecraft/auth/MojangAccountList.h>
|
#include <minecraft/auth/MojangAccountList.h>
|
||||||
#include "MultiMC.h"
|
#include "MultiMC.h"
|
||||||
#include "dialogs/CustomMessageBox.h"
|
#include "dialogs/CustomMessageBox.h"
|
||||||
#include "dialogs/AccountSelectDialog.h"
|
#include "dialogs/ProfileSelectDialog.h"
|
||||||
#include "dialogs/ProgressDialog.h"
|
#include "dialogs/ProgressDialog.h"
|
||||||
#include "dialogs/EditAccountDialog.h"
|
#include "dialogs/EditAccountDialog.h"
|
||||||
#include "InstanceWindow.h"
|
#include "InstanceWindow.h"
|
||||||
@ -59,8 +59,8 @@ void LaunchController::login()
|
|||||||
else if (account.get() == nullptr)
|
else if (account.get() == nullptr)
|
||||||
{
|
{
|
||||||
// If no default account is set, ask the user which one to use.
|
// If no default account is set, ask the user which one to use.
|
||||||
AccountSelectDialog selectDialog(tr("Which account would you like to use?"),
|
ProfileSelectDialog selectDialog(tr("Which profile would you like to use?"),
|
||||||
AccountSelectDialog::GlobalDefaultCheckbox, m_parentWidget);
|
ProfileSelectDialog::GlobalDefaultCheckbox, m_parentWidget);
|
||||||
|
|
||||||
selectDialog.exec();
|
selectDialog.exec();
|
||||||
|
|
@ -56,6 +56,7 @@
|
|||||||
#include <launch/LaunchTask.h>
|
#include <launch/LaunchTask.h>
|
||||||
#include <minecraft/MinecraftVersionList.h>
|
#include <minecraft/MinecraftVersionList.h>
|
||||||
#include <minecraft/legacy/LwjglVersionList.h>
|
#include <minecraft/legacy/LwjglVersionList.h>
|
||||||
|
#include <minecraft/auth/MojangAccountList.h>
|
||||||
#include <SkinUtils.h>
|
#include <SkinUtils.h>
|
||||||
#include <net/URLConstants.h>
|
#include <net/URLConstants.h>
|
||||||
#include <net/NetJob.h>
|
#include <net/NetJob.h>
|
||||||
@ -66,12 +67,11 @@
|
|||||||
#include <updater/DownloadTask.h>
|
#include <updater/DownloadTask.h>
|
||||||
#include <updater/UpdateChecker.h>
|
#include <updater/UpdateChecker.h>
|
||||||
#include <DesktopServices.h>
|
#include <DesktopServices.h>
|
||||||
|
|
||||||
#include "InstanceWindow.h"
|
#include "InstanceWindow.h"
|
||||||
#include "InstancePageProvider.h"
|
#include "InstancePageProvider.h"
|
||||||
#include "InstanceProxyModel.h"
|
#include "InstanceProxyModel.h"
|
||||||
#include "JavaCommon.h"
|
#include "JavaCommon.h"
|
||||||
#include "LaunchInteraction.h"
|
#include "LaunchController.h"
|
||||||
#include "SettingsUI.h"
|
#include "SettingsUI.h"
|
||||||
#include "groupview/GroupView.h"
|
#include "groupview/GroupView.h"
|
||||||
#include "groupview/InstanceDelegate.h"
|
#include "groupview/InstanceDelegate.h"
|
||||||
@ -84,7 +84,6 @@
|
|||||||
#include "dialogs/CustomMessageBox.h"
|
#include "dialogs/CustomMessageBox.h"
|
||||||
#include "dialogs/IconPickerDialog.h"
|
#include "dialogs/IconPickerDialog.h"
|
||||||
#include "dialogs/CopyInstanceDialog.h"
|
#include "dialogs/CopyInstanceDialog.h"
|
||||||
#include "dialogs/AccountSelectDialog.h"
|
|
||||||
#include "dialogs/UpdateDialog.h"
|
#include "dialogs/UpdateDialog.h"
|
||||||
#include "dialogs/EditAccountDialog.h"
|
#include "dialogs/EditAccountDialog.h"
|
||||||
#include "dialogs/NotificationDialog.h"
|
#include "dialogs/NotificationDialog.h"
|
||||||
|
@ -13,8 +13,9 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "AccountSelectDialog.h"
|
#include "ProfileSelectDialog.h"
|
||||||
#include "ui_AccountSelectDialog.h"
|
#include <SkinUtils.h>
|
||||||
|
#include "ui_ProfileSelectDialog.h"
|
||||||
|
|
||||||
#include <QItemSelectionModel>
|
#include <QItemSelectionModel>
|
||||||
|
|
||||||
@ -24,14 +25,39 @@
|
|||||||
|
|
||||||
#include <MultiMC.h>
|
#include <MultiMC.h>
|
||||||
|
|
||||||
AccountSelectDialog::AccountSelectDialog(const QString &message, int flags, QWidget *parent)
|
ProfileSelectDialog::ProfileSelectDialog(const QString &message, int flags, QWidget *parent)
|
||||||
: QDialog(parent), ui(new Ui::AccountSelectDialog)
|
: QDialog(parent), ui(new Ui::ProfileSelectDialog)
|
||||||
{
|
{
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
|
|
||||||
m_accounts = MMC->accounts();
|
m_accounts = MMC->accounts();
|
||||||
ui->listView->setModel(m_accounts.get());
|
auto view = ui->listView;
|
||||||
ui->listView->hideColumn(MojangAccountList::ActiveColumn);
|
//view->setModel(m_accounts.get());
|
||||||
|
//view->hideColumn(MojangAccountList::ActiveColumn);
|
||||||
|
view->setColumnCount(1);
|
||||||
|
view->setRootIsDecorated(false);
|
||||||
|
if(QTreeWidgetItem* header = view->headerItem())
|
||||||
|
{
|
||||||
|
header->setText(0, tr("Name"));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
view->setHeaderLabel(tr("Name"));
|
||||||
|
}
|
||||||
|
QList <QTreeWidgetItem *> items;
|
||||||
|
for (int i = 0; i < m_accounts->count(); i++)
|
||||||
|
{
|
||||||
|
MojangAccountPtr account = m_accounts->at(i);
|
||||||
|
for (auto profile : account->profiles())
|
||||||
|
{
|
||||||
|
auto item = new QTreeWidgetItem(view);
|
||||||
|
item->setText(0, profile.name);
|
||||||
|
item->setIcon(0, SkinUtils::getFaceFromCache(profile.id));
|
||||||
|
item->setData(0, MojangAccountList::PointerRole, QVariant::fromValue(account));
|
||||||
|
items.append(item);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
view->addTopLevelItems(items);
|
||||||
|
|
||||||
// Set the message label.
|
// Set the message label.
|
||||||
ui->msgLabel->setVisible(!message.isEmpty());
|
ui->msgLabel->setVisible(!message.isEmpty());
|
||||||
@ -48,27 +74,27 @@ AccountSelectDialog::AccountSelectDialog(const QString &message, int flags, QWid
|
|||||||
connect(ui->listView, SIGNAL(doubleClicked(QModelIndex)), SLOT(on_buttonBox_accepted()));
|
connect(ui->listView, SIGNAL(doubleClicked(QModelIndex)), SLOT(on_buttonBox_accepted()));
|
||||||
}
|
}
|
||||||
|
|
||||||
AccountSelectDialog::~AccountSelectDialog()
|
ProfileSelectDialog::~ProfileSelectDialog()
|
||||||
{
|
{
|
||||||
delete ui;
|
delete ui;
|
||||||
}
|
}
|
||||||
|
|
||||||
MojangAccountPtr AccountSelectDialog::selectedAccount() const
|
MojangAccountPtr ProfileSelectDialog::selectedAccount() const
|
||||||
{
|
{
|
||||||
return m_selected;
|
return m_selected;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool AccountSelectDialog::useAsGlobalDefault() const
|
bool ProfileSelectDialog::useAsGlobalDefault() const
|
||||||
{
|
{
|
||||||
return ui->globalDefaultCheck->isChecked();
|
return ui->globalDefaultCheck->isChecked();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool AccountSelectDialog::useAsInstDefaullt() const
|
bool ProfileSelectDialog::useAsInstDefaullt() const
|
||||||
{
|
{
|
||||||
return ui->instDefaultCheck->isChecked();
|
return ui->instDefaultCheck->isChecked();
|
||||||
}
|
}
|
||||||
|
|
||||||
void AccountSelectDialog::on_buttonBox_accepted()
|
void ProfileSelectDialog::on_buttonBox_accepted()
|
||||||
{
|
{
|
||||||
QModelIndexList selection = ui->listView->selectionModel()->selectedIndexes();
|
QModelIndexList selection = ui->listView->selectionModel()->selectedIndexes();
|
||||||
if (selection.size() > 0)
|
if (selection.size() > 0)
|
||||||
@ -79,7 +105,7 @@ void AccountSelectDialog::on_buttonBox_accepted()
|
|||||||
close();
|
close();
|
||||||
}
|
}
|
||||||
|
|
||||||
void AccountSelectDialog::on_buttonBox_rejected()
|
void ProfileSelectDialog::on_buttonBox_rejected()
|
||||||
{
|
{
|
||||||
close();
|
close();
|
||||||
}
|
}
|
@ -23,10 +23,10 @@
|
|||||||
|
|
||||||
namespace Ui
|
namespace Ui
|
||||||
{
|
{
|
||||||
class AccountSelectDialog;
|
class ProfileSelectDialog;
|
||||||
}
|
}
|
||||||
|
|
||||||
class AccountSelectDialog : public QDialog
|
class ProfileSelectDialog : public QDialog
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
@ -52,8 +52,8 @@ public:
|
|||||||
* Constructs a new account select dialog with the given parent and message.
|
* Constructs a new account select dialog with the given parent and message.
|
||||||
* The message will be shown at the top of the dialog. It is an empty string by default.
|
* The message will be shown at the top of the dialog. It is an empty string by default.
|
||||||
*/
|
*/
|
||||||
explicit AccountSelectDialog(const QString& message="", int flags=0, QWidget *parent = 0);
|
explicit ProfileSelectDialog(const QString& message="", int flags=0, QWidget *parent = 0);
|
||||||
~AccountSelectDialog();
|
~ProfileSelectDialog();
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* Gets a pointer to the account that the user selected.
|
* Gets a pointer to the account that the user selected.
|
||||||
@ -86,5 +86,5 @@ protected:
|
|||||||
MojangAccountPtr m_selected;
|
MojangAccountPtr m_selected;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Ui::AccountSelectDialog *ui;
|
Ui::ProfileSelectDialog *ui;
|
||||||
};
|
};
|
@ -1,12 +1,12 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<ui version="4.0">
|
<ui version="4.0">
|
||||||
<class>AccountSelectDialog</class>
|
<class>ProfileSelectDialog</class>
|
||||||
<widget class="QDialog" name="AccountSelectDialog">
|
<widget class="QDialog" name="ProfileSelectDialog">
|
||||||
<property name="geometry">
|
<property name="geometry">
|
||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>413</width>
|
<width>465</width>
|
||||||
<height>300</height>
|
<height>300</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
@ -17,12 +17,18 @@
|
|||||||
<item>
|
<item>
|
||||||
<widget class="QLabel" name="msgLabel">
|
<widget class="QLabel" name="msgLabel">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Select an account.</string>
|
<string>Select a profile.</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QTreeView" name="listView"/>
|
<widget class="QTreeWidget" name="listView">
|
||||||
|
<column>
|
||||||
|
<property name="text">
|
||||||
|
<string notr="true">1</string>
|
||||||
|
</property>
|
||||||
|
</column>
|
||||||
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
<layout class="QHBoxLayout" name="horizontalLayout">
|
@ -1,6 +1,6 @@
|
|||||||
#include "MultiMC.h"
|
#include "MultiMC.h"
|
||||||
#include "MainWindow.h"
|
#include "MainWindow.h"
|
||||||
#include "LaunchInteraction.h"
|
#include "LaunchController.h"
|
||||||
#include <InstanceList.h>
|
#include <InstanceList.h>
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
|
|
||||||
|
@ -25,7 +25,6 @@
|
|||||||
#include "Env.h"
|
#include "Env.h"
|
||||||
|
|
||||||
#include "dialogs/ProgressDialog.h"
|
#include "dialogs/ProgressDialog.h"
|
||||||
#include "dialogs/AccountSelectDialog.h"
|
|
||||||
#include "dialogs/LoginDialog.h"
|
#include "dialogs/LoginDialog.h"
|
||||||
#include "dialogs/CustomMessageBox.h"
|
#include "dialogs/CustomMessageBox.h"
|
||||||
#include "dialogs/SkinUploadDialog.h"
|
#include "dialogs/SkinUploadDialog.h"
|
||||||
|
Loading…
Reference in New Issue
Block a user