#include #include #include #include #include "accountlistmodel.h" #include "controller.h" #include "emojimodel.h" #include "imageitem.h" #include "imageprovider.h" #include "messageeventmodel.h" #include "room.h" #include "roomlistmodel.h" #include "spectralroom.h" #include "userlistmodel.h" #include "csapi/joining.h" #include "csapi/leaving.h" #include "qqmlsortfilterproxymodel.h" using namespace QMatrixClient; int main(int argc, char *argv[]) { #if defined(Q_OS_WIN) QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling); #endif QApplication app(argc, argv); app.setOrganizationName("ENCOM"); app.setOrganizationDomain("encom.eu.org"); app.setApplicationName("Spectral"); app.setWindowIcon(QIcon(":/assets/img/icon.png")); app.setQuitOnLastWindowClosed(false); qmlRegisterType("SortFilterProxyModel", 0, 2, "SortFilterProxyModel"); qmlRegisterType("Spectral", 0, 1, "ImageItem"); qmlRegisterType("Spectral", 0, 1, "Controller"); qmlRegisterType("Spectral", 0, 1, "AccountListModel"); qmlRegisterType("Spectral", 0, 1, "RoomListModel"); qmlRegisterType("Spectral", 0, 1, "UserListModel"); qmlRegisterType("Spectral", 0, 1, "MessageEventModel"); qmlRegisterType("Spectral", 0, 1, "EmojiModel"); qmlRegisterUncreatableType("Spectral", 0, 1, "RoomMessageEvent", "ENUM"); qmlRegisterUncreatableType("Spectral", 0, 1, "RoomType", "ENUM"); qRegisterMetaType("User*"); qRegisterMetaType("MessageEventType"); qRegisterMetaType("SpectralRoom"); QQmlApplicationEngine engine; engine.addImportPath("qrc:/imports"); ImageProvider *m_provider = new ImageProvider(); engine.rootContext()->setContextProperty("imageProvider", m_provider); engine.addImageProvider(QLatin1String("mxc"), m_provider); engine.load(QUrl(QStringLiteral("qrc:/qml/main.qml"))); if (engine.rootObjects().isEmpty()) return -1; return app.exec(); }