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