diff --git a/src/FlightDisplay/FlightDisplayView.qml b/src/FlightDisplay/FlightDisplayView.qml index 1dfa87a381b6d29229304aafb2c1ed5c40089528..fdced82c0f0dee5d55a6165f2550944717cc08cb 100644 --- a/src/FlightDisplay/FlightDisplayView.qml +++ b/src/FlightDisplay/FlightDisplayView.qml @@ -47,7 +47,7 @@ QGCView { QGCPalette { id: qgcPal; colorGroupEnabled: enabled } property real availableHeight: parent.height - property var _activeVehicle: multiVehicleManager.activeVehicle + property var _activeVehicle: QGroundControl.multiVehicleManager.activeVehicle property bool _mainIsMap: QGroundControl.loadBoolGlobalSetting(_mainIsMapKey, true) @@ -121,7 +121,7 @@ QGCView { } Connections { - target: multiVehicleManager + target: QGroundControl.multiVehicleManager onActiveVehicleChanged: px4JoystickCheck() } diff --git a/src/FlightDisplay/FlightDisplayViewMap.qml b/src/FlightDisplay/FlightDisplayViewMap.qml index 884719ea9e7d8f6c350ff0e587e641fcf8cd96d2..9e2c630d4a68462a3419b8b35dff8d5bd8f34e1a 100644 --- a/src/FlightDisplay/FlightDisplayViewMap.qml +++ b/src/FlightDisplay/FlightDisplayViewMap.qml @@ -72,7 +72,7 @@ FlightMap { // Add trajectory points to the map MapItemView { - model: _mainIsMap ? multiVehicleManager.activeVehicle ? multiVehicleManager.activeVehicle.trajectoryPoints : 0 : 0 + model: _mainIsMap ? _activeVehicle ? _activeVehicle.trajectoryPoints : 0 : 0 delegate: MapPolyline { line.width: 3 @@ -87,7 +87,7 @@ FlightMap { // Add the vehicles to the map MapItemView { - model: multiVehicleManager.vehicles + model: QGroundControl.multiVehicleManager.vehicles delegate: VehicleMapItem { vehicle: object diff --git a/src/FlightDisplay/FlightDisplayViewVideo.qml b/src/FlightDisplay/FlightDisplayViewVideo.qml index f98c0b5fa256f2249ca2f64dc87aed9bf571881e..eb90d3c6d2165ebe9e776050e81422284c0f8364 100644 --- a/src/FlightDisplay/FlightDisplayViewVideo.qml +++ b/src/FlightDisplay/FlightDisplayViewVideo.qml @@ -63,7 +63,7 @@ Item { pitchAngle: _pitch width: ScreenTools.defaultFontPixelSize * (30) height: ScreenTools.defaultFontPixelSize * (30) - active: multiVehicleManager.activeVehicleAvailable + active: QGroundControl.multiVehicleManager.activeVehicleAvailable z: QGroundControl.zOrderWidgets } */ diff --git a/src/FlightDisplay/FlightDisplayViewWidgets.qml b/src/FlightDisplay/FlightDisplayViewWidgets.qml index 20b36bd7970d3cd713c8ad3b9e0b583d5ed24810..370c748f7852ea48c4e55ab015760deb07684f20 100644 --- a/src/FlightDisplay/FlightDisplayViewWidgets.qml +++ b/src/FlightDisplay/FlightDisplayViewWidgets.qml @@ -68,7 +68,7 @@ Item { width: parent.width Repeater { - model: multiVehicleManager.vehicles + model: QGroundControl.multiVehicleManager.vehicles delegate: QGCLabel { @@ -180,7 +180,7 @@ Item { text: "Center map on Vehicle" enabled: _activeVehicle && !followVehicleCheckBox.checked - property var activeVehicle: multiVehicleManager.activeVehicle + property var activeVehicle: QGroundControl.multiVehicleManager.activeVehicle onClicked: { _dropButtonsExclusiveGroup.current = null diff --git a/src/FlightMap/Widgets/QGCInstrumentWidget.qml b/src/FlightMap/Widgets/QGCInstrumentWidget.qml index 0573beb78829fe5f37afdb4d66752a6ec347093e..694072839633133cc569edd53a7f9618151c85b4 100644 --- a/src/FlightMap/Widgets/QGCInstrumentWidget.qml +++ b/src/FlightMap/Widgets/QGCInstrumentWidget.qml @@ -104,7 +104,7 @@ Item { opacity: 0.5 width: attitudeWidget.width * 0.15 fillMode: Image.PreserveAspectFit - visible: QGroundControl.multiVehicleManager.activeVehicle + visible: _activeVehicle MouseArea { anchors.fill: parent diff --git a/src/MissionEditor/MissionEditor.qml b/src/MissionEditor/MissionEditor.qml index d83d797c7d6efbdc296bd9adcfc893295bda2eb8..d0017fa6e371ac1d3530b2818eeb3daeef2f8617 100644 --- a/src/MissionEditor/MissionEditor.qml +++ b/src/MissionEditor/MissionEditor.qml @@ -51,7 +51,7 @@ QGCView { readonly property int _decimalPlaces: 8 readonly property real _horizontalMargin: ScreenTools.defaultFontPixelWidth / 2 readonly property real _margin: ScreenTools.defaultFontPixelHeight / 2 - readonly property var _activeVehicle: multiVehicleManager.activeVehicle + readonly property var _activeVehicle: QGroundControl.multiVehicleManager.activeVehicle readonly property real _editFieldWidth: ScreenTools.defaultFontPixelWidth * 16 readonly property real _rightPanelWidth: Math.min(parent.width / 3, ScreenTools.defaultFontPixelWidth * 30) readonly property real _rightPanelOpacity: 0.8 @@ -68,7 +68,7 @@ QGCView { onActiveVehiclePositionChanged: updateMapToVehiclePosition() Connections { - target: multiVehicleManager + target: QGroundControl.multiVehicleManager onActiveVehicleChanged: { // When the active vehicle changes we need to allow the first vehicle position to move the map again @@ -443,7 +443,7 @@ QGCView { // Add the vehicles to the map MapItemView { - model: multiVehicleManager.vehicles + model: QGroundControl.multiVehicleManager.vehicles delegate: VehicleMapItem { vehicle: object @@ -596,7 +596,7 @@ QGCView { text: "Vehicle" enabled: activeVehicle && activeVehicle.latitude != 0 && activeVehicle.longitude != 0 - property var activeVehicle: multiVehicleManager.activeVehicle + property var activeVehicle: _activeVehicle onClicked: { centerMapButton.hideDropDown() diff --git a/src/QGCApplication.cc b/src/QGCApplication.cc index a890f5e0019c61127b2054b1376d1ae63b7f3ea8..f7090f0ed488f1ea6e5d9003349faa804093bb26 100644 --- a/src/QGCApplication.cc +++ b/src/QGCApplication.cc @@ -483,7 +483,6 @@ bool QGCApplication::_initForNormalAppBoot(void) #ifdef __mobile__ _qmlAppEngine = new QQmlApplicationEngine(this); _qmlAppEngine->addImportPath("qrc:/qml"); - _qmlAppEngine->rootContext()->setContextProperty("multiVehicleManager", toolbox()->multiVehicleManager()); _qmlAppEngine->rootContext()->setContextProperty("joystickManager", toolbox()->joystickManager()); _qmlAppEngine->load(QUrl(QStringLiteral("qrc:/qml/MainWindowNative.qml"))); #else diff --git a/src/QGCQuickWidget.cc b/src/QGCQuickWidget.cc index 0993a4323ef2f97df188a8afc4a585bf232c1246..b51002f2368f34fc61b103fdd6c09d7622cf90d3 100644 --- a/src/QGCQuickWidget.cc +++ b/src/QGCQuickWidget.cc @@ -41,7 +41,6 @@ QGCQuickWidget::QGCQuickWidget(QWidget* parent) : { setAttribute(Qt::WA_AcceptTouchEvents); rootContext()->engine()->addImportPath("qrc:/qml"); - rootContext()->setContextProperty("multiVehicleManager", qgcApp()->toolbox()->multiVehicleManager()); rootContext()->setContextProperty("joystickManager", qgcApp()->toolbox()->joystickManager()); } diff --git a/src/QmlControls/ParameterEditor.qml b/src/QmlControls/ParameterEditor.qml index d2ce7fc7b2f8afc221fc86bb7cb2468a65266ca1..c0ccf753fdc7bddbcc3a97d9e19392906c29ebcd 100644 --- a/src/QmlControls/ParameterEditor.qml +++ b/src/QmlControls/ParameterEditor.qml @@ -48,7 +48,7 @@ QGCView { property bool _searchFilter: false ///< true: showing results of search property var _searchResults ///< List of parameter names from search results property string _currentGroup: "" - property bool _showRCToParam: !ScreenTools.isMobile && multiVehicleManager.activeVehicle.px4Firmware + property bool _showRCToParam: !ScreenTools.isMobile && QGroundControl.multiVehicleManager.activeVehicle.px4Firmware ParameterEditorController { id: controller; diff --git a/src/VehicleSetup/FirmwareUpgrade.qml b/src/VehicleSetup/FirmwareUpgrade.qml index 0af3893066c89cf51537b6a1aaba46dd0834c474..b637b46f158cc405f2e5c72177d1e2adf5c137e5 100644 --- a/src/VehicleSetup/FirmwareUpgrade.qml +++ b/src/VehicleSetup/FirmwareUpgrade.qml @@ -102,7 +102,7 @@ QGCView { // Board was found right away, so something is already plugged in before we've started upgrade statusTextArea.append(qgcUnplugText1) statusTextArea.append(qgcUnplugText2) - multiVehicleManager.activeVehicle.autoDisconnect = true + QGroundControl.multiVehicleManager.activeVehicle.autoDisconnect = true } else { // We end up here when we detect a board plugged in after we've started upgrade statusTextArea.append(highlightPrefix + "Found device" + highlightSuffix + ": " + controller.boardType) diff --git a/src/VehicleSetup/JoystickConfig.qml b/src/VehicleSetup/JoystickConfig.qml index c5926410faa602550bb5da34edae143fad3b9042..9f2a3c539d4de6b1d535afc0488ac2ec7ed6ce07 100644 --- a/src/VehicleSetup/JoystickConfig.qml +++ b/src/VehicleSetup/JoystickConfig.qml @@ -25,6 +25,7 @@ import QtQuick 2.2 import QtQuick.Controls 1.2 import QtQuick.Dialogs 1.2 +import QGroundControl 1.0 import QGroundControl.Palette 1.0 import QGroundControl.Controls 1.0 import QGroundControl.ScreenTools 1.0 @@ -43,7 +44,7 @@ QGCView { property bool controllerCompleted: false property bool controllerAndViewReady: false - property var _activeVehicle: multiVehicleManager.activeVehicle + property var _activeVehicle: QGroundControl.multiVehicleManager.activeVehicle property var _activeJoystick: joystickManager.activeJoystick JoystickConfigController { diff --git a/src/VehicleSetup/PX4FlowSensor.qml b/src/VehicleSetup/PX4FlowSensor.qml index 95805261e2e3d2e7ab47ac1aa606fbfeef9d23f2..94cc07e4fa0289aa4c38ea101cc51e13fe70de4b 100644 --- a/src/VehicleSetup/PX4FlowSensor.qml +++ b/src/VehicleSetup/PX4FlowSensor.qml @@ -21,24 +21,24 @@ ======================================================================*/ -import QtQuick 2.3 -import QtQuick.Controls 1.2 -import QtQuick.Controls.Styles 1.2 -import QtQuick.Dialogs 1.2 +import QtQuick 2.3 +import QtQuick.Controls 1.2 +import QtQuick.Controls.Styles 1.2 +import QtQuick.Dialogs 1.2 -import QGroundControl.Controls 1.0 -import QGroundControl.FactSystem 1.0 -import QGroundControl.FactControls 1.0 -import QGroundControl.Palette 1.0 -import QGroundControl.Controllers 1.0 -import QGroundControl.ScreenTools 1.0 -import QGroundControl.MultiVehicleManager 1.0 +import QGroundControl 1.0 +import QGroundControl.Controls 1.0 +import QGroundControl.FactSystem 1.0 +import QGroundControl.FactControls 1.0 +import QGroundControl.Palette 1.0 +import QGroundControl.Controllers 1.0 +import QGroundControl.ScreenTools 1.0 QGCView { id: qgcView viewPanel: panel - property var _activeVehicle: multiVehicleManager.activeVehicle + property var _activeVehicle: QGroundControl.multiVehicleManager.activeVehicle QGCPalette { id: qgcPal; colorGroupEnabled: panel.enabled } diff --git a/src/VehicleSetup/SetupView.qml b/src/VehicleSetup/SetupView.qml index cb4ee371d057cb89e8686769fa64b0a8dcdf73cb..e39058755c18dd2f7980cbc703560cada9235224 100644 --- a/src/VehicleSetup/SetupView.qml +++ b/src/VehicleSetup/SetupView.qml @@ -50,17 +50,17 @@ Rectangle { readonly property string _armedVehicleText: "This operation cannot be performed while vehicle is armed." property string _messagePanelText: "missing message panel text" - property bool _fullParameterVehicleAvailable: multiVehicleManager.parameterReadyVehicleAvailable && !multiVehicleManager.activeVehicle.missingParameters + property bool _fullParameterVehicleAvailable: QGroundControl.multiVehicleManager.parameterReadyVehicleAvailable && !QGroundControl.multiVehicleManager.activeVehicle.missingParameters function showSummaryPanel() { if (_fullParameterVehicleAvailable) { - if (multiVehicleManager.activeVehicle.autopilot.vehicleComponents.length == 0) { + if (QGroundControl.multiVehicleManager.activeVehicle.autopilot.vehicleComponents.length == 0) { panelLoader.sourceComponent = noComponentsVehicleSummaryComponent } else { panelLoader.source = "VehicleSummary.qml"; } - } else if (multiVehicleManager.parameterReadyVehicleAvailable) { + } else if (QGroundControl.multiVehicleManager.parameterReadyVehicleAvailable) { panelLoader.sourceComponent = missingParametersVehicleSummaryComponent } else { panelLoader.sourceComponent = disconnectedVehicleSummaryComponent @@ -70,7 +70,7 @@ Rectangle { function showFirmwarePanel() { if (!ScreenTools.isMobile) { - if (multiVehicleManager.activeVehicleAvailable && multiVehicleManager.activeVehicle.armed) { + if (QGroundControl.multiVehicleManager.activeVehicleAvailable && QGroundControl.multiVehicleManager.activeVehicle.armed) { _messagePanelText = _armedVehicleText panelLoader.sourceComponent = messagePanelComponent } else { @@ -81,7 +81,7 @@ Rectangle { function showJoystickPanel() { - if (multiVehicleManager.activeVehicleAvailable && multiVehicleManager.activeVehicle.armed) { + if (QGroundControl.multiVehicleManager.activeVehicleAvailable && QGroundControl.multiVehicleManager.activeVehicle.armed) { _messagePanelText = _armedVehicleText panelLoader.sourceComponent = messagePanelComponent } else { @@ -101,7 +101,7 @@ Rectangle { function showVehicleComponentPanel(vehicleComponent) { - if (multiVehicleManager.activeVehicle.armed && !vehicleComponent.allowSetupWhileArmed) { + if (QGroundControl.multiVehicleManager.activeVehicle.armed && !vehicleComponent.allowSetupWhileArmed) { _messagePanelText = _armedVehicleText panelLoader.sourceComponent = messagePanelComponent } else { @@ -117,7 +117,7 @@ Rectangle { Component.onCompleted: showSummaryPanel() Connections { - target: multiVehicleManager + target: QGroundControl.multiVehicleManager onParameterReadyVehicleAvailableChanged: { if (parameterReadyVehicleAvailable || summaryButton.checked || setupButtonGroup.current != firmwareButton) { @@ -295,7 +295,7 @@ Rectangle { Repeater { id: componentRepeater - model: _fullParameterVehicleAvailable ? multiVehicleManager.activeVehicle.autopilot.vehicleComponents : 0 + model: _fullParameterVehicleAvailable ? QGroundControl.multiVehicleManager.activeVehicle.autopilot.vehicleComponents : 0 SubMenuButton { imageResource: modelData.iconResource @@ -313,7 +313,7 @@ Rectangle { SubMenuButton { setupIndicator: false exclusiveGroup: setupButtonGroup - visible: multiVehicleManager.parameterReadyVehicleAvailable + visible: QGroundControl.multiVehicleManager.parameterReadyVehicleAvailable text: "Parameters" onClicked: showParametersPanel() diff --git a/src/VehicleSetup/VehicleSummary.qml b/src/VehicleSetup/VehicleSummary.qml index 82b40295736db9d8c073b4ce3016e81a24d0c177..e44ada102e8a8e687c711e2ade069d4a646b901b 100644 --- a/src/VehicleSetup/VehicleSummary.qml +++ b/src/VehicleSetup/VehicleSummary.qml @@ -25,6 +25,7 @@ import QtQuick 2.2 import QtQuick.Controls 1.2 import QtQuick.Controls.Styles 1.2 +import QGroundControl 1.0 import QGroundControl.FactSystem 1.0 import QGroundControl.Controls 1.0 import QGroundControl.ScreenTools 1.0 @@ -95,7 +96,7 @@ Rectangle { text: setupComplete ? "Below you will find a summary of the settings for your vehicle. To the left are the setup menus for each component." : "WARNING: Your vehicle requires setup prior to flight. Please resolve the items marked in red using the menu on the left." - property bool setupComplete: multiVehicleManager.activeVehicle ? multiVehicleManager.activeVehicle.autopilot.setupComplete : false + property bool setupComplete: QGroundControl.multiVehicleManager.activeVehicle ? QGroundControl.multiVehicleManager.activeVehicle.autopilot.setupComplete : false } Flow { @@ -104,7 +105,7 @@ Rectangle { spacing: _summaryBoxSpace Repeater { - model: multiVehicleManager.activeVehicle ? multiVehicleManager.activeVehicle.autopilot.vehicleComponents : undefined + model: QGroundControl.multiVehicleManager.activeVehicle ? QGroundControl.multiVehicleManager.activeVehicle.autopilot.vehicleComponents : undefined // Outer summary item rectangle Rectangle { diff --git a/src/ui/MainWindowInner.qml b/src/ui/MainWindowInner.qml index e515a92880588a647131e821372f25f155cb9bbc..cf249e5165f0bfcf0c74667c0263146024a2b00b 100644 --- a/src/ui/MainWindowInner.qml +++ b/src/ui/MainWindowInner.qml @@ -53,7 +53,7 @@ Item { property var gcsPosition: QtPositioning.coordinate() // Starts as invalid coordinate property var currentPopUp: null property real currentCenterX: 0 - property var activeVehicle: multiVehicleManager.activeVehicle + property var activeVehicle: QGroundControl.multiVehicleManager.activeVehicle property string formatedMessage: activeVehicle ? activeVehicle.formatedMessage : "" function showFlyView() { @@ -232,7 +232,7 @@ Item { if(currentPopUp) { currentPopUp.close() } - if(multiVehicleManager.activeVehicleAvailable) { + if(QGroundControl.multiVehicleManager.activeVehicleAvailable) { messageText.text = activeVehicle.formatedMessages //-- Hack to scroll to last message for (var i = 0; i < activeVehicle.messageCount; i++) diff --git a/src/ui/preferences/MavlinkSettings.qml b/src/ui/preferences/MavlinkSettings.qml index f901bbeb59a043b7e06b8438fd4de245fe7b4830..4c64f3d29106257ecc2112b8d1c503e323afccee 100644 --- a/src/ui/preferences/MavlinkSettings.qml +++ b/src/ui/preferences/MavlinkSettings.qml @@ -88,9 +88,9 @@ Rectangle { //-- Mavlink Heartbeats QGCCheckBox { text: "Emit heartbeat" - checked: multiVehicleManager.gcsHeartBeatEnabled + checked: QGroundControl.multiVehicleManager.gcsHeartBeatEnabled onClicked: { - multiVehicleManager.gcsHeartBeatEnabled = checked + QGroundControl.multiVehicleManager.gcsHeartBeatEnabled = checked } } //----------------------------------------------------------------- diff --git a/src/ui/toolbar/MainToolBar.qml b/src/ui/toolbar/MainToolBar.qml index 8fe4ec7329b47e03b6e1fc12797cafe90c410dbd..acd067c7d4faf503da28bf05c70411d7e7053365 100644 --- a/src/ui/toolbar/MainToolBar.qml +++ b/src/ui/toolbar/MainToolBar.qml @@ -45,7 +45,7 @@ Rectangle { QGCPalette { id: qgcPal; colorGroupEnabled: true } - property var activeVehicle: multiVehicleManager.activeVehicle + property var activeVehicle: QGroundControl.multiVehicleManager.activeVehicle property var mainWindow: null property bool isMessageImportant: activeVehicle ? !activeVehicle.messageTypeNormal && !activeVehicle.messageTypeNone : false property bool isBackgroundDark: true diff --git a/src/ui/toolbar/MainToolBarIndicators.qml b/src/ui/toolbar/MainToolBarIndicators.qml index 7a549621147e69b179ed5777d2dcac29c9b53a7a..e36efd1469bb2bdeee072e40b603fa62ac27ac4b 100644 --- a/src/ui/toolbar/MainToolBarIndicators.qml +++ b/src/ui/toolbar/MainToolBarIndicators.qml @@ -322,10 +322,10 @@ Row { MenuItem { checkable: true - onTriggered: multiVehicleManager.activeVehicle = vehicle + onTriggered: QGroundControl.multiVehicleManager.activeVehicle = vehicle property int vehicleId: Number(text.split(" ")[1]) - property var vehicle: multiVehicleManager.getVehicleById(vehicleId) + property var vehicle: QGroundControl.multiVehicleManager.getVehicleById(vehicleId) } } @@ -339,8 +339,8 @@ Row { vehicleMenuItems.length = 0 // Add new items - for (var i=0; i