Skip to content
Snippets Groups Projects
Commit 798f0130 authored by Ming Rui Zhang's avatar Ming Rui Zhang Committed by Andreas Traczyk
Browse files

misc: expose enum class value to qml client

Change-Id: I03835c364640409c92942ad9a95d9133e5e07520
parent 8c254175
Branches
No related tags found
No related merge requests found
...@@ -517,7 +517,7 @@ ENDIF() ...@@ -517,7 +517,7 @@ ENDIF()
IF(NOT ${ENABLE_STATIC} MATCHES false) IF(NOT ${ENABLE_STATIC} MATCHES false)
message(STATUS "Configuring as static lib") message(STATUS "Configuring as static lib")
add_library( ringclient_static STATIC ${libringclient_LIB_SRCS} ${LIB_HEADER_MOC} ) add_library( ringclient_static STATIC ${libringclient_LIB_SRCS} ${libringclient_api_LIB_HDRS} ${LIB_HEADER_MOC} )
target_link_libraries(ringclient_static Qt5::Core) target_link_libraries(ringclient_static Qt5::Core)
target_link_libraries(ringclient_static Qt5::Gui) target_link_libraries(ringclient_static Qt5::Gui)
target_link_libraries( ringclient_static target_link_libraries( ringclient_static
......
/**************************************************************************** /****************************************************************************
* Copyright (C) 2017-2020 Savoir-faire Linux Inc. * * Copyright (C) 2017-2020 Savoir-faire Linux Inc. *
* Author: Nicolas Jäger <nicolas.jager@savoirfairelinux.com> * * Author: Nicolas Jäger <nicolas.jager@savoirfairelinux.com> *
* Author: Sébastien Blin <sebastien.blin@savoirfairelinux.com> * * Author: Sébastien Blin <sebastien.blin@savoirfairelinux.com> *
* * * *
...@@ -42,12 +42,19 @@ class PeerDiscoveryModel; ...@@ -42,12 +42,19 @@ class PeerDiscoveryModel;
namespace account namespace account
{ {
#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0)
Q_NAMESPACE
Q_CLASSINFO("RegisterEnumClassesUnscoped", "false")
#endif
enum class Type { enum class Type {
INVALID, INVALID,
RING, RING,
SIP SIP
}; };
#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0)
Q_ENUM_NS(Type)
#endif
#pragma push_macro("REGISTERED") #pragma push_macro("REGISTERED")
#undef REGISTERED #undef REGISTERED
...@@ -60,6 +67,9 @@ enum class Status { ...@@ -60,6 +67,9 @@ enum class Status {
TRYING, TRYING,
REGISTERED REGISTERED
}; };
#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0)
Q_ENUM_NS(Status)
#endif
static inline account::Status static inline account::Status
to_status(const QString& type) to_status(const QString& type)
...@@ -84,6 +94,9 @@ enum class KeyExchangeProtocol { ...@@ -84,6 +94,9 @@ enum class KeyExchangeProtocol {
NONE, NONE,
SDES SDES
}; };
#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0)
Q_ENUM_NS(KeyExchangeProtocol)
#endif
enum class TlsMethod { enum class TlsMethod {
DEFAULT, DEFAULT,
...@@ -91,6 +104,9 @@ enum class TlsMethod { ...@@ -91,6 +104,9 @@ enum class TlsMethod {
TLSv1_1, TLSv1_1,
TLSv1_2 TLSv1_2
}; };
#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0)
Q_ENUM_NS(TlsMethod)
#endif
struct ConfProperties_t { struct ConfProperties_t {
QString mailbox; QString mailbox;
...@@ -201,6 +217,9 @@ enum class ExportOnRingStatus { ...@@ -201,6 +217,9 @@ enum class ExportOnRingStatus {
NETWORK_ERROR = 2, NETWORK_ERROR = 2,
INVALID INVALID
}; };
#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0)
Q_ENUM_NS(ExportOnRingStatus)
#endif
enum class RegisterNameStatus { enum class RegisterNameStatus {
SUCCESS = 0, SUCCESS = 0,
...@@ -210,6 +229,9 @@ enum class RegisterNameStatus { ...@@ -210,6 +229,9 @@ enum class RegisterNameStatus {
NETWORK_ERROR = 4, NETWORK_ERROR = 4,
INVALID INVALID
}; };
#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0)
Q_ENUM_NS(RegisterNameStatus)
#endif
enum class LookupStatus { enum class LookupStatus {
SUCCESS = 0, SUCCESS = 0,
...@@ -218,6 +240,9 @@ enum class LookupStatus { ...@@ -218,6 +240,9 @@ enum class LookupStatus {
ERROR = 3, ERROR = 3,
INVALID INVALID
}; };
#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0)
Q_ENUM_NS(LookupStatus)
#endif
struct Info struct Info
{ {
......
...@@ -36,6 +36,10 @@ namespace api ...@@ -36,6 +36,10 @@ namespace api
namespace call namespace call
{ {
#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0)
Q_NAMESPACE
Q_CLASSINFO("RegisterEnumClassesUnscoped", "false")
#endif
enum class Status { enum class Status {
INVALID, INVALID,
...@@ -52,6 +56,9 @@ enum class Status { ...@@ -52,6 +56,9 @@ enum class Status {
TERMINATING, TERMINATING,
CONNECTED CONNECTED
}; };
#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0)
Q_ENUM_NS(Status)
#endif
static inline QString static inline QString
to_string(const call::Status& status) to_string(const call::Status& status)
...@@ -126,6 +133,9 @@ enum class Type { ...@@ -126,6 +133,9 @@ enum class Type {
DIALOG, DIALOG,
CONFERENCE CONFERENCE
}; };
#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0)
Q_ENUM_NS(Type)
#endif
enum class Layout { enum class Layout {
GRID, GRID,
......
...@@ -40,6 +40,10 @@ class Database; ...@@ -40,6 +40,10 @@ class Database;
namespace api namespace api
{ {
#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0)
Q_NAMESPACE
Q_CLASSINFO("RegisterEnumClassesUnscoped", "false")
#endif
namespace account { struct Info; } namespace account { struct Info; }
namespace interaction { struct Info; } namespace interaction { struct Info; }
...@@ -52,6 +56,9 @@ enum class ConferenceableItem { ...@@ -52,6 +56,9 @@ enum class ConferenceableItem {
CALL, CALL,
CONTACT CONTACT
}; };
#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0)
Q_ENUM_NS(ConferenceableItem)
#endif
struct AccountConversation struct AccountConversation
{ {
......
...@@ -28,6 +28,10 @@ ...@@ -28,6 +28,10 @@
namespace lrc { namespace api { namespace lrc { namespace api {
namespace datatransfer { namespace datatransfer {
#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0)
Q_NAMESPACE
Q_CLASSINFO("RegisterEnumClassesUnscoped", "false")
#endif
enum class Status { enum class Status {
on_connection, // outgoing tx: wait for connection/acceptance, incoming tx: wait for local acceptance on_connection, // outgoing tx: wait for connection/acceptance, incoming tx: wait for local acceptance
...@@ -41,6 +45,9 @@ enum class Status { ...@@ -41,6 +45,9 @@ enum class Status {
unsupported, // error: unable to do the transfer (generic error) unsupported, // error: unable to do the transfer (generic error)
INVALID INVALID
}; };
#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0)
Q_ENUM_NS(Status)
#endif
static inline const QString static inline const QString
to_string(const Status& status) to_string(const Status& status)
......
...@@ -30,6 +30,10 @@ namespace api ...@@ -30,6 +30,10 @@ namespace api
namespace interaction namespace interaction
{ {
#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0)
Q_NAMESPACE
Q_CLASSINFO("RegisterEnumClassesUnscoped", "false")
#endif
enum class Type { enum class Type {
INVALID, INVALID,
...@@ -39,6 +43,9 @@ enum class Type { ...@@ -39,6 +43,9 @@ enum class Type {
DATA_TRANSFER, DATA_TRANSFER,
COUNT__ COUNT__
}; };
#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0)
Q_ENUM_NS(Type)
#endif
static inline const QString static inline const QString
to_string(const Type& type) to_string(const Type& type)
...@@ -93,6 +100,9 @@ enum class Status { ...@@ -93,6 +100,9 @@ enum class Status {
TRANSFER_FINISHED, TRANSFER_FINISHED,
COUNT__ COUNT__
}; };
#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0)
Q_ENUM_NS(Status)
#endif
static inline const QString static inline const QString
to_string(const Status& status) to_string(const Status& status)
......
/**************************************************************************** /****************************************************************************
* Copyright (C) 2018-2020 Savoir-faire Linux Inc. * * Copyright (C) 2018-2020 Savoir-faire Linux Inc. *
* Author: Sébastien Blin <sebastien.blin@savoirfairelinux.com> * * Author: Sébastien Blin <sebastien.blin@savoirfairelinux.com> *
* * * *
* This library is free software; you can redistribute it and/or * * This library is free software; you can redistribute it and/or *
...@@ -45,6 +45,10 @@ namespace api ...@@ -45,6 +45,10 @@ namespace api
namespace video namespace video
{ {
#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0)
Q_NAMESPACE
Q_CLASSINFO("RegisterEnumClassesUnscoped", "false")
#endif
constexpr static const char PREVIEW_RENDERER_ID[] = "local"; constexpr static const char PREVIEW_RENDERER_ID[] = "local";
...@@ -71,13 +75,16 @@ struct Frame { ...@@ -71,13 +75,16 @@ struct Frame {
unsigned int width { 0 }; unsigned int width { 0 };
}; };
enum DeviceType enum class DeviceType
{ {
CAMERA, CAMERA,
DISPLAY, DISPLAY,
FILE, FILE,
INVALID INVALID
}; };
#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0)
Q_ENUM_NS(DeviceType)
#endif
/** /**
* This class describes the current rendered device * This class describes the current rendered device
...@@ -85,7 +92,7 @@ enum DeviceType ...@@ -85,7 +92,7 @@ enum DeviceType
struct RenderedDevice struct RenderedDevice
{ {
QString name; QString name;
DeviceType type = INVALID; DeviceType type = DeviceType::INVALID;
}; };
/** /**
......
...@@ -18,6 +18,7 @@ ...@@ -18,6 +18,7 @@
***************************************************************************/ ***************************************************************************/
#pragma once #pragma once
#include <QObject>
#include <QString> #include <QString>
namespace lrc namespace lrc
...@@ -28,6 +29,10 @@ namespace api ...@@ -28,6 +29,10 @@ namespace api
namespace profile namespace profile
{ {
#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0)
Q_NAMESPACE
Q_CLASSINFO("RegisterEnumClassesUnscoped", "false")
#endif
enum class Type { enum class Type {
INVALID, INVALID,
...@@ -37,6 +42,9 @@ enum class Type { ...@@ -37,6 +42,9 @@ enum class Type {
TEMPORARY, TEMPORARY,
COUNT__ COUNT__
}; };
#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0)
Q_ENUM_NS(Type)
#endif
static inline const QString static inline const QString
to_string(const Type& type) to_string(const Type& type)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment