Add 02_IncomingCall qt tutorial.
This commit is contained in:
49
qt/02_IncomingCall/src/App.cpp
Normal file
49
qt/02_IncomingCall/src/App.cpp
Normal file
@@ -0,0 +1,49 @@
|
||||
#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>>();
|
||||
}
|
||||
Reference in New Issue
Block a user