main.cpp 1.72 KB
Newer Older
1 2
#include <QGuiApplication>
#include <QQmlApplicationEngine>
Camilo Higuita's avatar
Camilo Higuita committed
3
#include <QQuickStyle>
4 5
#include <QQmlContext>

6 7 8 9
#ifdef STATIC_KIRIGAMI
#include "3rdparty/kirigami/src/kirigamiplugin.h"
#endif

Camilo Higuita's avatar
Camilo Higuita committed
10
#ifdef STATIC_MAUIKIT
11
#include "3rdparty/mauikit/src/mauikit.h"
Camilo Higuita's avatar
Camilo Higuita committed
12 13
#endif

14 15
#ifdef Q_OS_ANDROID
#include <QGuiApplication>
16
#include <QtWebView/QtWebView>
17 18 19
#include <QIcon>
#else
#include <QApplication>
20
#include <QtWebEngine>
21 22
#endif

Camilo higuita's avatar
Camilo higuita committed
23 24
#include "./src/buho.h"
#include "./src/linker.h"
25

Camilo higuita's avatar
Camilo higuita committed
26
#include "./src/models/notes/notes.h"
27
#include "./src/models/books/books.h"
28
#include "./src/models/books/booklet.h"
Camilo higuita's avatar
Camilo higuita committed
29
#include "./src/models/links/links.h"
Camilo higuita's avatar
Camilo higuita committed
30

31 32 33 34
int main(int argc, char *argv[])
{
    QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);

35
#ifdef Q_OS_ANDROID
36
    QGuiApplication app(argc, argv);
37
    QtWebView::initialize();
38 39
#else
    QApplication app(argc, argv);
Camilo higuita's avatar
Camilo higuita committed
40
    //    QtWebEngine::initialize();
41 42
#endif

43 44 45 46 47
    app.setApplicationName(OWL::App);
    app.setApplicationVersion(OWL::version);
    app.setApplicationDisplayName(OWL::App);
    app.setWindowIcon(QIcon(":/buho.png"));

48 49 50
#ifdef STATIC_KIRIGAMI
    KirigamiPlugin::getInstance().registerTypes();
#endif
51

Camilo Higuita's avatar
Camilo Higuita committed
52
#ifdef STATIC_MAUIKIT
53 54 55
    MauiKit::getInstance().registerTypes();
#endif

56 57
    Buho owl;

58
    QQmlApplicationEngine engine;
59
    auto context = engine.rootContext();
60

61 62
    context->setContextProperty("owl", &owl);

63
    Linker linker;
64
    context->setContextProperty("linker", &linker);  
camilo higuita's avatar
camilo higuita committed
65
    qmlRegisterType<Booklet>();
66
    qmlRegisterType<Notes>("Notes", 1, 0, "Notes");
67
    qmlRegisterType<Books>("Books", 1, 0, "Books");
68
    qmlRegisterType<Links>("Links", 1, 0, "Links");
69

70 71 72 73 74 75
    engine.load(QUrl(QStringLiteral("qrc:/main.qml")));
    if (engine.rootObjects().isEmpty())
        return -1;

    return app.exec();
}