main.cpp 1.88 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/linker.h"
25

26 27 28 29 30
#include "models/basemodel.h"
#include "models/baselist.h"

#include "models/notes/notes.h"
#include "models/links/links.h"
Camilo higuita's avatar
Camilo higuita committed
31

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

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

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

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

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

57 58
    Buho owl;

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

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

Camilo Higuita's avatar
Camilo Higuita committed
64 65
    Linker linker;
    context->setContextProperty("linker", &linker);
66

67
    qmlRegisterUncreatableMetaObject(OWL::staticMetaObject, "OWL", 1, 0, "KEY", "Error");
68
    qmlRegisterUncreatableType<BaseList>("BaseList", 1, 0, "BaseList", QStringLiteral("BaseList should not be created in QML"));
69

70 71 72
    qmlRegisterType<BaseModel>("BuhoModel", 1, 0, "BuhoModel");
    qmlRegisterType<Notes>("Notes", 1, 0, "Notes");
    qmlRegisterType<Links>("Links", 1, 0, "Links");
73 74


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

    return app.exec();
}