|
|
|
#include <QGuiApplication>
|
|
|
|
#include <QQmlApplicationEngine>
|
|
|
|
#include <QQuickStyle>
|
|
|
|
#include <QIcon>
|
|
|
|
#include <QQmlContext>
|
|
|
|
#include "droidstar.h"
|
|
|
|
|
|
|
|
int main(int argc, char *argv[])
|
|
|
|
{
|
|
|
|
QGuiApplication app(argc, argv);
|
|
|
|
QQuickStyle::setStyle("Fusion");
|
|
|
|
app.setWindowIcon(QIcon(":/images/droidstar.png"));
|
|
|
|
qmlRegisterType<DroidStar>("org.dudetronics.droidstar", 1, 0, "DroidStar");
|
|
|
|
|
|
|
|
QQmlApplicationEngine engine;
|
|
|
|
#ifdef USE_FLITE
|
|
|
|
engine.rootContext()->setContextProperty("USE_FLITE", QVariant(true));
|
|
|
|
#else
|
|
|
|
engine.rootContext()->setContextProperty("USE_FLITE", QVariant(false));
|
|
|
|
#endif
|
|
|
|
const QUrl url(u"qrc:/DroidStar/main.qml"_qs);
|
|
|
|
QObject::connect(&engine, &QQmlApplicationEngine::objectCreated,
|
|
|
|
&app, [url](QObject *obj, const QUrl &objUrl) {
|
|
|
|
if (!obj && url == objUrl)
|
|
|
|
QCoreApplication::exit(-1);
|
|
|
|
}, Qt::QueuedConnection);
|
|
|
|
engine.load(url);
|
|
|
|
|
|
|
|
return app.exec();
|
|
|
|
}
|