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

View File

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