Add Q_ENUM macros for registering QSsl/QSslSocket in Meta-system

- Macros provide possibility to use enums in QML via QtNetwork QML module

Task-number: QTBUG-115056
Change-Id: I1ed96a7eb4b12681d16137528307fec6db5b016c
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
This commit is contained in:
Tatiana Borisova 2023-09-12 19:06:40 +02:00
parent 8bfdfd613e
commit b856790d67
2 changed files with 15 additions and 0 deletions

View File

@ -10,21 +10,26 @@
#endif #endif
#include <QtNetwork/qtnetworkglobal.h> #include <QtNetwork/qtnetworkglobal.h>
#include <QtCore/qmetaobject.h>
#include <QtCore/QFlags> #include <QtCore/QFlags>
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
namespace QSsl { namespace QSsl {
Q_NAMESPACE_EXPORT(Q_NETWORK_EXPORT)
enum KeyType { enum KeyType {
PrivateKey, PrivateKey,
PublicKey PublicKey
}; };
Q_ENUM_NS(KeyType)
enum EncodingFormat { enum EncodingFormat {
Pem, Pem,
Der Der
}; };
Q_ENUM_NS(EncodingFormat)
enum KeyAlgorithm { enum KeyAlgorithm {
Opaque, Opaque,
@ -33,12 +38,14 @@ namespace QSsl {
Ec, Ec,
Dh, Dh,
}; };
Q_ENUM_NS(KeyAlgorithm)
enum AlternativeNameEntryType { enum AlternativeNameEntryType {
EmailEntry, EmailEntry,
DnsEntry, DnsEntry,
IpAddressEntry IpAddressEntry
}; };
Q_ENUM_NS(AlternativeNameEntryType)
enum SslProtocol { enum SslProtocol {
TlsV1_0 QT_DEPRECATED_VERSION_X_6_3("Use TlsV1_2OrLater instead."), TlsV1_0 QT_DEPRECATED_VERSION_X_6_3("Use TlsV1_2OrLater instead."),
@ -61,6 +68,7 @@ namespace QSsl {
UnknownProtocol = -1 UnknownProtocol = -1
}; };
Q_ENUM_NS(SslProtocol)
enum SslOption { enum SslOption {
SslOptionDisableEmptyFragments = 0x01, SslOptionDisableEmptyFragments = 0x01,
@ -72,6 +80,7 @@ namespace QSsl {
SslOptionDisableSessionPersistence = 0x40, SslOptionDisableSessionPersistence = 0x40,
SslOptionDisableServerCipherPreference = 0x80 SslOptionDisableServerCipherPreference = 0x80
}; };
Q_ENUM_NS(SslOption)
Q_DECLARE_FLAGS(SslOptions, SslOption) Q_DECLARE_FLAGS(SslOptions, SslOption)
enum class AlertLevel { enum class AlertLevel {
@ -79,6 +88,7 @@ namespace QSsl {
Fatal, Fatal,
Unknown Unknown
}; };
Q_ENUM_NS(AlertLevel)
enum class AlertType { enum class AlertType {
CloseNotify, CloseNotify,
@ -116,6 +126,7 @@ namespace QSsl {
NoApplicationProtocol = 120, NoApplicationProtocol = 120,
UnknownAlertMessage = 255 UnknownAlertMessage = 255
}; };
Q_ENUM_NS(AlertType)
enum class ImplementedClass enum class ImplementedClass
{ {
@ -127,6 +138,7 @@ namespace QSsl {
Dtls, Dtls,
DtlsCookie DtlsCookie
}; };
Q_ENUM_NS(ImplementedClass)
enum class SupportedFeature enum class SupportedFeature
{ {
@ -138,6 +150,7 @@ namespace QSsl {
SessionTicket, SessionTicket,
Alerts Alerts
}; };
Q_ENUM_NS(SupportedFeature)
} }
Q_DECLARE_OPERATORS_FOR_FLAGS(QSsl::SslOptions) Q_DECLARE_OPERATORS_FOR_FLAGS(QSsl::SslOptions)

View File

@ -35,6 +35,7 @@ public:
SslClientMode, SslClientMode,
SslServerMode SslServerMode
}; };
Q_ENUM(SslMode)
enum PeerVerifyMode { enum PeerVerifyMode {
VerifyNone, VerifyNone,
@ -42,6 +43,7 @@ public:
VerifyPeer, VerifyPeer,
AutoVerifyPeer AutoVerifyPeer
}; };
Q_ENUM(PeerVerifyMode)
explicit QSslSocket(QObject *parent = nullptr); explicit QSslSocket(QObject *parent = nullptr);
~QSslSocket(); ~QSslSocket();