1
0
Fork 0

Hacking UI for FP entry

This commit is contained in:
James Turner 2018-07-05 09:02:02 +01:00
parent 5b73e9c7d0
commit 9716274612
11 changed files with 404 additions and 59 deletions

View file

@ -6,32 +6,16 @@ Item {
property bool showAddButton: false
property alias title: headerTitle.text
property alias title: header.title
property alias description: description.text
signal add();
implicitWidth: parent.width
implicitHeight: headerRect.height + Style.margin + description.height
implicitHeight: header.height + Style.margin + description.height
Rectangle {
id: headerRect
HeaderBox {
id: header
width: parent.width
height: headerTitle.height + (Style.margin * 2)
color: Style.themeColor
border.width: 1
border.color: Style.frameColor
Text {
id: headerTitle
color: "white"
anchors.verticalCenter: parent.verticalCenter
font.bold: true
font.pixelSize: Style.subHeadingFontPixelSize
anchors.left: parent.left
anchors.leftMargin: Style.inset
}
AddButton {
id: addButton
@ -46,7 +30,7 @@ Item {
StyledText {
id: description
width: parent.width
anchors.top: headerRect.bottom
anchors.top: header.bottom
anchors.topMargin: Style.margin
wrapMode: Text.WordWrap
}

View file

@ -0,0 +1,7 @@
import QtQuick 2.0
LineEdit
{
placeholder: "KSFO"
suggestedWidthString: "XXXX"
}

View file

@ -9,6 +9,7 @@ FocusScope {
property var value: new Date()
implicitHeight: label.implicitHeight
implicitWidth: label.implicitWidth + Style.margin + editFrame.width
function daysInMonth()
{
@ -32,14 +33,13 @@ FocusScope {
updateCurrentDate();
}
Text {
StyledText {
id: label
anchors.left: root.left
anchors.leftMargin: 8
anchors.leftMargin: Style.margin
anchors.verticalCenter: parent.verticalCenter
horizontalAlignment: Text.AlignRight
// color: mouseArea.containsMouse ? Style.themeColor :
// (root.enabled ? "black" : Style.inactiveThemeColor)
enabled: root.enabled
}
Rectangle {
@ -82,9 +82,10 @@ FocusScope {
onCommit: updateCurrentDate();
}
Text {
StyledText {
text: " / "
anchors.verticalCenter: parent.verticalCenter
enabled: root.enabled
}
DateTimeValueEdit {
@ -98,9 +99,10 @@ FocusScope {
onCommit: updateCurrentDate();
}
Text {
StyledText {
text: " / "
anchors.verticalCenter: parent.verticalCenter
enabled: root.enabled
}
DateTimeValueEdit {
@ -115,9 +117,10 @@ FocusScope {
}
// spacer here
Text {
StyledText {
text: " "
anchors.verticalCenter: parent.verticalCenter
enabled: root.enabled
}
DateTimeValueEdit {
@ -131,9 +134,10 @@ FocusScope {
onCommit: updateCurrentDate();
}
Text {
StyledText {
text: " : "
anchors.verticalCenter: parent.verticalCenter
enabled: root.enabled
}
DateTimeValueEdit {

213
src/GUI/qml/FlightPlan.qml Normal file
View file

@ -0,0 +1,213 @@
import QtQuick 2.4
import FlightGear.Launcher 1.0
import "."
Item {
Flickable {
id: flick
height: parent.height
width: parent.width - scrollbar.width
flickableDirection: Flickable.VerticalFlick
contentHeight: contents.childrenRect.height
Column
{
id: contents
width: parent.width - (Style.margin * 2)
x: Style.margin
spacing: Style.margin
HeaderBox {
title: qsTr("Aircraft & flight information")
width: parent.width
}
// date of flight << omit for now
Row {
height: aircraftIdent.height
width: parent.width
spacing: Style.margin
StyledText {
text: qsTr("Callsign / Flight No.")
anchors.verticalCenter: parent.verticalCenter
}
LineEdit {
// Aircraft identication - callsign (share with MP)
id: aircraftIdent
placeholder: "D-FGFS"
suggestedWidthString: "XXXXXX";
anchors.verticalCenter: parent.verticalCenter
}
Item { width: Style.strutSize; height: 1 }
StyledText {
text: qsTr("Aircraft type:")
anchors.verticalCenter: parent.verticalCenter
}
LineEdit {
placeholder: "B738"
suggestedWidthString: "XXXX";
anchors.verticalCenter: parent.verticalCenter
}
}
Row {
height: childrenRect.height
width: parent.width
spacing: Style.margin
PopupChoice {
id: flightRules
label: qsTr("Flight rules:")
model: ["VFR", "IFR"] // initially IFR (Y), initially VFR (Z)
}
Item { width: Style.strutSize; height: 1 }
PopupChoice {
id: flightType
label: qsTr("Flight type:")
model: [qsTr("Scheduled"),
qsTr("Non-scheduled"),
qsTr("General aviation"),
qsTr("Military"),
qsTr("Other")]
}
}
Row {
height: childrenRect.height
width: parent.width
spacing: Style.margin
PopupChoice {
id: wakeTurbulenceCategory
label: qsTr("Wake turbulence category:")
model: [qsTr("Light"),
qsTr("Medium"),
qsTr("Heavy"),
qsTr("Jumbo")]
}
// equipment
// - ideally prefill from acft
}
HeaderBox {
title: qsTr("Route")
width: parent.width
}
Row {
height: childrenRect.height
width: parent.width
spacing: Style.margin
AirportEntry {
label: qsTr("Departure airport:")
}
// padding
Item { width: Style.strutSize; height: 1 }
TimeEdit {
id: departureTime
label: qsTr("Departure time:")
}
}
// cruising speed + level
Row {
height: childrenRect.height
width: parent.width
spacing: Style.margin
IntegerSpinbox {
label: qsTr("Cruise speed:")
suffix: "kts"
min: 0
max: 10000 // more for spaceships?
step: 5
maxDigits: 5
}
// padding
Item { width: Style.strutSize; height: 1 }
LocationAltitudeRow {
}
}
StyledText {
width: parent.width
text: qsTr("Route")
}
PlainTextEditBox {
id: route
width: parent.width
}
Row {
height: childrenRect.height
width: parent.width
spacing: Style.margin
AirportEntry {
id: destinationICAO
label: qsTr("Destination airport:")
}
Item { width: Style.strutSize; height: 1 }
TimeEdit {
id: enrouteEstimate
label: qsTr("Estimate enroute time:")
}
Item { width: Style.strutSize; height: 1 }
AirportEntry {
id: alternate1
label: qsTr("Alternate airport:")
}
}
HeaderBox {
title: qsTr("Additional information")
width: parent.width
}
StyledText {
width: parent.width
text: qsTr("Remarks")
}
PlainTextEditBox {
id: remarks
width: parent.width
}
// speak to Act-pie guy about passing all this over MP props?
} // of main column
} // of flickable
Scrollbar {
id: scrollbar
anchors.right: parent.right
height: parent.height
flickable: flick
visible: flick.contentHeight > flick.height
}
}

23
src/GUI/qml/HeaderBox.qml Normal file
View file

@ -0,0 +1,23 @@
import QtQuick 2.4
import "."
Rectangle {
id: headerRect
implicitHeight: headerTitle.height + (Style.margin * 2)
property alias title: headerTitle.text
color: Style.themeColor
border.width: 1
border.color: Style.frameColor
Text {
id: headerTitle
color: "white"
anchors.verticalCenter: parent.verticalCenter
font.bold: true
font.pixelSize: Style.subHeadingFontPixelSize
anchors.left: parent.left
anchors.leftMargin: Style.inset
}
}

View file

@ -69,6 +69,13 @@ Item {
}
}
function enterFlightPlan()
{
sidebar.selectedPage = -1;
pageLoader.source = "qrc:///qml/FlightPlan.qml"
root.state = "loader";
}
Sidebar {
id: sidebar
width: Style.strutSize * 2
@ -141,6 +148,8 @@ Item {
MenuItem { text:qsTr("Save configuration as..."); shortcut: "Ctrl+S";
onTriggered: _launcher.saveConfigAs(); },
MenuDivider {},
MenuItem { text:qsTr("Flight-planning"); onTriggered: root.enterFlightPlan(); shortcut: "Ctrl+P"; enabled: false},
MenuDivider {},
MenuItem { text:qsTr("View command line"); onTriggered: _launcher.viewCommandLine(); shortcut: "Ctrl+L"},
MenuItem { text:qsTr("Select data files location..."); onTriggered: _launcher.requestChangeDataPath(); },
MenuItem { text:qsTr("Restore default settings..."); onTriggered: _launcher.requestRestoreDefaults(); },

View file

@ -50,7 +50,7 @@ Row {
PopupChoice {
id: altitudeTypeChoice
enabled: __rowEnabled && (location.altitudeType !== LocationController.Off)
enabled: __rowEnabled && (_location.altitudeType !== LocationController.Off)
currentIndex: Math.max(0, _location.altitudeType - 1)
readonly property bool isFlightLevel: (currentIndex == 2)

View file

@ -0,0 +1,38 @@
import QtQuick 2.4
import FlightGear.Launcher 1.0
import "."
Rectangle {
id: editFrame
property bool enabled: true
property alias placeholder: placeholderText.text
property alias text: edit.text
implicitHeight: edit.height + Style.margin
border.color: edit.activeFocus ? Style.frameColor : Style.minorFrameColor
border.width: 1
TextEdit {
id: edit
enabled: editFrame.enabled
anchors.verticalCenter: parent.verticalCenter
anchors.left: parent.left
anchors.right: parent.right
anchors.margins: Style.margin
height: Math.max(Style.strutSize * 4, implicitHeight)
textFormat: TextEdit.PlainText
font.family: "Courier"
selectByMouse: true
wrapMode: TextEdit.WordWrap
font.pixelSize: Style.baseFontPixelSize
color: Style.baseTextColor
StyledText {
id: placeholderText
visible: (edit.text.length == 0) && !edit.activeFocus
font.family: "Courier"
color: Style.disabledTextColor
}
}
}

View file

@ -60,36 +60,12 @@ SettingControl {
"page (for example, airport or altitude) will be ignored.");
}
Rectangle {
id: editFrame
height: edit.height + Style.margin
border.color: edit.activeFocus ? Style.frameColor : Style.minorFrameColor
border.width: 1
PlainTextEditBox
{
id: edit
width: parent.width
TextEdit {
id: edit
enabled: root.enabled
anchors.verticalCenter: parent.verticalCenter
anchors.left: parent.left
anchors.right: parent.right
anchors.margins: Style.margin
height: Math.max(Style.strutSize * 4, implicitHeight)
textFormat: TextEdit.PlainText
font.family: "Courier"
selectByMouse: true
wrapMode: TextEdit.WordWrap
font.pixelSize: Style.baseFontPixelSize
color: Style.baseTextColor
StyledText {
id: placeholder
visible: (edit.text.length == 0) && !edit.activeFocus
text: root.placeholder
font.family: "Courier"
color: Style.disabledTextColor
}
}
enabled: root.enabled
placeholder: root.placeholder
}
}

86
src/GUI/qml/TimeEdit.qml Normal file
View file

@ -0,0 +1,86 @@
import QtQuick 2.4
import "."
FocusScope {
id: root
property alias label: label.text
property bool enabled: true
property var value: new Date()
implicitHeight: label.implicitHeight
implicitWidth: label.implicitWidth + Style.margin + editFrame.width
function updateCurrentTime()
{
root.value = new Date(0, 0, 0, hours.value, minutes.value);
}
function setTime(date)
{
hours.value = date.getHours();
minutes.value = date.getMinutes();
updateCurrentTime();
}
StyledText {
id: label
anchors.left: root.left
anchors.leftMargin: Style.margin
anchors.verticalCenter: parent.verticalCenter
horizontalAlignment: Text.AlignRight
enabled: root.enabled
}
Rectangle {
id: editFrame
radius: Style.roundRadius
border.color: root.focus ? Style.themeColor : Style.minorFrameColor
border.width: 1
height: 30
anchors.left: label.right
anchors.leftMargin: Style.margin
anchors.verticalCenter: parent.verticalCenter
width: editRow.childrenRect.width + Style.roundRadius * 2 + 64
Row {
id: editRow
anchors {
left: parent.left
top: parent.top
bottom: parent.bottom
right: parent.right
margins: Style.margin
}
DateTimeValueEdit {
id: hours
minValue: 0
maxValue: 23
widthString: "00"
nextToFocus: minutes
anchors.verticalCenter: parent.verticalCenter
onCommit: updateCurrentTime();
}
Text {
text: " : "
anchors.verticalCenter: parent.verticalCenter
enabled: root.enabled
}
DateTimeValueEdit {
id: minutes
minValue: 0
maxValue: 59
widthString: "00"
anchors.verticalCenter: parent.verticalCenter
previousToFocus: hours
onCommit: updateCurrentTime();
}
} // of time elements row
}
}

View file

@ -109,6 +109,11 @@
<file>qml/LocationAltitudeRow.qml</file>
<file>qml/CatalogDelegate.qml</file>
<file alias="clear-text-icon">assets/icons8-clear-symbol-26.png</file>
<file>qml/FlightPlan.qml</file>
<file>qml/PlainTextEditBox.qml</file>
<file>qml/HeaderBox.qml</file>
<file>qml/TimeEdit.qml</file>
<file>qml/AirportEntry.qml</file>
</qresource>
<qresource prefix="/preview">
<file alias="close-icon">preview-close.png</file>