main.cpp 1010 Bytes
Newer Older
Artem Sidyakin's avatar
Artem Sidyakin committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34
#include <QGuiApplication>
#include <QQmlApplicationEngine>
#include <QQmlContext>
#include <QtDebug>
#include <QCameraInfo>

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

    QGuiApplication app(argc, argv);

    qDebug() << "cameras found: " << QCameraInfo::availableCameras().count();

    QQmlApplicationEngine engine;

    QString shotsFolderName = "shots/";
    QString shotsPathLastMile = shotsFolderName.prepend("/");
#if defined(Q_OS_MAC)
    shotsPathLastMile = shotsFolderName.prepend("/../../..");
#elif defined(Q_OS_WIN)
    webPagesPathLastMile = shotsFolderName.prepend("/..");
#endif
    QString shotsPath = QString("%1%2")
            .arg(app.applicationDirPath())
            .arg(shotsPathLastMile);
    qDebug() << shotsPath;
    engine.rootContext()->setContextProperty("shotsPath", shotsPath);

    engine.load(QUrl(QStringLiteral("qrc:/main.qml")));
    if (engine.rootObjects().isEmpty()) { return -1; }

    return app.exec();
}