2018-02-23 14:39:14 +00:00
|
|
|
#include <QGuiApplication>
|
|
|
|
#include <QQmlApplicationEngine>
|
2018-02-28 09:10:42 +00:00
|
|
|
#include <QNetworkProxy>
|
2018-03-02 08:56:36 +00:00
|
|
|
#include <QQmlContext>
|
2018-02-23 14:39:14 +00:00
|
|
|
|
2018-02-27 11:07:50 +00:00
|
|
|
#include "matrix/controller.h"
|
2018-02-28 09:10:42 +00:00
|
|
|
#include "matrix/roomlistmodel.h"
|
2018-03-02 08:56:36 +00:00
|
|
|
#include "matrix/imageprovider.h"
|
2018-03-15 09:10:27 +00:00
|
|
|
#include "matrix/messageeventmodel.h"
|
2018-03-02 08:56:36 +00:00
|
|
|
|
2018-02-23 14:39:14 +00:00
|
|
|
using namespace QMatrixClient;
|
|
|
|
|
|
|
|
int main(int argc, char *argv[])
|
|
|
|
{
|
|
|
|
#if defined(Q_OS_WIN)
|
|
|
|
QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
|
|
|
|
#endif
|
|
|
|
|
|
|
|
QGuiApplication app(argc, argv);
|
|
|
|
|
2018-02-28 09:10:42 +00:00
|
|
|
// Enable this if you need proxy.
|
2018-02-28 13:11:42 +00:00
|
|
|
QNetworkProxy proxy;
|
|
|
|
proxy.setType(QNetworkProxy::HttpProxy);
|
|
|
|
proxy.setHostName("localhost");
|
|
|
|
proxy.setPort(1082);
|
|
|
|
QNetworkProxy::setApplicationProxy(proxy);
|
2018-02-28 09:10:42 +00:00
|
|
|
|
2018-02-27 11:07:50 +00:00
|
|
|
qmlRegisterType<Controller>("Matrique", 0, 1, "Controller");
|
2018-02-28 09:10:42 +00:00
|
|
|
qmlRegisterType<RoomListModel>("Matrique", 0, 1, "RoomListModel");
|
2018-03-15 09:10:27 +00:00
|
|
|
qmlRegisterType<MessageEventModel>("Matrique", 0, 1, "MessageEventModel");
|
2018-02-23 14:39:14 +00:00
|
|
|
|
|
|
|
QQmlApplicationEngine engine;
|
2018-03-02 08:56:36 +00:00
|
|
|
|
|
|
|
Connection* m_connection = new Connection();
|
|
|
|
ImageProvider* m_provider = new ImageProvider();
|
|
|
|
m_provider->setConnection(m_connection);
|
|
|
|
|
|
|
|
engine.rootContext()->setContextProperty("m_connection", m_connection);
|
|
|
|
engine.addImageProvider(QLatin1String("mxc"), m_provider);
|
2018-02-23 14:39:14 +00:00
|
|
|
engine.load(QUrl(QStringLiteral("qrc:/qml/main.qml")));
|
|
|
|
if (engine.rootObjects().isEmpty())
|
|
|
|
return -1;
|
|
|
|
|
|
|
|
return app.exec();
|
|
|
|
}
|