diff --git a/src/FlightMap/Widgets/QGCInstrumentWidget.qml b/src/FlightMap/Widgets/QGCInstrumentWidget.qml index b90f1b0..0573beb 100644 --- a/src/FlightMap/Widgets/QGCInstrumentWidget.qml +++ b/src/FlightMap/Widgets/QGCInstrumentWidget.qml @@ -131,7 +131,7 @@ Item { Rectangle { anchors.fill: _valuesWidget color: _backgroundColor - visible: !_showCompass && _activeVehicle + visible: !_showCompass radius: _spacing } @@ -145,7 +145,6 @@ Item { } } - Rectangle { id: _spacer2 height: 1 diff --git a/src/FlightMap/Widgets/ValuesWidget.qml b/src/FlightMap/Widgets/ValuesWidget.qml index 596e2fd..0e275e5 100644 --- a/src/FlightMap/Widgets/ValuesWidget.qml +++ b/src/FlightMap/Widgets/ValuesWidget.qml @@ -33,7 +33,6 @@ import QGroundControl 1.0 QGCFlickable { id: _root - visible: _activeVehicle height: Math.min(maxHeight, _smallFlow.y + _smallFlow.height) contentHeight: _smallFlow.y + _smallFlow.height flickableDirection: Flickable.VerticalFlick @@ -43,7 +42,7 @@ QGCFlickable { property color textColor property var maxHeight - property var _activeVehicle: QGroundControl.multiVehicleManager.activeVehicle + property var _activeVehicle: QGroundControl.multiVehicleManager.activeVehicle ? QGroundControl.multiVehicleManager.activeVehicle : QGroundControl.multiVehicleManager.disconnectedVehicle property real _margins: ScreenTools.defaultFontPixelWidth / 2 QGCPalette { id:qgcPal; colorGroupEnabled: true } diff --git a/src/FlightMap/Widgets/VibrationWidget.qml b/src/FlightMap/Widgets/VibrationWidget.qml index 83f838d..cc973fe 100644 --- a/src/FlightMap/Widgets/VibrationWidget.qml +++ b/src/FlightMap/Widgets/VibrationWidget.qml @@ -33,7 +33,6 @@ import QGroundControl 1.0 QGCFlickable { id: _root - visible: _activeVehicle height: Math.min(maxHeight, innerItem.height) contentHeight: innerItem.height flickableDirection: Flickable.VerticalFlick @@ -43,7 +42,7 @@ QGCFlickable { property color backgroundColor property var maxHeight - property var _activeVehicle: QGroundControl.multiVehicleManager.activeVehicle + property var _activeVehicle: QGroundControl.multiVehicleManager.activeVehicle ? QGroundControl.multiVehicleManager.activeVehicle : QGroundControl.multiVehicleManager.disconnectedVehicle property real _margins: ScreenTools.defaultFontPixelWidth / 2 property real _barWidth: Math.round(ScreenTools.defaultFontPixelWidth * 3) diff --git a/src/QmlControls/QGroundControlQmlGlobal.h b/src/QmlControls/QGroundControlQmlGlobal.h index beae942..de35f49 100644 --- a/src/QmlControls/QGroundControlQmlGlobal.h +++ b/src/QmlControls/QGroundControlQmlGlobal.h @@ -55,7 +55,7 @@ public: Q_PROPERTY(LinkManager* linkManager READ linkManager CONSTANT) Q_PROPERTY(MissionCommands* missionCommands READ missionCommands CONSTANT) Q_PROPERTY(MultiVehicleManager* multiVehicleManager READ multiVehicleManager CONSTANT) - Q_PROPERTY(QGCMapEngineManager* mapEngineManager READ mapEngineManager CONSTANT) + Q_PROPERTY(QGCMapEngineManager* mapEngineManager READ mapEngineManager CONSTANT) Q_PROPERTY(qreal zOrderTopMost READ zOrderTopMost CONSTANT) ///< z order for top most items, toolbar, main window sub view Q_PROPERTY(qreal zOrderWidgets READ zOrderWidgets CONSTANT) ///< z order value to widgets, for example: zoom controls, hud widgetss diff --git a/src/Vehicle/MultiVehicleManager.cc b/src/Vehicle/MultiVehicleManager.cc index 7646e92..019694d 100644 --- a/src/Vehicle/MultiVehicleManager.cc +++ b/src/Vehicle/MultiVehicleManager.cc @@ -50,6 +50,7 @@ MultiVehicleManager::MultiVehicleManager(QGCApplication* app) , _activeVehicleAvailable(false) , _parameterReadyVehicleAvailable(false) , _activeVehicle(NULL) + , _disconnectedVehicle(NULL) , _firmwarePluginManager(NULL) , _autopilotPluginManager(NULL) , _joystickManager(NULL) @@ -66,6 +67,8 @@ MultiVehicleManager::MultiVehicleManager(QGCApplication* app) if (_gcsHeartbeatEnabled) { _gcsHeartbeatTimer.start(); } + + _disconnectedVehicle = new Vehicle(this); } void MultiVehicleManager::setToolbox(QGCToolbox *toolbox) diff --git a/src/Vehicle/MultiVehicleManager.h b/src/Vehicle/MultiVehicleManager.h index c1bd659..31fb92f 100644 --- a/src/Vehicle/MultiVehicleManager.h +++ b/src/Vehicle/MultiVehicleManager.h @@ -57,6 +57,9 @@ public: Q_PROPERTY(QmlObjectListModel* vehicles READ vehicles CONSTANT) Q_PROPERTY(bool gcsHeartBeatEnabled READ gcsHeartbeatEnabled WRITE setGcsHeartbeatEnabled NOTIFY gcsHeartBeatEnabledChanged) + /// A disconnected vehicle is used to access FactGroup information for the Vehicle object when no active vehicle is available + Q_PROPERTY(Vehicle* disconnectedVehicle MEMBER _disconnectedVehicle CONSTANT) + // Methods Q_INVOKABLE Vehicle* getVehicleById(int vehicleId); @@ -104,6 +107,7 @@ private: bool _activeVehicleAvailable; ///< true: An active vehicle is available bool _parameterReadyVehicleAvailable; ///< true: An active vehicle with ready parameters is available Vehicle* _activeVehicle; ///< Currently active vehicle from a ui perspective + Vehicle* _disconnectedVehicle; ///< Disconnected vechicle for FactGroup access QList _vehiclesBeingDeleted; ///< List of Vehicles being deleted in queued phases Vehicle* _vehicleBeingSetActive; ///< Vehicle being set active in queued phases