Files
amnezia-client/client/ui/models/containers_model.h
vkamn 40950b92ee feat: awg 2 support (#1836)
* Add updated awg container

* add missing files

* Hide uninstalled AwgLegacy container

* Fix resources file

* Add role for allowed for installation containers

* Add native config sharing for new Awg container

* Fix not opening awg settings

* Remove AwgLegacy from wizard manual installation page

* Fix AmneziaWG settings

* chore: update link to submodule

* refactor: remove j1-j3 and itime

* chore: return s3 s4 fields to ui

* fix: awg2 native config compatability

* chore: update packet size validation

* feat: add awg2 support in self-hosted containers

* fix: delete parameters from server config

* feat: add H-parameters  validation as a strings

* chore: update link to submodule

* chore: add containers type for awg 1.5 and awg 2

* chore: fixed s3/s4 visibility for awg 1

---------

Co-authored-by: aiamnezia <ai@amnezia.org>
2025-12-11 15:18:36 +08:00

77 lines
1.8 KiB
C++

#ifndef CONTAINERS_MODEL_H
#define CONTAINERS_MODEL_H
#include <QAbstractListModel>
#include <QJsonObject>
#include <utility>
#include <vector>
#include "containers/containers_defs.h"
class ContainersModel : public QAbstractListModel
{
Q_OBJECT
public:
ContainersModel(QObject *parent = nullptr);
enum Roles {
NameRole = Qt::UserRole + 1,
DescriptionRole,
DetailedDescriptionRole,
ServiceTypeRole,
ConfigRole,
IsThirdPartyConfigRole,
DockerContainerRole,
IsEasySetupContainerRole,
EasySetupHeaderRole,
EasySetupDescriptionRole,
EasySetupOrderRole,
IsInstallationAllowedRole,
IsInstalledRole,
IsCurrentlyProcessedRole,
IsDefaultRole,
IsSupportedRole,
IsShareableRole,
InstallPageOrderRole
};
int rowCount(const QModelIndex &parent = QModelIndex()) const override;
QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
QVariant data(const int index, int role) const;
public slots:
void updateModel(const QJsonArray &containers);
void setProcessedContainerIndex(int containerIndex);
int getProcessedContainerIndex();
QString getProcessedContainerName();
QJsonObject getContainerConfig(const int containerIndex);
bool isSupportedByCurrentPlatform(const int containerIndex);
bool isServiceContainer(const int containerIndex);
bool hasInstalledServices();
bool hasInstalledProtocols();
static bool isInstallationAllowed(DockerContainer container);
protected:
QHash<int, QByteArray> roleNames() const override;
signals:
void containersModelUpdated();
private:
QMap<DockerContainer, QJsonObject> m_containers;
int m_processedContainerIndex;
};
#endif // CONTAINERS_MODEL_H