Files
amnezia-client/client/ui/models/clientManagementModel.h
T

39 lines
912 B
C++
Raw Normal View History

2023-01-09 12:38:01 +03:00
#ifndef CLIENTMANAGEMENTMODEL_H
#define CLIENTMANAGEMENTMODEL_H
#include <QAbstractListModel>
2023-11-21 20:13:51 +07:00
#include <QJsonArray>
2023-01-09 12:38:01 +03:00
class ClientManagementModel : public QAbstractListModel
{
Q_OBJECT
public:
2023-11-21 20:13:51 +07:00
enum Roles {
2026-06-04 15:45:53 +01:00
ClientIdRole = Qt::UserRole + 1,
ClientNameRole,
2024-04-28 16:03:41 +03:00
CreationDateRole,
LatestHandshakeRole,
DataReceivedRole,
DataSentRole,
AllowedIpsRole
2024-04-28 16:03:41 +03:00
};
explicit ClientManagementModel(QObject *parent = nullptr);
2023-01-09 12:38:01 +03:00
int rowCount(const QModelIndex &parent = QModelIndex()) const override;
QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
2023-11-21 20:13:51 +07:00
public slots:
void updateModel(const QJsonArray &clients);
void updateClientName(int row, const QString &newName);
2023-01-09 12:38:01 +03:00
protected:
QHash<int, QByteArray> roleNames() const override;
private:
2023-11-21 20:13:51 +07:00
QJsonArray m_clientsTable;
2023-01-09 12:38:01 +03:00
};
#endif // CLIENTMANAGEMENTMODEL_H