main.cpp 1.15 KB
Newer Older
1
#include <QApplication>
Camilo Higuita's avatar
src  
Camilo Higuita committed
2
#include <QQmlApplicationEngine>
3
#include <QQmlContext>
Camilo Higuita's avatar
Camilo Higuita committed
4
#include <QQuickStyle>
5
#include <QIcon>
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);
17 18 19 20
    app.setApplicationName(PIX::App);
    app.setApplicationVersion(PIX::version);
    app.setApplicationDisplayName(PIX::App);
    app.setWindowIcon(QIcon(":/img/assets/pix.png"));
Camilo Higuita's avatar
Camilo Higuita committed
21

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

29
    Pix pix;
30

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

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

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

    return app.exec();
}