2018-07-19 08:04:09 +00:00
|
|
|
#include <QApplication>
|
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-07-13 04:06:27 +00:00
|
|
|
#include "controller.h"
|
2018-08-17 04:55:57 +00:00
|
|
|
#include "emojimodel.h"
|
2018-07-13 04:06:27 +00:00
|
|
|
#include "imageprovider.h"
|
2018-08-24 05:25:41 +00:00
|
|
|
#include "matriqueroom.h"
|
2018-07-13 04:06:27 +00:00
|
|
|
#include "messageeventmodel.h"
|
2018-07-09 02:45:26 +00:00
|
|
|
#include "room.h"
|
2018-07-17 06:14:48 +00:00
|
|
|
#include "roomlistmodel.h"
|
2018-08-26 05:17:12 +00:00
|
|
|
#include "userlistmodel.h"
|
2018-03-02 08:56:36 +00:00
|
|
|
|
2018-08-01 12:26:29 +00:00
|
|
|
#include "csapi/joining.h"
|
2018-07-30 14:42:27 +00:00
|
|
|
#include "csapi/leaving.h"
|
|
|
|
|
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-19 08:04:09 +00:00
|
|
|
QApplication app(argc, argv);
|
2018-02-23 14:39:14 +00:00
|
|
|
|
2018-08-24 13:43:03 +00:00
|
|
|
app.setOrganizationName("ENCOM");
|
|
|
|
app.setOrganizationDomain("encom.eu.org");
|
|
|
|
app.setApplicationName("Matrique");
|
|
|
|
|
2018-08-19 06:51:09 +00:00
|
|
|
app.setQuitOnLastWindowClosed(false);
|
|
|
|
|
2018-08-18 08:02:47 +00:00
|
|
|
qRegisterMetaType<MatriqueRoom *>("MatriqueRoom*");
|
2018-07-17 06:14:48 +00:00
|
|
|
qRegisterMetaType<User *>("User*");
|
2018-08-04 12:40:23 +00:00
|
|
|
qRegisterMetaType<MessageEventType>("MessageEventType");
|
2018-08-24 05:25:41 +00:00
|
|
|
qRegisterMetaType<MatriqueRoom *>("MatriqueRoom");
|
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");
|
2018-08-26 05:17:12 +00:00
|
|
|
qmlRegisterType<UserListModel>("Matrique", 0, 1, "UserListModel");
|
2018-07-09 02:45:26 +00:00
|
|
|
qmlRegisterType<MessageEventModel>("Matrique", 0, 1, "MessageEventModel");
|
2018-08-11 12:48:44 +00:00
|
|
|
qmlRegisterType<EmojiModel>("Matrique", 0, 1, "EmojiModel");
|
2018-08-17 04:55:57 +00:00
|
|
|
qmlRegisterUncreatableType<RoomMessageEvent>("Matrique", 0, 1,
|
|
|
|
"RoomMessageEvent", "ENUM");
|
|
|
|
qmlRegisterUncreatableType<RoomType>("Matrique", 0, 1, "RoomType", "ENUM");
|
2018-08-24 05:25:41 +00:00
|
|
|
qmlRegisterSingletonType(QUrl("qrc:/qml/MatriqueSettings.qml"),
|
|
|
|
"Matrique.Settings", 0, 1, "MSettings");
|
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
|
|
|
}
|