Commit 96792c7b authored by Gus Grubba's avatar Gus Grubba

Split Flight Brief and Flight Details into different components

Have different modes for the Airspace Widget (Plan/Fly)
parent b20f9be0
This diff is collapsed.
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.Airmap 1.0
import QGroundControl.Airspace 1.0
import QGroundControl.Controls 1.0
import QGroundControl.Palette 1.0
import QGroundControl.ScreenTools 1.0
import QGroundControl.SettingsManager 1.0
Item {
id: _root
implicitHeight: briefRootCol.height
implicitWidth: briefRootCol.width
property real baseHeight: ScreenTools.defaultFontPixelHeight * 22
property real baseWidth: ScreenTools.defaultFontPixelWidth * 40
Column {
id: briefRootCol
spacing: ScreenTools.defaultFontPixelHeight * 0.25
Rectangle {
color: qgcPal.windowShade
anchors.right: parent.right
anchors.left: parent.left
height: briefLabel.height + ScreenTools.defaultFontPixelHeight
QGCLabel {
id: briefLabel
text: qsTr("Flight Brief")
font.pointSize: ScreenTools.mediumFontPointSize
font.family: ScreenTools.demiboldFontFamily
anchors.centerIn: parent
}
}
Item { width: 1; height: ScreenTools.defaultFontPixelHeight * 0.5; }
Flickable {
clip: true
width: baseWidth
height: baseHeight - buttonRow.height - ScreenTools.defaultFontPixelHeight
contentHeight: briefCol.height
flickableDirection: Flickable.VerticalFlick
Column {
id: briefCol
spacing: ScreenTools.defaultFontPixelHeight * 0.5
anchors.right: parent.right
anchors.left: parent.left
QGCLabel {
text: qsTr("Authorizations")
}
Rectangle {
color: qgcPal.windowShade
anchors.right: parent.right
anchors.left: parent.left
height: authCol.height + ScreenTools.defaultFontPixelHeight
Column {
id: authCol
spacing: ScreenTools.defaultFontPixelHeight * 0.5
anchors.margins: ScreenTools.defaultFontPixelWidth
anchors.right: parent.right
anchors.left: parent.left
anchors.verticalCenter: parent.verticalCenter
QGCLabel {
text: qsTr("Federal Aviation Administration")
visible: _flightPermit !== AirspaceFlightPlanProvider.PermitNone
}
QGCLabel {
text: qsTr("Automatic authorization to fly in controlled airspace")
visible: _flightPermit !== AirspaceFlightPlanProvider.PermitNone
font.pointSize: ScreenTools.smallFontPointSize
}
Rectangle {
anchors.right: parent.right
anchors.left: parent.left
height: label.height + (ScreenTools.defaultFontPixelHeight * 0.5)
color: {
if(_flightPermit == AirspaceFlightPlanProvider.PermitPending)
return _colorOrange
if(_flightPermit == AirspaceFlightPlanProvider.PermitAccepted)
return _colorGreen
if(_flightPermit == AirspaceFlightPlanProvider.PermitRejected)
return _colorRed
return _colorGray
}
QGCLabel {
id: label
color: _colorWhite
text: {
if(_flightPermit === AirspaceFlightPlanProvider.PermitPending)
return qsTr("Authorization Pending")
if(_flightPermit === AirspaceFlightPlanProvider.PermitAccepted)
return qsTr("Authorization Accepted")
if(_flightPermit === AirspaceFlightPlanProvider.PermitRejected)
return qsTr("Authorization Rejected")
return qsTr("Authorization Unknown")
}
anchors.centerIn: parent
}
}
}
}
Item { width: 1; height: ScreenTools.defaultFontPixelHeight * 0.25; }
QGCLabel {
text: qsTr("Rules & Compliance")
visible: hasBriefRules()
}
ExclusiveGroup { id: ruleGroup }
ComplianceRules {
text: qsTr("Rules you may be violating")
rules: violationRules
visible: violationRules && violationRules.count
color: _colorRed
exclusiveGroup: ruleGroup
anchors.right: parent.right
anchors.left: parent.left
property var violationRules: QGroundControl.airspaceManager.flightPlan.rulesViolation
}
ComplianceRules {
text: qsTr("Rules needing more information")
rules: infoRules
color: _colorOrange
visible: infoRules && infoRules.count
exclusiveGroup: ruleGroup
anchors.right: parent.right
anchors.left: parent.left
property var infoRules: QGroundControl.airspaceManager.flightPlan.rulesInfo
}
ComplianceRules {
text: qsTr("Rules you should review")
rules: reviewRules
color: _colorYellow
visible: reviewRules && reviewRules.count
exclusiveGroup: ruleGroup
anchors.right: parent.right
anchors.left: parent.left
property var reviewRules: QGroundControl.airspaceManager.flightPlan.rulesReview
}
ComplianceRules {
text: qsTr("Rules you are following")
rules: followRules
color: _colorGreen
visible: followRules && followRules.count
exclusiveGroup: ruleGroup
anchors.right: parent.right
anchors.left: parent.left
property var followRules: QGroundControl.airspaceManager.flightPlan.rulesFollowing
}
}
}
//-------------------------------------------------------------
//-- File Flight Plan or Close
Item { width: 1; height: ScreenTools.defaultFontPixelHeight; }
Row {
id: buttonRow
spacing: ScreenTools.defaultFontPixelWidth
anchors.horizontalCenter: parent.horizontalCenter
QGCButton {
text: qsTr("Update Plan")
backRadius: 4
heightFactor: 0.3333
showBorder: true
enabled: _flightPermit !== AirspaceFlightPlanProvider.PermitNone && _dirty
visible: planView
width: ScreenTools.defaultFontPixelWidth * 12
onClicked: {
//-- TODO: Update Plan
mainWindow.enableToolbar()
rootLoader.sourceComponent = null
}
}
QGCButton {
text: qsTr("Submit Plan")
backRadius: 4
heightFactor: 0.3333
showBorder: true
enabled: _flightPermit !== AirspaceFlightPlanProvider.PermitNone
width: ScreenTools.defaultFontPixelWidth * 12
visible: planView
onClicked: {
//-- TODO: File Plan
mainWindow.enableToolbar()
rootLoader.sourceComponent = null
}
}
QGCButton {
text: qsTr("Close")
backRadius: 4
heightFactor: 0.3333
showBorder: true
width: ScreenTools.defaultFontPixelWidth * 12
onClicked: {
mainWindow.enableToolbar()
rootLoader.sourceComponent = null
}
}
}
}
}
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.Airmap 1.0
import QGroundControl.Airspace 1.0
import QGroundControl.Controls 1.0
import QGroundControl.Palette 1.0
import QGroundControl.ScreenTools 1.0
import QGroundControl.SettingsManager 1.0
Item {
id: _root
implicitHeight: detailCol.height
implicitWidth: detailCol.width
property real baseHeight: ScreenTools.defaultFontPixelHeight * 22
property real baseWidth: ScreenTools.defaultFontPixelWidth * 40
Column {
id: detailCol
spacing: ScreenTools.defaultFontPixelHeight * 0.25
Rectangle {
color: qgcPal.windowShade
anchors.right: parent.right
anchors.left: parent.left
height: detailsLabel.height + ScreenTools.defaultFontPixelHeight
QGCLabel {
id: detailsLabel
text: qsTr("Flight Details")
font.pointSize: ScreenTools.mediumFontPointSize
font.family: ScreenTools.demiboldFontFamily
anchors.centerIn: parent
}
}
Item { width: 1; height: ScreenTools.defaultFontPixelHeight * 0.5; }
Flickable {
clip: true
width: baseWidth
height: baseHeight
contentHeight: flContextCol.height
flickableDirection: Flickable.VerticalFlick
Column {
id: flContextCol
spacing: ScreenTools.defaultFontPixelHeight * 0.5
anchors.right: parent.right
anchors.left: parent.left
QGCLabel {
text: qsTr("Flight Date & Time")
}
Rectangle {
id: dateRect
color: qgcPal.windowShade
anchors.right: parent.right
anchors.left: parent.left
height: datePickerCol.height + (ScreenTools.defaultFontPixelHeight * 2)
Column {
id: datePickerCol
spacing: ScreenTools.defaultFontPixelHeight * 0.5
anchors.margins: ScreenTools.defaultFontPixelWidth
anchors.right: parent.right
anchors.left: parent.left
anchors.verticalCenter: parent.verticalCenter
QGCButton {
text: {
var today = new Date();
if(datePicker.selectedDate.setHours(0,0,0,0) === today.setHours(0,0,0,0)) {
return qsTr("Today")
} else {
return datePicker.selectedDate.toLocaleDateString(Qt.locale())
}
}
iconSource: "qrc:/airmap/expand.svg"
anchors.right: parent.right
anchors.left: parent.left
onClicked: {
_dirty = true
datePicker.visible = true
}
}
Item {
anchors.right: parent.right
anchors.left: parent.left
height: timeSlider.height
QGCLabel {
id: timeLabel
text: ('00' + hour).slice(-2) + ":" + ('00' + minute).slice(-2)
width: ScreenTools.defaultFontPixelWidth * 5
anchors.left: parent.left
anchors.verticalCenter: parent.verticalCenter
property int hour: Math.floor(timeSlider.value * 0.25)
property int minute: (timeSlider.value * 15) % 60
}
QGCSlider {
id: timeSlider
width: parent.width - timeLabel.width - ScreenTools.defaultFontPixelWidth
stepSize: 1
minimumValue: 0
maximumValue: 95 // 96 blocks of 15 minutes in 24 hours
anchors.right: parent.right
anchors.verticalCenter: parent.verticalCenter
onValueChanged: {
_dirty = true
}
Component.onCompleted: {
var today = new Date()
var val = (((today.getHours() * 60) + today.getMinutes()) * (96/1440)) + 1
if(val > 95) val = 95
value = Math.ceil(val)
}
}
}
}
}
Item { width: 1; height: ScreenTools.defaultFontPixelHeight * 0.25; }
QGCLabel {
text: qsTr("Flight Context")
visible: QGroundControl.airspaceManager.flightPlan.briefFeatures.count > 0
}
Repeater {
model: QGroundControl.airspaceManager.flightPlan.briefFeatures
visible: QGroundControl.airspaceManager.flightPlan.briefFeatures.count > 0
delegate: FlightFeature {
feature: object
visible: object && object.type !== AirspaceRuleFeature.Unknown && object.description !== "" && object.name !== ""
anchors.right: parent.right
anchors.left: parent.left
}
}
}
}
}
Calendar {
id: datePicker
anchors.centerIn: parent
visible: false;
minimumDate: {
return new Date()
}
onClicked: {
visible = false;
}
}
}
......@@ -6,3 +6,5 @@ AirspaceWeather 1.0 AirspaceWeather.qml
ComplianceRules 1.0 ComplianceRules.qml
FlightFeature 1.0 FlightFeature.qml
RuleSelector 1.0 RuleSelector.qml
FlightBrief 1.0 FlightBrief.qml
FlightDetails 1.0 FlightDetails.qml
\ No newline at end of file
......@@ -5,6 +5,8 @@
<file alias="QGroundControl/Airmap/AirspaceRegulation.qml">AirspaceRegulation.qml</file>
<file alias="QGroundControl/Airmap/AirspaceWeather.qml">AirspaceWeather.qml</file>
<file alias="QGroundControl/Airmap/ComplianceRules.qml">ComplianceRules.qml</file>
<file alias="QGroundControl/Airmap/FlightBrief.qml">FlightBrief.qml</file>
<file alias="QGroundControl/Airmap/FlightDetails.qml">FlightDetails.qml</file>
<file alias="QGroundControl/Airmap/FlightFeature.qml">FlightFeature.qml</file>
<file alias="QGroundControl/Airmap/qmldir">QGroundControl.Airmap.qmldir</file>
<file alias="QGroundControl/Airmap/RuleSelector.qml">RuleSelector.qml</file>
......
......@@ -139,6 +139,7 @@ Item {
AirspaceControl {
id: airspaceControl
width: getPreferredInstrumentWidth()
planView: false
visible: _airspaceEnabled
anchors.margins: ScreenTools.defaultFontPixelHeight * 0.5
}
......
......@@ -571,6 +571,7 @@ QGCView {
id: airspaceControl
width: parent.width
visible: _airspaceEnabled
planView: true
showColapse: true
}
//-------------------------------------------------------
......
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