Browse Source

APM support forwarding: Add toolbar indicator just to APMFirmwarePlugin

QGC4.4
davidsastresas 2 years ago committed by David Sastre
parent
commit
6c4ff9c862
  1. 1
      qgroundcontrol.qrc
  2. 11
      src/FirmwarePlugin/APM/APMFirmwarePlugin.cc
  3. 2
      src/FirmwarePlugin/APM/APMFirmwarePlugin.h
  4. 75
      src/ui/toolbar/APMSupportForwardingIndicator.qml

1
qgroundcontrol.qrc

@ -18,6 +18,7 @@ @@ -18,6 +18,7 @@
<file alias="ROIIndicator.qml">src/ui/toolbar/ROIIndicator.qml</file>
<file alias="TelemetryRSSIIndicator.qml">src/ui/toolbar/TelemetryRSSIIndicator.qml</file>
<file alias="VTOLModeIndicator.qml">src/ui/toolbar/VTOLModeIndicator.qml</file>
<file alias="APMSupportForwardingIndicator.qml">src/ui/toolbar/APMSupportForwardingIndicator.qml</file>
</qresource>
<qresource prefix="/checklists">
<file alias="DefaultChecklist.qml">src/FlightDisplay/DefaultChecklist.qml</file>

11
src/FirmwarePlugin/APM/APMFirmwarePlugin.cc

@ -639,6 +639,17 @@ bool APMFirmwarePlugin::hasGripper(const Vehicle* vehicle) const @@ -639,6 +639,17 @@ bool APMFirmwarePlugin::hasGripper(const Vehicle* vehicle) const
return false;
}
const QVariantList& APMFirmwarePlugin::toolIndicators(const Vehicle* vehicle)
{
if (_toolIndicatorList.size() == 0) {
// First call the base class to get the standard QGC list
_toolIndicatorList = FirmwarePlugin::toolIndicators(vehicle);
// Then add the forwarding support indicator
_toolIndicatorList.append(QVariant::fromValue(QUrl::fromUserInput("qrc:/toolbar/APMSupportForwardingIndicator.qml")));
}
return _toolIndicatorList;
}
bool APMFirmwarePlugin::isGuidedMode(const Vehicle* vehicle) const
{
return vehicle->flightMode() == "Guided";

2
src/FirmwarePlugin/APM/APMFirmwarePlugin.h

@ -79,6 +79,7 @@ public: @@ -79,6 +79,7 @@ public:
QString brandImageOutdoor (const Vehicle* vehicle) const override { Q_UNUSED(vehicle); return QStringLiteral("/qmlimages/APM/BrandImage"); }
QString getHobbsMeter (Vehicle* vehicle) override;
bool hasGripper (const Vehicle* vehicle) const override;
const QVariantList& toolIndicators (const Vehicle* vehicle) override;
protected:
/// All access to singleton is through stack specific implementation
@ -110,6 +111,7 @@ private: @@ -110,6 +111,7 @@ private:
// Any instance data here must be global to all vehicles
// Vehicle specific data should go into APMFirmwarePluginInstanceData
QVariantList _toolIndicatorList;
QList<APMCustomMode> _supportedModes;
QMap<int /* vehicle id */, QMap<int /* componentId */, bool /* true: component is part of ArduPilot stack */>> _ardupilotComponentMap;

75
src/ui/toolbar/APMSupportForwardingIndicator.qml

@ -0,0 +1,75 @@ @@ -0,0 +1,75 @@
/****************************************************************************
*
* (c) 2009-2023 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>
*
* QGroundControl is licensed according to the terms in the file
* COPYING.md in the root of the source code directory.
*
****************************************************************************/
import QtQuick 2.11
import QtQuick.Layouts 1.11
import QGroundControl 1.0
import QGroundControl.Controls 1.0
import QGroundControl.ScreenTools 1.0
import QGroundControl.Palette 1.0
//-------------------------------------------------------------------------
//-- Telemetry RSSI
Item {
id: _root
anchors.top: parent.top
anchors.bottom: parent.bottom
width: forwardingSupportIcon.width * 1.1
property bool showIndicator: QGroundControl.linkManager.mavlinkSupportForwardingEnabled
Component {
id: forwardingSupportInfo
Rectangle {
width: telemGrid.width + ScreenTools.defaultFontPixelWidth * 3
height: telemGrid.height + ScreenTools.defaultFontPixelHeight * 2
radius: ScreenTools.defaultFontPixelHeight * 0.5
color: qgcPal.window
GridLayout {
id: telemGrid
anchors.margins: ScreenTools.defaultFontPixelHeight
columnSpacing: ScreenTools.defaultFontPixelWidth
columns: 2
anchors.centerIn: parent
QGCLabel {
Layout.columnSpan: 2
text: qsTr("Mavlink traffic is being forwarded to a support server")
}
QGCLabel {
text: qsTr("Server name:")
}
QGCLabel {
text: QGroundControl.settingsManager.appSettings.forwardMavlinkAPMSupportHostName.value
}
}
}
}
Image {
id: forwardingSupportIcon
anchors.top: parent.top
anchors.bottom: parent.bottom
width: height
sourceSize.height: height
source: "/qmlimages/ForwardingSupportIconGreen.svg"
fillMode: Image.PreserveAspectFit
}
MouseArea {
anchors.fill: parent
onClicked: {
mainWindow.showIndicatorPopup(_root, forwardingSupportInfo)
}
}
}
Loading…
Cancel
Save