Browse Source

Control on Fly View

Eliminated flight widget "states"
Define flight widget top margin (plugin options)
QGC4.4
Gus Grubba 7 years ago
parent
commit
365c6d7156
  1. 1
      qgcresources.qrc
  2. 19
      src/Airmap/AirspaceControl.qml
  3. 9
      src/Airmap/images/colapse.svg
  4. 89
      src/FlightDisplay/FlightDisplayViewWidgets.qml
  5. 1
      src/FlightMap/Widgets/QGCInstrumentWidgetAlternate.qml
  6. 5
      src/PlanView/PlanView.qml
  7. 2
      src/QGCPalette.cc
  8. 1
      src/QmlControls/PageView.qml
  9. 13
      src/api/QGCOptions.h

1
qgcresources.qrc

@ -176,6 +176,7 @@
</qresource> </qresource>
<qresource prefix="/airmap"> <qresource prefix="/airmap">
<file alias="advisory-icon.svg">src/Airmap/images/advisory-icon.svg</file> <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="expand.svg">src/Airmap/images/expand.svg</file>
<file alias="pencil.svg">src/Airmap/images/pencil.svg</file> <file alias="pencil.svg">src/Airmap/images/pencil.svg</file>
</qresource> </qresource>

19
src/Airmap/AirspaceControl.qml

@ -18,7 +18,8 @@ Item {
width: parent.width width: parent.width
height: colapsed ? colapsedRect.height : expandedRect.height 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 real _radius: ScreenTools.defaultFontPixelWidth * 0.5
readonly property color _colorOrange: "#d75e0d" 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) //-- Contents (Brown Box)
Rectangle { Rectangle {

9
src/Airmap/images/colapse.svg

@ -0,0 +1,9 @@
<?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>

After

Width:  |  Height:  |  Size: 580 B

89
src/FlightDisplay/FlightDisplayViewWidgets.qml

@ -15,19 +15,21 @@ import QtLocation 5.3
import QtPositioning 5.3 import QtPositioning 5.3
import QtQuick.Layouts 1.2 import QtQuick.Layouts 1.2
import QGroundControl 1.0 import QGroundControl 1.0
import QGroundControl.ScreenTools 1.0 import QGroundControl.ScreenTools 1.0
import QGroundControl.Controls 1.0 import QGroundControl.Controls 1.0
import QGroundControl.Palette 1.0 import QGroundControl.Palette 1.0
import QGroundControl.Vehicle 1.0 import QGroundControl.Vehicle 1.0
import QGroundControl.FlightMap 1.0 import QGroundControl.FlightMap 1.0
import QGroundControl.Airmap 1.0
Item { Item {
id: _root id: widgetRoot
property var qgcView property var qgcView
property bool useLightColors property bool useLightColors
property var missionController property var missionController
property bool showValues: true
property var _activeVehicle: QGroundControl.multiVehicleManager.activeVehicle property var _activeVehicle: QGroundControl.multiVehicleManager.activeVehicle
property bool _isSatellite: _mainIsMap ? (_flightMap ? _flightMap.isSatelliteMap : true) : true property bool _isSatellite: _mainIsMap ? (_flightMap ? _flightMap.isSatelliteMap : true) : true
@ -51,28 +53,14 @@ Item {
if(QGroundControl.corePlugin.options.instrumentWidget) { if(QGroundControl.corePlugin.options.instrumentWidget) {
if(QGroundControl.corePlugin.options.instrumentWidget.source.toString().length) { if(QGroundControl.corePlugin.options.instrumentWidget.source.toString().length) {
instrumentsLoader.source = QGroundControl.corePlugin.options.instrumentWidget.source 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 { } else {
// Note: We currently show alternate instruments all the time. This is a trial change for daily builds. // 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. // Leaving non-alternate code in for now in case the trial fails.
var useAlternateInstruments = true//QGroundControl.settingsManager.appSettings.virtualJoystick.value || ScreenTools.isTinyScreen var useAlternateInstruments = true//QGroundControl.settingsManager.appSettings.virtualJoystick.value || ScreenTools.isTinyScreen
if(useAlternateInstruments) { if(useAlternateInstruments) {
instrumentsLoader.source = "qrc:/qml/QGCInstrumentWidgetAlternate.qml" instrumentsLoader.source = "qrc:/qml/QGCInstrumentWidgetAlternate.qml"
instrumentsLoader.state = "topMode"
} else { } else {
instrumentsLoader.source = "qrc:/qml/QGCInstrumentWidget.qml" instrumentsLoader.source = "qrc:/qml/QGCInstrumentWidget.qml"
instrumentsLoader.state = QGroundControl.settingsManager.appSettings.showLargeCompass.value == 1 ? "centerMode" : "topMode"
} }
} }
} else { } 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." 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."
} }
} }
Column {
//-- Instrument Panel id: instrumentsColumn
Loader { spacing: ScreenTools.defaultFontPixelHeight * 0.25
id: instrumentsLoader anchors.top: parent.top
anchors.margins: ScreenTools.defaultFontPixelHeight / 2 anchors.topMargin: QGroundControl.corePlugin.options.instrumentWidget.widgetTopMargin + (ScreenTools.defaultFontPixelHeight * 0.5)
anchors.margins: ScreenTools.defaultFontPixelHeight * 0.5
anchors.right: parent.right anchors.right: parent.right
z: QGroundControl.zOrderWidgets //-------------------------------------------------------
property var qgcView: _root.qgcView // Airmap Airspace Control
property real maxHeight:parent.height - (anchors.margins * 2) AirspaceControl {
states: [ id: airspaceControl
State { width: getPreferredInstrumentWidth()
name: "topMode" anchors.margins: ScreenTools.defaultFontPixelHeight * 0.5
AnchorChanges { onColapsedChanged: {
target: instrumentsLoader widgetRoot.showValues = colapsed
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
}
} }
] }
//-------------------------------------------------------
//-- 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
}
} }
} }

