Files
amnezia-client/client/ui/models/containersModel.h
T
vkamn f9b106cf5b fix: various fixes (#2693)
* fix: fixed country model update

* fix: fixed context menu crush on ios

* fix: fixed passphrase dialog freeze

* fix: fixed country switch

* fix: fixed start minimized

* fix: fixed black screen after remove container

* refactor: return cloak and ss only for view

* fix: fixed default server change after improt while connected

* fix: divider visibility

* fix: fixed revoke admin user

* fix: fixed language restore after backup

* fix: link hover for tor settings page

* fix: fixed openvpn connecntion status

* fix: fixed free color status

* fix: fixed client config update

* chore: bump version
2026-06-04 22:45:53 +08:00

95 lines
2.4 KiB
C++

#ifndef CONTAINERS_MODEL_H
#define CONTAINERS_MODEL_H
#include <QAbstractListModel>
#include <QJsonObject>
#include <utility>
#include <vector>
#include "core/utils/containerEnum.h"
#include "core/utils/containers/containerUtils.h"
#include "core/utils/protocolEnum.h"
#include "core/models/containerConfig.h"
class ContainersModel : public QAbstractListModel
{
Q_OBJECT
public:
ContainersModel(QObject *parent = nullptr);
enum Roles {
NameRole = Qt::UserRole + 1,
DescriptionRole,
DetailedDescriptionRole,
ServiceTypeRole,
ConfigRole,
IsThirdPartyConfigRole,
DockerContainerRole,
ContainerStringRole,
IsEasySetupContainerRole,
EasySetupHeaderRole,
EasySetupDescriptionRole,
EasySetupOrderRole,
IsInstallationAllowedRole,
IsInstalledRole,
IsCurrentlyProcessedRole,
IsDefaultRole,
IsSupportedRole,
IsShareableRole,
IsUnsupportedContainerRole,
InstallPageOrderRole,
// Container type check roles
IsVpnContainerRole,
IsServiceContainerRole,
IsIpsecRole,
IsDnsRole,
IsSftpRole,
IsTorWebsiteRole,
IsSocks5ProxyRole,
IsMtProxyRole,
IsTelemtRole,
};
Q_INVOKABLE void openContainerSettings(int containerIndex);
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 QMap<amnezia::DockerContainer, amnezia::ContainerConfig> &containers);
void setProcessedContainerIndex(int containerIndex);
QString getProcessedContainerName();
QJsonObject getContainerConfig(const int containerIndex);
bool isSupportedByCurrentPlatform(const int containerIndex);
bool isServiceContainer(const int containerIndex);
bool hasInstalledServices();
bool hasInstalledProtocols();
static bool isInstallationAllowed(amnezia::DockerContainer container);
protected:
QHash<int, QByteArray> roleNames() const override;
signals:
void containersModelUpdated();
private:
QMap<amnezia::DockerContainer, amnezia::ContainerConfig> m_containers;
int m_processedContainerIndex = -1;
};
#endif // CONTAINERS_MODEL_H