Skip to content

Commit 4d60c99

Browse files
committed
Add QML module
This is required for some tooling - qmlls, qmllint, etc. - to work correctly. It also improves qml compilation in the clients
1 parent e67e08e commit 4d60c99

File tree

5 files changed

+22
-0
lines changed

5 files changed

+22
-0
lines changed

CMakeLists.txt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -258,6 +258,12 @@ target_sources(${QUOTIENT_LIB_NAME} PUBLIC FILE_SET HEADERS BASE_DIRS .
258258
libquotientemojis.qrc
259259
)
260260

261+
include(ECMQmlModule)
262+
include(KDEInstallDirs)
263+
264+
ecm_add_qml_module(${QUOTIENT_LIB_NAME} URI com.github.quotient_im.libquotient GENERATE_PLUGIN_SOURCE)
265+
ecm_finalize_qml_module(${QUOTIENT_LIB_NAME} DESTINATION ${KDE_INSTALL_QMLDIR})
266+
261267
# Configure API files generation
262268

263269
set(CSAPI_DIR csapi)
@@ -375,6 +381,8 @@ target_include_directories(${QUOTIENT_LIB_NAME} PUBLIC
375381
$<BUILD_INTERFACE:$<$<NOT:$<BOOL:${QUOTIENT_FORCE_NAMESPACED_INCLUDES}>>:${CMAKE_CURRENT_SOURCE_DIR}/Quotient>>
376382
)
377383

384+
target_include_directories(${QUOTIENT_LIB_NAME} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/Quotient/e2ee)
385+
378386
target_link_libraries(${QUOTIENT_LIB_NAME}
379387
PUBLIC ${Qt}::Core ${Qt}::Network ${Qt}::Gui qt${${Qt}Core_VERSION_MAJOR}keychain Olm::Olm ${Qt}::Sql
380388
PRIVATE OpenSSL::Crypto ${Qt}::CorePrivate)

Quotient/connection.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
#include <QtCore/QObject>
2525
#include <QtCore/QSize>
2626
#include <QtCore/QUrl>
27+
#include <QtQmlIntegration/qqmlintegration.h>
2728

2829
#include <functional>
2930

@@ -125,6 +126,8 @@ using IgnoredUsersList = IgnoredUsersEvent::value_type;
125126

126127
class QUOTIENT_API Connection : public QObject {
127128
Q_OBJECT
129+
QML_ELEMENT
130+
QML_UNCREATABLE("")
128131

129132
Q_PROPERTY(User* localUser READ user NOTIFY stateChanged)
130133
Q_PROPERTY(QString localUserId READ userId NOTIFY stateChanged)

Quotient/e2ee/sssshandler.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,14 @@
1010
#include <QtCore/QObject>
1111
#include <QtCore/QPointer>
1212

13+
#include <QtQmlIntegration/qqmlintegration.h>
14+
1315
namespace Quotient {
1416
class QUOTIENT_API SSSSHandler : public QObject
1517
{
1618
Q_OBJECT
19+
QML_ELEMENT
20+
1721
Q_PROPERTY(Quotient::Connection* connection READ connection WRITE setConnection NOTIFY connectionChanged)
1822

1923
public:

Quotient/keyimport.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
#include "expected.h"
99
#include "quotient_export.h"
1010

11+
#include <QtQmlIntegration/qqmlintegration.h>
12+
1113
class TestKeyImport;
1214

1315
namespace Quotient
@@ -21,6 +23,7 @@ namespace Quotient
2123
class QUOTIENT_API KeyImport : public QObject
2224
{
2325
Q_OBJECT
26+
QML_ELEMENT
2427

2528
public:
2629
enum Error {

Quotient/room.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929

3030
#include <QtCore/QJsonObject>
3131
#include <QtGui/QImage>
32+
#include <QtQmlIntegration/qqmlintegration.h>
3233

3334
#include <deque>
3435
#include <utility>
@@ -118,6 +119,9 @@ struct Notification
118119

119120
class QUOTIENT_API Room : public QObject {
120121
Q_OBJECT
122+
QML_ELEMENT
123+
QML_UNCREATABLE("")
124+
121125
Q_PROPERTY(Connection* connection READ connection CONSTANT)
122126
Q_PROPERTY(RoomMember localMember READ localMember CONSTANT)
123127
Q_PROPERTY(QString id READ id CONSTANT)

0 commit comments

Comments
 (0)