Commit d4cd3d30 authored by Ronan Abhamon's avatar Ronan Abhamon

feat(app): use wrapper

parent 38e44163
......@@ -26,6 +26,8 @@ foreach (package ${QT5_PACKAGES})
endif ()
endforeach ()
list(APPEND LIBS "${CMAKE_SOURCE_DIR}/../OUTPUT/desktop/lib64/liblinphone++.so")
set(SOURCES
src/app/App.cpp
src/app/Logger.cpp
......@@ -33,7 +35,7 @@ set(SOURCES
src/components/contacts/ContactModel.cpp
src/components/contacts/ContactsListModel.cpp
src/components/contacts/ContactsListProxyModel.cpp
src/components/linphone/LinphoneCore.cpp
src/components/core/CoreManager.cpp
src/components/notifier/Notifier.cpp
src/components/settings/AccountSettingsModel.cpp
src/components/settings/SettingsModel.cpp
......@@ -48,7 +50,7 @@ set(HEADERS
src/components/contacts/ContactModel.hpp
src/components/contacts/ContactsListModel.hpp
src/components/contacts/ContactsListProxyModel.hpp
src/components/linphone/LinphoneCore.hpp
src/components/core/CoreManager.hpp
src/components/notifier/Notifier.hpp
src/components/presence/Presence.hpp
src/components/settings/AccountSettingsModel.hpp
......@@ -132,4 +134,5 @@ qt5_add_resources(RESOURCES ${QRC_RESOURCES})
add_executable(${LINPHONE_EXEC} ${SOURCES} ${HEADERS} ${RESOURCES})
add_dependencies(${LINPHONE_EXEC} update_translations)
add_dependencies(update_translations check_qml)
target_include_directories(${LINPHONE_EXEC} PRIVATE "${CMAKE_SOURCE_DIR}/../OUTPUT/desktop/include/")
target_link_libraries(${LINPHONE_EXEC} ${LIBS})
......@@ -5,7 +5,7 @@
#include <QtDebug>
#include "../components/contacts/ContactsListProxyModel.hpp"
#include "../components/linphone/LinphoneCore.hpp"
#include "../components/core/CoreManager.hpp"
#include "../components/settings/AccountSettingsModel.hpp"
#include "../components/timeline/TimelineModel.hpp"
......@@ -98,7 +98,7 @@ void App::addContextProperties () {
context->setContextProperty("TimelineModel", new TimelineModel());
// Other.
context->setContextProperty("LinphoneCore", LinphoneCore::getInstance());
context->setContextProperty("CoreManager", CoreManager::getInstance());
m_notifier = new Notifier();
context->setContextProperty("Notifier", m_notifier);
......
#include "CoreManager.hpp"
// ===================================================================
CoreManager *CoreManager::m_instance = nullptr;
CoreManager::CoreManager (QObject *parent) : m_core(
linphone::Factory::get()->createCore(nullptr, "", "", nullptr)
) {}
#ifndef LINPHONE_CORE_H_
#define LINPHONE_CORE_H_
#ifndef CORE_MANAGER_H_
#define CORE_MANAGER_H_
#include <QObject>
#include <linphone++/linphone.hh>
// ===================================================================
class LinphoneCore : public QObject {
class CoreManager : public QObject {
Q_OBJECT;
public:
static void init () {
if (!m_instance) {
m_instance = new LinphoneCore();
m_instance = new CoreManager();
}
}
static LinphoneCore *getInstance () {
static CoreManager *getInstance () {
return m_instance;
}
private:
LinphoneCore (QObject *parent = Q_NULLPTR) {};
CoreManager (QObject *parent = Q_NULLPTR);
static LinphoneCore *m_instance;
std::shared_ptr<linphone::Core> m_core;
static CoreManager *m_instance;
};
#endif // LINPHONE_CORE_H_
#endif // CORE_MANAGER_H_
#include "LinphoneCore.hpp"
// ===================================================================
LinphoneCore *LinphoneCore::m_instance = nullptr;
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment