2025-02-28 18:17:43 +03:00
|
|
|
#ifndef APIDEVICESMODEL_H
|
|
|
|
|
#define APIDEVICESMODEL_H
|
|
|
|
|
|
|
|
|
|
#include <QAbstractListModel>
|
|
|
|
|
#include <QJsonArray>
|
|
|
|
|
#include <QVector>
|
|
|
|
|
|
|
|
|
|
class ApiDevicesModel : public QAbstractListModel
|
|
|
|
|
{
|
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
enum Roles {
|
|
|
|
|
OsVersionRole = Qt::UserRole + 1,
|
|
|
|
|
SupportTagRole,
|
|
|
|
|
CountryCodeRole,
|
|
|
|
|
LastUpdateRole,
|
|
|
|
|
IsCurrentDeviceRole
|
|
|
|
|
};
|
|
|
|
|
|
2026-04-30 14:53:03 +08:00
|
|
|
explicit ApiDevicesModel(QObject *parent = nullptr);
|
2025-02-28 18:17:43 +03:00
|
|
|
|
|
|
|
|
int rowCount(const QModelIndex &parent = QModelIndex()) const override;
|
|
|
|
|
|
|
|
|
|
QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
|
|
|
|
|
|
|
|
|
|
public slots:
|
2026-04-30 14:53:03 +08:00
|
|
|
void updateModel(const QJsonArray &issuedConfigs, const QString ¤tInstallationUuid);
|
2025-02-28 18:17:43 +03:00
|
|
|
|
|
|
|
|
protected:
|
|
|
|
|
QHash<int, QByteArray> roleNames() const override;
|
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
struct IssuedConfigInfo
|
|
|
|
|
{
|
|
|
|
|
QString installationUuid;
|
|
|
|
|
QString workerLastUpdated;
|
|
|
|
|
QString lastDownloaded;
|
|
|
|
|
QString sourceType;
|
|
|
|
|
QString osVersion;
|
|
|
|
|
|
|
|
|
|
QString countryName;
|
|
|
|
|
QString countryCode;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
QVector<IssuedConfigInfo> m_issuedConfigs;
|
2026-04-30 14:53:03 +08:00
|
|
|
QString m_currentInstallationUuid;
|
2025-02-28 18:17:43 +03:00
|
|
|
};
|
|
|
|
|
#endif // APIDEVICESMODEL_H
|