amnezia-client/client/containers/containers_defs.h
2021-09-20 21:51:28 +03:00

71 lines
1.7 KiB
C++

#ifndef CONTAIERNS_DEFS_H
#define CONTAIERNS_DEFS_H
#include <QObject>
#include <QQmlEngine>
#include "../protocols/protocols_defs.h"
using namespace amnezia;
namespace amnezia {
namespace ContainerEnumNS {
Q_NAMESPACE
enum DockerContainer {
None = 0,
OpenVpn,
ShadowSocks,
Cloak,
WireGuard,
//non-vpn
TorSite,
Dns,
FileShare
};
Q_ENUM_NS(DockerContainer)
} // namespace ContainerEnumNS
using namespace ContainerEnumNS;
using namespace ProtocolEnumNS;
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();
Q_INVOKABLE static QVector<Protocol> protocolsForContainer(DockerContainer container);
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 Protocol defaultProtocol(DockerContainer c);
};
static void declareQmlContainerEnum() {
qmlRegisterUncreatableMetaObject(
ContainerEnumNS::staticMetaObject,
"ContainerEnum",
1, 0,
"ContainerEnum",
"Error: only enums"
);
}
} // namespace amnezia
QDebug operator<<(QDebug debug, const amnezia::DockerContainer &c);
#endif // CONTAIERNS_DEFS_H