1
src/FlightMap/Widgets/QGCInstrumentWidgetAlternate.qml

@ -66,6 +66,7 @@ Rectangle {
anchors.top: parent.bottom anchors.top: parent.bottom
width: parent.width width: parent.width
height: _valuesWidget.height height: _valuesWidget.height
visible: widgetRoot.showValues
Rectangle { Rectangle {
anchors.fill: _valuesWidget anchors.fill: _valuesWidget

5
src/PlanView/PlanView.qml

@ -512,8 +512,9 @@ QGCView {
//------------------------------------------------------- //-------------------------------------------------------
// Airmap Airspace Control // Airmap Airspace Control
AirspaceControl { AirspaceControl {
id: airspaceControl id: airspaceControl
width: parent.width width: parent.width
showColapse: false
onColapsedChanged: { onColapsedChanged: {
if(!airspaceControl.colasped) { if(!airspaceControl.colasped) {
planControlColapsed = true planControlColapsed = true

2
src/QGCPalette.cc

@ -73,7 +73,7 @@ void QGCPalette::_buildMap(void)
DECLARE_QGC_COLOR(alertBackground, "#eecc44", "#eecc44", "#eecc44", "#eecc44") DECLARE_QGC_COLOR(alertBackground, "#eecc44", "#eecc44", "#eecc44", "#eecc44")
DECLARE_QGC_COLOR(alertBorder, "#808080", "#808080", "#808080", "#808080") DECLARE_QGC_COLOR(alertBorder, "#808080", "#808080", "#808080", "#808080")
DECLARE_QGC_COLOR(alertText, "#000000", "#000000", "#000000", "#000000") 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 // Colors are not affecting by theming
DECLARE_QGC_COLOR(mapWidgetBorderLight, "#ffffff", "#ffffff", "#ffffff", "#ffffff") DECLARE_QGC_COLOR(mapWidgetBorderLight, "#ffffff", "#ffffff", "#ffffff", "#ffffff")

1
src/QmlControls/PageView.qml

@ -10,6 +10,7 @@ Rectangle {
id: _root id: _root
height: pageFlickable.y + pageFlickable.height + _margins height: pageFlickable.y + pageFlickable.height + _margins
color: qgcPal.window color: qgcPal.window
radius: ScreenTools.defaultFontPixelWidth * 0.5
property var qgcView ///< QGCView to use for showing dialogs property var qgcView ///< QGCView to use for showing dialogs
property real maxHeight ///< Maximum height that should be taken, smaller than this is ok property real maxHeight ///< Maximum height that should be taken, smaller than this is ok

13
src/api/QGCOptions.h

@ -121,18 +121,11 @@ class CustomInstrumentWidget : public QObject
{ {
Q_OBJECT Q_OBJECT
public: public:
//-- Widget Position
enum Pos {
POS_TOP_RIGHT = 0,
POS_CENTER_RIGHT = 1,
POS_BOTTOM_RIGHT = 2,
};
Q_ENUMS(Pos)
CustomInstrumentWidget(QObject* parent = NULL); CustomInstrumentWidget(QObject* parent = NULL);
Q_PROPERTY(QUrl source READ source CONSTANT) 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 QUrl source () { return QUrl(); }
virtual Pos widgetPosition () { return POS_CENTER_RIGHT; } virtual double widgetTopMargin () { return 0.0; }
signals: signals:
void widgetPositionChanged (); void widgetTopMarginChanged();
}; };

Loading…
Cancel
Save