main.cpp 1.85 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 11 12 13
#ifdef STATIC_MAUIKIT
#include "./mauikit/src/mauikit.h"
#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

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

27
#include "models/notes/notesmodel.h"
28
#include "models/links/linksmodel.h"
Camilo higuita's avatar
Camilo higuita committed
29

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

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

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

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

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

55 56
    Buho owl;

57
    QQmlApplicationEngine engine;
58 59 60
    auto context = engine.rootContext();
    context->setContextProperty("owl", &owl);

Camilo Higuita's avatar
Camilo Higuita committed
61
    Linker linker;
62
    auto tag = owl.getTagging();
Camilo Higuita's avatar
Camilo Higuita committed
63 64

    context->setContextProperty("linker", &linker);
65
    context->setContextProperty("tag", tag);
66

Camilo Higuita's avatar
Camilo Higuita committed
67
    qmlRegisterType<DocumentHandler>("org.buho.editor", 1, 0, "DocumentHandler");
68 69

    qmlRegisterUncreatableMetaObject(OWL::staticMetaObject, "Owl", 1, 0, "KEY", "Error");
70

Camilo higuita's avatar
Camilo higuita committed
71
    qmlRegisterType<NotesModel>("Notes", 1, 0, "NotesModel");
72 73
    qmlRegisterType<LinksModel>("Links", 1, 0, "LinksModel");

74 75 76 77 78 79
    engine.load(QUrl(QStringLiteral("qrc:/main.qml")));
    if (engine.rootObjects().isEmpty())
        return -1;

    return app.exec();
}