|
63 | 63 | #include "QGroundControlQmlGlobal.h" |
64 | 64 | #include "SettingsManager.h" |
65 | 65 | #include "AppSettings.h" |
| 66 | +#include "ShapeFileHelper.h" |
66 | 67 | #include "SyslinkComponentController.h" |
67 | 68 | #include "UDPLink.h" |
68 | 69 | #include "Vehicle.h" |
|
89 | 90 |
|
90 | 91 | QGC_LOGGING_CATEGORY(QGCApplicationLog, "qgc.qgcapplication") |
91 | 92 |
|
| 93 | +// Qml Singleton factories |
| 94 | + |
| 95 | +static QObject *mavlinkSingletonFactory(QQmlEngine*, QJSEngine*) |
| 96 | +{ |
| 97 | + return new QGCMAVLink(); |
| 98 | +} |
| 99 | + |
92 | 100 | QGCApplication::QGCApplication(int &argc, char *argv[], bool unitTesting, bool simpleBootTest) |
93 | 101 | : QApplication(argc, argv) |
94 | 102 | , _runningUnitTests(unitTesting) |
@@ -297,6 +305,10 @@ void QGCApplication::init() |
297 | 305 | #endif |
298 | 306 | qmlRegisterType<JoystickConfigController>("QGroundControl.Controllers", 1, 0, "JoystickConfigController"); |
299 | 307 |
|
| 308 | + (void) qmlRegisterSingletonType<ShapeFileHelper>("QGroundControl.ShapeFileHelper", 1, 0, "ShapeFileHelper", [](QQmlEngine *, QJSEngine *) { return new ShapeFileHelper(); }); |
| 309 | + |
| 310 | + qmlRegisterSingletonType<QGCMAVLink>("MAVLink", 1, 0, "MAVLink", mavlinkSingletonFactory); |
| 311 | + |
300 | 312 | // Although this should really be in _initForNormalAppBoot putting it here allowws us to create unit tests which pop up more easily |
301 | 313 | if(QFontDatabase::addApplicationFont(":/fonts/opensans") < 0) { |
302 | 314 | qCWarning(QGCApplicationLog) << "Could not load /fonts/opensans font"; |
|
0 commit comments