mirror of
https://gitlab.linphone.org/BC/public/linphone-desktop.git
synced 2026-01-17 11:28:07 +00:00
Instantiate SDK thread. Add logger. Format logs to match SDK syntax. Change log domain to 'app'.
44 lines
1.2 KiB
C++
44 lines
1.2 KiB
C++
#include "App.hpp"
|
|
|
|
#include <QCoreApplication>
|
|
|
|
#include "tool/Constants.hpp"
|
|
#include "view/Page/LoginPage.hpp"
|
|
|
|
App::App(QObject *parent) : QObject(parent) {
|
|
mLinphoneThread = new Thread(this);
|
|
init();
|
|
qDebug() << "Starting Thread";
|
|
mLinphoneThread->start();
|
|
}
|
|
|
|
//-----------------------------------------------------------
|
|
// Initializations
|
|
//-----------------------------------------------------------
|
|
|
|
void App::init() {
|
|
// Core
|
|
mCoreModel = QSharedPointer<CoreModel>::create("", mLinphoneThread);
|
|
|
|
connect(mLinphoneThread, &QThread::started, mCoreModel.get(), &CoreModel::start);
|
|
// QML
|
|
mEngine = new QQmlApplicationEngine(this);
|
|
mEngine->addImportPath(":/");
|
|
|
|
initCppInterfaces();
|
|
|
|
const QUrl url(u"qrc:/Linphone/view/App/Main.qml"_qs);
|
|
QObject::connect(
|
|
mEngine, &QQmlApplicationEngine::objectCreated, this,
|
|
[url](QObject *obj, const QUrl &objUrl) {
|
|
if (!obj && url == objUrl) QCoreApplication::exit(-1);
|
|
},
|
|
Qt::QueuedConnection);
|
|
mEngine->load(url);
|
|
}
|
|
|
|
void App::initCppInterfaces() {
|
|
qmlRegisterSingletonType<LoginPage>(
|
|
Constants::MainQmlUri, 1, 0, "LoginPageCpp",
|
|
[](QQmlEngine *engine, QJSEngine *) -> QObject * { return new LoginPage(engine); });
|
|
}
|