diff --git a/qgcresources.qrc b/qgcresources.qrc index 5cf8cb3e5d6c8e19268a7a5f4de1707c40a0033b..019dfa2f5e31804feaca780d04b4028b89fd2707 100644 --- a/qgcresources.qrc +++ b/qgcresources.qrc @@ -176,6 +176,7 @@ src/Airmap/images/advisory-icon.svg + src/Airmap/images/colapse.svg src/Airmap/images/expand.svg src/Airmap/images/pencil.svg diff --git a/src/Airmap/AirspaceControl.qml b/src/Airmap/AirspaceControl.qml index 5cbd6516c7e59790bdebd133ad4b15e520e94522..dea3cddf67f8c00dcd40d5acc0fe2cc9141b4694 100644 --- a/src/Airmap/AirspaceControl.qml +++ b/src/Airmap/AirspaceControl.qml @@ -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 { diff --git a/src/Airmap/images/colapse.svg b/src/Airmap/images/colapse.svg new file mode 100644 index 0000000000000000000000000000000000000000..bf33cf0dcc87af69239a20d68956974ba3cf7914 --- /dev/null +++ b/src/Airmap/images/colapse.svg @@ -0,0 +1,9 @@ + + + + + + diff --git a/src/FlightDisplay/FlightDisplayViewWidgets.qml b/src/FlightDisplay/FlightDisplayViewWidgets.qml index 4d61d876f7504f36582a22b14db106f9f3b3abf9..b83ad869f9459d2f70f07c661ce728258742767f 100644 --- a/src/FlightDisplay/FlightDisplayViewWidgets.qml +++ b/src/FlightDisplay/FlightDisplayViewWidgets.qml @@ -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 + } } } diff --git a/src/FlightMap/Widgets/QGCInstrumentWidgetAlternate.qml b/src/FlightMap/Widgets/QGCInstrumentWidgetAlternate.qml index 290fec81fec381820564febe485d2dfd4644c683..93ebc493b09e759bddd84958963010457e5ab4c3 100644 --- a/src/FlightMap/Widgets/QGCInstrumentWidgetAlternate.qml +++ b/src/FlightMap/Widgets/QGCInstrumentWidgetAlternate.qml @@ -66,6 +66,7 @@ Rectangle { anchors.top: parent.bottom width: parent.width height: _valuesWidget.height + visible: widgetRoot.showValues Rectangle { anchors.fill: _valuesWidget diff --git a/src/PlanView/PlanView.qml b/src/PlanView/PlanView.qml index bac7574bec538aa0d8be683f12450e43c671210f..fc6c4d44127362b839ee9ece0499417fdc97e582 100644 --- a/src/PlanView/PlanView.qml +++ b/src/PlanView/PlanView.qml @@ -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 diff --git a/src/QGCPalette.cc b/src/QGCPalette.cc index 5af46e337e881cca41fbd5f67d2bf27b54cd00c2..70a6098eac12908cfd6f79791a33e41710943042 100644 --- a/src/QGCPalette.cc +++ b/src/QGCPalette.cc @@ -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") diff --git a/src/QmlControls/PageView.qml b/src/QmlControls/PageView.qml index 6dfdc6cb4c2944bc81a19130e471c8b5a50ea278..6dda2997c98c9eb4c26c2571fe7bd325e0446d96 100644 --- a/src/QmlControls/PageView.qml +++ b/src/QmlControls/PageView.qml @@ -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 diff --git a/src/api/QGCOptions.h b/src/api/QGCOptions.h index 9d06d00bdb2fa6161f5befda061623ddd8984fa6..3e2607409e64e379a3e497603175ea2c97876668 100644 --- a/src/api/QGCOptions.h +++ b/src/api/QGCOptions.h @@ -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(); };