2015-08-13 15:35:25 +02:00
|
|
|
#include <QtCore>
|
|
|
|
|
#include <QQmlApplicationEngine>
|
2015-08-13 22:36:11 +02:00
|
|
|
#include <QQmlContext>
|
2015-08-13 15:35:25 +02:00
|
|
|
#include <configfile.h>
|
|
|
|
|
#include <boost/shared_ptr.hpp>
|
|
|
|
|
|
2015-08-13 22:36:11 +02:00
|
|
|
#include "qmlconfig.h"
|
2015-08-13 15:35:25 +02:00
|
|
|
#include "qmlwrapper.h"
|
2015-08-17 14:52:46 +02:00
|
|
|
#include "startviewimpl.h"
|
|
|
|
|
#include "createlocalgameviewimpl.h"
|
2015-08-13 15:35:25 +02:00
|
|
|
|
|
|
|
|
QmlWrapper::QmlWrapper(boost::shared_ptr<ConfigFile> c)
|
|
|
|
|
:QObject(), myConfig(c)
|
|
|
|
|
{
|
|
|
|
|
myEngine.reset(new QQmlApplicationEngine);
|
2015-08-13 22:36:11 +02:00
|
|
|
myQmlConfig = new QmlConfig(myConfig); //need to be a default pointer because QML doesnt support shared_ptr()
|
2015-08-13 15:35:25 +02:00
|
|
|
|
2015-08-17 14:52:46 +02:00
|
|
|
//TODO create Session and Log here
|
|
|
|
|
|
|
|
|
|
myStartViewImpl = new StartViewImpl(this);
|
|
|
|
|
myCreateLocalGameViewImpl = new CreateLocalGameViewImpl(this);
|
|
|
|
|
|
|
|
|
|
//Add c++ content to QML here
|
2015-08-13 22:36:11 +02:00
|
|
|
myEngine->rootContext()->setContextProperty("Config", myQmlConfig);
|
2015-08-17 14:52:46 +02:00
|
|
|
myEngine->rootContext()->setContextProperty("StartViewImpl", myStartViewImpl);
|
2015-08-13 15:35:25 +02:00
|
|
|
|
|
|
|
|
myEngine->load(QUrl(QStringLiteral("qrc:/main.qml")));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
QmlWrapper::~QmlWrapper()
|
|
|
|
|
{
|
|
|
|
|
myEngine->deleteLater();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
QmlWrapper::QmlWrapper(const QmlWrapper&)
|
|
|
|
|
:QObject()
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
}
|
2015-08-17 14:52:46 +02:00
|
|
|
|
|
|
|
|
|