69 lines
2.2 KiB
C++
69 lines
2.2 KiB
C++
#include <QGuiApplication>
|
|
#include <QQmlApplicationEngine>
|
|
#include <QQuickStyle>
|
|
#include <QIcon>
|
|
#include <QQmlContext>
|
|
#include "droidstar.h"
|
|
#include "dmr.h" // Ensure this is the correct include for your DMR class
|
|
#include <QSharedPointer>
|
|
#include "vuidupdater.h" // Include the new header
|
|
#include "LogHandler.h"
|
|
#include "AudioSessionManager.h"
|
|
#include "LiveActivityQtBridge.h"
|
|
|
|
|
|
|
|
int main(int argc, char *argv[])
|
|
{
|
|
QGuiApplication app(argc, argv);
|
|
// Use Material styling for a modern dark UI (Fusion defaults to a light palette).
|
|
QQuickStyle::setStyle("Material");
|
|
// QRC icon (registered via `DroidStar.pro` resources.files)
|
|
app.setWindowIcon(QIcon(":/DroidStar/images/droidstar.png"));
|
|
|
|
// Register DroidStar type
|
|
qmlRegisterType<DroidStar>("org.dudetronics.droidstar", 1, 0, "DroidStar");
|
|
|
|
QQmlApplicationEngine engine;
|
|
|
|
// Create an instance of DroidStar
|
|
DroidStar droidStarInstance;
|
|
|
|
// Expose the DroidStar instance to QML as a context property
|
|
engine.rootContext()->setContextProperty("droidStar", &droidStarInstance);
|
|
|
|
// Expose instances to QML
|
|
VUIDUpdater vuidUpdater;
|
|
engine.rootContext()->setContextProperty("vuidUpdater", &vuidUpdater);
|
|
|
|
LogHandler logHandler;
|
|
engine.rootContext()->setContextProperty("logHandler", &logHandler);
|
|
|
|
// iOS Dynamic Island / Live Activity bridge (no-op on non-iOS)
|
|
LiveActivityQtBridge liveActivity;
|
|
engine.rootContext()->setContextProperty("liveActivity", &liveActivity);
|
|
|
|
|
|
|
|
|
|
// Check for FLITE support
|
|
#ifdef USE_FLITE
|
|
engine.rootContext()->setContextProperty("USE_FLITE", QVariant(true));
|
|
#else
|
|
engine.rootContext()->setContextProperty("USE_FLITE", QVariant(false));
|
|
#endif
|
|
|
|
// Load the main QML file
|
|
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();
|
|
|
|
}
|