diff --git a/QGCApplication.pro b/QGCApplication.pro
index 4402e8a260bfc765ceb0e5dd6f4bae60dccb3e3d..de414f3d5941329f17f12c4718edef0533d88b4b 100644
--- a/QGCApplication.pro
+++ b/QGCApplication.pro
@@ -140,12 +140,12 @@ INCLUDEPATH += \
src/audio \
src/AutoPilotPlugins \
src/comm \
+ src/FlightDisplay \
src/input \
src/lib/qmapcontrol \
src/QmlControls \
src/uas \
src/ui \
- src/ui/flightdisplay \
src/ui/linechart \
src/ui/map \
src/ui/mapdisplay \
@@ -238,6 +238,8 @@ HEADERS += \
src/comm/QGCMAVLink.h \
src/comm/TCPLink.h \
src/comm/UDPLink.h \
+ src/FlightDisplay/FlightDisplayWidget.h \
+ src/FlightDisplay/FlightDisplayView.h \
src/GAudioOutput.h \
src/HomePositionManager.h \
src/LogCompressor.h \
@@ -264,7 +266,6 @@ HEADERS += \
src/uas/UASInterface.h \
src/uas/UASMessageHandler.h \
src/uas/UASWaypointManager.h \
- src/ui/flightdisplay/FlightDisplay.h \
src/ui/HDDisplay.h \
src/ui/HSIDisplay.h \
src/ui/HUD.h \
@@ -373,6 +374,8 @@ SOURCES += \
src/comm/MockLinkMissionItemHandler.cc \
src/comm/TCPLink.cc \
src/comm/UDPLink.cc \
+ src/FlightDisplay/FlightDisplayWidget.cc \
+ src/FlightDisplay/FlightDisplayView.cc \
src/GAudioOutput.cc \
src/HomePositionManager.cc \
src/LogCompressor.cc \
@@ -394,7 +397,6 @@ SOURCES += \
src/uas/UAS.cc \
src/uas/UASMessageHandler.cc \
src/uas/UASWaypointManager.cc \
- src/ui/flightdisplay/FlightDisplay.cc \
src/ui/HDDisplay.cc \
src/ui/HSIDisplay.cc \
src/ui/HUD.cc \
diff --git a/qgroundcontrol.qrc b/qgroundcontrol.qrc
index ff8a881336e80fbb9bdb2151a96dfebd2adaf00a..17945e62efef6b733a5e30fc4e7f3118542908b2 100644
--- a/qgroundcontrol.qrc
+++ b/qgroundcontrol.qrc
@@ -116,7 +116,8 @@
src/AutoPilotPlugins/PX4/AirframeComponentSummary.qml
src/AutoPilotPlugins/PX4/AirframeComponent.qml
src/ui/toolbar/MainToolBar.qml
- src/ui/flightdisplay/FlightDisplay.qml
+ src/FlightDisplay/FlightDisplayView.qml
+ src/FlightDisplay/FlightDisplayWidget.qml
src/ui/mapdisplay/MapDisplay.qml
diff --git a/src/ui/flightdisplay/FlightDisplay.cc b/src/FlightDisplay/FlightDisplayView.cc
similarity index 85%
rename from src/ui/flightdisplay/FlightDisplay.cc
rename to src/FlightDisplay/FlightDisplayView.cc
index 6b2f87b666286cdcf06e4d838a0e75f599aea150..34cfa13e84c0935cbeca98de1dfea13f5b977613 100644
--- a/src/ui/flightdisplay/FlightDisplay.cc
+++ b/src/FlightDisplay/FlightDisplayView.cc
@@ -21,12 +21,6 @@ This file is part of the QGROUNDCONTROL project
======================================================================*/
-/**
- * @file
- * @brief QGC Main Flight Display
- * @author Gus Grubba
- */
-
#include
#include
#include
@@ -36,15 +30,15 @@ This file is part of the QGROUNDCONTROL project
#include "VideoReceiver.h"
#include "ScreenToolsController.h"
-#include "FlightDisplay.h"
+#include "FlightDisplayView.h"
-const char* kMainFlightDisplayGroup = "MainFlightDisplay";
+const char* kMainFlightDisplayViewGroup = "FlightDisplayView";
-FlightDisplay::FlightDisplay(QWidget *parent)
+FlightDisplayView::FlightDisplayView(QWidget *parent)
: QGCQmlWidgetHolder(parent)
{
setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding);
- setObjectName("MainFlightDisplay");
+ setObjectName("FlightDisplayView");
// Get rid of layout default margins
QLayout* pl = layout();
if(pl) {
@@ -90,26 +84,26 @@ FlightDisplay::FlightDisplay(QWidget *parent)
#endif
setContextPropertyObject("videoReceiver", pReceiver);
- setSource(QUrl::fromUserInput("qrc:/qml/FlightDisplay.qml"));
+ setSource(QUrl::fromUserInput("qrc:/qml/FlightDisplayView.qml"));
setVisible(true);
}
-FlightDisplay::~FlightDisplay()
+FlightDisplayView::~FlightDisplayView()
{
}
-void FlightDisplay::saveSetting(const QString &name, const QString& value)
+void FlightDisplayView::saveSetting(const QString &name, const QString& value)
{
QSettings settings;
- QString key(kMainFlightDisplayGroup);
+ QString key(kMainFlightDisplayViewGroup);
key += "/" + name;
settings.setValue(key, value);
}
-QString FlightDisplay::loadSetting(const QString &name, const QString& defaultValue)
+QString FlightDisplayView::loadSetting(const QString &name, const QString& defaultValue)
{
QSettings settings;
- QString key(kMainFlightDisplayGroup);
+ QString key(kMainFlightDisplayViewGroup);
key += "/" + name;
return settings.value(key, defaultValue).toString();
}
diff --git a/src/ui/flightdisplay/FlightDisplay.h b/src/FlightDisplay/FlightDisplayView.h
similarity index 83%
rename from src/ui/flightdisplay/FlightDisplay.h
rename to src/FlightDisplay/FlightDisplayView.h
index cd3e63e72e6b877405127891ce9c0890043fcb89..e97c290015370a173bd7eaec8ea700aec1fc4080 100644
--- a/src/ui/flightdisplay/FlightDisplay.h
+++ b/src/FlightDisplay/FlightDisplayView.h
@@ -21,25 +21,17 @@ This file is part of the QGROUNDCONTROL project
======================================================================*/
-/**
- * @file
- * @brief QGC Main Flight Display
- * @author Gus Grubba
- */
-
-#ifndef QGCFLIGHTDISPLAY_H
-#define QGCFLIGHTDISPLAY_H
+#ifndef FlightDisplayView_H
+#define FlightDisplayView_H
#include "QGCQmlWidgetHolder.h"
-class UASInterface;
-
-class FlightDisplay : public QGCQmlWidgetHolder
+class FlightDisplayView : public QGCQmlWidgetHolder
{
Q_OBJECT
public:
- FlightDisplay(QWidget* parent = NULL);
- ~FlightDisplay();
+ FlightDisplayView(QWidget* parent = NULL);
+ ~FlightDisplayView();
/// @brief Invokes the Flight Display Options menu
void showOptionsMenu() { emit showOptionsMenuChanged(); }
@@ -60,4 +52,4 @@ signals:
};
-#endif // QGCFLIGHTDISPLAY_H
+#endif
diff --git a/src/FlightDisplay/FlightDisplayView.qml b/src/FlightDisplay/FlightDisplayView.qml
new file mode 100644
index 0000000000000000000000000000000000000000..d6d35225338a943d9c947fb377e08fb0eb331c3b
--- /dev/null
+++ b/src/FlightDisplay/FlightDisplayView.qml
@@ -0,0 +1,134 @@
+/*=====================================================================
+
+QGroundControl Open Source Ground Control Station
+
+(c) 2009, 2015 QGROUNDCONTROL PROJECT
+
+This file is part of the QGROUNDCONTROL project
+
+ QGROUNDCONTROL is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ QGROUNDCONTROL is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with QGROUNDCONTROL. If not, see .
+
+======================================================================*/
+
+import QtQuick 2.4
+import QtQuick.Controls 1.3
+import QtQuick.Controls.Styles 1.2
+import QtQuick.Dialogs 1.2
+
+import QGroundControl.FlightMap 1.0
+import QGroundControl.ScreenTools 1.0
+import QGroundControl.Controls 1.0
+import QGroundControl.Palette 1.0
+
+
+/// Flight Display View
+Item {
+ id: root
+
+ property var __qgcPal: QGCPalette { colorGroupEnabled: enabled }
+
+ property var _activeVehicle: multiVehicleManager.activeVehicle
+
+ readonly property real _defaultLatitude: 37.803784
+ readonly property real _defaultLongitude: -122.462276
+ readonly property real _defaultRoll: 0
+ readonly property real _defaultPitch: 0
+ readonly property real _defaultHeading: 0
+ readonly property real _defaultAltitudeWGS84: 0
+ readonly property real _defaultGroundSpeed: 0
+ readonly property real _defaultAirSpeed: 0
+ readonly property real _defaultClimbRate: 0
+
+ property real _roll: _activeVehicle ? (isNaN(_activeVehicle.roll) ? _defaultRoll : _activeVehicle.roll) : _defaultRoll
+ property real _pitch: _activeVehicle ? (isNaN(_activeVehicle.pitch) ? _defaultPitch : _activeVehicle.pitch) : _defaultPitch
+ property real _latitude: _activeVehicle ? ((_activeVehicle.latitude === 0) ? _defaultLatitude : _activeVehicle.latitude) : _defaultLatitude
+ property real _longitude: _activeVehicle ? ((_activeVehicle.longitude === 0) ? _defaultLongitude : _activeVehicle.longitude) : _defaultLongitude
+ property real _heading: _activeVehicle ? (isNaN(_activeVehicle.heading) ? _defaultHeading : _activeVehicle.heading) : _defaultHeading
+ property real _altitudeWGS84: _activeVehicle ? _activeVehicle.altitudeWGS84 : _defaultAltitudeWGS84
+ property real _groundSpeed: _activeVehicle ? _activeVehicle.groundSpeed : _defaultGroundSpeed
+ property real _airSpeed: _activeVehicle ? _activeVehicle.airSpeed : _defaultAirSpeed
+ property real _climbRate: _activeVehicle ? _activeVehicle.climbRate : _defaultClimbRate
+
+ function getBool(value) {
+ return value === '0' ? false : true;
+ }
+
+ function setBool(value) {
+ return value ? "1" : "0";
+ }
+
+ FlightMap {
+ id: flightMap
+ anchors.fill: parent
+ mapName: "FlightDisplayView"
+ latitude: _latitude
+ longitude: _longitude
+ z: 10
+ showVehicles: true
+ }
+
+ QGCCompassWidget {
+ x: ScreenTools.defaultFontPixelSize * (7.1)
+ y: ScreenTools.defaultFontPixelSize * (0.42)
+ size: ScreenTools.defaultFontPixelSize * (13.3)
+ heading: _heading
+ active: multiVehicleManager.activeVehicleAvailable
+ z: flightMap.z + 2
+ }
+
+ QGCAttitudeWidget {
+ anchors.rightMargin: ScreenTools.defaultFontPixelSize * (7.1)
+ anchors.right: parent.right
+ y: ScreenTools.defaultFontPixelSize * (0.42)
+ size: ScreenTools.defaultFontPixelSize * (13.3)
+ rollAngle: _roll
+ pitchAngle: _pitch
+ active: multiVehicleManager.activeVehicleAvailable
+ z: flightMap.z + 2
+ }
+
+ QGCAltitudeWidget {
+ anchors.right: parent.right
+ height: parent.height * 0.65 > ScreenTools.defaultFontPixelSize * (23.4) ? ScreenTools.defaultFontPixelSize * (23.4) : parent.height * 0.65
+ width: ScreenTools.defaultFontPixelSize * (5)
+ altitude: _altitudeWGS84
+ z: 30
+ }
+
+ QGCSpeedWidget {
+ anchors.left: parent.left
+ width: ScreenTools.defaultFontPixelSize * (5)
+ height: parent.height * 0.65 > ScreenTools.defaultFontPixelSize * (23.4) ? ScreenTools.defaultFontPixelSize * (23.4) : parent.height * 0.65
+ speed: _groundSpeed
+ z: 40
+ }
+
+ QGCCurrentSpeed {
+ anchors.left: parent.left
+ width: ScreenTools.defaultFontPixelSize * (6.25)
+ airspeed: _airSpeed
+ groundspeed: _groundSpeed
+ active: multiVehicleManager.activeVehicleAvailable
+ z: 50
+ }
+
+ QGCCurrentAltitude {
+ anchors.right: parent.right
+ width: ScreenTools.defaultFontPixelSize * (6.25)
+ altitude: _altitudeWGS84
+ vertZ: _climbRate
+ active: multiVehicleManager.activeVehicleAvailable
+ z: 60
+ }
+}
diff --git a/src/FlightDisplay/FlightDisplayWidget.cc b/src/FlightDisplay/FlightDisplayWidget.cc
new file mode 100644
index 0000000000000000000000000000000000000000..3b0b6e1c44071602e0ec2ed18f983550d232c2cb
--- /dev/null
+++ b/src/FlightDisplay/FlightDisplayWidget.cc
@@ -0,0 +1,109 @@
+/*=====================================================================
+
+QGroundControl Open Source Ground Control Station
+
+(c) 2009, 2015 QGROUNDCONTROL PROJECT
+
+This file is part of the QGROUNDCONTROL project
+
+ QGROUNDCONTROL is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ QGROUNDCONTROL is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with QGROUNDCONTROL. If not, see .
+
+======================================================================*/
+
+#include
+#include
+#include
+
+#include
+#include
+#include "VideoReceiver.h"
+
+#include "ScreenToolsController.h"
+#include "FlightDisplayWidget.h"
+
+const char* kMainFlightDisplayWidgetGroup = "FlightDisplayWidget";
+
+FlightDisplayWidget::FlightDisplayWidget(QWidget *parent)
+ : QGCQmlWidgetHolder(parent)
+{
+ setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding);
+ setObjectName("FlightDisplayWidget");
+ // Get rid of layout default margins
+ QLayout* pl = layout();
+ if(pl) {
+ pl->setContentsMargins(0,0,0,0);
+ }
+#ifndef __android__
+ setMinimumWidth( 31 * ScreenToolsController::defaultFontPixelSize_s());
+ setMinimumHeight(33 * ScreenToolsController::defaultFontPixelSize_s());
+#endif
+ setContextPropertyObject("flightDisplay", this);
+
+ /*
+ * This is the receiving end of an UDP RTP stream. The sender can be setup with this command:
+ *
+ * gst-launch-1.0 uvch264src initial-bitrate=1000000 average-bitrate=1000000 iframe-period=1000 name=src auto-start=true src.vidsrc ! \
+ * video/x-h264,width=1280,height=720,framerate=24/1 ! h264parse ! rtph264pay ! udpsink host=192.168.1.9 port=5000
+ *
+ * Where the main parameters are:
+ *
+ * uvch264src: Your h264 video source (the example above uses a Logitech C920 on an Raspberry PI 2+ or Odroid C1
+ * host=192.168.1.9 This is the IP address of QGC. You can use Avahi/Zeroconf to find QGC using the "_qgroundcontrol._udp" service.
+ *
+ * Advanced settings (you should probably read the gstreamer documentation before changing these):
+ *
+ * initial-bitrate=1000000 average-bitrate=1000000
+ * The bit rate to use. The greater, the better quality at the cost of higher bandwidth.
+ *
+ * width=1280,height=720,framerate=24/1
+ * The video resolution and frame rate. This depends on the camera used.
+ *
+ * iframe-period=1000
+ * Interval between iFrames. The greater the interval the lesser bandwidth at the cost of a longer time to recover from lost packets.
+ *
+ * Do not change anything else unless you know what you are doing. Any other change will require a matching change on the receiving end.
+ *
+ */
+ VideoSurface* pSurface = new VideoSurface;
+ setContextPropertyObject("videoDisplay", pSurface);
+ VideoReceiver* pReceiver = new VideoReceiver(this);
+ pReceiver->setUri(QLatin1Literal("udp://0.0.0.0:5000"));
+#if defined(QGC_GST_STREAMING)
+ pReceiver->setVideoSink(pSurface->videoSink());
+#endif
+ setContextPropertyObject("videoReceiver", pReceiver);
+
+ setSource(QUrl::fromUserInput("qrc:/qml/FlightDisplayWidget.qml"));
+ setVisible(true);
+}
+
+FlightDisplayWidget::~FlightDisplayWidget()
+{
+}
+
+void FlightDisplayWidget::saveSetting(const QString &name, const QString& value)
+{
+ QSettings settings;
+ QString key(kMainFlightDisplayWidgetGroup);
+ key += "/" + name;
+ settings.setValue(key, value);
+}
+
+QString FlightDisplayWidget::loadSetting(const QString &name, const QString& defaultValue)
+{
+ QSettings settings;
+ QString key(kMainFlightDisplayWidgetGroup);
+ key += "/" + name;
+ return settings.value(key, defaultValue).toString();
+}
diff --git a/src/FlightDisplay/FlightDisplayWidget.h b/src/FlightDisplay/FlightDisplayWidget.h
new file mode 100644
index 0000000000000000000000000000000000000000..bccb4dfdbaa5e4b795278ebae5be3ed2f4b52c2d
--- /dev/null
+++ b/src/FlightDisplay/FlightDisplayWidget.h
@@ -0,0 +1,55 @@
+/*=====================================================================
+
+QGroundControl Open Source Ground Control Station
+
+(c) 2009, 2015 QGROUNDCONTROL PROJECT
+
+This file is part of the QGROUNDCONTROL project
+
+ QGROUNDCONTROL is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ QGROUNDCONTROL is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with QGROUNDCONTROL. If not, see .
+
+======================================================================*/
+
+#ifndef FlightDisplayWidget_H
+#define FlightDisplayWidget_H
+
+#include "QGCQmlWidgetHolder.h"
+
+class FlightDisplayWidget : public QGCQmlWidgetHolder
+{
+ Q_OBJECT
+public:
+ FlightDisplayWidget(QWidget* parent = NULL);
+ ~FlightDisplayWidget();
+
+ /// @brief Invokes the Flight Display Options menu
+ void showOptionsMenu() { emit showOptionsMenuChanged(); }
+
+ Q_PROPERTY(bool hasVideo READ hasVideo CONSTANT)
+
+ Q_INVOKABLE void saveSetting (const QString &key, const QString& value);
+ Q_INVOKABLE QString loadSetting (const QString &key, const QString& defaultValue);
+
+#if defined(QGC_GST_STREAMING)
+ bool hasVideo () { return true; }
+#else
+ bool hasVideo () { return false; }
+#endif
+
+signals:
+ void showOptionsMenuChanged ();
+
+};
+
+#endif
diff --git a/src/ui/flightdisplay/FlightDisplay.qml b/src/FlightDisplay/FlightDisplayWidget.qml
similarity index 72%
rename from src/ui/flightdisplay/FlightDisplay.qml
rename to src/FlightDisplay/FlightDisplayWidget.qml
index 248eefc977290f6f0dbdc9bc73e0062bf2c45a3e..39262b94fc586f68d08a01077ec7e6691ebf127d 100644
--- a/src/ui/flightdisplay/FlightDisplay.qml
+++ b/src/FlightDisplay/FlightDisplayWidget.qml
@@ -21,22 +21,17 @@ This file is part of the QGROUNDCONTROL project
======================================================================*/
-/**
- * @file
- * @brief QGC Main Flight Display
- * @author Gus Grubba
- */
-
-import QtQuick 2.4
-import QtQuick.Controls 1.3
-import QtQuick.Controls.Styles 1.2
-import QtQuick.Dialogs 1.2
-
-import QGroundControl.FlightMap 1.0
-import QGroundControl.ScreenTools 1.0
-import QGroundControl.Controls 1.0
-import QGroundControl.Palette 1.0
+import QtQuick 2.4
+import QtQuick.Controls 1.3
+import QtQuick.Controls.Styles 1.2
+import QtQuick.Dialogs 1.2
+import QGroundControl.FlightMap 1.0
+import QGroundControl.ScreenTools 1.0
+import QGroundControl.Controls 1.0
+import QGroundControl.Palette 1.0
+
+/// Flight Display Widget
Item {
id: root
@@ -91,19 +86,15 @@ Item {
Component.onCompleted:
{
mapBackground.visible = getBool(flightDisplay.loadSetting("showMapBackground", "0"));
- mapBackground.alwaysNorth = getBool(flightDisplay.loadSetting("mapAlwaysPointsNorth", "0"));
videoBackground.visible = getBool(flightDisplay.loadSetting("showVideoBackground", "0"));
showPitchIndicator = getBool(flightDisplay.loadSetting("showPitchIndicator", "1"));
- compassWidget.visible = getBool(flightDisplay.loadSetting("showCompassWidget", "0"));
- compassHUD.visible = getBool(flightDisplay.loadSetting("showCompassHUD", "1"));
- attitudeWidget.visible = getBool(flightDisplay.loadSetting("showAttitudeWidget", "0"));
- attitudeHUD.visible = getBool(flightDisplay.loadSetting("showAttitudeHUD", "1"));
altitudeWidget.visible = getBool(flightDisplay.loadSetting("showAltitudeWidget", "1"));
speedWidget.visible = getBool(flightDisplay.loadSetting("showSpeedWidget", "1"));
currentSpeed.showAirSpeed = getBool(flightDisplay.loadSetting("showCurrentAirSpeed", "1"));
currentSpeed.showGroundSpeed = getBool(flightDisplay.loadSetting("showCurrentGroundSpeed", "1"));
currentAltitude.showClimbRate = getBool(flightDisplay.loadSetting("showCurrentClimbRate", "1"));
currentAltitude.showAltitude = getBool(flightDisplay.loadSetting("showCurrentAltitude", "1"));
+
// Insert Map Type menu before separator
contextMenu.insertItem(2, mapBackground.mapMenu);
// Video or Map. Not both:
@@ -111,16 +102,6 @@ Item {
videoBackground.visible = false;
flightDisplay.saveSetting("showVideoBackground", setBool(videoBackground.visible));
}
- // Compass HUD or Widget. Not both:
- if(compassWidget.visible && compassHUD.visible) {
- compassWidget.visible = false;
- flightDisplay.saveSetting("showCompassWidget", setBool(compassWidget.visible));
- }
- // Attitude HUD or Widget. Not both:
- if(attitudeWidget.visible && attitudeHUD.visible) {
- attitudeWidget.visible = false;
- flightDisplay.saveSetting("showAttitudeWidget", setBool(attitudeWidget.visible));
- }
// Disable video if we don't have support for it
if(!flightDisplay.hasVideo) {
videoBackground.visible = false;
@@ -143,20 +124,6 @@ Item {
}
}
- /*
- //-- Off until Qt 5.5.x, which fixes bug in 5.4.x
- MenuItem {
- text: "Map Always Points North"
- checkable: true
- checked: mapBackground.alwaysNorth
- onTriggered:
- {
- mapBackground.alwaysNorth = !mapBackground.alwaysNorth;
- flightDisplay.saveSetting("mapAlwaysPointsNorth", setBool(mapBackground.alwaysNorth));
- }
- }
- */
-
MenuSeparator {}
MenuItem {
@@ -172,26 +139,6 @@ Item {
MenuSeparator {}
- MenuItem {
- text: "Attitude Widget"
- checkable: true
- checked: attitudeWidget.visible
- onTriggered:
- {
- enforceExclusiveOption(attitudeWidget, attitudeHUD, "showAttitudeWidget", "showAttitudeHUD");
- }
- }
-
- MenuItem {
- text: "Attitude HUD"
- checkable: true
- checked: attitudeHUD.visible
- onTriggered:
- {
- enforceExclusiveOption(attitudeHUD, attitudeWidget, "showAttitudeHUD", "showAttitudeWidget");
- }
- }
-
MenuItem {
text: "Pitch Indicator"
checkable: true
@@ -204,26 +151,6 @@ Item {
}
}
- MenuItem {
- text: "Compass Widget"
- checkable: true
- checked: compassWidget.visible
- onTriggered:
- {
- enforceExclusiveOption(compassWidget, compassHUD, "showCompassWidget", "showCompassHUD");
- }
- }
-
- MenuItem {
- text: "Compass HUD"
- checkable: true
- checked: compassHUD.visible
- onTriggered:
- {
- enforceExclusiveOption(compassHUD, compassWidget, "showCompassHUD", "showCompassWidget");
- }
- }
-
MenuItem {
text: "Altitude Indicator"
checkable: true
@@ -300,12 +227,8 @@ Item {
flightDisplay.saveSetting("showPitchIndicator", setBool(showPitchIndicator));
attitudeWidget.visible = false;
flightDisplay.saveSetting("showAttitudeWidget", setBool(attitudeWidget.visible));
- attitudeHUD.visible = true;
- flightDisplay.saveSetting("showAttitudeHUD", setBool(attitudeHUD.visible));
compassWidget.visible = false
flightDisplay.saveSetting("showCompassWidget", setBool(compassWidget.visible));
- compassHUD.visible = true
- flightDisplay.saveSetting("showCompassHUD", setBool(compassHUD.visible));
altitudeWidget.visible = true;
flightDisplay.saveSetting("showAltitudeWidget", setBool(altitudeWidget.visible));
currentAltitude.showAltitude = true;
@@ -320,10 +243,6 @@ Item {
flightDisplay.saveSetting("showCurrentGroundSpeed", setBool(currentSpeed.showGroundSpeed));
mapBackground.visible = false;
flightDisplay.saveSetting("showMapBackground", setBool(mapBackground.visible));
- mapBackground.alwaysNorth = false;
- flightDisplay.saveSetting("mapAlwaysPointsNorth", setBool(mapBackground.alwaysNorth));
- mapBackground.showWaypoints = false
- flightDisplay.saveSetting("mapShowWaypoints", setBool(mapBackground.showWaypoints));
videoBackground.visible = false;
flightDisplay.saveSetting("showVideoBackground", setBool(videoBackground.visible));
}
@@ -344,31 +263,12 @@ Item {
FlightMap {
id: mapBackground
anchors.fill: parent
- mapName: 'MainFlightDisplay'
+ mapName: 'FlightDisplayWidget'
latitude: mapBackground.visible ? root.latitude : root.defaultLatitude
longitude: mapBackground.visible ? root.longitude : root.defaultLongitude
- readOnly: true
z: 10
}
- // Floating (Top Left) Compass Widget
-
- QGCCompassWidget {
- id: compassWidget
- y: ScreenTools.defaultFontPixelSize * (0.42)
- x: ScreenTools.defaultFontPixelSize * (7.1)
- size: ScreenTools.defaultFontPixelSize * (13.3)
- heading: root.heading
- z: mapBackground.z + 2
- onResetRequested: {
- y = ScreenTools.defaultFontPixelSize * (0.42)
- x = ScreenTools.defaultFontPixelSize * (7.1)
- size = ScreenTools.defaultFontPixelSize * (13.3)
- tForm.xScale = 1
- tForm.yScale = 1
- }
- }
-
// HUD (lower middle) Compass
QGCCompassHUD {
@@ -378,6 +278,7 @@ Item {
width: ScreenTools.defaultFontPixelSize * (10)
height: ScreenTools.defaultFontPixelSize * (10)
heading: root.heading
+ active: multiVehicleManager.activeVehicleAvailable
z: 70
}
@@ -391,28 +292,6 @@ Item {
visible: !videoBackground.visible && !mapBackground.visible
}
- // Floating (Top Right) Attitude Widget
-
- QGCAttitudeWidget {
- id: attitudeWidget
- y: ScreenTools.defaultFontPixelSize * (0.42)
- size: ScreenTools.defaultFontPixelSize * (13.3)
- rollAngle: roll
- pitchAngle: pitch
- showPitch: showPitchIndicator
- anchors.right: root.right
- anchors.rightMargin: ScreenTools.defaultFontPixelSize * (7.1)
- z: mapBackground.z + 2
- onResetRequested: {
- y = ScreenTools.defaultFontPixelSize * (0.42)
- anchors.right = root.right
- anchors.rightMargin = ScreenTools.defaultFontPixelSize * (7.1)
- size = ScreenTools.defaultFontPixelSize * (13.3)
- tForm.xScale = 1
- tForm.yScale = 1
- }
- }
-
// HUD (center) Attitude Indicator
QGCAttitudeHUD {
@@ -422,6 +301,7 @@ Item {
showPitch: showPitchIndicator
width: ScreenTools.defaultFontPixelSize * (30)
height: ScreenTools.defaultFontPixelSize * (30)
+ active: multiVehicleManager.activeVehicleAvailable
z: 20
}
@@ -449,6 +329,7 @@ Item {
width: ScreenTools.defaultFontPixelSize * (6.25)
airspeed: root.airSpeed
groundspeed: root.groundSpeed
+ active: multiVehicleManager.activeVehicleAvailable
showAirSpeed: true
showGroundSpeed: true
visible: (currentSpeed.showGroundSpeed || currentSpeed.showAirSpeed)
@@ -463,6 +344,7 @@ Item {
vertZ: root.climbRate
showAltitude: true
showClimbRate: true
+ active: multiVehicleManager.activeVehicleAvailable
visible: (currentAltitude.showAltitude || currentAltitude.showClimbRate)
z: 60
}
diff --git a/src/FlightMap/FlightMap.qml b/src/FlightMap/FlightMap.qml
index 39f56970c0d21eac701893b36a902fe7d8510b8c..601cc744b260ed469559905367a8239d1cc2e090 100644
--- a/src/FlightMap/FlightMap.qml
+++ b/src/FlightMap/FlightMap.qml
@@ -33,7 +33,7 @@ import QtLocation 5.3
import QtPositioning 5.3
import QGroundControl.Controls 1.0
-import QGroundControl.FlightMap 1.0
+import QGroundControl.FlightMap 1.0
import QGroundControl.ScreenTools 1.0
import QGroundControl.MultiVehicleManager 1.0
import QGroundControl.Vehicle 1.0
@@ -46,20 +46,16 @@ Item {
property real longitude: 0
property real zoomLevel: 18
property real heading: 0
- property bool alwaysNorth: true
property bool interactive: true
- property bool showVehicles: true
property string mapName: 'defaultMap'
property alias mapItem: map
property alias mapMenu: mapTypeMenu
- property alias readOnly: map.readOnly
+ property bool showVehicles: false
Component.onCompleted: {
map.zoomLevel = 18
mapTypeMenu.update();
- if (showVehicles) {
- addExistingVehicles()
- }
+ addExistingVehicles()
}
//-- Menu to select supported map types
@@ -116,6 +112,7 @@ Item {
}
}
+/*
function formatDistance(meters)
{
var dist = Math.round(meters)
@@ -134,37 +131,56 @@ Item {
}
return dist
}
+*/
+
+ // The following code is used to add and remove Vehicle markers from the map. Due to the following
+ // problems this code must be here is the base FlightMap control:
+ // - If you pass a reference to the Map control into another object and then try to call
+ // functions such as addMapItem on it, it will fail telling you addMapItem is not a function
+ // on that object
+ // - Due to the fact that you need to dynamically add the MapQuickItems, they need to be able
+ // to reference the Vehicle they are associated with in some way. In order to do that
+ // we need to keep a separate array of Vehicles which must be at the top level of the object
+ // hierarchy in order for the dynamically added object to see it.
+
- property var vehicles: [] ///< List of known vehicles
- property var vehicleMapItems: [] ///< List of know vehicle map items
+ property var _vehicles: [] ///< List of known vehicles
+ property var _vehicleMapItems: [] ///< List of known vehicle map items
+
+ Connections {
+ target: multiVehicleManager
+
+ onVehicleAdded: addVehicle(vehicle)
+ onVehicleRemoved: removeVehicle(vehicle)
+ }
function addVehicle(vehicle) {
- var qmlItemTemplate = "VehicleMapItem { " +
- "coordinate: vehicles[%1].coordinate; " +
- "heading: vehicles[%1].heading " +
- "}"
+ var qmlItemTemplate = "VehicleMapItem { " +
+ "coordinate: _vehicles[%1].coordinate; " +
+ "heading: _vehicles[%1].heading " +
+ "}"
- var i = vehicles.length
- qmlItemTemplate = qmlItemTemplate.replace("%1", i)
- qmlItemTemplate = qmlItemTemplate.replace("%1", i)
+ var i = _vehicles.length
+ qmlItemTemplate = qmlItemTemplate.replace("%1", i)
+ qmlItemTemplate = qmlItemTemplate.replace("%1", i)
- vehicles.push(vehicle)
- var mapItem = Qt.createQmlObject (qmlItemTemplate, map)
- vehicleMapItems.push(mapItem)
+ _vehicles.push(vehicle)
+ var mapItem = Qt.createQmlObject (qmlItemTemplate, map)
+ _vehicleMapItems.push(mapItem)
- mapItem.z = map.z + 1
- map.addMapItem(mapItem)
+ mapItem.z = map.z + 1
+ map.addMapItem(mapItem)
}
function removeVehicle(vehicle) {
- for (var i=0; isetVisible(false);
}
}
@@ -549,7 +550,7 @@ void MainWindow::_createInnerDockWidget(const QString& widgetName)
widget = hddisplay;
} else if (widgetName == _pfdDockWidgetName) {
- widget = new FlightDisplay(this);
+ widget = new FlightDisplayWidget(this);
} else if (widgetName == _hudDockWidgetName) {
widget = new HUD(320,240,this);
} else if (widgetName == _uasInfoViewDockWidgetName) {
diff --git a/src/ui/MainWindow.h b/src/ui/MainWindow.h
index 3c2140878a09588a0ae4813c4879c2f15890dd4b..76e95adfeffef79f9b7e2683c5b0e2051d3bbb49 100644
--- a/src/ui/MainWindow.h
+++ b/src/ui/MainWindow.h
@@ -59,7 +59,7 @@ This file is part of the QGROUNDCONTROL project
#include "MainToolBar.h"
#include "LogCompressor.h"
-#include "FlightDisplay.h"
+#include "FlightDisplayView.h"
#include "QGCMAVLinkInspector.h"
#include "QGCMAVLinkLogPlayer.h"
#include "MAVLinkDecoder.h"
@@ -74,7 +74,6 @@ class QGCStatusBar;
class Linecharts;
class QGCDataPlot2D;
class QGCUASFileViewMulti;
-class FlightDisplay;
/**
* @brief Main Application Window
@@ -126,7 +125,7 @@ public:
MainToolBar* getMainToolBar(void) { return _mainToolBar; }
/// @brief Gets a pointer to the Main Flight Display
- FlightDisplay* getFlightDisplay() { return dynamic_cast(_flightView.data()); }
+ FlightDisplayView* getFlightDisplay() { return dynamic_cast(_flightView.data()); }
QWidget* getCurrentViewWidget(void) { return _currentViewWidget; }
diff --git a/src/ui/toolbar/MainToolBar.cc b/src/ui/toolbar/MainToolBar.cc
index 18164abca684acf11b5f4b29fe58668bd2000e2a..97f869a4a38142042a3c5ecb4c3db0995655db25 100644
--- a/src/ui/toolbar/MainToolBar.cc
+++ b/src/ui/toolbar/MainToolBar.cc
@@ -35,7 +35,7 @@ This file is part of the QGROUNDCONTROL project
#include "MainWindow.h"
#include "UASMessageView.h"
#include "UASMessageHandler.h"
-#include "FlightDisplay.h"
+#include "FlightDisplayView.h"
#include "QGCApplication.h"
#include "MultiVehicleManager.h"
@@ -154,7 +154,7 @@ void MainToolBar::onFlyView()
void MainToolBar::onFlyViewMenu()
{
- FlightDisplay* fdsp = MainWindow::instance()->getFlightDisplay();
+ FlightDisplayView* fdsp = MainWindow::instance()->getFlightDisplay();
if(fdsp) {
fdsp->showOptionsMenu();
}