main.cpp 1.06 KB
Newer Older
1
#include <QApplication>
Camilo Higuita's avatar
src  
Camilo Higuita committed
2
#include <QQmlApplicationEngine>
Camilo Higuita's avatar
Camilo Higuita committed
3
#include <QFontDatabase>
4
#include <QQmlContext>
Camilo Higuita's avatar
Camilo Higuita committed
5
#include <QQuickStyle>
6
#include "src/pix.h"
7

8 9 10
#ifdef Q_OS_ANDROID
#include "./3rdparty/kirigami/src/kirigamiplugin.h"
#endif
Camilo Higuita's avatar
src  
Camilo Higuita committed
11 12 13 14 15

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

16
    QApplication app(argc, argv);
Camilo Higuita's avatar
src  
Camilo Higuita committed
17

Camilo Higuita's avatar
Camilo Higuita committed
18 19
    QFontDatabase::addApplicationFont(":/utils/materialdesignicons-webfont.ttf");

20 21
#ifdef Q_OS_ANDROID
    KirigamiPlugin::getInstance().registerTypes();
22 23 24
#else
//    if(QQuickStyle::availableStyles().contains("nomad"))
//        QQuickStyle::setStyle("nomad");
25
#endif
Camilo Higuita's avatar
Camilo Higuita committed
26

27 28
      Pix pix;

Camilo Higuita's avatar
src  
Camilo Higuita committed
29
    QQmlApplicationEngine engine;
30 31 32 33 34
    QObject::connect(&engine, &QQmlApplicationEngine::objectCreated, [&]()
    {
        qDebug()<<"FINISHED LOADING QML APP";
        pix.refreshCollection();
    });
35

36
    auto context = engine.rootContext();  
Camilo Higuita's avatar
Camilo Higuita committed
37
    context->setContextProperty("pix", &pix);
38

Camilo Higuita's avatar
src  
Camilo Higuita committed
39 40 41 42 43 44
    engine.load(QUrl(QStringLiteral("qrc:/main.qml")));
    if (engine.rootObjects().isEmpty())
        return -1;

    return app.exec();
}