X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=blobdiff_plain;f=src%2Fclient%2Fcoreaccountmodel.h;h=853aa9e52946c4d5c7a05f2caa2837f52309cc8c;hp=88bc341d97c5656d03b9e34a262b98e5e462abf4;hb=c1cf157116de7fc3da96203aa6f03c38c7ebb650;hpb=30b159cb876a9495de42e9a3e70ca050516f0805 diff --git a/src/client/coreaccountmodel.h b/src/client/coreaccountmodel.h index 88bc341d..853aa9e5 100644 --- a/src/client/coreaccountmodel.h +++ b/src/client/coreaccountmodel.h @@ -32,18 +32,19 @@ class CLIENT_EXPORT CoreAccountModel : public QAbstractListModel Q_OBJECT public: - enum { + enum + { AccountIdRole = Qt::UserRole, UuidRole }; - CoreAccountModel(QObject *parent = nullptr); - CoreAccountModel(const CoreAccountModel *other, QObject *parent = nullptr); + CoreAccountModel(QObject* parent = nullptr); + CoreAccountModel(const CoreAccountModel* other, QObject* parent = nullptr); - inline int rowCount(const QModelIndex &parent = QModelIndex()) const override; - QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override; + inline int rowCount(const QModelIndex& parent = QModelIndex()) const override; + QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const override; - CoreAccount account(const QModelIndex &) const; + CoreAccount account(const QModelIndex&) const; CoreAccount account(AccountId) const; QList accounts() const; QList accountIds() const; @@ -51,14 +52,14 @@ public: inline AccountId internalAccount() const; - AccountId createOrUpdateAccount(const CoreAccount &newAccountData); + AccountId createOrUpdateAccount(const CoreAccount& newAccountData); CoreAccount takeAccount(AccountId); void removeAccount(AccountId); - void update(const CoreAccountModel *other); + void update(const CoreAccountModel* other); - bool operator==(const CoreAccountModel &other) const; - bool operator!=(const CoreAccountModel &other) const; + bool operator==(const CoreAccountModel& other) const; + bool operator!=(const CoreAccountModel& other) const; public slots: void save(); @@ -66,7 +67,7 @@ public slots: void clear(); protected: - void insertAccount(const CoreAccount &); + void insertAccount(const CoreAccount&); int findAccountIdx(AccountId) const; private: @@ -77,14 +78,12 @@ private: AccountId _internalAccount; }; - // Inlines -int CoreAccountModel::rowCount(const QModelIndex &) const +int CoreAccountModel::rowCount(const QModelIndex&) const { return _accounts.count(); } - AccountId CoreAccountModel::internalAccount() const { return _internalAccount;