mirror of
https://github.com/UltimMC/Launcher.git
synced 2026-01-01 13:16:14 +00:00
UI Improvement: Display account type (#33)
* Add account type column in accounts page * Show account type in account chooser * Allow set skin and delete skin only on mojang accounts * Rename Offline mode to Local
This commit is contained in:
@@ -194,6 +194,18 @@ QString MojangAccount::authEndpoint() const
|
||||
return BuildConfig.AUTH_BASE_MOJANG;
|
||||
}
|
||||
|
||||
QString MojangAccount::displayLoginType() const
|
||||
{
|
||||
if(m_loginType == "mojang")
|
||||
return "Mojang";
|
||||
if(m_loginType == "dummy")
|
||||
return "Local";
|
||||
if(m_loginType == "elyby")
|
||||
return "Ely.by";
|
||||
|
||||
return "Unknown";
|
||||
}
|
||||
|
||||
std::shared_ptr<YggdrasilTask> MojangAccount::login(AuthSessionPtr session, QString password)
|
||||
{
|
||||
Q_ASSERT(m_currentTask.get() == nullptr);
|
||||
|
||||
@@ -141,8 +141,12 @@ public: /* queries */
|
||||
//! Returns whether the account is NotVerified, Verified or Online
|
||||
AccountStatus accountStatus() const;
|
||||
|
||||
//! Returns endpoint for authentication
|
||||
QString authEndpoint() const;
|
||||
|
||||
// ! Returns login type to display in account list or account chooser
|
||||
QString displayLoginType() const;
|
||||
|
||||
signals:
|
||||
/**
|
||||
* This signal is emitted when the account changes
|
||||
|
||||
@@ -194,6 +194,9 @@ QVariant MojangAccountList::data(const QModelIndex &index, int role) const
|
||||
case NameColumn:
|
||||
return account->username();
|
||||
|
||||
case TypeColumn:
|
||||
return account->displayLoginType();
|
||||
|
||||
default:
|
||||
return QVariant();
|
||||
}
|
||||
@@ -229,6 +232,9 @@ QVariant MojangAccountList::headerData(int section, Qt::Orientation orientation,
|
||||
case NameColumn:
|
||||
return tr("Name");
|
||||
|
||||
case TypeColumn:
|
||||
return tr("Account type");
|
||||
|
||||
default:
|
||||
return QVariant();
|
||||
}
|
||||
@@ -256,7 +262,7 @@ int MojangAccountList::rowCount(const QModelIndex &) const
|
||||
|
||||
int MojangAccountList::columnCount(const QModelIndex &) const
|
||||
{
|
||||
return 2;
|
||||
return 3;
|
||||
}
|
||||
|
||||
Qt::ItemFlags MojangAccountList::flags(const QModelIndex &index) const
|
||||
|
||||
@@ -51,6 +51,9 @@ public:
|
||||
|
||||
// Second column - Name
|
||||
NameColumn,
|
||||
|
||||
// Third column - account type
|
||||
TypeColumn,
|
||||
};
|
||||
|
||||
explicit MojangAccountList(QObject *parent = 0);
|
||||
|
||||
Reference in New Issue
Block a user