NOISSUE Some happy little refactors

This commit is contained in:
Petr Mrázek
2021-11-20 16:22:22 +01:00
parent eafeb64dec
commit 0c861db7a2
142 changed files with 812 additions and 694 deletions

View File

@ -42,11 +42,13 @@ public:
ProfileNameColumn,
MigrationColumn,
TypeColumn,
StatusColumn,
NUM_COLUMNS
};
explicit AccountList(QObject *parent = 0);
virtual ~AccountList() noexcept;
const MinecraftAccountPtr at(int i) const;
int count() const;
@ -63,6 +65,7 @@ public:
void removeAccount(QModelIndex index);
int findAccountByProfileId(const QString &profileId) const;
MinecraftAccountPtr getAccountByProfileName(const QString &profileName) const;
QStringList profileNames() const;
/*!
* Sets the path to load/save the list file from/to.
@ -78,13 +81,14 @@ public:
bool loadV3(QJsonObject &root);
bool saveList();
MinecraftAccountPtr activeAccount() const;
void setActiveAccount(MinecraftAccountPtr profileId);
MinecraftAccountPtr defaultAccount() const;
void setDefaultAccount(MinecraftAccountPtr profileId);
bool anyAccountIsValid();
signals:
void listChanged();
void activeAccountChanged();
void listActivityChanged();
void defaultAccountChanged();
public slots:
/**
@ -92,6 +96,11 @@ public slots:
*/
void accountChanged();
/**
* This is called when a (refresh/login) task involving the account starts or ends
*/
void accountActivityChanged(bool active);
protected:
/*!
* Called whenever the list changes.
@ -101,13 +110,13 @@ protected:
/*!
* Called whenever the active account changes.
* Emits the activeAccountChanged() signal and autosaves the list if enabled.
* Emits the defaultAccountChanged() signal and autosaves the list if enabled.
*/
void onActiveChanged();
void onDefaultAccountChanged();
QList<MinecraftAccountPtr> m_accounts;
MinecraftAccountPtr m_activeAccount;
MinecraftAccountPtr m_defaultAccount;
//! Path to the account list file. Empty string if there isn't one.
QString m_listFilePath;