Localize account type in account list
Signed-off-by: LocalSpook <56512186+LocalSpook@users.noreply.github.com>
This commit is contained in:
parent
38d77b58cd
commit
9d972ccc63
@ -68,6 +68,8 @@ function(
|
|||||||
/w14906 # string literal cast to 'LPWSTR'
|
/w14906 # string literal cast to 'LPWSTR'
|
||||||
/w14928 # illegal copy-initialization; more than one user-defined conversion has been implicitly applied
|
/w14928 # illegal copy-initialization; more than one user-defined conversion has been implicitly applied
|
||||||
/permissive- # standards conformance mode for MSVC compiler.
|
/permissive- # standards conformance mode for MSVC compiler.
|
||||||
|
|
||||||
|
/we4062 # forbid omitting a possible value of an enum in a switch statement
|
||||||
)
|
)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
@ -93,6 +95,8 @@ function(
|
|||||||
# in a lot of noise. This warning is only notifying us that clang is emulating the GCC behaviour
|
# in a lot of noise. This warning is only notifying us that clang is emulating the GCC behaviour
|
||||||
# instead of the exact standard wording so we can safely ignore it
|
# instead of the exact standard wording so we can safely ignore it
|
||||||
-Wno-gnu-zero-variadic-macro-arguments
|
-Wno-gnu-zero-variadic-macro-arguments
|
||||||
|
|
||||||
|
-Werror=switch # forbid omitting a possible value of an enum in a switch statement
|
||||||
)
|
)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
@ -104,6 +108,8 @@ function(
|
|||||||
-Wduplicated-branches # warn if if / else branches have duplicated code
|
-Wduplicated-branches # warn if if / else branches have duplicated code
|
||||||
-Wlogical-op # warn about logical operations being used where bitwise were probably wanted
|
-Wlogical-op # warn about logical operations being used where bitwise were probably wanted
|
||||||
-Wuseless-cast # warn if you perform a cast to the same type
|
-Wuseless-cast # warn if you perform a cast to the same type
|
||||||
|
|
||||||
|
-Werror=switch # forbid omitting a possible value of an enum in a switch statement
|
||||||
)
|
)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
@ -128,6 +134,8 @@ function(
|
|||||||
-Woverloaded-virtual
|
-Woverloaded-virtual
|
||||||
-Wuseless-cast
|
-Wuseless-cast
|
||||||
-Wextra-semi
|
-Wextra-semi
|
||||||
|
|
||||||
|
-Werror=switch # forbid omitting a possible value of an enum in a switch statement
|
||||||
)
|
)
|
||||||
|
|
||||||
target_compile_options(
|
target_compile_options(
|
||||||
|
@ -36,6 +36,7 @@
|
|||||||
|
|
||||||
#include "LaunchController.h"
|
#include "LaunchController.h"
|
||||||
#include "Application.h"
|
#include "Application.h"
|
||||||
|
#include "minecraft/auth/AccountData.h"
|
||||||
#include "minecraft/auth/AccountList.h"
|
#include "minecraft/auth/AccountList.h"
|
||||||
|
|
||||||
#include "ui/InstanceWindow.h"
|
#include "ui/InstanceWindow.h"
|
||||||
@ -161,7 +162,7 @@ void LaunchController::login()
|
|||||||
m_accountToUse->fillSession(m_session);
|
m_accountToUse->fillSession(m_session);
|
||||||
|
|
||||||
// Launch immediately in true offline mode
|
// Launch immediately in true offline mode
|
||||||
if (m_accountToUse->isOffline()) {
|
if (m_accountToUse->accountType() == AccountType::Offline) {
|
||||||
launchInstance();
|
launchInstance();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -283,9 +283,15 @@ QVariant AccountList::data(const QModelIndex& index, int role) const
|
|||||||
return account->accountDisplayString();
|
return account->accountDisplayString();
|
||||||
|
|
||||||
case TypeColumn: {
|
case TypeColumn: {
|
||||||
auto typeStr = account->typeString();
|
switch (account->accountType()) {
|
||||||
typeStr[0] = typeStr[0].toUpper();
|
case AccountType::MSA: {
|
||||||
return typeStr;
|
return tr("MSA", "Account type");
|
||||||
|
}
|
||||||
|
case AccountType::Offline: {
|
||||||
|
return tr("Offline", "Account type");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return tr("Unknown", "Account type");
|
||||||
}
|
}
|
||||||
|
|
||||||
case StatusColumn: {
|
case StatusColumn: {
|
||||||
|
@ -52,6 +52,7 @@
|
|||||||
|
|
||||||
#include "flows/MSA.h"
|
#include "flows/MSA.h"
|
||||||
#include "flows/Offline.h"
|
#include "flows/Offline.h"
|
||||||
|
#include "minecraft/auth/AccountData.h"
|
||||||
|
|
||||||
MinecraftAccount::MinecraftAccount(QObject* parent) : QObject(parent)
|
MinecraftAccount::MinecraftAccount(QObject* parent) : QObject(parent)
|
||||||
{
|
{
|
||||||
@ -185,7 +186,7 @@ void MinecraftAccount::authFailed(QString reason)
|
|||||||
// NOTE: this doesn't do much. There was an error of some sort.
|
// NOTE: this doesn't do much. There was an error of some sort.
|
||||||
} break;
|
} break;
|
||||||
case AccountTaskState::STATE_FAILED_HARD: {
|
case AccountTaskState::STATE_FAILED_HARD: {
|
||||||
if (isMSA()) {
|
if (accountType() == AccountType::MSA) {
|
||||||
data.msaToken.token = QString();
|
data.msaToken.token = QString();
|
||||||
data.msaToken.refresh_token = QString();
|
data.msaToken.refresh_token = QString();
|
||||||
data.msaToken.validity = Katabasis::Validity::None;
|
data.msaToken.validity = Katabasis::Validity::None;
|
||||||
|
@ -118,9 +118,7 @@ class MinecraftAccount : public QObject, public Usable {
|
|||||||
|
|
||||||
bool isActive() const;
|
bool isActive() const;
|
||||||
|
|
||||||
bool isMSA() const { return data.type == AccountType::MSA; }
|
[[nodiscard]] AccountType accountType() const noexcept { return data.type; }
|
||||||
|
|
||||||
bool isOffline() const { return data.type == AccountType::Offline; }
|
|
||||||
|
|
||||||
bool ownsMinecraft() const { return data.minecraftEntitlement.ownsMinecraft; }
|
bool ownsMinecraft() const { return data.minecraftEntitlement.ownsMinecraft; }
|
||||||
|
|
||||||
|
@ -35,6 +35,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "AccountListPage.h"
|
#include "AccountListPage.h"
|
||||||
|
#include "minecraft/auth/AccountData.h"
|
||||||
#include "ui_AccountListPage.h"
|
#include "ui_AccountListPage.h"
|
||||||
|
|
||||||
#include <QItemSelectionModel>
|
#include <QItemSelectionModel>
|
||||||
@ -215,7 +216,7 @@ void AccountListPage::updateButtonStates()
|
|||||||
QModelIndex selected = selection.first();
|
QModelIndex selected = selection.first();
|
||||||
MinecraftAccountPtr account = selected.data(AccountList::PointerRole).value<MinecraftAccountPtr>();
|
MinecraftAccountPtr account = selected.data(AccountList::PointerRole).value<MinecraftAccountPtr>();
|
||||||
accountIsReady = !account->isActive();
|
accountIsReady = !account->isActive();
|
||||||
accountIsOnline = !account->isOffline();
|
accountIsOnline = account->accountType() != AccountType::Offline;
|
||||||
}
|
}
|
||||||
ui->actionRemove->setEnabled(accountIsReady);
|
ui->actionRemove->setEnabled(accountIsReady);
|
||||||
ui->actionSetDefault->setEnabled(accountIsReady);
|
ui->actionSetDefault->setEnabled(accountIsReady);
|
||||||
|
Loading…
Reference in New Issue
Block a user