Files
amnezia-client/client/containers/containers_defs.h
T

77 lines
1.8 KiB
C++
Raw Normal View History

2021-09-09 20:15:44 +03:00
#ifndef CONTAIERNS_DEFS_H
#define CONTAIERNS_DEFS_H
#include <QObject>
2021-09-16 19:49:50 +03:00
#include <QQmlEngine>
2021-09-09 20:15:44 +03:00
#include "../protocols/protocols_defs.h"
using namespace amnezia;
namespace amnezia {
2021-09-16 19:49:50 +03:00
namespace ContainerEnumNS {
Q_NAMESPACE
2021-09-20 21:51:28 +03:00
enum DockerContainer {
None = 0,
2021-09-09 20:15:44 +03:00
OpenVpn,
2021-09-20 21:51:28 +03:00
ShadowSocks,
Cloak,
WireGuard,
2021-10-04 19:07:49 +03:00
Ipsec,
2021-09-20 21:51:28 +03:00
//non-vpn
TorWebSite,
2021-09-20 21:51:28 +03:00
Dns,
2021-11-17 23:42:17 +03:00
//FileShare,
Sftp
2021-09-09 20:15:44 +03:00
};
2021-09-16 16:19:14 +03:00
Q_ENUM_NS(DockerContainer)
2021-09-16 19:49:50 +03:00
} // namespace ContainerEnumNS
using namespace ContainerEnumNS;
using namespace ProtocolEnumNS;
2021-09-09 20:15:44 +03:00
2021-09-20 21:51:28 +03:00
class ContainerProps : public QObject
{
Q_OBJECT
public:
Q_INVOKABLE static DockerContainer containerFromString(const QString &container);
Q_INVOKABLE static QString containerToString(DockerContainer container);
Q_INVOKABLE static QList<DockerContainer> allContainers();
Q_INVOKABLE static QMap<DockerContainer, QString> containerHumanNames();
Q_INVOKABLE static QMap<DockerContainer, QString> containerDescriptions();
2021-09-09 20:15:44 +03:00
// these protocols will be displayed in container settings
Q_INVOKABLE static QVector<Proto> protocolsForContainer(DockerContainer container);
2021-09-20 21:51:28 +03:00
Q_INVOKABLE static ServiceType containerService(DockerContainer c);
// binding between Docker container and main protocol of given container
// it may be changed fot future containers :)
Q_INVOKABLE static Proto defaultProtocol(DockerContainer c);
2021-12-04 16:13:34 +03:00
Q_INVOKABLE static bool isSupportedByCurrentPlatform(DockerContainer c);
2021-09-20 21:51:28 +03:00
};
2021-09-09 20:15:44 +03:00
2021-09-20 21:51:28 +03:00
static void declareQmlContainerEnum() {
2021-09-16 19:49:50 +03:00
qmlRegisterUncreatableMetaObject(
ContainerEnumNS::staticMetaObject,
"ContainerEnum",
1, 0,
"ContainerEnum",
"Error: only enums"
);
}
2021-09-09 20:15:44 +03:00
} // namespace amnezia
QDebug operator<<(QDebug debug, const amnezia::DockerContainer &c);
#endif // CONTAIERNS_DEFS_H