linphone-desktop/Linphone/core/App.cpp
Julien Wadel e795f0ea51 Add Widget module for MessageBox (in case of fatal error) and display critical popup just before abort.
Instantiate SDK thread.
Add logger.
Format logs to match SDK syntax.
Change log domain to 'app'.
2023-10-05 15:42:08 +02:00

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); });
}