Add auth server column to account list

Signed-off-by: BatteredBunny <ayes2022@protonmail.com>
This commit is contained in:
BatteredBunny 2024-01-18 23:48:39 +02:00
parent 99cb41421d
commit 5c95f10f64
2 changed files with 17 additions and 0 deletions

View File

@ -51,6 +51,7 @@
#include <FileSystem.h> #include <FileSystem.h>
#include <QSaveFile> #include <QSaveFile>
#include <QString>
#include <chrono> #include <chrono>
@ -333,6 +334,17 @@ QVariant AccountList::data(const QModelIndex& index, int role) const
} }
} }
case AuthServerColumn: {
QString suffix = "/authlib-injector/authserver";
QString server = account->authServerUrl();
if (server.endsWith(suffix)) {
server.chop(suffix.length());
return server;
} else {
return server;
}
}
case MigrationColumn: { case MigrationColumn: {
if (!account->isMojang()) { if (!account->isMojang()) {
return tr("N/A", "Can Migrate"); return tr("N/A", "Can Migrate");
@ -379,6 +391,8 @@ QVariant AccountList::headerData(int section, [[maybe_unused]] Qt::Orientation o
return tr("Type"); return tr("Type");
case StatusColumn: case StatusColumn:
return tr("Status"); return tr("Status");
case AuthServerColumn:
return tr("Server");
default: default:
return QVariant(); return QVariant();
} }
@ -393,6 +407,8 @@ QVariant AccountList::headerData(int section, [[maybe_unused]] Qt::Orientation o
return tr("Type of the account (MSA or Offline)"); return tr("Type of the account (MSA or Offline)");
case StatusColumn: case StatusColumn:
return tr("Current status of the account."); return tr("Current status of the account.");
case AuthServerColumn:
return tr("Auth server the account is using.");
default: default:
return QVariant(); return QVariant();
} }

View File

@ -58,6 +58,7 @@ class AccountList : public QAbstractListModel {
MigrationColumn, MigrationColumn,
TypeColumn, TypeColumn,
StatusColumn, StatusColumn,
AuthServerColumn,
NUM_COLUMNS NUM_COLUMNS
}; };