aboutsummaryrefslogtreecommitdiff
path: root/launcher/minecraft/auth/AccountList.h
diff options
context:
space:
mode:
authorSefa Eyeoglu <contact@scrumplex.net>2023-08-02 18:35:35 +0200
committerSefa Eyeoglu <contact@scrumplex.net>2023-08-02 18:35:35 +0200
commit1d468ac35ad88d8c77cc83f25e3704d9bd7df01b (patch)
tree8644b1574c947a1a87c5c7b2567f746cfe17882f /launcher/minecraft/auth/AccountList.h
parentce2ca1381519a2e261d7f76dffa874d559d979c2 (diff)
downloadPrismLauncher-1d468ac35ad88d8c77cc83f25e3704d9bd7df01b.tar.gz
PrismLauncher-1d468ac35ad88d8c77cc83f25e3704d9bd7df01b.tar.bz2
PrismLauncher-1d468ac35ad88d8c77cc83f25e3704d9bd7df01b.zip
chore: reformat
Signed-off-by: Sefa Eyeoglu <contact@scrumplex.net>
Diffstat (limited to 'launcher/minecraft/auth/AccountList.h')
-rw-r--r--launcher/minecraft/auth/AccountList.h54
1 files changed, 24 insertions, 30 deletions
diff --git a/launcher/minecraft/auth/AccountList.h b/launcher/minecraft/auth/AccountList.h
index a8c3529a..30926d13 100644
--- a/launcher/minecraft/auth/AccountList.h
+++ b/launcher/minecraft/auth/AccountList.h
@@ -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;
};
-