chore: reformat

Signed-off-by: Sefa Eyeoglu <contact@scrumplex.net>
This commit is contained in:
Sefa Eyeoglu
2023-08-02 18:35:35 +02:00
parent ce2ca13815
commit 1d468ac35a
594 changed files with 16040 additions and 16536 deletions

View File

@ -37,26 +37,21 @@
#include "MinecraftAccount.h"
#include <QObject>
#include <QVariant>
#include <QAbstractListModel>
#include <QObject>
#include <QSharedPointer>
#include <QVariant>
/*!
* List of available Mojang accounts.
* This should be loaded in the background by Prism Launcher on startup.
*/
class AccountList : public QAbstractListModel
{
class AccountList : public QAbstractListModel {
Q_OBJECT
public:
enum ModelRoles
{
PointerRole = 0x34B1CB48
};
public:
enum ModelRoles { PointerRole = 0x34B1CB48 };
enum VListColumns
{
enum VListColumns {
// TODO: Add icon column.
ProfileNameColumn = 0,
NameColumn,
@ -67,24 +62,24 @@ public:
NUM_COLUMNS
};
explicit AccountList(QObject *parent = 0);
explicit AccountList(QObject* parent = 0);
virtual ~AccountList() noexcept;
const MinecraftAccountPtr at(int i) const;
int count() const;
//////// List Model Functions ////////
QVariant data(const QModelIndex &index, int role) const override;
QVariant data(const QModelIndex& index, int role) const override;
virtual QVariant headerData(int section, Qt::Orientation orientation, int role) const override;
virtual int rowCount(const QModelIndex &parent) const override;
virtual int columnCount(const QModelIndex &parent) const override;
virtual Qt::ItemFlags flags(const QModelIndex &index) const override;
virtual bool setData(const QModelIndex &index, const QVariant &value, int role) override;
virtual int rowCount(const QModelIndex& parent) const override;
virtual int columnCount(const QModelIndex& parent) const override;
virtual Qt::ItemFlags flags(const QModelIndex& index) const override;
virtual bool setData(const QModelIndex& index, const QVariant& value, int role) override;
void addAccount(const MinecraftAccountPtr account);
void removeAccount(QModelIndex index);
int findAccountByProfileId(const QString &profileId) const;
MinecraftAccountPtr getAccountByProfileName(const QString &profileName) const;
int findAccountByProfileId(const QString& profileId) const;
MinecraftAccountPtr getAccountByProfileName(const QString& profileName) const;
QStringList profileNames() const;
// requesting a refresh pushes it to the front of the queue
@ -102,8 +97,8 @@ public:
void setListFilePath(QString path, bool autosave = false);
bool loadList();
bool loadV2(QJsonObject &root);
bool loadV3(QJsonObject &root);
bool loadV2(QJsonObject& root);
bool loadV3(QJsonObject& root);
bool saveList();
MinecraftAccountPtr defaultAccount() const;
@ -112,20 +107,20 @@ public:
bool isActive() const;
protected:
protected:
void beginActivity();
void endActivity();
private:
private:
const char* m_name;
uint32_t m_activityCount = 0;
signals:
signals:
void listChanged();
void listActivityChanged();
void defaultAccountChanged();
void activityChanged(bool active);
public slots:
public slots:
/**
* This is called when one of the accounts changes and the list needs to be updated
*/
@ -141,16 +136,16 @@ public slots:
*/
void fillQueue();
private slots:
private slots:
void tryNext();
void authSucceeded();
void authFailed(QString reason);
protected:
protected:
QList<QString> m_refreshQueue;
QTimer *m_refreshTimer;
QTimer *m_nextTimer;
QTimer* m_refreshTimer;
QTimer* m_nextTimer;
shared_qobject_ptr<AccountTask> m_currentTask;
/*!
@ -178,4 +173,3 @@ protected:
*/
bool m_autosave = false;
};