Commit 9075dbb3 authored by Don Gagne's avatar Don Gagne

Merge pull request #1462 from dogmaphobic/flightView

Finalizing Primary Flight Control
parents 81e22ad4 167813ba
......@@ -100,7 +100,9 @@
<file alias="QGroundControl/FlightControls/qmldir">src/ui/qmlcommon/qmldir</file>
<file alias="QGroundControl/FlightControls/QGCAltitudeWidget.qml">src/ui/qmlcommon/QGCAltitudeWidget.qml</file>
<file alias="QGroundControl/FlightControls/QGCAttitudeWidget.qml">src/ui/qmlcommon/QGCAttitudeWidget.qml</file>
<file alias="QGroundControl/FlightControls/QGCAttitudeInstrument.qml">src/ui/qmlcommon/QGCAttitudeInstrument.qml</file>
<file alias="QGroundControl/FlightControls/QGCCompass.qml">src/ui/qmlcommon/QGCCompass.qml</file>
<file alias="QGroundControl/FlightControls/QGCCompassInstrument.qml">src/ui/qmlcommon/QGCCompassInstrument.qml</file>
<file alias="QGroundControl/FlightControls/QGCCurrentAltitude.qml">src/ui/qmlcommon/QGCCurrentAltitude.qml</file>
<file alias="QGroundControl/FlightControls/QGCCurrentSpeed.qml">src/ui/qmlcommon/QGCCurrentSpeed.qml</file>
<file alias="QGroundControl/FlightControls/QGCMapBackground.qml">src/ui/qmlcommon/QGCMapBackground.qml</file>
......@@ -109,19 +111,24 @@
<file alias="QGroundControl/FlightControls/QGCSlider.qml">src/ui/qmlcommon/QGCSlider.qml</file>
<file alias="QGroundControl/FlightControls/QGCWaypointEditor.qml">src/ui/qmlcommon/QGCWaypointEditor.qml</file>
<file alias="QGroundControl/FlightControls/QGCMapToolButton.qml">src/ui/qmlcommon/QGCMapToolButton.qml</file>
<file alias="QGroundControl/FlightControls/QGCArtificialHorizon.qml">src/ui/qmlcommon/QGCArtificialHorizon.qml</file>
<!-- QML Main UI Resources -->
<file alias="compass.svg">src/ui/qmlcommon/compass.svg</file>
<file alias="compassNeedle.svg">src/ui/qmlcommon/compassNeedle.svg</file>
<file alias="crossHair.svg">src/ui/qmlcommon/crossHair.svg</file>
<file alias="rollDial.svg">src/ui/qmlcommon/rollDial.svg</file>
<file alias="rollDialWhite.svg">src/ui/qmlcommon/rollDialWhite.svg</file>
<file alias="rollPointer.svg">src/ui/qmlcommon/rollPointer.svg</file>
<file alias="rollPointerWhite.svg">src/ui/qmlcommon/rollPointerWhite.svg</file>
<file alias="scale.png">src/ui/qmlcommon/scale.png</file>
<file alias="scale_end.png">src/ui/qmlcommon/scale_end.png</file>
<file alias="buttonLeft.svg">src/ui/qmlcommon/buttonLeft.svg</file>
<file alias="buttonRight.svg">src/ui/qmlcommon/buttonRight.svg</file>
<file alias="buttonHome.svg">src/ui/qmlcommon/buttonHome.svg</file>
<file alias="buttonMore.svg">src/ui/qmlcommon/buttonMore.svg</file>
<file alias="attitudeInstrument.svg">src/ui/qmlcommon/attitudeInstrument.svg</file>
<file alias="attitudeDial.svg">src/ui/qmlcommon/attitudeDial.svg</file>
<file alias="attitudePointer.svg">src/ui/qmlcommon/attitudePointer.svg</file>
<file alias="compassInstrumentAirplane.svg">src/ui/qmlcommon/compassInstrumentAirplane.svg</file>
<file alias="compassInstrumentDial.svg">src/ui/qmlcommon/compassInstrumentDial.svg</file>
</qresource>
<qresource prefix="/AutoPilotPlugins/PX4">
......
......@@ -38,6 +38,8 @@ This file is part of the QGROUNDCONTROL project
#include <QNetworkReply>
#include <QMutex>
#define MAX_MAP_ZOOM (20.0)
namespace OpenPilot {
enum MapType
......
......@@ -53,9 +53,17 @@ QGeoMapReplyQGC::QGeoMapReplyQGC(QNetworkReply *reply, const QGeoTileSpec &spec,
: QGeoTiledMapReply(spec, parent)
, m_reply(reply)
{
connect(m_reply, SIGNAL(finished()), this, SLOT(networkReplyFinished()));
connect(m_reply, SIGNAL(error(QNetworkReply::NetworkError)), this, SLOT(networkReplyError(QNetworkReply::NetworkError)));
connect(m_reply, SIGNAL(destroyed()), this, SLOT(replyDestroyed()));
if(!reply)
{
setError(QGeoTiledMapReply::UnknownError, "Invalid tile request");
setFinished(true);
}
else
{
connect(m_reply, SIGNAL(finished()), this, SLOT(networkReplyFinished()));
connect(m_reply, SIGNAL(error(QNetworkReply::NetworkError)), this, SLOT(networkReplyError(QNetworkReply::NetworkError)));
connect(m_reply, SIGNAL(destroyed()), this, SLOT(replyDestroyed()));
}
}
QGeoMapReplyQGC::~QGeoMapReplyQGC()
......
......@@ -59,7 +59,7 @@ QGeoTiledMappingManagerEngineQGC::QGeoTiledMappingManagerEngineQGC(const QVarian
{
QGeoCameraCapabilities cameraCaps;
cameraCaps.setMinimumZoomLevel(2.0);
cameraCaps.setMaximumZoomLevel(20.0);
cameraCaps.setMaximumZoomLevel(MAX_MAP_ZOOM);
cameraCaps.setSupportsBearing(true);
setCameraCapabilities(cameraCaps);
......
This diff is collapsed.
......@@ -67,8 +67,8 @@ QGCFlightDisplay::QGCFlightDisplay(QWidget *parent)
if(pl) {
pl->setContentsMargins(0,0,0,0);
}
setMinimumWidth(270);
setMinimumHeight(300);
setMinimumWidth(380);
setMinimumHeight(360);
setContextPropertyObject("flightDisplay", this);
setSource(QUrl::fromUserInput("qrc:/qml/FlightDisplay.qml"));
setVisible(true);
......@@ -114,6 +114,7 @@ void QGCFlightDisplay::_forgetUAS(UASInterface* uas)
disconnect(_mav, &UASInterface::NavigationControllerDataChanged, this, &QGCFlightDisplay::_updateNavigationControllerData);
}
_mav = NULL;
emit mavPresentChanged();
}
void QGCFlightDisplay::_setActiveUAS(UASInterface* uas)
......@@ -136,6 +137,7 @@ void QGCFlightDisplay::_setActiveUAS(UASInterface* uas)
// Set new UAS
_mav = uas;
}
emit mavPresentChanged();
}
void QGCFlightDisplay::_updateAttitude(UASInterface*, double roll, double pitch, double yaw, quint64)
......
......@@ -53,6 +53,7 @@ public:
Q_PROPERTY(bool repaintRequested READ repaintRequested NOTIFY repaintRequestedChanged)
Q_PROPERTY(float latitude READ latitude NOTIFY latitudeChanged)
Q_PROPERTY(float longitude READ longitude NOTIFY longitudeChanged)
Q_PROPERTY(bool mavPresent READ mavPresent NOTIFY mavPresentChanged)
Q_INVOKABLE void saveSetting (const QString &key, const QString& value);
Q_INVOKABLE QString loadSetting (const QString &key, const QString& defaultValue);
......@@ -69,6 +70,7 @@ public:
float latitude () { return _latitude; }
float longitude () { return _longitude; }
bool repaintRequested () { return true; }
bool mavPresent () { return _mav != NULL; }
/** @brief Start updating widget */
void showEvent(QShowEvent* event);
......@@ -88,6 +90,7 @@ signals:
void repaintRequestedChanged();
void latitudeChanged ();
void longitudeChanged ();
void mavPresentChanged ();
private slots:
/** @brief Attitude from main autopilot / system state */
......
......@@ -33,6 +33,7 @@ import QtQuick.Controls.Styles 1.2
import QtQuick.Layouts 1.1
import QGroundControl.Palette 1.0
import QGroundControl.Controls 1.0
import QGroundControl.FlightControls 1.0
Rectangle {
......
......@@ -27,9 +27,8 @@ This file is part of the QGROUNDCONTROL project
* @author Gus Grubba <mavlink@grubba.com>
*/
// TODO: This is temporary until I find a better way to display a large range of numbers
import QtQuick 2.4
import QGroundControl.Controls 1.0
Rectangle {
id: root
......@@ -63,9 +62,7 @@ Rectangle {
}
anchors.verticalCenter: parent.verticalCenter
height: parent.height * 0.75 > 280 ? 280 : parent.height * 0.75
clip: true
height: parent.height * 0.65 > 280 ? 280 : parent.height * 0.65
smooth: true
radius: 5
border.color: Qt.rgba(1,1,1,0.25)
......@@ -74,34 +71,42 @@ Rectangle {
GradientStop { position: 0.5; color: Qt.rgba(0,0,0,0.25) }
GradientStop { position: 1.0; color: Qt.rgba(0,0,0,0.65) }
}
Column{
id: col
width: parent.width
Rectangle {
id: clipRect
height: parent.height - 5
width: parent.width
clip: true
color: Qt.rgba(0,0,0,0);
anchors.verticalCenter: parent.verticalCenter
spacing: _reticleSpacing
Repeater {
model: _speedArray
anchors.left: parent.left
Rectangle {
property int _alt: modelData
width: (_alt % 10 === 0) ? 10 : 15
height: _reticleHeight
color: Qt.rgba(1,1,1,0.35)
Text {
visible: (_alt % 10 === 0)
x: 20
anchors.verticalCenter: parent.verticalCenter
antialiasing: true
font.weight: Font.DemiBold
text: _alt
color: _alt < 0 ? "#f8983a" : "white"
style: Text.Outline
styleColor: Qt.rgba(0,0,0,0.25)
Column{
id: col
width: parent.width
anchors.verticalCenter: parent.verticalCenter
spacing: _reticleSpacing
Repeater {
model: _speedArray
anchors.left: parent.left
Rectangle {
property int _alt: modelData
width: (_alt % 10 === 0) ? 10 : 15
height: _reticleHeight
color: Qt.rgba(1,1,1,0.35)
QGCLabel {
visible: (_alt % 10 === 0)
x: 20
anchors.verticalCenter: parent.verticalCenter
antialiasing: true
font.weight: Font.DemiBold
text: _alt
color: _alt < 0 ? "#f8983a" : "white"
style: Text.Outline
styleColor: Qt.rgba(0,0,0,0.25)
}
}
}
}
transform: Translate {
y: ((altitude - _currentCenter) * _reticleSlot / 5) - (_reticleSlot / 2)
transform: Translate {
y: ((altitude - _currentCenter) * _reticleSlot / 5) - (_reticleSlot / 2)
}
}
}
}
/*=====================================================================
QGroundControl Open Source Ground Control Station
(c) 2009, 2015 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>
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 <http://www.gnu.org/licenses/>.
======================================================================*/
/**
* @file
* @brief QGC Artificial Horizon
* @author Gus Grubba <mavlink@grubba.com>
*/
import QtQuick 2.4
Item {
id: root
property real rollAngle : 0
property real pitchAngle: 0
clip: true
anchors.fill: parent
Item {
id: artificialHorizon
width: root.width * 4
height: root.height * 4
anchors.centerIn: parent
Rectangle {
id: sky
anchors.fill: parent
smooth: true
antialiasing: true
gradient: Gradient {
GradientStop { position: 0.25; color: Qt.hsla(0.6, 1.0, 0.25) }
GradientStop { position: 0.5; color: Qt.hsla(0.6, 0.5, 0.55) }
}
}
Rectangle {
id: ground
height: sky.height / 2
anchors {
left: sky.left;
right: sky.right;
bottom: sky.bottom
}
smooth: true
antialiasing: true
gradient: Gradient {
GradientStop { position: 0.0; color: Qt.hsla(0.25, 0.5, 0.45) }
GradientStop { position: 0.25; color: Qt.hsla(0.25, 0.75, 0.25) }
}
}
transform: [
Translate {
y: root.visible ? pitchAngle * 4 : 0
},
Rotation {
origin.x: artificialHorizon.width / 2
origin.y: artificialHorizon.height / 2
angle: root.visible ? -rollAngle : 0
}]
}
}
/*=====================================================================
QGroundControl Open Source Ground Control Station
(c) 2009, 2015 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>
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 <http://www.gnu.org/licenses/>.
======================================================================*/
/**
* @file
* @brief QGC Attitude Instrument
* @author Gus Grubba <mavlink@grubba.com>
*/
import QtQuick 2.4
Item {
id: root
property real rollAngle : 0
property real pitchAngle: 0
property real size: 100
property bool showPitch: true
width: size
height: size
//----------------------------------------------------
//-- Artificial Horizon
QGCArtificialHorizon {
rollAngle: root.rollAngle
pitchAngle: root.pitchAngle
}
//----------------------------------------------------
//-- Pointer
Image {
id: pointer
source: "/qml/attitudePointer.svg"
width: root.width
mipmap: true
fillMode: Image.PreserveAspectFit
anchors.bottom: parent.bottom
anchors.horizontalCenter: parent.horizontalCenter
}
//----------------------------------------------------
//-- Instrument Dial
Image {
id: instrumentDial
source: "/qml/attitudeDial.svg"
mipmap: true
width: root.width
fillMode: Image.PreserveAspectFit
anchors.bottom: parent.bottom
anchors.horizontalCenter: parent.horizontalCenter
transform: Rotation {
origin.x: root.width / 2
origin.y: root.height / 2
angle: -rollAngle
}
}
//----------------------------------------------------
//-- Pitch
QGCPitchWidget {
id: pitchWidget
visible: root.showPitch
size: parent.width * 0.65
anchors.verticalCenter: parent.verticalCenter
pitchAngle: root.pitchAngle
rollAngle: root.rollAngle
color: Qt.rgba(0,0,0,0)
}
//----------------------------------------------------
//-- Cross Hair
Image {
id: crossHair
anchors.centerIn: parent
source: "/qml/crossHair.svg"
mipmap: true
width: parent.width * 0.75
fillMode: Image.PreserveAspectFit
}
//----------------------------------------------------
//-- Instrument Pannel
Image {
id: pannel
width: parent.width
source: "/qml/attitudeInstrument.svg"
mipmap: true
fillMode: Image.PreserveAspectFit
anchors.centerIn: parent
}
}
......@@ -23,7 +23,7 @@ This file is part of the QGROUNDCONTROL project
/**
* @file
* @brief QGC Main Flight Display
* @brief QGC Attitude Widget
* @author Gus Grubba <mavlink@grubba.com>
*/
......@@ -31,88 +31,49 @@ import QtQuick 2.4
Item {
id: root
property real rollAngle : 0
property real pitchAngle: 0
property real backgroundOpacity: 1
property bool displayBackground: true
property bool useWhite: true
property real rollAngle : 0
property real pitchAngle: 0
property bool showAttitude: true
anchors.fill: parent
Item {
id: background
width: parent.width * 4
height: parent.height * 4
anchors.centerIn: parent
Rectangle {
anchors.fill: parent
color: Qt.rgba(0,0,0,0)
visible: displayBackground
Rectangle {
id: sky
visible: displayBackground
anchors.fill: parent
smooth: true
antialiasing: true
gradient: Gradient {
GradientStop { position: 0.25; color: Qt.hsla(0.6, 1.0, 0.25, backgroundOpacity) }
GradientStop { position: 0.5; color: Qt.hsla(0.6, 0.5, 0.75, backgroundOpacity) }
}
}
Rectangle {
id: ground
visible: displayBackground
height: sky.height / 2
anchors {
left: sky.left;
right: sky.right;
bottom: sky.bottom
}
smooth: true
antialiasing: true
gradient: Gradient {
GradientStop { position: 0.0; color: Qt.hsla(0.25, 0.5, 0.45, backgroundOpacity) }
GradientStop { position: 0.25; color: Qt.hsla(0.25, 0.75, 0.25, backgroundOpacity) }
}
}
transform: [
Translate {
y: (root.visible && root.displayBackground) ? pitchAngle * 4 : 0
},
Rotation {
origin.x: background.width / 2
origin.y: background.height / 2
angle: (root.visible && root.displayBackground) ? -rollAngle : 0
}]
}
QGCArtificialHorizon {
rollAngle: root.rollAngle
pitchAngle: root.pitchAngle
}
Image {
id: rollDial
visible: root.showAttitude
anchors { bottom: root.verticalCenter; horizontalCenter: parent.horizontalCenter}
source: useWhite ? "/qml/rollDialWhite.svg" : "/qml/rollDial.svg"
source: "/qml/rollDialWhite.svg"
mipmap: true
width: 260
fillMode: Image.PreserveAspectFit
transform: Rotation {
origin.x: rollDial.width / 2
origin.y: rollDial.height
angle: -rollAngle
angle: -rollAngle
}
}
Image {
id: pointer
visible: root.showAttitude
anchors { bottom: root.verticalCenter; horizontalCenter: parent.horizontalCenter}
source: useWhite ? "/qml/rollPointerWhite.svg" : "/qml/rollPointer.svg"
smooth: true
width: rollDial.width
fillMode: Image.PreserveAspectFit
source: "/qml/rollPointerWhite.svg"
mipmap: true
width: rollDial.width
fillMode: Image.PreserveAspectFit
}
Image {
id: crossHair
visible: root.showAttitude
anchors.centerIn: parent
source: "/qml/crossHair.svg"
mipmap: true
width: 260
fillMode: Image.PreserveAspectFit
}
}
......@@ -28,11 +28,10 @@ This file is part of the QGROUNDCONTROL project
*/
import QtQuick 2.4
import QGroundControl.Controls 1.0
Item {
id: root
width: 120
height: width
property real heading : 0
Image {
id: compass
......@@ -62,7 +61,7 @@ Item {
height: 25
border.color: Qt.rgba(1,1,1,0.15)
color: Qt.rgba(0,0,0,0.25)
Text {
QGCLabel {
text: heading.toFixed(0)
font.weight: Font.DemiBold
color: "white"
......
/*=====================================================================
QGroundControl Open Source Ground Control Station
(c) 2009, 2015 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>
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 <http://www.gnu.org/licenses/>.
======================================================================*/
/**
* @file
* @brief QGC Compass
* @author Gus Grubba <mavlink@grubba.com>
*/
import QtQuick 2.4
import QGroundControl.Controls 1.0
import QGroundControl.ScreenTools 1.0
Item {
property ScreenTools screenTools: ScreenTools { }
id: root
property real heading: 0
property real size: 120
property real _fontSize: screenTools.dpiAdjustedPointSize(size * 12 / 120)
width: size
height: size
Rectangle {
id: compassBack
anchors.fill: parent
color: "#212121"
}
Image {
id: pointer
source: "/qml/compassInstrumentAirplane.svg"
mipmap: true
width: root.width * 0.75
fillMode: Image.PreserveAspectFit
anchors.centerIn: parent
transform: Rotation {
origin.x: pointer.width / 2
origin.y: pointer.height / 2
angle: -heading
}
}
Image {
id: compassDial
source: "/qml/compassInstrumentDial.svg"
mipmap: true
width: root.width
fillMode: Image.PreserveAspectFit
anchors.centerIn: parent
}
Rectangle {
anchors.centerIn: root
width: size * 0.35
height: size * 0.2
border.color: Qt.rgba(1,1,1,0.15)
color: Qt.rgba(0,0,0,0.65)
QGCLabel {
text: heading.toFixed(0)
font.weight: Font.DemiBold
font.pointSize: _fontSize < 1 ? 1 : _fontSize;
color: "white"
anchors.centerIn: parent
}
}
}
......@@ -28,6 +28,7 @@ This file is part of the QGROUNDCONTROL project
*/
import QtQuick 2.1
import QGroundControl.Controls 1.0
Rectangle {
id: root
......@@ -44,14 +45,14 @@ Rectangle {
Column{
anchors.centerIn: parent
spacing: 4
Text {
QGCLabel {
text: 'h: ' + altitude.toFixed(0)
font.weight: Font.DemiBold
color: "white"
anchors.right: parent.right
visible: showAltitude
}
Text {
QGCLabel {
text: 'vZ: ' + vertZ.toFixed(0)
color: "white"
font.weight: showAltitude ? Font.Normal : Font.DemiBold
......
......@@ -28,6 +28,7 @@ This file is part of the QGROUNDCONTROL project
*/
import QtQuick 2.1
import QGroundControl.Controls 1.0
Rectangle {
id: root
......@@ -44,14 +45,14 @@ Rectangle {
Column{
anchors.centerIn: parent
spacing: 4
Text {
QGCLabel {
text: 'GS: ' + groundspeed.toFixed(0)
font.weight: Font.DemiBold
color: "white"
anchors.right: parent.right
visible: showGroundSpeed
}
Text {
QGCLabel {
text: 'AS: ' + airspeed.toFixed(0)
color: "white"
anchors.right: parent.right
......
......@@ -31,15 +31,17 @@ import QtQuick 2.4
import QtPositioning 5.3
import QtLocation 5.3
import QGroundControl.Controls 1.0
import QGroundControl.FlightControls 1.0
Rectangle {
id: root
property real latitude: 37.803784
property real longitude : -122.462276
property real zoomLevel: 15
property real zoomLevel: 18
property real heading: 0
property bool alwaysNorth: true
property bool interactive: true
property alias mapItem: map
color: Qt.rgba(0,0,0,0)
......@@ -95,8 +97,11 @@ Rectangle {
height: 1
zoomLevel: root.zoomLevel