50 lines
1.1 KiB
C++
50 lines
1.1 KiB
C++
#include <QDir>
|
|
#include <QQmlContext>
|
|
|
|
#include "App.hpp"
|
|
#include "CoreManager.hpp"
|
|
|
|
using namespace std;
|
|
using namespace linphone;
|
|
|
|
App::App(int &argc, char *argv[]) : QGuiApplication(argc, argv)
|
|
{
|
|
setOrganizationName("Belledonne Communications");
|
|
setOrganizationDomain("belledonne-communications.com");
|
|
setApplicationName(QFileInfo(applicationFilePath()).baseName());
|
|
}
|
|
|
|
App::~App()
|
|
{
|
|
}
|
|
|
|
void App::init()
|
|
{
|
|
registerTypes();
|
|
|
|
mEngine = new QQmlApplicationEngine();
|
|
mEngine->load(QUrl("qrc:/ui/MainPage.qml"));
|
|
if (mEngine->rootObjects().isEmpty())
|
|
qFatal("Unable to open main window.");
|
|
|
|
// Initialize the CoreManager singleton and add it to the Qml context.
|
|
CoreManager::init(this);
|
|
auto coreManager = CoreManager::getInstance();
|
|
QQmlContext *ctx = mEngine->rootContext();
|
|
ctx->setContextProperty("coreManager", coreManager);
|
|
}
|
|
|
|
void App::stop()
|
|
{
|
|
CoreManager::uninit();
|
|
}
|
|
|
|
void App::registerTypes()
|
|
{
|
|
qRegisterMetaType<string>();
|
|
qRegisterMetaType<RegistrationState>();
|
|
qRegisterMetaType<shared_ptr<Account>>();
|
|
qRegisterMetaType<Call::State>();
|
|
qRegisterMetaType<shared_ptr<Call>>();
|
|
}
|