QML ServerContainers page refact

This commit is contained in:
pokamest 2021-09-16 16:19:14 +03:00
parent 9ae2e3fba2
commit 0faf6c8599
90 changed files with 5651 additions and 125 deletions

View file

@ -29,6 +29,7 @@ QString amnezia::protoToString(amnezia::Protocol proto){
QVector<amnezia::Protocol> amnezia::allProtocols()
{
return QVector<amnezia::Protocol> {
Protocol::Any,
Protocol::OpenVpn,
Protocol::ShadowSocks,
Protocol::Cloak,

View file

@ -113,6 +113,7 @@ constexpr char serverPskKeyPath[] = "/opt/amnezia/wireguard/wireguard_psk.key";
} // namespace protocols
Q_NAMESPACE
enum class Protocol {
Any,
OpenVpn,
@ -120,6 +121,8 @@ enum class Protocol {
Cloak,
WireGuard
};
Q_ENUM_NS(Protocol)
QVector<Protocol> allProtocols();
Protocol protoFromString(QString proto);
@ -129,6 +132,16 @@ QMap<Protocol, QString> protocolHumanNames();
QMap<Protocol, QString> protocolDescriptions();
bool isProtocolVpnType(Protocol p);
static void declareQmlProtocolEnum() {
qmlRegisterUncreatableMetaObject(
PageEnumNS::staticMetaObject,
"ProtocolEnum",
1, 0,
"ProtocolEnum",
"Error: only enums"
);
}
} // namespace amnezia
QDebug operator<<(QDebug debug, const amnezia::Protocol &p);