#include #include #include #include //#include #include "accounts.h" #include "message.h" #include "chat.h" #include "chatlist.h" #include "context.h" #include "contact.h" #include "eventemitter.h" #include "notifications.h" int main(int argc, char *argv[]) { QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling); QCoreApplication::setAttribute(Qt::AA_ShareOpenGLContexts); QtWebEngine::initialize(); QGuiApplication app(argc, argv); app.setApplicationName("KDeltaChat"); app.setOrganizationName("KDeltaChat"); app.setOrganizationDomain("delta.chat"); // TODO: switch to using Qt 5.15 QML_ELEMENT macro if (qmlRegisterType("DeltaChat", 1, 0, "DcAccounts") == -1) { QCoreApplication::exit(-1); } if (qmlRegisterType("DeltaChat", 1, 0, "DcContext") == -1) { QCoreApplication::exit(-1); } if (qmlRegisterType("DeltaChat", 1, 0, "DcChatlist") == -1) { QCoreApplication::exit(-1); } if (qmlRegisterType("DeltaChat", 1, 0, "DcChat") == -1) { QCoreApplication::exit(-1); } if (qmlRegisterType("DeltaChat", 1, 0, "DcMessage") == -1) { QCoreApplication::exit(-1); } if (qmlRegisterType("DeltaChat", 1, 0, "DcContact") == -1) { QCoreApplication::exit(-1); } if (qmlRegisterType("DeltaChat", 1, 0, "DcLot") == -1) { QCoreApplication::exit(-1); } if (qmlRegisterType("DcNotifications", 1, 0, "DcNotifications") == -1) { QCoreApplication::exit(-1); } if (qmlRegisterType("DeltaChat", 1, 0, "DcAccountsEventEmitter") == -1) { QCoreApplication::exit(-1); } DcNotifications* KNotif = new DcNotifications(); qRegisterMetaType("size_t"); qRegisterMetaType("uint32_t"); qRegisterMetaType>("QVector"); QQmlApplicationEngine engine; engine.rootContext()->setContextProperty("KNotif", KNotif); const QUrl url(QStringLiteral("qrc:/qml/main.qml")); QObject::connect(&engine, &QQmlApplicationEngine::objectCreated, &app, [url](QObject *obj, const QUrl &objUrl) { if (!obj && url == objUrl) QCoreApplication::exit(-1); }, Qt::QueuedConnection); engine.load(url); return app.exec(); }