17 changed files with 31 additions and 13674 deletions
@ -1,109 +0,0 @@
@@ -1,109 +0,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/>.
|
||||
|
||||
======================================================================*/ |
||||
|
||||
#include <QQmlContext> |
||||
#include <QQmlEngine> |
||||
#include <QSettings> |
||||
|
||||
#include <VideoItem.h> |
||||
#include <VideoSurface.h> |
||||
#include "VideoReceiver.h" |
||||
|
||||
#include "ScreenToolsController.h" |
||||
#include "FlightDisplayWidget.h" |
||||
|
||||
const char* kMainFlightDisplayWidgetGroup = "FlightDisplayWidget"; |
||||
|
||||
FlightDisplayWidget::FlightDisplayWidget(const QString& title, QAction* action, QWidget *parent) |
||||
: QGCQmlWidgetHolder(title, action, 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); |
||||
} |
||||
setMinimumWidth(300); |
||||
setMinimumHeight(300); |
||||
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); |
||||
|
||||
loadSettings(); |
||||
} |
||||
|
||||
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(); |
||||
} |
@ -1,55 +0,0 @@
@@ -1,55 +0,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/>.
|
||||
|
||||
======================================================================*/ |
||||
|
||||
#ifndef FlightDisplayWidget_H |
||||
#define FlightDisplayWidget_H |
||||
|
||||
#include "QGCQmlWidgetHolder.h" |
||||
|
||||
class FlightDisplayWidget : public QGCQmlWidgetHolder |
||||
{ |
||||
Q_OBJECT |
||||
public: |
||||
FlightDisplayWidget(const QString& title, QAction* action, 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 |
@ -1,208 +0,0 @@
@@ -1,208 +0,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/>. |
||||
|
||||
======================================================================*/ |
||||
|
||||
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 |
||||
|
||||
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 |
||||
|
||||
property bool showPitchIndicator: true |
||||
|
||||
function getBool(value) { |
||||
return value === '0' ? false : true; |
||||
} |
||||
|
||||
function setBool(value) { |
||||
return value ? "1" : "0"; |
||||
} |
||||
|
||||
function enforceExclusiveOption(setWidget, alternateWidget, defaultSetting, alternateSetting) { |
||||
setWidget.visible = !setWidget.visible; |
||||
flightDisplay.saveSetting(defaultSetting, setBool(setWidget.visible)); |
||||
alternateWidget.visible = setWidget.visible ? false : alternateWidget.visible; |
||||
flightDisplay.saveSetting(alternateSetting, setBool(alternateWidget.visible)); |
||||
} |
||||
|
||||
Connections { |
||||
target: flightDisplay |
||||
onShowOptionsMenuChanged: { |
||||
contextMenu.popup(); |
||||
} |
||||
} |
||||
|
||||
Component.onCompleted: |
||||
{ |
||||
videoBackground.visible = getBool(flightDisplay.loadSetting("showVideoBackground", "0")); |
||||
|
||||
// Disable video if we don't have support for it |
||||
if(!flightDisplay.hasVideo) { |
||||
videoBackground.visible = false; |
||||
flightDisplay.saveSetting("showVideoBackground", setBool(videoBackground.visible)); |
||||
} |
||||
// Enable/Disable menu accordingly |
||||
videoMenu.enabled = flightDisplay.hasVideo; |
||||
} |
||||
|
||||
Menu { |
||||
id: contextMenu |
||||
|
||||
MenuItem { |
||||
id: videoMenu |
||||
text: "Video Background" |
||||
checkable: true |
||||
checked: videoBackground.visible |
||||
onToggled: videoBackground.visible = checked |
||||
} |
||||
} |
||||
|
||||
// Video and Map backgrounds are exclusive. If one is enabled the other is disabled. |
||||
|
||||
QGCVideoBackground { |
||||
id: videoBackground |
||||
anchors.fill: parent |
||||
display: videoDisplay |
||||
receiver: videoReceiver |
||||
z: 10 |
||||
} |
||||
|
||||
// HUD (lower middle) Compass |
||||
|
||||
QGCCompassHUD { |
||||
id: compassHUD |
||||
y: root.height * 0.7 |
||||
x: root.width * 0.5 - ScreenTools.defaultFontPixelSize * (5) |
||||
width: ScreenTools.defaultFontPixelSize * (10) |
||||
height: ScreenTools.defaultFontPixelSize * (10) |
||||
heading: root.heading |
||||
active: multiVehicleManager.activeVehicleAvailable |
||||
z: 70 |
||||
} |
||||
|
||||
// Sky/Ground background (visible when no Map or Video is enabled) |
||||
|
||||
QGCArtificialHorizon { |
||||
id: artificialHoriz |
||||
anchors.fill: parent |
||||
rollAngle: roll |
||||
pitchAngle: pitch |
||||
visible: !videoBackground.visible |
||||
} |
||||
|
||||
// HUD (center) Attitude Indicator |
||||
|
||||
QGCAttitudeHUD { |
||||
id: attitudeHUD |
||||
rollAngle: roll |
||||
pitchAngle: pitch |
||||
showPitch: showPitchIndicator |
||||
width: ScreenTools.defaultFontPixelSize * (30) |
||||
height: ScreenTools.defaultFontPixelSize * (30) |
||||
active: multiVehicleManager.activeVehicleAvailable |
||||
z: 20 |
||||
} |
||||
|
||||
QGCAltitudeWidget { |
||||
id: altitudeWidget |
||||
anchors.right: parent.right |
||||
width: ScreenTools.defaultFontPixelSize * (5) |
||||
height: parent.height * 0.65 > ScreenTools.defaultFontPixelSize * (23.4) ? ScreenTools.defaultFontPixelSize * (23.4) : parent.height * 0.65 |
||||
altitude: root.altitudeWGS84 |
||||
z: 30 |
||||
} |
||||
|
||||
QGCSpeedWidget { |
||||
id: speedWidget |
||||
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: root.groundSpeed |
||||
z: 40 |
||||
} |
||||
|
||||
QGCCurrentSpeed { |
||||
id: currentSpeed |
||||
anchors.left: parent.left |
||||
width: ScreenTools.defaultFontPixelSize * (6.25) |
||||
airspeed: root.airSpeed |
||||
groundspeed: root.groundSpeed |
||||
active: multiVehicleManager.activeVehicleAvailable |
||||
showAirSpeed: true |
||||
showGroundSpeed: true |
||||
visible: (currentSpeed.showGroundSpeed || currentSpeed.showAirSpeed) |
||||
z: 50 |
||||
} |
||||
|
||||
QGCCurrentAltitude { |
||||
id: currentAltitude |
||||
anchors.right: parent.right |
||||
width: ScreenTools.defaultFontPixelSize * (6.25) |
||||
altitude: root.altitudeWGS84 |
||||
vertZ: root.climbRate |
||||
showAltitude: true |
||||
showClimbRate: true |
||||
active: multiVehicleManager.activeVehicleAvailable |
||||
visible: (currentAltitude.showAltitude || currentAltitude.showClimbRate) |
||||
z: 60 |
||||
} |
||||
|
||||
QGCButton { |
||||
anchors.margins: ScreenTools.defaultFontPixelWidth |
||||
anchors.right: parent.right |
||||
anchors.bottom: parent.bottom |
||||
text: "Options" |
||||
menu: contextMenu |
||||
} |
||||
} |
Before Width: | Height: | Size: 939 KiB |
@ -1,112 +0,0 @@
@@ -1,112 +0,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 Altitude Indicator |
||||
* @author Gus Grubba <mavlink@grubba.com> |
||||
*/ |
||||
|
||||
import QtQuick 2.4 |
||||
import QGroundControl.Controls 1.0 |
||||
import QGroundControl.ScreenTools 1.0 |
||||
|
||||
Rectangle { |
||||
id: root |
||||
property real altitude: 50 |
||||
property real _reticleSpacing: ScreenTools.defaultFontPixelSize * (1.33) |
||||
property real _reticleHeight: ScreenTools.defaultFontPixelSize * (0.166) |
||||
property real _reticleSlot: _reticleSpacing + _reticleHeight |
||||
property var _speedArray: [] |
||||
property int _currentCenter: 0 |
||||
property int _currentStart: -100 |
||||
|
||||
function updateArray() { |
||||
var tmpArray = []; |
||||
_currentCenter = Math.floor(altitude / 5) * 5; |
||||
_currentStart = _currentCenter + 100; |
||||
for(var i = 0; i < 40; i++) { |
||||
tmpArray[i] = _currentStart - (i * 5); |
||||
} |
||||
_speedArray = tmpArray; |
||||
} |
||||
|
||||
Component.onCompleted: |
||||
{ |
||||
updateArray() ; |
||||
} |
||||
|
||||
onAltitudeChanged: { |
||||
if(Math.abs(_currentCenter - altitude) > 50) { |
||||
updateArray() ; |
||||
} |
||||
} |
||||
|
||||
anchors.verticalCenter: parent.verticalCenter |
||||
smooth: true |
||||
radius: ScreenTools.defaultFontPixelSize * (0.42) |
||||
border.color: Qt.rgba(1,1,1,0.25) |
||||
gradient: Gradient { |
||||
GradientStop { position: 0.0; color: Qt.rgba(0,0,0,0.65) } |
||||
GradientStop { position: 0.5; color: Qt.rgba(0,0,0,0.25) } |
||||
GradientStop { position: 1.0; color: Qt.rgba(0,0,0,0.65) } |
||||
} |
||||
Rectangle { |
||||
id: clipRect |
||||
height: parent.height - ScreenTools.defaultFontPixelSize * (0.42) |
||||
width: parent.width |
||||
clip: true |
||||
color: Qt.rgba(0,0,0,0); |
||||
anchors.verticalCenter: parent.verticalCenter |
||||
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) ? ScreenTools.defaultFontPixelSize * (0.83) : ScreenTools.defaultFontPixelSize * (1.25) |
||||
height: _reticleHeight |
||||
color: Qt.rgba(1,1,1,0.35) |
||||
QGCLabel { |
||||
visible: (_alt % 10 === 0) |
||||
x: ScreenTools.defaultFontPixelSize * (1.66) |
||||
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) |
||||
} |
||||
} |
||||
} |
||||
} |
@ -1,84 +0,0 @@
@@ -1,84 +0,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 Compass HUD |
||||
* @author Gus Grubba <mavlink@grubba.com> |
||||
*/ |
||||
|
||||
import QtQuick 2.4 |
||||
import QGroundControl.Controls 1.0 |
||||
import QGroundControl.ScreenTools 1.0 |
||||
|
||||
Item { |
||||
id: root |
||||
|
||||
property bool active: false ///< true: actively connected to data provider, false: show inactive control |
||||
property real heading: _defaultHeading |
||||
|
||||
readonly property real _defaultHeading: 0 |
||||
|
||||
property real _heading: active ? heading : _defaultHeading |
||||
|
||||
Image { |
||||
id: compass |
||||
anchors.centerIn: parent |
||||
source: "/qmlimages/compass.svg" |
||||
mipmap: true |
||||
width: root.width |
||||
fillMode: Image.PreserveAspectFit |
||||
|
||||
transform: Rotation { |
||||
origin.x: compass.width / 2 |
||||
origin.y: compass.height / 2 |
||||
angle: -_heading |
||||
} |
||||
} |
||||
|
||||
Image { |
||||
id: pointer |
||||
anchors.bottom: compass.top |
||||
anchors.horizontalCenter: root.horizontalCenter |
||||
source: "/qmlimages/compassNeedle.svg" |
||||
smooth: true |
||||
width: compass.width * 0.1 |
||||
fillMode: Image.PreserveAspectFit |
||||
} |
||||
|
||||
Rectangle { |
||||
anchors.centerIn: compass |
||||
width: ScreenTools.defaultFontPixelSize * (3.33) |
||||
height: ScreenTools.defaultFontPixelSize * (2.08) |
||||
border.color: Qt.rgba(1,1,1,0.15) |
||||
color: Qt.rgba(0,0,0,0.25) |
||||
|
||||
QGCLabel { |
||||
text: _heading.toFixed(0) |
||||
font.weight: Font.DemiBold |
||||
color: "white" |
||||
anchors.centerIn: parent |
||||
visible: active |
||||
} |
||||
} |
||||
} |
@ -1,67 +0,0 @@
@@ -1,67 +0,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 Current Altitude Indicator |
||||
* @author Gus Grubba <mavlink@grubba.com> |
||||
*/ |
||||
|
||||
import QtQuick 2.1 |
||||
import QGroundControl.Controls 1.0 |
||||
import QGroundControl.ScreenTools 1.0 |
||||
|
||||
Rectangle { |
||||
id: root |
||||
|
||||
property bool active: false ///< true: actively connected to data provider, false: show inactive control |
||||
property real altitude: 0 |
||||
property real vertZ: 0 |
||||
property bool showAltitude: true |
||||
property bool showClimbRate: true |
||||
|
||||
anchors.verticalCenter: parent.verticalCenter |
||||
width: parent.width |
||||
height: (showAltitude && showClimbRate) ? ScreenTools.defaultFontPixelSize * (4.16) : ScreenTools.defaultFontPixelSize * (2.08) |
||||
color: "black" |
||||
border.color: Qt.rgba(1,1,1,0.25) |
||||
opacity: 1.0 |
||||
Column{ |
||||
anchors.centerIn: parent |
||||
spacing: ScreenTools.defaultFontPixelSize * (0.33) |
||||
QGCLabel { |
||||
text: 'h: ' + (active ? altitude.toFixed(0) : "") |
||||
font.weight: Font.DemiBold |
||||
color: "white" |
||||
anchors.right: parent.right |
||||
visible: showAltitude |
||||
} |
||||
QGCLabel { |
||||
text: 'vZ: ' + (active ? vertZ.toFixed(0) : "") |
||||
color: "white" |
||||
font.weight: showAltitude ? Font.Normal : Font.DemiBold |
||||
anchors.right: parent.right |
||||
visible: showClimbRate |
||||
} |
||||
} |
||||
} |
@ -1,67 +0,0 @@
@@ -1,67 +0,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 Current Speed Indicator |
||||
* @author Gus Grubba <mavlink@grubba.com> |
||||
*/ |
||||
|
||||
import QtQuick 2.1 |
||||
import QGroundControl.Controls 1.0 |
||||
import QGroundControl.ScreenTools 1.0 |
||||
|
||||
Rectangle { |
||||
id: root |
||||
|
||||
property bool active: false ///< true: actively connected to data provider, false: show inactive control |
||||
property real airspeed: 0 |
||||
property real groundspeed: 0 |
||||
property bool showAirSpeed: true |
||||
property bool showGroundSpeed: true |
||||
|
||||
anchors.verticalCenter: parent.verticalCenter |
||||
width: parent.width |
||||
height: (showAirSpeed && showGroundSpeed) ? ScreenTools.defaultFontPixelSize * (4.16) : ScreenTools.defaultFontPixelSize * (2.08) |
||||
color: "black" |
||||
border.color: Qt.rgba(1,1,1,0.25) |
||||
opacity: 1.0 |
||||
Column{ |
||||
anchors.centerIn: parent |
||||
spacing: ScreenTools.defaultFontPixelSize * (0.33) |
||||
QGCLabel { |
||||
text: 'GS: ' + (active ? groundspeed.toFixed(0) : "") |
||||
font.weight: Font.DemiBold |
||||
color: "white" |
||||
anchors.right: parent.right |
||||
visible: showGroundSpeed |
||||
} |
||||
QGCLabel { |
||||
text: 'AS: ' + (active ? airspeed.toFixed(0) : "") |
||||
color: "white" |
||||
anchors.right: parent.right |
||||
font.weight: showAirSpeed ? Font.Normal : Font.DemiBold |
||||
visible: showAirSpeed |
||||
} |
||||
} |
||||
} |
@ -1,89 +0,0 @@
@@ -1,89 +0,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 Speed Indicator |
||||
* @author Gus Grubba <mavlink@grubba.com> |
||||
*/ |
||||
|
||||
import QtQuick 2.4 |
||||
import QGroundControl.ScreenTools 1.0 |
||||
import QGroundControl.Controls 1.0 |
||||
|
||||
Rectangle { |
||||
id: root |
||||
property real speed: 0 |
||||
property real _reticleSpacing: ScreenTools.defaultFontPixelSize * (0.83) |
||||
property real _reticleHeight: ScreenTools.defaultFontPixelSize * (0.166) |
||||
property real _reticleSlot: _reticleSpacing + _reticleHeight |
||||
anchors.verticalCenter: parent.verticalCenter |
||||
z:10 |
||||
smooth: true |
||||
radius: ScreenTools.defaultFontPixelSize * (0.42) |
||||
border.color: Qt.rgba(1,1,1,0.25) |
||||
gradient: Gradient { |
||||
GradientStop { position: 0.0; color: Qt.rgba(0,0,0,0.65) } |
||||
GradientStop { position: 0.5; color: Qt.rgba(0,0,0,0.25) } |
||||
GradientStop { position: 1.0; color: Qt.rgba(0,0,0,0.65) } |
||||
} |
||||
Rectangle { |
||||
id: clipRect |
||||
height: parent.height - ScreenTools.defaultFontPixelSize * (0.42) |
||||
width: parent.width |
||||
clip: true |
||||
color: Qt.rgba(0,0,0,0); |
||||
anchors.verticalCenter: parent.verticalCenter |
||||
Column{ |
||||
id: col |
||||
width: parent.width |
||||
anchors.verticalCenter: parent.verticalCenter |
||||
spacing: _reticleSpacing |
||||
Repeater { |
||||
model: 40 |
||||
Rectangle { |
||||
property int _speed: -(index - 20) |
||||
width: (_speed % 5 === 0) ? ScreenTools.defaultFontPixelSize * (0.83) : ScreenTools.defaultFontPixelSize * (1.25) |
||||
anchors.right: parent.right |
||||
height: _reticleHeight |
||||
color: Qt.rgba(1,1,1,0.35) |
||||
QGCLabel { |
||||
visible: (_speed % 5 === 0) |
||||
anchors.horizontalCenter: parent.horizontalCenter |
||||
anchors.horizontalCenterOffset: ScreenTools.defaultFontPixelSize * (-2.5) |
||||
anchors.verticalCenter: parent.verticalCenter |
||||
antialiasing: true |
||||
font.weight: Font.DemiBold |
||||
text: _speed |
||||
color: _speed < 0 ? "#f8983a" : "white" |
||||
style: Text.Outline |
||||
styleColor: Qt.rgba(0,0,0,0.25) |
||||
} |
||||
} |
||||
} |
||||
transform: Translate { |
||||
y: (speed * _reticleSlot) - (_reticleSlot / 2) |
||||
} |
||||
} |
||||
} |
||||
} |
Loading…
Reference in new issue