From 706c30b4e2119614e3c0d50a6b5e24cc323b5218 Mon Sep 17 00:00:00 2001 From: Gus Grubba Date: Tue, 30 Oct 2018 23:00:30 -0400 Subject: [PATCH] Might as well replace a few more way too repetitive strings. --- src/QGCApplication.cc | 64 ++++++++++++++++++++++--------------------- 1 file changed, 33 insertions(+), 31 deletions(-) diff --git a/src/QGCApplication.cc b/src/QGCApplication.cc index 426c69f9c..48280b951 100644 --- a/src/QGCApplication.cc +++ b/src/QGCApplication.cc @@ -377,7 +377,10 @@ QGCApplication::~QGCApplication() void QGCApplication::_initCommon(void) { - static const char* kRefOnly = "Reference only"; + static const char* kRefOnly = "Reference only"; + static const char* kQGCControllers = "QGroundControl.Controllers"; + static const char* kQGCVehicle = "QGroundControl.Vehicle"; + QSettings settings; // Register our Qml objects @@ -385,6 +388,18 @@ void QGCApplication::_initCommon(void) qmlRegisterType ("QGroundControl.Palette", 1, 0, "QGCPalette"); qmlRegisterType ("QGroundControl.Palette", 1, 0, "QGCMapPalette"); + qmlRegisterUncreatableType (kQGCVehicle, 1, 0, "Vehicle", kRefOnly); + qmlRegisterUncreatableType (kQGCVehicle, 1, 0, "MissionItem", kRefOnly); + qmlRegisterUncreatableType (kQGCVehicle, 1, 0, "MissionManager", kRefOnly); + qmlRegisterUncreatableType (kQGCVehicle, 1, 0, "ParameterManager", kRefOnly); + qmlRegisterUncreatableType (kQGCVehicle, 1, 0, "QGCCameraManager", kRefOnly); + qmlRegisterUncreatableType (kQGCVehicle, 1, 0, "QGCCameraControl", kRefOnly); + qmlRegisterUncreatableType (kQGCVehicle, 1, 0, "LinkInterface", kRefOnly); + qmlRegisterUncreatableType (kQGCControllers, 1, 0, "MissionController", kRefOnly); + qmlRegisterUncreatableType (kQGCControllers, 1, 0, "GeoFenceController", kRefOnly); + qmlRegisterUncreatableType(kQGCControllers, 1, 0, "RallyPointController", kRefOnly); + qmlRegisterUncreatableType (kQGCControllers, 1, 0, "VisualMissionItem", kRefOnly); + qmlRegisterUncreatableType ("QGroundControl", 1, 0, "CoordinateVector", kRefOnly); qmlRegisterUncreatableType ("QGroundControl", 1, 0, "QmlObjectListModel", kRefOnly); qmlRegisterUncreatableType ("QGroundControl", 1, 0, "MissionCommandTree", kRefOnly); @@ -392,47 +407,34 @@ void QGCApplication::_initCommon(void) qmlRegisterUncreatableType ("QGroundControl.AutoPilotPlugin", 1, 0, "AutoPilotPlugin", kRefOnly); qmlRegisterUncreatableType ("QGroundControl.AutoPilotPlugin", 1, 0, "VehicleComponent", kRefOnly); - qmlRegisterUncreatableType ("QGroundControl.Vehicle", 1, 0, "Vehicle", kRefOnly); - qmlRegisterUncreatableType ("QGroundControl.Vehicle", 1, 0, "MissionItem", kRefOnly); - qmlRegisterUncreatableType ("QGroundControl.Vehicle", 1, 0, "MissionManager", kRefOnly); - qmlRegisterUncreatableType ("QGroundControl.Vehicle", 1, 0, "ParameterManager", kRefOnly); - qmlRegisterUncreatableType ("QGroundControl.Vehicle", 1, 0, "QGCCameraManager", kRefOnly); - qmlRegisterUncreatableType ("QGroundControl.Vehicle", 1, 0, "QGCCameraControl", kRefOnly); - qmlRegisterUncreatableType ("QGroundControl.Vehicle", 1, 0, "LinkInterface", kRefOnly); qmlRegisterUncreatableType ("QGroundControl.JoystickManager", 1, 0, "JoystickManager", kRefOnly); qmlRegisterUncreatableType ("QGroundControl.JoystickManager", 1, 0, "Joystick", kRefOnly); qmlRegisterUncreatableType ("QGroundControl.QGCPositionManager", 1, 0, "QGCPositionManager", kRefOnly); - qmlRegisterUncreatableType ("QGroundControl.Controllers", 1, 0, "MissionController", kRefOnly); - qmlRegisterUncreatableType ("QGroundControl.Controllers", 1, 0, "GeoFenceController", kRefOnly); - qmlRegisterUncreatableType("QGroundControl.Controllers", 1, 0, "RallyPointController", kRefOnly); - qmlRegisterUncreatableType ("QGroundControl.Controllers", 1, 0, "VisualMissionItem", kRefOnly); qmlRegisterUncreatableType("QGroundControl.FactControls", 1, 0, "FactValueSliderListModel", kRefOnly); qmlRegisterUncreatableType ("QGroundControl.FlightMap", 1, 0, "QGCMapPolygon", kRefOnly); qmlRegisterUncreatableType ("QGroundControl.FlightMap", 1, 0, "QGCGeoBoundingCube", kRefOnly); -// qRegisterMetaType("QGCGeoBoundingCube"); - - qmlRegisterType ("QGroundControl.FlightMap", 1, 0, "QGCMapCircle"); + qmlRegisterType ("QGroundControl.FlightMap", 1, 0, "QGCMapCircle"); - qmlRegisterType ("QGroundControl.Controllers", 1, 0, "ParameterEditorController"); - qmlRegisterType ("QGroundControl.Controllers", 1, 0, "ESP8266ComponentController"); - qmlRegisterType ("QGroundControl.Controllers", 1, 0, "ScreenToolsController"); - qmlRegisterType ("QGroundControl.Controllers", 1, 0, "PlanMasterController"); - qmlRegisterType ("QGroundControl.Controllers", 1, 0, "ValuesWidgetController"); - qmlRegisterType ("QGroundControl.Controllers", 1, 0, "QGCFileDialogController"); - qmlRegisterType ("QGroundControl.Controllers", 1, 0, "RCChannelMonitorController"); - qmlRegisterType ("QGroundControl.Controllers", 1, 0, "JoystickConfigController"); - qmlRegisterType ("QGroundControl.Controllers", 1, 0, "LogDownloadController"); - qmlRegisterType ("QGroundControl.Controllers", 1, 0, "SyslinkComponentController"); - qmlRegisterType ("QGroundControl.Controllers", 1, 0, "EditPositionDialogController"); + qmlRegisterType (kQGCControllers, 1, 0, "ParameterEditorController"); + qmlRegisterType (kQGCControllers, 1, 0, "ESP8266ComponentController"); + qmlRegisterType (kQGCControllers, 1, 0, "ScreenToolsController"); + qmlRegisterType (kQGCControllers, 1, 0, "PlanMasterController"); + qmlRegisterType (kQGCControllers, 1, 0, "ValuesWidgetController"); + qmlRegisterType (kQGCControllers, 1, 0, "QGCFileDialogController"); + qmlRegisterType (kQGCControllers, 1, 0, "RCChannelMonitorController"); + qmlRegisterType (kQGCControllers, 1, 0, "JoystickConfigController"); + qmlRegisterType (kQGCControllers, 1, 0, "LogDownloadController"); + qmlRegisterType (kQGCControllers, 1, 0, "SyslinkComponentController"); + qmlRegisterType (kQGCControllers, 1, 0, "EditPositionDialogController"); #ifndef __mobile__ - qmlRegisterType ("QGroundControl.Controllers", 1, 0, "ViewWidgetController"); - qmlRegisterType ("QGroundControl.Controllers", 1, 0, "CustomCommandWidgetController"); - qmlRegisterType ("QGroundControl.Controllers", 1, 0, "FirmwareUpgradeController"); - qmlRegisterType ("QGroundControl.Controllers", 1, 0, "GeoTagController"); - qmlRegisterType ("QGroundControl.Controllers", 1, 0, "MavlinkConsoleController"); + qmlRegisterType (kQGCControllers, 1, 0, "ViewWidgetController"); + qmlRegisterType (kQGCControllers, 1, 0, "CustomCommandWidgetController"); + qmlRegisterType (kQGCControllers, 1, 0, "FirmwareUpgradeController"); + qmlRegisterType (kQGCControllers, 1, 0, "GeoTagController"); + qmlRegisterType (kQGCControllers, 1, 0, "MavlinkConsoleController"); #endif // Register Qml Singletons -- 2.22.0