#include <QGuiApplication>
#include <QQmlApplicationEngine>
#include "database.h"

int main(int argc, char *argv[])
{
    QCoreApplication::setApplicationName("Camper");
    QCoreApplication::setOrganizationName("Tandem");

    QGuiApplication app(argc, argv);

    Database::getInstance(); // return ignored; create instance before QML engine
    QQmlApplicationEngine engine;
    QObject::connect(
        &engine,
        &QQmlApplicationEngine::objectCreationFailed,
        &app,
        []() { QCoreApplication::exit(-1); },
        Qt::QueuedConnection);
    engine.loadFromModule("Camper", "Main");

    return app.exec();
}
