mirror of
https://github.com/amnezia-vpn/amnezia-client.git
synced 2026-05-08 14:33:23 +00:00
* fix: fixed links on page with service description * fix: fixed subscription text color * chore: update ru translations * chore: add save button * fix: ru translation fixes
44 lines
912 B
C++
44 lines
912 B
C++
#ifndef APIBENEFITSMODEL_H
|
|
#define APIBENEFITSMODEL_H
|
|
|
|
#include <QAbstractListModel>
|
|
#include <QJsonArray>
|
|
#include <QString>
|
|
#include <QVector>
|
|
|
|
class ApiBenefitsModel : public QAbstractListModel
|
|
{
|
|
Q_OBJECT
|
|
|
|
public:
|
|
enum Roles {
|
|
IconRole = Qt::UserRole + 1,
|
|
TitleRole,
|
|
BodyRole,
|
|
LinkRole
|
|
};
|
|
Q_ENUM(Roles)
|
|
|
|
explicit ApiBenefitsModel(QObject *parent = nullptr);
|
|
|
|
int rowCount(const QModelIndex &parent = QModelIndex()) const override;
|
|
QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
|
|
QHash<int, QByteArray> roleNames() const override;
|
|
|
|
void updateModel(const QJsonArray &benefits);
|
|
void clear();
|
|
|
|
private:
|
|
struct ServiceBenefitItem
|
|
{
|
|
QString icon;
|
|
QString title;
|
|
QString body;
|
|
bool link = false;
|
|
};
|
|
|
|
QVector<ServiceBenefitItem> m_serviceBenefits;
|
|
};
|
|
|
|
#endif
|