Commit 55bf2f59 authored by Gus Grubba's avatar Gus Grubba

Added flight info and flight brief UI. It's not yet wired to live, real data.

parent a6ea3d79
......@@ -37,8 +37,8 @@ AirMapManager::AirMapManager(QGCApplication* app, QGCToolbox* toolbox)
{
_logger = std::make_shared<qt::Logger>();
qt::register_types(); // TODO: still needed?
_logger->logging_category().setEnabled(QtDebugMsg, true);
_logger->logging_category().setEnabled(QtInfoMsg, true);
_logger->logging_category().setEnabled(QtDebugMsg, false);
_logger->logging_category().setEnabled(QtInfoMsg, false);
_logger->logging_category().setEnabled(QtWarningMsg, true);
_dispatchingLogger = std::make_shared<qt::DispatchingLogger>(_logger);
connect(&_shared, &AirMapSharedState::error, this, &AirMapManager::_error);
......
......@@ -118,6 +118,7 @@ Item {
sourceSize.height: height
source: "qrc:/airmap/expand.svg"
color: _textColor
fillMode: Image.PreserveAspectFit
anchors.right: parent.right
anchors.rightMargin: ScreenTools.defaultFontPixelWidth
anchors.verticalCenter: parent.verticalCenter
......@@ -166,6 +167,7 @@ Item {
sourceSize.height: height
source: "qrc:/airmap/advisory-icon.svg"
color: _textColor
fillMode: Image.PreserveAspectFit
anchors.verticalCenter: parent.verticalCenter
}
Column {
......@@ -199,6 +201,7 @@ Item {
source: "qrc:/airmap/colapse.svg"
color: _textColor
visible: showColapse
fillMode: Image.PreserveAspectFit
anchors.right: parent.right
anchors.rightMargin: ScreenTools.defaultFontPixelWidth
anchors.verticalCenter: parent.verticalCenter
......@@ -244,7 +247,7 @@ Item {
anchors.rightMargin: ScreenTools.defaultFontPixelWidth * 0.5
Column {
id: regCol
spacing: ScreenTools.defaultFontPixelHeight * 0.5
spacing: ScreenTools.defaultFontPixelHeight * 0.25
anchors.left: parent.left
anchors.leftMargin: ScreenTools.defaultFontPixelWidth * 0.5
anchors.right: parent.right
......@@ -256,13 +259,12 @@ Item {
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
text: qsTr("Advisories based on the selected rules.")
color: _colorWhite
anchors.horizontalCenter: parent.horizontalCenter
font.pointSize: ScreenTools.smallFontPointSize
}
Item { width: 1; height: ScreenTools.defaultFontPixelHeight * 0.125; }
GridLayout {
columns: 2
anchors.left: parent.left
......@@ -280,6 +282,7 @@ Item {
sourceSize.height: height
source: "qrc:/airmap/pencil.svg"
color: _colorWhite
fillMode: Image.PreserveAspectFit
anchors.centerIn: parent
MouseArea {
anchors.fill: parent
......@@ -314,7 +317,7 @@ Item {
}
Flickable {
clip: true
height: ScreenTools.defaultFontPixelHeight * 8
height: ScreenTools.defaultFontPixelHeight * 6
contentHeight: advisoryCol.height
flickableDirection: Flickable.VerticalFlick
anchors.left: parent.left
......@@ -343,24 +346,16 @@ Item {
}
}
//-- Footer
Row {
spacing: ScreenTools.defaultFontPixelWidth * 2
QGCButton {
text: qsTr("File Flight Plan")
backRadius: 4
heightFactor: 0.3333
showBorder: true
width: ScreenTools.defaultFontPixelWidth * 16
anchors.horizontalCenter: parent.horizontalCenter
QGCButton {
text: qsTr("Details")
backRadius: 4
heightFactor: 0.3333
showBorder: true
enabled: _flightPermit !== AirspaceFlightPlanProvider.PermitNone
width: ScreenTools.defaultFontPixelWidth * 10
}
QGCButton {
text: qsTr("File Plan")
backRadius: 4
heightFactor: 0.3333
showBorder: true
enabled: _flightPermit !== AirspaceFlightPlanProvider.PermitNone
width: ScreenTools.defaultFontPixelWidth * 10
onClicked: {
rootLoader.sourceComponent = flightDetails
mainWindow.disableToolbar()
}
}
QGCLabel {
......@@ -547,4 +542,292 @@ Item {
}
}
}
//---------------------------------------------------------------
//-- Flight Details
Component {
id: flightDetails
Rectangle {
id: flightDetailsRoot
width: mainWindow.width
height: mainWindow.height
color: Qt.rgba(0,0,0,0.1)
property real flickHeight: ScreenTools.defaultFontPixelHeight * 22
property real flickWidth: ScreenTools.defaultFontPixelWidth * 40
MouseArea {
anchors.fill: parent
onWheel: { wheel.accepted = true; }
onPressed: { mouse.accepted = true; }
onReleased: { mouse.accepted = true; }
}
Rectangle {
id: flightDetailsShadow
anchors.fill: flightDetailsRect
radius: flightDetailsRect.radius
color: qgcPal.window
visible: false
}
DropShadow {
anchors.fill: flightDetailsShadow
visible: flightDetailsRect.visible
horizontalOffset: 4
verticalOffset: 4
radius: 32.0
samples: 65
color: Qt.rgba(0,0,0,0.75)
source: flightDetailsShadow
}
Rectangle {
id: flightDetailsRect
color: qgcPal.window
width: flDetailsRow.width + (ScreenTools.defaultFontPixelWidth * 4)
height: flDetailsRow.height + (ScreenTools.defaultFontPixelHeight * 2)
radius: ScreenTools.defaultFontPixelWidth
anchors.centerIn: parent
Row {
id: flDetailsRow
spacing: ScreenTools.defaultFontPixelWidth
anchors.centerIn: parent
//---------------------------------------------------------
//-- Flight Details
Column {
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: flightDetailsRoot.flickWidth
height: flightDetailsRoot.flickHeight
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: 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: (timeSlider.value * 0.25).toFixed(0)
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
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")
}
Repeater {
model: [1, 2, 3, 4, 5, 6]
delegate: FlightFeature {
anchors.right: parent.right
anchors.left: parent.left
}
}
}
}
}
//---------------------------------------------------------
//-- Divider
Rectangle {
color: qgcPal.text
width: 1
height: parent.height
opacity: 0.25
anchors.verticalCenter: parent.verticalCenter
}
//---------------------------------------------------------
//-- Flight Brief
Column {
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: flightDetailsRoot.flickWidth
height: flightDetailsRoot.flickHeight - 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: dateRect.height
Column {
id: authCol
spacing: ScreenTools.defaultFontPixelHeight * 0.25
anchors.margins: ScreenTools.defaultFontPixelWidth
anchors.right: parent.right
anchors.left: parent.left
anchors.verticalCenter: parent.verticalCenter
QGCLabel {
text: qsTr("Federal Aviation Administration")
}
QGCLabel {
text: qsTr("Automatic authorization to fly in controlled airspace")
font.pointSize: ScreenTools.smallFontPointSize
}
}
}
Item { width: 1; height: ScreenTools.defaultFontPixelHeight * 0.25; }
QGCLabel {
text: qsTr("Rules & Compliance")
}
ComplianceRules {
text: qsTr("Rules you may be violating")
anchors.right: parent.right
anchors.left: parent.left
}
ComplianceRules {
text: qsTr("Rules needing more information")
anchors.right: parent.right
anchors.left: parent.left
}
ComplianceRules {
text: qsTr("Rules you should review")
anchors.right: parent.right
anchors.left: parent.left
}
ComplianceRules {
text: qsTr("Rules you are following")
anchors.right: parent.right
anchors.left: parent.left
}
}
}
//-------------------------------------------------------------
//-- File Flight Plan or Close
Item { width: 1; height: ScreenTools.defaultFontPixelHeight; }
Row {
id: buttonRow
spacing: ScreenTools.defaultFontPixelWidth * 2
anchors.horizontalCenter: parent.horizontalCenter
QGCButton {
text: qsTr("Submit Plan")
backRadius: 4
heightFactor: 0.3333
showBorder: true
enabled: _flightPermit !== AirspaceFlightPlanProvider.PermitNone
width: ScreenTools.defaultFontPixelWidth * 12
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
}
}
}
}
}
}
Calendar {
id: datePicker
anchors.centerIn: parent
visible: false;
minimumDate: {
return new Date()
}
onClicked: {
visible = false;
}
}
Component.onCompleted: {
mainWindow.disableToolbar()
}
}
}
}
......@@ -31,6 +31,7 @@ Item {
source: _valid ? QGroundControl.airspaceManager.weatherInfo.icon : ""
color: contentColor
visible: _valid
fillMode: Image.PreserveAspectFit
anchors.verticalCenter: parent.verticalCenter
}
QGCLabel {
......
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
import QGroundControl.SettingsManager 1.0
Item {
id: _root
height: ScreenTools.defaultFontPixelHeight * 2
property alias text: title.text
readonly property color _colorOrange: "#d75e0d"
readonly property color _colorYellow: "#d7c61d"
readonly property color _colorRed: "#aa1200"
readonly property color _colorGreen: "#125f00"
QGCPalette {
id: qgcPal
colorGroupEnabled: enabled
}
Rectangle {
anchors.fill: parent
color: qgcPal.windowShade
}
Row {
spacing: ScreenTools.defaultFontPixelWidth * 2
anchors.verticalCenter: parent.verticalCenter
Rectangle {
height: _root.height
width: ScreenTools.defaultFontPixelWidth * 0.75
color: _colorGreen
}
QGCLabel {
id: title
anchors.verticalCenter: parent.verticalCenter
}
}
QGCColoredImage {
source: "qrc:/airmap/expand.svg"
height: ScreenTools.defaultFontPixelHeight
width: height
color: qgcPal.text
fillMode: Image.PreserveAspectFit
sourceSize.height: height
anchors.right: parent.right
anchors.rightMargin: ScreenTools.defaultFontPixelWidth
anchors.verticalCenter: parent.verticalCenter
}
}
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
import QGroundControl.SettingsManager 1.0
Rectangle {
id: _root
height: questionCol.height + (ScreenTools.defaultFontPixelHeight * 1.25)
color: qgcPal.windowShade
QGCPalette {
id: qgcPal
colorGroupEnabled: enabled
}
Column {
id: questionCol
spacing: ScreenTools.defaultFontPixelHeight * 0.5
anchors.centerIn: parent
QGCLabel {
text: "Question?"
anchors.left: questionText.left
}
QGCTextField {
id: questionText
width: _root.width - (ScreenTools.defaultFontPixelWidth * 2)
anchors.horizontalCenter: parent.horizontalCenter
}
}
}
......@@ -3,4 +3,6 @@ Module QGroundControl.Airmap
AirspaceControl 1.0 AirspaceControl.qml
AirspaceRegulation 1.0 AirspaceRegulation.qml
AirspaceWeather 1.0 AirspaceWeather.qml
RuleSelector 1.0 RuleSelector.qml
\ No newline at end of file
ComplianceRules 1.0 ComplianceRules.qml
FlightFeature 1.0 FlightFeature.qml
RuleSelector 1.0 RuleSelector.qml
......@@ -4,6 +4,8 @@
<file alias="QGroundControl/Airmap/AirspaceControl.qml">AirspaceControl.qml</file>
<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/FlightFeature.qml">FlightFeature.qml</file>
<file alias="QGroundControl/Airmap/qmldir">QGroundControl.Airmap.qmldir</file>
<file alias="QGroundControl/Airmap/RuleSelector.qml">RuleSelector.qml</file>
</qresource>
......
......@@ -9,6 +9,7 @@ Button {
property bool primary: false ///< primary button for a group of buttons
property real pointSize: ScreenTools.defaultFontPointSize ///< Point size for button text
property bool showBorder: _qgcPal.globalTheme === QGCPalette.Light
property bool iconLeft: false
property real backRadius: 0
property real heightFactor: 0.5
......@@ -73,31 +74,35 @@ Button {
/*! This defines the label of the button. */
label: Item {
implicitWidth: row.implicitWidth
implicitHeight: row.implicitHeight
baselineOffset: row.y + text.y + text.baselineOffset
implicitWidth: text.implicitWidth + icon.width
implicitHeight: text.implicitHeight
baselineOffset: text.y + text.baselineOffset
Row {
id: row
anchors.centerIn: parent
spacing: ScreenTools.defaultFontPixelWidth * 0.25
Image {
source: control.iconSource
anchors.verticalCenter: parent.verticalCenter
}
QGCColoredImage {
id: icon
source: control.iconSource
height: source === "" ? 0 : text.height
width: height
color: text.color
fillMode: Image.PreserveAspectFit
sourceSize.height: height
anchors.left: control.iconLeft ? parent.left : undefined
anchors.leftMargin: control.iconLeft ? ScreenTools.defaultFontPixelWidth : undefined
anchors.right: !control.iconLeft ? parent.right : undefined
anchors.rightMargin: !control.iconLeft ? ScreenTools.defaultFontPixelWidth : undefined
anchors.verticalCenter: parent.verticalCenter
}
Text {
id: text
anchors.verticalCenter: parent.verticalCenter
antialiasing: true
text: control.text
font.pointSize: pointSize
font.family: ScreenTools.normalFontFamily
color: _showHighlight ?
control._qgcPal.buttonHighlightText :
(primary ? control._qgcPal.primaryButtonText : control._qgcPal.buttonText)
}
Text {
id: text
anchors.centerIn: parent
antialiasing: true
text: control.text
font.pointSize: pointSize
font.family: ScreenTools.normalFontFamily
color: _showHighlight ?
control._qgcPal.buttonHighlightText :
(primary ? control._qgcPal.primaryButtonText : control._qgcPal.buttonText)
}
}
}
......
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