amnezia-client/client/ui/models/protocols_model.h
Nethius 96566f04ee
feature/mtu connection config (#833)
* added the ability to change mtu for connection-only configs
* added replacing MTU with default when importing awg/wg configs in amnezia
2024-09-13 09:38:48 +01:00

47 lines
1.1 KiB
C++

#ifndef PROTOCOLS_MODEL_H
#define PROTOCOLS_MODEL_H
#include <QAbstractListModel>
#include <QJsonObject>
#include "../controllers/pageController.h"
#include "settings.h"
class ProtocolsModel : public QAbstractListModel
{
Q_OBJECT
public:
enum Roles {
ProtocolNameRole = Qt::UserRole + 1,
ServerProtocolPageRole,
ClientProtocolPageRole,
ProtocolIndexRole,
RawConfigRole,
IsClientProtocolExistsRole
};
ProtocolsModel(std::shared_ptr<Settings> settings, QObject *parent = nullptr);
int rowCount(const QModelIndex &parent = QModelIndex()) const override;
QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
public slots:
void updateModel(const QJsonObject &content);
QJsonObject getConfig();
protected:
QHash<int, QByteArray> roleNames() const override;
private:
PageLoader::PageEnum serverProtocolPage(Proto protocol) const;
PageLoader::PageEnum clientProtocolPage(Proto protocol) const;
std::shared_ptr<Settings> m_settings;
DockerContainer m_container;
QJsonObject m_content;
};
#endif // PROTOCOLS_MODEL_H