ShatteredPrism/launcher/minecraft/auth/AuthStep.h
Reider745 60234a550b
Some checks failed
CodeQL Code Scanning / CodeQL (push) Has been cancelled
Build Application / Build Debug (push) Has been cancelled
Nix / Build (${{ matrix.system }}) (macos-13, x86_64-darwin) (push) Has been cancelled
Nix / Build (${{ matrix.system }}) (macos-14, aarch64-darwin) (push) Has been cancelled
Nix / Build (${{ matrix.system }}) (ubuntu-22.04, x86_64-linux) (push) Has been cancelled
Nix / Build (${{ matrix.system }}) (ubuntu-22.04-arm, aarch64-linux) (push) Has been cancelled
Update Flake Lockfile / update-flake (push) Has been cancelled
feat: auto install modpack & choise nickname
2025-04-15 11:13:45 +03:00

45 lines
1.2 KiB
C++
Executable File

#pragma once
#include <QList>
#include <QNetworkReply>
#include <QObject>
#include "QObjectPtr.h"
#include "minecraft/auth/AccountData.h"
/**
* Enum for describing the state of the current task.
* Used by the getStateMessage function to determine what the status message should be.
*/
enum class AccountTaskState {
STATE_CREATED,
STATE_WORKING,
STATE_SUCCEEDED,
STATE_DISABLED, //!< MSA Client ID has changed. Tell user to reloginn
STATE_FAILED_SOFT, //!< soft failure. authentication went through partially
STATE_FAILED_HARD, //!< hard failure. main tokens are invalid
STATE_FAILED_GONE, //!< hard failure. main tokens are invalid, and the account no longer exists
STATE_OFFLINE //!< soft failure. authentication failed in the first step in a 'soft' way
};
class AuthStep : public QObject {
Q_OBJECT
public:
using Ptr = shared_qobject_ptr<AuthStep>;
explicit AuthStep(AccountData* data) : QObject(nullptr), m_data(data) {};
virtual ~AuthStep() noexcept = default;
virtual QString describe() = 0;
public slots:
virtual void perform() = 0;
virtual void abort() {}
signals:
void finished(AccountTaskState resultingState, QString message);
protected:
AccountData* m_data;
};