This repository has been archived on 2026-05-31. You can view files and clone it, but cannot push or open issues or pull requests.
2022-01-20 12:09:55 +01:00

39 lines
824 B
C++

#ifndef TOKENINFOS_H
#define TOKENINFOS_H
#include <QAbstractListModel>
class TokenInfo;
class TokenInfos : public QAbstractListModel
{
Q_OBJECT
Q_PROPERTY(int count READ rowCount NOTIFY countChanged)
public:
enum Roles {
RoleId,
RoleUsername,
RoleDeviceName,
RoleCreationTime
};
explicit TokenInfos(QObject *parent = nullptr);
int rowCount(const QModelIndex &parent = QModelIndex()) const override;
QVariant data(const QModelIndex &index, int role) const override;
QHash<int, QByteArray> roleNames() const override;
void addToken(TokenInfo *tokenInfo);
void removeToken(const QUuid &tokenId);
Q_INVOKABLE TokenInfo* get(int index) const;
signals:
void countChanged();
private:
QList<TokenInfo*> m_list;
};
#endif // TOKENINFOS_H