aboutsummaryrefslogtreecommitdiff
path: root/launcher/minecraft/auth/AccountTask.cpp
diff options
context:
space:
mode:
authorTheKodeToad <TheKodeToad@proton.me>2023-08-16 20:46:16 +0100
committerTheKodeToad <TheKodeToad@proton.me>2023-08-16 22:23:38 +0100
commit3e2733d840d24ce4f46b49bca0b8656d4d6e3d87 (patch)
tree386113207514b8071b0122b318c10439259ca83c /launcher/minecraft/auth/AccountTask.cpp
parent57430fd189aed592a170d597de61b3acabaaa43d (diff)
parentc88088c91a92a371a9bc2b7384c2897157772b7e (diff)
downloadPrismLauncher-3e2733d840d24ce4f46b49bca0b8656d4d6e3d87.tar.gz
PrismLauncher-3e2733d840d24ce4f46b49bca0b8656d4d6e3d87.tar.bz2
PrismLauncher-3e2733d840d24ce4f46b49bca0b8656d4d6e3d87.zip
Merge branch 'develop' into better-launch
Signed-off-by: TheKodeToad <TheKodeToad@proton.me>
Diffstat (limited to 'launcher/minecraft/auth/AccountTask.cpp')
-rw-r--r--launcher/minecraft/auth/AccountTask.cpp54
1 files changed, 26 insertions, 28 deletions
diff --git a/launcher/minecraft/auth/AccountTask.cpp b/launcher/minecraft/auth/AccountTask.cpp
index 4118c3c5..4c3d6ee1 100644
--- a/launcher/minecraft/auth/AccountTask.cpp
+++ b/launcher/minecraft/auth/AccountTask.cpp
@@ -1,6 +1,6 @@
// SPDX-License-Identifier: GPL-3.0-only
/*
- * PolyMC - Minecraft Launcher
+ * Prism Launcher - Minecraft Launcher
* Copyright (C) 2022 Sefa Eyeoglu <contact@scrumplex.net>
*
* This program is free software: you can redistribute it and/or modify
@@ -36,43 +36,41 @@
#include "AccountTask.h"
#include "MinecraftAccount.h"
-#include <QObject>
-#include <QString>
-#include <QJsonObject>
+#include <QByteArray>
#include <QJsonDocument>
+#include <QJsonObject>
#include <QNetworkReply>
-#include <QByteArray>
+#include <QObject>
+#include <QString>
#include <QDebug>
-AccountTask::AccountTask(AccountData *data, QObject *parent)
- : Task(parent), m_data(data)
+AccountTask::AccountTask(AccountData* data, QObject* parent) : Task(parent), m_data(data)
{
changeState(AccountTaskState::STATE_CREATED);
}
QString AccountTask::getStateMessage() const
{
- switch (m_taskState)
- {
- case AccountTaskState::STATE_CREATED:
- return "Waiting...";
- case AccountTaskState::STATE_WORKING:
- return tr("Sending request to auth servers...");
- case AccountTaskState::STATE_SUCCEEDED:
- return tr("Authentication task succeeded.");
- case AccountTaskState::STATE_OFFLINE:
- return tr("Failed to contact the authentication server.");
- case AccountTaskState::STATE_DISABLED:
- return tr("Client ID has changed. New session needs to be created.");
- case AccountTaskState::STATE_FAILED_SOFT:
- return tr("Encountered an error during authentication.");
- case AccountTaskState::STATE_FAILED_HARD:
- return tr("Failed to authenticate. The session has expired.");
- case AccountTaskState::STATE_FAILED_GONE:
- return tr("Failed to authenticate. The account no longer exists.");
- default:
- return tr("...");
+ switch (m_taskState) {
+ case AccountTaskState::STATE_CREATED:
+ return "Waiting...";
+ case AccountTaskState::STATE_WORKING:
+ return tr("Sending request to auth servers...");
+ case AccountTaskState::STATE_SUCCEEDED:
+ return tr("Authentication task succeeded.");
+ case AccountTaskState::STATE_OFFLINE:
+ return tr("Failed to contact the authentication server.");
+ case AccountTaskState::STATE_DISABLED:
+ return tr("Client ID has changed. New session needs to be created.");
+ case AccountTaskState::STATE_FAILED_SOFT:
+ return tr("Encountered an error during authentication.");
+ case AccountTaskState::STATE_FAILED_HARD:
+ return tr("Failed to authenticate. The session has expired.");
+ case AccountTaskState::STATE_FAILED_GONE:
+ return tr("Failed to authenticate. The account no longer exists.");
+ default:
+ return tr("...");
}
}
@@ -82,7 +80,7 @@ bool AccountTask::changeState(AccountTaskState newState, QString reason)
// FIXME: virtual method invoked in constructor.
// We want that behavior, but maybe make it less weird?
setStatus(getStateMessage());
- switch(newState) {
+ switch (newState) {
case AccountTaskState::STATE_CREATED: {
m_data->errorString.clear();
return true;