added models, classes and ui files for amnezia wireguard

This commit is contained in:
vladimir.kuznetsov 2023-09-22 00:37:55 +05:00
parent d4d6fbab88
commit 6afdd8375d
26 changed files with 534 additions and 60 deletions

View file

@ -0,0 +1,39 @@
#ifndef AMNEZIAWIREGUARDCONFIGMODEL_H
#define AMNEZIAWIREGUARDCONFIGMODEL_H
#include <QAbstractListModel>
#include <QJsonObject>
#include "containers/containers_defs.h"
class AmneziaWireGuardConfigModel : public QAbstractListModel
{
Q_OBJECT
public:
enum Roles {
PortRole = Qt::UserRole + 1,
CipherRole
};
explicit AmneziaWireGuardConfigModel(QObject *parent = nullptr);
int rowCount(const QModelIndex &parent = QModelIndex()) const override;
bool setData(const QModelIndex &index, const QVariant &value, int role) override;
QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
public slots:
void updateModel(const QJsonObject &config);
QJsonObject getConfig();
protected:
QHash<int, QByteArray> roleNames() const override;
private:
DockerContainer m_container;
QJsonObject m_protocolConfig;
QJsonObject m_fullConfig;
};
#endif // AMNEZIAWIREGUARDCONFIGMODEL_H