From 6929d26958198bf8ffc17edeab06b301d7e4b203 Mon Sep 17 00:00:00 2001 From: Gus Grubba Date: Sat, 20 Jan 2018 09:13:35 -0500 Subject: [PATCH] Initial Mockup --- qgcresources.qrc | 6 + qgroundcontrol.qrc | 3 + resources/waypoint.svg | 10 + src/Airmap/AirspaceControl.qml | 237 ++++++++++++++++++++++++ src/Airmap/AirspaceRegulation.qml | 58 ++++++ src/Airmap/QGroundControl.Airmap.qmldir | 4 + src/Airmap/images/advisory-icon.svg | 21 +++ src/Airmap/images/pencil.svg | 17 ++ src/PlanView/PlanView.qml | 194 +++++-------------- 9 files changed, 404 insertions(+), 146 deletions(-) create mode 100644 resources/waypoint.svg create mode 100644 src/Airmap/AirspaceControl.qml create mode 100644 src/Airmap/AirspaceRegulation.qml create mode 100644 src/Airmap/QGroundControl.Airmap.qmldir create mode 100644 src/Airmap/images/advisory-icon.svg create mode 100644 src/Airmap/images/pencil.svg diff --git a/qgcresources.qrc b/qgcresources.qrc index 5b6fa54b5..c50d5ac95 100644 --- a/qgcresources.qrc +++ b/qgcresources.qrc @@ -171,6 +171,11 @@ src/FirmwarePlugin/APM/APMBrandImageSub.png src/FirmwarePlugin/PX4/PX4BrandImage.png src/FlightMap/Images/sub.png + src/Airmap/images/advisory-icon.svg + + + src/Airmap/images/advisory-icon.svg + src/Airmap/images/pencil.svg resources/action.svg @@ -207,6 +212,7 @@ resources/wind-rose-arrow.svg resources/XDelete.svg resources/XDeleteBlack.svg + resources/waypoint.svg resources/icons/qgroundcontrol.ico diff --git a/qgroundcontrol.qrc b/qgroundcontrol.qrc index 366817258..23b68169b 100644 --- a/qgroundcontrol.qrc +++ b/qgroundcontrol.qrc @@ -15,6 +15,9 @@ src/ui/toolbar/JoystickIndicator.qml + src/Airmap/QGroundControl.Airmap.qmldir + src/Airmap/AirspaceControl.qml + src/Airmap/AirspaceRegulation.qml src/AnalyzeView/AnalyzeView.qml src/ui/AppSettings.qml src/ui/preferences/BluetoothSettings.qml diff --git a/resources/waypoint.svg b/resources/waypoint.svg new file mode 100644 index 000000000..257fb7114 --- /dev/null +++ b/resources/waypoint.svg @@ -0,0 +1,10 @@ + + + + + + diff --git a/src/Airmap/AirspaceControl.qml b/src/Airmap/AirspaceControl.qml new file mode 100644 index 000000000..62e1b52a3 --- /dev/null +++ b/src/Airmap/AirspaceControl.qml @@ -0,0 +1,237 @@ +import QtQuick 2.3 +import QtQuick.Controls 1.2 +import QtQuick.Controls.Styles 1.4 +import QtQuick.Dialogs 1.2 +import QtQuick.Layouts 1.2 +import QtQml 2.2 + +import QGroundControl 1.0 +import QGroundControl.ScreenTools 1.0 +import QGroundControl.Vehicle 1.0 +import QGroundControl.Controls 1.0 +import QGroundControl.FactControls 1.0 +import QGroundControl.Palette 1.0 +import QGroundControl.Airmap 1.0 + +Item { + id: _root + width: parent.width + height: colapsed ? colapsedRect.height : expandedRect.height + + property var colapsed: true + + readonly property real _radius: ScreenTools.defaultFontPixelWidth * 0.5 + readonly property color _colorOrange: "#d75e0d" + readonly property color _colorBrown: "#3c2b24" + readonly property color _colorLightBrown: "#5a4e49" + readonly property color _colorGray: "#615c61" + readonly property color _colorMidBrown: "#3a322f" + readonly property color _colorYellow: "#d7c61d" + readonly property color _colorWhite: "#ffffff" + + QGCPalette { + id: qgcPal + colorGroupEnabled: enabled + } + + //--------------------------------------------------------------- + //-- Colapsed State + Rectangle { + id: colapsedRect + width: parent.width + height: colapsed ? colapsedRow.height + ScreenTools.defaultFontPixelHeight : 0 + color: _colorOrange + radius: _radius + visible: colapsed + Row { + id: colapsedRow + spacing: ScreenTools.defaultFontPixelWidth + anchors.left: parent.left + anchors.leftMargin: ScreenTools.defaultFontPixelWidth + anchors.verticalCenter: parent.verticalCenter + QGCColoredImage { + width: height + height: ScreenTools.defaultFontPixelWidth * 2.5 + sourceSize.height: height + source: "qrc:/airmap/advisory-icon.svg" + color: _colorWhite + anchors.verticalCenter: parent.verticalCenter + } + QGCLabel { + text: qsTr("Airspace") + color: _colorWhite + anchors.verticalCenter: parent.verticalCenter + } + } + MouseArea { + anchors.fill: parent + onClicked: colapsed = false + } + } + //--------------------------------------------------------------- + //-- Expanded State + Rectangle { + id: expandedRect + width: parent.width + height: !colapsed ? expandedCol.height + ScreenTools.defaultFontPixelHeight : 0 + color: _colorOrange + radius: _radius + visible: !colapsed + Column { + id: expandedCol + spacing: ScreenTools.defaultFontPixelHeight * 0.5 + anchors.left: parent.left + anchors.right: parent.right + anchors.verticalCenter: parent.verticalCenter + //-- Header + Item { + height: expandedRow.height + anchors.left: parent.left + anchors.right: parent.right + Row { + id: expandedRow + spacing: ScreenTools.defaultFontPixelWidth + anchors.left: parent.left + anchors.leftMargin: ScreenTools.defaultFontPixelWidth + QGCColoredImage { + width: height + height: ScreenTools.defaultFontPixelWidth * 2.5 + sourceSize.height: height + source: "qrc:/airmap/advisory-icon.svg" + color: _colorWhite + anchors.verticalCenter: parent.verticalCenter + } + Column { + spacing: 0 + anchors.verticalCenter: parent.verticalCenter + QGCLabel { + text: qsTr("Airspace") + color: _colorWhite + } + QGCLabel { + text: qsTr("3 Advisories") + color: _colorWhite + font.pointSize: ScreenTools.smallFontPointSize + } + } + } + MouseArea { + anchors.fill: parent + enabled: !colapsed + onClicked: colapsed = true + } + } + //-- Contents (Brown Box) + Rectangle { + color: _colorBrown + height: airspaceCol.height + ScreenTools.defaultFontPixelHeight + radius: _radius + anchors.left: parent.left + anchors.leftMargin: ScreenTools.defaultFontPixelWidth * 0.5 + anchors.right: parent.right + anchors.rightMargin: ScreenTools.defaultFontPixelWidth * 0.5 + Column { + id: airspaceCol + spacing: ScreenTools.defaultFontPixelHeight * 0.5 + anchors.left: parent.left + anchors.leftMargin: ScreenTools.defaultFontPixelWidth * 0.5 + anchors.right: parent.right + anchors.rightMargin: ScreenTools.defaultFontPixelWidth * 0.5 + anchors.verticalCenter: parent.verticalCenter + //-- Regulations + Rectangle { + color: _colorLightBrown + height: regCol.height + ScreenTools.defaultFontPixelHeight + radius: _radius + anchors.left: parent.left + anchors.leftMargin: ScreenTools.defaultFontPixelWidth * 0.5 + anchors.right: parent.right + anchors.rightMargin: ScreenTools.defaultFontPixelWidth * 0.5 + Column { + id: regCol + spacing: ScreenTools.defaultFontPixelHeight * 0.5 + anchors.left: parent.left + anchors.leftMargin: ScreenTools.defaultFontPixelWidth * 0.5 + anchors.right: parent.right + anchors.rightMargin: ScreenTools.defaultFontPixelWidth * 0.5 + anchors.verticalCenter: parent.verticalCenter + QGCLabel { + text: qsTr("Airspace Regulations") + color: _colorWhite + anchors.horizontalCenter: parent.horizontalCenter + } + QGCLabel { + text: qsTr("Airspace advisories based on the selected rules.") + color: _colorWhite + anchors.left: parent.left + anchors.right: parent.right + wrapMode: Text.WordWrap + font.pointSize: ScreenTools.smallFontPointSize + } + GridLayout { + columns: 2 + anchors.left: parent.left + anchors.right: parent.right + Rectangle { + width: regButton.height + height: width + radius: 2 + color: _colorGray + anchors.verticalCenter: parent.verticalCenter + QGCColoredImage { + width: height + height: parent.height * 0.5 + sourceSize.height: height + source: "qrc:/airmap/pencil.svg" + color: _colorWhite + anchors.centerIn: parent + } + } + Rectangle { + id: regButton + height: regLabel.height + ScreenTools.defaultFontPixelHeight + radius: 2 + color: _colorMidBrown + Layout.fillWidth: true + QGCLabel { + id: regLabel + text: qsTr("FAA-107, Airmap") + color: _colorWhite + anchors.centerIn: parent + } + } + } + } + } + AirspaceRegulation { + regTitle: qsTr("Controlled Aispace (1)") + regText: qsTr("Santa Monica Class D requires FAA Authorization, permissible below 100ft.") + regColor: _colorOrange + textColor: _colorWhite + anchors.left: parent.left + anchors.leftMargin: ScreenTools.defaultFontPixelWidth * 0.5 + anchors.right: parent.right + anchors.rightMargin: ScreenTools.defaultFontPixelWidth * 0.5 + } + AirspaceRegulation { + regTitle: qsTr("Schools (2)") + regText: qsTr("Santa Monica School of Something.") + regColor: _colorYellow + textColor: _colorWhite + anchors.left: parent.left + anchors.leftMargin: ScreenTools.defaultFontPixelWidth * 0.5 + anchors.right: parent.right + anchors.rightMargin: ScreenTools.defaultFontPixelWidth * 0.5 + } + } + } + //-- Footer + QGCLabel { + text: qsTr("Powered by AIRMAP") + color: _colorWhite + font.pointSize: ScreenTools.smallFontPointSize + anchors.horizontalCenter: parent.horizontalCenter + } + } + } +} diff --git a/src/Airmap/AirspaceRegulation.qml b/src/Airmap/AirspaceRegulation.qml new file mode 100644 index 000000000..91a0af129 --- /dev/null +++ b/src/Airmap/AirspaceRegulation.qml @@ -0,0 +1,58 @@ +import QtQuick 2.3 +import QtQuick.Controls 1.2 +import QtQuick.Controls.Styles 1.4 +import QtQuick.Dialogs 1.2 +import QtQml 2.2 + +import QGroundControl 1.0 +import QGroundControl.ScreenTools 1.0 +import QGroundControl.Controls 1.0 +import QGroundControl.Palette 1.0 +import QGroundControl.Airmap 1.0 + +Item { + id: _root + height: regCol.height + + property var textColor: "white" + property var regColor: "white" + property var regTitle: "" + property var regText: "" + + Column { + id: regCol + spacing: ScreenTools.defaultFontPixelHeight * 0.5 + anchors.left: parent.left + anchors.leftMargin: ScreenTools.defaultFontPixelWidth * 0.5 + anchors.right: parent.right + anchors.rightMargin: ScreenTools.defaultFontPixelWidth * 0.5 + Row { + spacing: ScreenTools.defaultFontPixelWidth + anchors.left: parent.left + anchors.leftMargin: ScreenTools.defaultFontPixelWidth * 0.5 + anchors.right: parent.right + anchors.rightMargin: ScreenTools.defaultFontPixelWidth * 0.5 + Rectangle { + width: height + height: ScreenTools.defaultFontPixelWidth * 1.5 + radius: height * 0.5 + color: regColor + anchors.verticalCenter: parent.verticalCenter + } + QGCLabel { + text: regTitle + color: textColor + } + } + QGCLabel { + text: regText + color: textColor + anchors.left: parent.left + anchors.leftMargin: ScreenTools.defaultFontPixelWidth * 0.5 + anchors.right: parent.right + anchors.rightMargin: ScreenTools.defaultFontPixelWidth * 0.5 + wrapMode: Text.WordWrap + font.pointSize: ScreenTools.smallFontPointSize + } + } +} diff --git a/src/Airmap/QGroundControl.Airmap.qmldir b/src/Airmap/QGroundControl.Airmap.qmldir new file mode 100644 index 000000000..116917dfd --- /dev/null +++ b/src/Airmap/QGroundControl.Airmap.qmldir @@ -0,0 +1,4 @@ +Module QGroundControl.Airmap + +AirspaceControl 1.0 AirspaceControl.qml +AirspaceRegulation 1.0 AirspaceRegulation.qml diff --git a/src/Airmap/images/advisory-icon.svg b/src/Airmap/images/advisory-icon.svg new file mode 100644 index 000000000..9141d18db --- /dev/null +++ b/src/Airmap/images/advisory-icon.svg @@ -0,0 +1,21 @@ + + + + +Page 1 +Created with Sketch. + + + + + + diff --git a/src/Airmap/images/pencil.svg b/src/Airmap/images/pencil.svg new file mode 100644 index 000000000..2b98ce6ff --- /dev/null +++ b/src/Airmap/images/pencil.svg @@ -0,0 +1,17 @@ + + + + + + diff --git a/src/PlanView/PlanView.qml b/src/PlanView/PlanView.qml index 53c2c2ded..ef8c4a14f 100644 --- a/src/PlanView/PlanView.qml +++ b/src/PlanView/PlanView.qml @@ -25,6 +25,7 @@ import QGroundControl.FactControls 1.0 import QGroundControl.Palette 1.0 import QGroundControl.Mavlink 1.0 import QGroundControl.Controllers 1.0 +import QGroundControl.Airmap 1.0 /// Mission Editor @@ -34,8 +35,9 @@ QGCView { z: QGroundControl.zOrderTopMost readonly property int _decimalPlaces: 8 - readonly property real _horizontalMargin: ScreenTools.defaultFontPixelWidth / 2 + readonly property real _horizontalMargin: ScreenTools.defaultFontPixelWidth * 0.5 readonly property real _margin: ScreenTools.defaultFontPixelHeight * 0.5 + readonly property real _radius: ScreenTools.defaultFontPixelWidth * 0.5 readonly property var _activeVehicle: QGroundControl.multiVehicleManager.activeVehicle readonly property real _rightPanelWidth: Math.min(parent.width / 3, ScreenTools.defaultFontPixelWidth * 30) readonly property real _toolButtonTopMargin: parent.height - ScreenTools.availableHeight + (ScreenTools.defaultFontPixelHeight / 2) @@ -303,7 +305,7 @@ QGCView { planView: true // This is the center rectangle of the map which is not obscured by tools - property rect centerViewport: Qt.rect(_leftToolWidth, _toolbarHeight, editorMap.width - _leftToolWidth - _rightPanelWidth, editorMap.height - _statusHeight - _toolbarHeight) + property rect centerViewport: Qt.rect(_leftToolWidth, _toolbarHeight, editorMap.width - _leftToolWidth - _rightPanelWidth, editorMap.height - _statusHeight - _toolbarHeight) property real _leftToolWidth: toolStrip.x + toolStrip.width property real _statusHeight: waypointValuesDisplay.visible ? editorMap.height - waypointValuesDisplay.y : 0 @@ -480,165 +482,65 @@ QGCView { } } } - } // FlightMap - + } + //----------------------------------------------------------- // Right pane for mission editing controls Rectangle { id: rightPanel - anchors.bottom: parent.bottom - anchors.right: parent.right height: ScreenTools.availableHeight width: _rightPanelWidth color: qgcPal.window opacity: 0.2 + anchors.bottom: parent.bottom + anchors.right: parent.right + anchors.rightMargin: ScreenTools.defaultFontPixelWidth } - Item { - anchors.fill: rightPanel - - // Plan Element selector (Mission/Fence/Rally) - Row { - id: planElementSelectorRow - anchors.topMargin: Math.round(ScreenTools.defaultFontPixelHeight / 3) - anchors.top: parent.top + anchors.fill: rightPanel + Column { + id: rightControls + spacing: ScreenTools.defaultFontPixelHeight * 0.25 anchors.left: parent.left anchors.right: parent.right - spacing: _horizontalMargin - visible: QGroundControl.corePlugin.options.enablePlanViewSelector - - readonly property real _buttonRadius: ScreenTools.defaultFontPixelHeight * 0.75 - - ExclusiveGroup { - id: planElementSelectorGroup - onCurrentChanged: { - switch (current) { - case planElementMission: - _editingLayer = _layerMission - break - case planElementGeoFence: - _editingLayer = _layerGeoFence - break - case planElementRallyPoints: - _editingLayer = _layerRallyPoints - break - } - } - } - - QGCRadioButton { - id: planElementMission - exclusiveGroup: planElementSelectorGroup - text: qsTr("Mission") - checked: true - color: mapPal.text - textStyle: Text.Outline - textStyleColor: mapPal.textOutline - } - - Item { height: 1; width: 1 } - - QGCRadioButton { - id: planElementGeoFence - exclusiveGroup: planElementSelectorGroup - text: qsTr("Fence") - color: mapPal.text - textStyle: Text.Outline - textStyleColor: mapPal.textOutline - } - - Item { height: 1; width: 1 } - - QGCRadioButton { - id: planElementRallyPoints - exclusiveGroup: planElementSelectorGroup - text: qsTr("Rally") - color: mapPal.text - textStyle: Text.Outline - textStyleColor: mapPal.textOutline + anchors.top: parent.top + anchors.topMargin: ScreenTools.defaultFontPixelHeight * 0.25 + //------------------------------------------------------- + // Airmap Airspace Control + AirspaceControl { + width: parent.width } - } // Row - Plan Element Selector - - // Mission Item Editor - Item { - id: missionItemEditor - anchors.topMargin: ScreenTools.defaultFontPixelHeight / 2 - anchors.top: planElementSelectorRow.visible ? planElementSelectorRow.bottom : planElementSelectorRow.top - anchors.left: parent.left - anchors.right: parent.right - anchors.bottom: parent.bottom - visible: _editingLayer == _layerMission - - QGCListView { - id: missionItemEditorListView - anchors.fill: parent - spacing: _margin / 2 - orientation: ListView.Vertical - model: _missionController.visualItems - cacheBuffer: Math.max(height * 2, 0) - clip: true - currentIndex: _missionController.currentPlanViewIndex - highlightMoveDuration: 250 - - delegate: MissionItemEditor { - map: editorMap - masterController: _planMasterController - missionItem: object - width: parent.width - readOnly: false - rootQgcView: _qgcView - - onClicked: _missionController.setCurrentPlanViewIndex(object.sequenceNumber, false) - - onRemove: { - var removeIndex = index - _missionController.removeMissionItem(removeIndex) - if (removeIndex >= _missionController.visualItems.count) { - removeIndex-- - } - _missionController.setCurrentPlanViewIndex(removeIndex, true) + //------------------------------------------------------- + // Mission Controls (Colapsed) + Rectangle { + id: planColapsed + width: parent.width + height: colapsedRow.height + ScreenTools.defaultFontPixelHeight + color: qgcPal.missionItemEditor + radius: _radius + Row { + id: colapsedRow + spacing: ScreenTools.defaultFontPixelWidth + anchors.left: parent.left + anchors.leftMargin: ScreenTools.defaultFontPixelWidth + anchors.verticalCenter: parent.verticalCenter + QGCColoredImage { + width: height + height: ScreenTools.defaultFontPixelWidth * 2.5 + sourceSize.height: height + source: "qrc:/res/waypoint.svg" + color: qgcPal.text + anchors.verticalCenter: parent.verticalCenter + } + QGCLabel { + id: colapsedPlanLabel + text: qsTr("Plan") + color: qgcPal.text + anchors.verticalCenter: parent.verticalCenter } - - onInsertWaypoint: insertSimpleMissionItem(editorMap.center, index) - onInsertComplexItem: insertComplexMissionItem(complexItemName, editorMap.center, index) } - } // QGCListView - } // Item - Mission Item editor - - // GeoFence Editor - GeoFenceEditor { - anchors.topMargin: ScreenTools.defaultFontPixelHeight / 2 - anchors.top: planElementSelectorRow.bottom - anchors.left: parent.left - anchors.right: parent.right - availableHeight: ScreenTools.availableHeight - myGeoFenceController: _geoFenceController - flightMap: editorMap - visible: _editingLayer == _layerGeoFence - } - - // Rally Point Editor - - RallyPointEditorHeader { - id: rallyPointHeader - anchors.topMargin: ScreenTools.defaultFontPixelHeight / 2 - anchors.top: planElementSelectorRow.bottom - anchors.left: parent.left - anchors.right: parent.right - visible: _editingLayer == _layerRallyPoints - controller: _rallyPointController - } - - RallyPointItemEditor { - id: rallyPointEditor - anchors.topMargin: ScreenTools.defaultFontPixelHeight / 2 - anchors.top: rallyPointHeader.bottom - anchors.left: parent.left - anchors.right: parent.right - visible: _editingLayer == _layerRallyPoints && _rallyPointController.points.count - rallyPoint: _rallyPointController.currentRallyPoint - controller: _rallyPointController + } } - } // Right panel + } MapScale { id: mapScale -- 2.22.0