Commit 365c6d71 authored by Gus Grubba's avatar Gus Grubba

Control on Fly View

Eliminated flight widget "states"
Define flight widget top margin (plugin options)
parent a7ddca45
......@@ -176,6 +176,7 @@
</qresource>
<qresource prefix="/airmap">
<file alias="advisory-icon.svg">src/Airmap/images/advisory-icon.svg</file>
<file alias="colapse.svg">src/Airmap/images/colapse.svg</file>
<file alias="expand.svg">src/Airmap/images/expand.svg</file>
<file alias="pencil.svg">src/Airmap/images/pencil.svg</file>
</qresource>
......
......@@ -18,7 +18,8 @@ Item {
width: parent.width
height: colapsed ? colapsedRect.height : expandedRect.height
property var colapsed: true
property bool colapsed: true
property bool showColapse: true
readonly property real _radius: ScreenTools.defaultFontPixelWidth * 0.5
readonly property color _colorOrange: "#d75e0d"
......@@ -125,6 +126,22 @@ Item {
}
}
}
QGCColoredImage {
width: height
height: ScreenTools.defaultFontPixelWidth * 2.5
sourceSize.height: height
source: "qrc:/airmap/colapse.svg"
color: _colorWhite
visible: showColapse
anchors.right: parent.right
anchors.rightMargin: ScreenTools.defaultFontPixelWidth
anchors.verticalCenter: parent.verticalCenter
MouseArea {
anchors.fill: parent
enabled: showColapse
onClicked: colapsed = true
}
}
}
//-- Contents (Brown Box)
Rectangle {
......
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 22.0.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
width="72px" height="36px" viewBox="0 0 72 36" style="enable-background:new 0 0 72 36;" xml:space="preserve">
<style type="text/css">
.st0{fill:none;stroke:#FFFFFF;stroke-width:4;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:10;}
</style>
<polyline class="st0" points="3.6,34 36,1.6 68.4,34 "/>
</svg>
......@@ -15,19 +15,21 @@ import QtLocation 5.3
import QtPositioning 5.3
import QtQuick.Layouts 1.2
import QGroundControl 1.0
import QGroundControl.ScreenTools 1.0
import QGroundControl.Controls 1.0
import QGroundControl.Palette 1.0
import QGroundControl.Vehicle 1.0
import QGroundControl.FlightMap 1.0
import QGroundControl 1.0
import QGroundControl.ScreenTools 1.0
import QGroundControl.Controls 1.0
import QGroundControl.Palette 1.0
import QGroundControl.Vehicle 1.0
import QGroundControl.FlightMap 1.0
import QGroundControl.Airmap 1.0
Item {
id: _root
id: widgetRoot
property var qgcView
property bool useLightColors
property var missionController
property bool showValues: true
property var _activeVehicle: QGroundControl.multiVehicleManager.activeVehicle
property bool _isSatellite: _mainIsMap ? (_flightMap ? _flightMap.isSatelliteMap : true) : true
......@@ -51,28 +53,14 @@ Item {
if(QGroundControl.corePlugin.options.instrumentWidget) {
if(QGroundControl.corePlugin.options.instrumentWidget.source.toString().length) {
instrumentsLoader.source = QGroundControl.corePlugin.options.instrumentWidget.source
switch(QGroundControl.corePlugin.options.instrumentWidget.widgetPosition) {
case CustomInstrumentWidget.POS_TOP_RIGHT:
instrumentsLoader.state = "topMode"
break;
case CustomInstrumentWidget.POS_BOTTOM_RIGHT:
instrumentsLoader.state = "bottomMode"
break;
case CustomInstrumentWidget.POS_CENTER_RIGHT:
default:
instrumentsLoader.state = "centerMode"
break;
}
} else {
// Note: We currently show alternate instruments all the time. This is a trial change for daily builds.
// Leaving non-alternate code in for now in case the trial fails.
var useAlternateInstruments = true//QGroundControl.settingsManager.appSettings.virtualJoystick.value || ScreenTools.isTinyScreen
if(useAlternateInstruments) {
instrumentsLoader.source = "qrc:/qml/QGCInstrumentWidgetAlternate.qml"
instrumentsLoader.state = "topMode"
} else {
instrumentsLoader.source = "qrc:/qml/QGCInstrumentWidget.qml"
instrumentsLoader.state = QGroundControl.settingsManager.appSettings.showLargeCompass.value == 1 ? "centerMode" : "topMode"
}
}
} else {
......@@ -130,43 +118,30 @@ Item {
text: "The vehicle has failed a pre-arm check. In order to arm the vehicle, resolve the failure or disable the arming check via the Safety tab on the Vehicle Setup page."
}
}
//-- Instrument Panel
Loader {
id: instrumentsLoader
anchors.margins: ScreenTools.defaultFontPixelHeight / 2
Column {
id: instrumentsColumn
spacing: ScreenTools.defaultFontPixelHeight * 0.25
anchors.top: parent.top
anchors.topMargin: QGroundControl.corePlugin.options.instrumentWidget.widgetTopMargin + (ScreenTools.defaultFontPixelHeight * 0.5)
anchors.margins: ScreenTools.defaultFontPixelHeight * 0.5
anchors.right: parent.right
z: QGroundControl.zOrderWidgets
property var qgcView: _root.qgcView
property real maxHeight:parent.height - (anchors.margins * 2)
states: [
State {
name: "topMode"
AnchorChanges {
target: instrumentsLoader
anchors.verticalCenter: undefined
anchors.bottom: undefined
anchors.top: _root ? _root.top : undefined
}
},
State {
name: "centerMode"
AnchorChanges {
target: instrumentsLoader
anchors.top: undefined
anchors.bottom: undefined
anchors.verticalCenter: _root ? _root.verticalCenter : undefined
}
},
State {
name: "bottomMode"
AnchorChanges {
target: instrumentsLoader
anchors.top: undefined
anchors.verticalCenter: undefined
anchors.bottom: _root ? _root.bottom : undefined
}
//-------------------------------------------------------
// Airmap Airspace Control
AirspaceControl {
id: airspaceControl
width: getPreferredInstrumentWidth()
anchors.margins: ScreenTools.defaultFontPixelHeight * 0.5
onColapsedChanged: {
widgetRoot.showValues = colapsed
}
]
}
//-------------------------------------------------------
//-- Instrument Panel
Loader {
id: instrumentsLoader
anchors.margins: ScreenTools.defaultFontPixelHeight * 0.5
property var qgcView: widgetRoot.qgcView
property real maxHeight: widgetRoot ? widgetRoot.height - instrumentsColumn.y - airspaceControl.height - (ScreenTools.defaultFontPixelHeight * 4) : 0
}
}
}
......@@ -66,6 +66,7 @@ Rectangle {
anchors.top: parent.bottom
width: parent.width
height: _valuesWidget.height
visible: widgetRoot.showValues
Rectangle {
anchors.fill: _valuesWidget
......
......@@ -512,8 +512,9 @@ QGCView {
//-------------------------------------------------------
// Airmap Airspace Control
AirspaceControl {
id: airspaceControl
width: parent.width
id: airspaceControl
width: parent.width
showColapse: false
onColapsedChanged: {
if(!airspaceControl.colasped) {
planControlColapsed = true
......
......@@ -73,7 +73,7 @@ void QGCPalette::_buildMap(void)
DECLARE_QGC_COLOR(alertBackground, "#eecc44", "#eecc44", "#eecc44", "#eecc44")
DECLARE_QGC_COLOR(alertBorder, "#808080", "#808080", "#808080", "#808080")
DECLARE_QGC_COLOR(alertText, "#000000", "#000000", "#000000", "#000000")
DECLARE_QGC_COLOR(missionItemEditor, "#585858", "#a39fd3", "#585858", "#4e4480")
DECLARE_QGC_COLOR(missionItemEditor, "#585858", "#dbfef8", "#585858", "#585d83")
// Colors are not affecting by theming
DECLARE_QGC_COLOR(mapWidgetBorderLight, "#ffffff", "#ffffff", "#ffffff", "#ffffff")
......
......@@ -10,6 +10,7 @@ Rectangle {
id: _root
height: pageFlickable.y + pageFlickable.height + _margins
color: qgcPal.window
radius: ScreenTools.defaultFontPixelWidth * 0.5
property var qgcView ///< QGCView to use for showing dialogs
property real maxHeight ///< Maximum height that should be taken, smaller than this is ok
......
......@@ -121,18 +121,11 @@ class CustomInstrumentWidget : public QObject
{
Q_OBJECT
public:
//-- Widget Position
enum Pos {
POS_TOP_RIGHT = 0,
POS_CENTER_RIGHT = 1,
POS_BOTTOM_RIGHT = 2,
};
Q_ENUMS(Pos)
CustomInstrumentWidget(QObject* parent = NULL);
Q_PROPERTY(QUrl source READ source CONSTANT)
Q_PROPERTY(Pos widgetPosition READ widgetPosition NOTIFY widgetPositionChanged)
Q_PROPERTY(double widgetTopMargin READ widgetTopMargin NOTIFY widgetTopMarginChanged)
virtual QUrl source () { return QUrl(); }
virtual Pos widgetPosition () { return POS_CENTER_RIGHT; }
virtual double widgetTopMargin () { return 0.0; }
signals:
void widgetPositionChanged ();
void widgetTopMarginChanged();
};
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment