From b28d9f8e97bce165fe8112cad1a6905ad5875d0b Mon Sep 17 00:00:00 2001 From: Ronan Abhamon Date: Thu, 24 Nov 2016 10:46:23 +0100 Subject: [PATCH] unstable --- tests/src/app/App.cpp | 7 +++++++ tests/src/components/chat/ChatModel.cpp | 6 ++++++ tests/src/components/chat/ChatModel.hpp | 20 ++++++++++++++++++++ 3 files changed, 33 insertions(+) diff --git a/tests/src/app/App.cpp b/tests/src/app/App.cpp index 13e5e14bd..e3398d3df 100644 --- a/tests/src/app/App.cpp +++ b/tests/src/app/App.cpp @@ -4,6 +4,7 @@ #include #include +#include "../components/chat/ChatModel.hpp" #include "../components/contacts/ContactsListProxyModel.hpp" #include "../components/core/CoreManager.hpp" #include "../components/settings/AccountSettingsModel.hpp" @@ -70,10 +71,12 @@ void App::initContentApp () { } void App::registerTypes () { + // Register meta types. qmlRegisterUncreatableType( "Linphone", 1, 0, "Presence", "Presence is uncreatable" ); + // Register Application/Core. qmlRegisterSingletonType( "Linphone", 1, 0, "App", [](QQmlEngine *, QJSEngine *) -> QObject *{ @@ -88,9 +91,13 @@ void App::registerTypes () { } ); + // Register models. ContactsListProxyModel::initContactsListModel(new ContactsListModel()); qmlRegisterType("Linphone", 1, 0, "ContactsListProxyModel"); + qmlRegisterType("Linphone", 1, 0, "ChatModel"); + + // Register singletons. qmlRegisterSingletonType( "Linphone", 1, 0, "ContactsListModel", [](QQmlEngine *, QJSEngine *) -> QObject *{ diff --git a/tests/src/components/chat/ChatModel.cpp b/tests/src/components/chat/ChatModel.cpp index 8b1378917..6699e670e 100644 --- a/tests/src/components/chat/ChatModel.cpp +++ b/tests/src/components/chat/ChatModel.cpp @@ -1 +1,7 @@ +#include "ChatModel.hpp" +// =================================================================== + +ChatModel::ChatModel (QObject *parent) : QObject(parent) { + +} diff --git a/tests/src/components/chat/ChatModel.hpp b/tests/src/components/chat/ChatModel.hpp index 64efe6d58..411a28f51 100644 --- a/tests/src/components/chat/ChatModel.hpp +++ b/tests/src/components/chat/ChatModel.hpp @@ -8,8 +8,28 @@ class ChatModel : public QObject { Q_OBJECT; + Q_PROPERTY( + QString remoteSipAddress + READ getRemoteSipAddress + WRITE setRemoteSipAddress + NOTIFY remoteSipAddressChanged + ); + public: ChatModel (QObject *parent = Q_NULLPTR); + +signals: + void remoteSipAddressChanged (QString remote_sip_address); + +private: + QString getRemoteSipAddress () const { + return m_remote_sip_address; + } + void setRemoteSipAddress (QString &remote_sip_address) { + m_remote_sip_address = remote_sip_address; + } + + QString m_remote_sip_address; }; #endif // CHAT_MODEL_H_