mirror of
https://gitlab.linphone.org/BC/public/linphone-desktop.git
synced 2026-01-23 22:58:15 +00:00
feat(app): use wrapper
This commit is contained in:
parent
38e44163d3
commit
d4cd3d3005
6 changed files with 47 additions and 37 deletions
|
|
@ -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);
|
||||
|
|
|
|||
9
tests/src/components/core/CoreManager.cpp
Normal file
9
tests/src/components/core/CoreManager.cpp
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
#include "CoreManager.hpp"
|
||||
|
||||
// ===================================================================
|
||||
|
||||
CoreManager *CoreManager::m_instance = nullptr;
|
||||
|
||||
CoreManager::CoreManager (QObject *parent) : m_core(
|
||||
linphone::Factory::get()->createCore(nullptr, "", "", nullptr)
|
||||
) {}
|
||||
31
tests/src/components/core/CoreManager.hpp
Normal file
31
tests/src/components/core/CoreManager.hpp
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
#ifndef CORE_MANAGER_H_
|
||||
#define CORE_MANAGER_H_
|
||||
|
||||
#include <QObject>
|
||||
#include <linphone++/linphone.hh>
|
||||
|
||||
// ===================================================================
|
||||
|
||||
class CoreManager : public QObject {
|
||||
Q_OBJECT;
|
||||
|
||||
public:
|
||||
static void init () {
|
||||
if (!m_instance) {
|
||||
m_instance = new CoreManager();
|
||||
}
|
||||
}
|
||||
|
||||
static CoreManager *getInstance () {
|
||||
return m_instance;
|
||||
}
|
||||
|
||||
private:
|
||||
CoreManager (QObject *parent = Q_NULLPTR);
|
||||
|
||||
std::shared_ptr<linphone::Core> m_core;
|
||||
|
||||
static CoreManager *m_instance;
|
||||
};
|
||||
|
||||
#endif // CORE_MANAGER_H_
|
||||
|
|
@ -1,5 +0,0 @@
|
|||
#include "LinphoneCore.hpp"
|
||||
|
||||
// ===================================================================
|
||||
|
||||
LinphoneCore *LinphoneCore::m_instance = nullptr;
|
||||
|
|
@ -1,28 +0,0 @@
|
|||
#ifndef LINPHONE_CORE_H_
|
||||
#define LINPHONE_CORE_H_
|
||||
|
||||
#include <QObject>
|
||||
|
||||
// ===================================================================
|
||||
|
||||
class LinphoneCore : public QObject {
|
||||
Q_OBJECT;
|
||||
|
||||
public:
|
||||
static void init () {
|
||||
if (!m_instance) {
|
||||
m_instance = new LinphoneCore();
|
||||
}
|
||||
}
|
||||
|
||||
static LinphoneCore *getInstance () {
|
||||
return m_instance;
|
||||
}
|
||||
|
||||
private:
|
||||
LinphoneCore (QObject *parent = Q_NULLPTR) {};
|
||||
|
||||
static LinphoneCore *m_instance;
|
||||
};
|
||||
|
||||
#endif // LINPHONE_CORE_H_
|
||||
Loading…
Add table
Reference in a new issue