Unverified Commit 6762622d authored by Don Gagne's avatar Don Gagne Committed by GitHub

Merge pull request #8552 from DonLakeFlyer/PlanViewTweals

Plan: Visual tweaks for mission items
parents 860915f7 edd8f9d0
...@@ -16,7 +16,7 @@ import QGroundControl.Palette 1.0 ...@@ -16,7 +16,7 @@ import QGroundControl.Palette 1.0
/// Mission item edit control /// Mission item edit control
Rectangle { Rectangle {
id: _root id: _root
height: editorLoader.visible ? (editorLoader.y + editorLoader.height + (_margin * 2)) : (commandPicker.y + commandPicker.height + _margin / 2) height: editorLoader.visible ? (editorLoader.y + editorLoader.height + _innerMargin) : (topRowLayout.y + topRowLayout.height + _margin)
color: _currentItem ? qgcPal.missionItemEditor : qgcPal.windowShade color: _currentItem ? qgcPal.missionItemEditor : qgcPal.windowShade
radius: _radius radius: _radius
opacity: _currentItem ? 1.0 : 0.7 opacity: _currentItem ? 1.0 : 0.7
...@@ -42,11 +42,12 @@ Rectangle { ...@@ -42,11 +42,12 @@ Rectangle {
property bool _readyForSave: missionItem.readyForSaveState === VisualMissionItem.ReadyForSave property bool _readyForSave: missionItem.readyForSaveState === VisualMissionItem.ReadyForSave
property var _activeVehicle: QGroundControl.multiVehicleManager.activeVehicle property var _activeVehicle: QGroundControl.multiVehicleManager.activeVehicle
readonly property real _editFieldWidth: Math.min(width - _margin * 2, ScreenTools.defaultFontPixelWidth * 12) readonly property real _editFieldWidth: Math.min(width - _innerMargin * 2, ScreenTools.defaultFontPixelWidth * 12)
readonly property real _margin: ScreenTools.defaultFontPixelWidth / 2 readonly property real _margin: ScreenTools.defaultFontPixelWidth / 2
readonly property real _innerMargin: 2
readonly property real _radius: ScreenTools.defaultFontPixelWidth / 2 readonly property real _radius: ScreenTools.defaultFontPixelWidth / 2
readonly property real _hamburgerSize: commandPicker.height * 0.75 readonly property real _hamburgerSize: commandPicker.height * 0.75
readonly property real _trashSize: commandPicker.height * 0.75 readonly property real _trashSize: commandPicker.height * 0.75
readonly property bool _waypointsOnlyMode: QGroundControl.corePlugin.options.missionWaypointsOnly readonly property bool _waypointsOnlyMode: QGroundControl.corePlugin.options.missionWaypointsOnly
QGCPalette { QGCPalette {
...@@ -76,211 +77,213 @@ Rectangle { ...@@ -76,211 +77,213 @@ Rectangle {
} }
} }
Rectangle { Row {
id: notReadyForSaveIndicator id: topRowLayout
anchors.verticalCenter: notReadyForSaveLabel.visible ? notReadyForSaveLabel.verticalCenter : commandPicker.verticalCenter anchors.margins: _margin
anchors.leftMargin: _margin anchors.left: parent.left
anchors.left: parent.left anchors.right: parent.right
width: readyForSaveLabel.contentHeight anchors.top: parent.top
height: width spacing: _margin
border.width: 1
border.color: qgcPal.warningText
color: "white"
radius: width / 2
visible: !_readyForSave
QGCLabel {
id: readyForSaveLabel
anchors.centerIn: parent
//: Indicator in Plan view to show mission item is not ready for save/send
text: qsTr("?")
color: qgcPal.warningText
font.pointSize: ScreenTools.smallFontPointSize
}
}
QGCLabel {
id: notReadyForSaveLabel
anchors.margins: _margin
anchors.left: notReadyForSaveIndicator.right
anchors.right: parent.right
anchors.top: commandPicker.bottom
visible: _currentItem && !_readyForSave
text: missionItem.readyForSaveState === VisualMissionItem.NotReadyForSaveTerrain ?
qsTr("Incomplete: Waiting on terrain data.") :
qsTr("Incomplete: Item not fully specified.")
wrapMode: Text.WordWrap
horizontalAlignment: Text.AlignHCenter
color: qgcPal.warningText
}
QGCColoredImage {
id: hamburger
anchors.rightMargin: ScreenTools.defaultFontPixelWidth
anchors.right: parent.right
anchors.verticalCenter: commandPicker.verticalCenter
width: _hamburgerSize
height: _hamburgerSize
sourceSize.height: _hamburgerSize
source: "qrc:/qmlimages/Hamburger.svg"
visible: missionItem.isCurrentItem && missionItem.sequenceNumber !== 0
color: qgcPal.text
}
QGCMouseArea {
fillItem: hamburger
visible: hamburger.visible
onClicked: {
currentItemScope.focus = true
hamburgerMenu.popup()
}
QGCMenu {
id: hamburgerMenu
QGCMenuItem { Rectangle {
text: qsTr("Move to vehicle position") id: notReadyForSaveIndicator
visible: missionItem.specifiesCoordinate anchors.verticalCenter: parent.verticalCenter
enabled: _activeVehicle width: readyForSaveLabel.contentHeight
onTriggered: missionItem.coordinate = _activeVehicle.coordinate height: width
border.width: 1
border.color: qgcPal.warningText
color: "white"
radius: width / 2
visible: !_readyForSave
QGCLabel {
id: readyForSaveLabel
anchors.centerIn: parent
//: Indicator in Plan view to show mission item is not ready for save/send
text: qsTr("?")
color: qgcPal.warningText
font.pointSize: ScreenTools.smallFontPointSize
} }
}
QGCMenuItem { QGCColoredImage {
text: qsTr("Move to previous item position") id: deleteButton
visible: _missionController.previousCoordinate.isValid anchors.verticalCenter: parent.verticalCenter
onTriggered: missionItem.coordinate = _missionController.previousCoordinate height: _hamburgerSize
width: height
sourceSize.height: height
fillMode: Image.PreserveAspectFit
mipmap: true
smooth: true
color: qgcPal.text
visible: _currentItem && missionItem.sequenceNumber !== 0
source: "/res/TrashDelete.svg"
QGCMouseArea {
fillItem: parent
onClicked: remove()
} }
}
QGCMenuItem { Item {
text: qsTr("Edit position...") id: commandPicker
visible: missionItem.specifiesCoordinate anchors.verticalCenter: parent.verticalCenter
onTriggered: mainWindow.showComponentDialog(editPositionDialog, qsTr("Edit Position"), mainWindow.showDialogDefaultWidth, StandardButton.Close) height: ScreenTools.implicitComboBoxHeight
width: innerLayout.width
visible: !commandLabel.visible
RowLayout {
id: innerLayout
anchors.verticalCenter: parent.verticalCenter
spacing: _padding
property real _padding: ScreenTools.comboBoxPadding
QGCLabel { text: missionItem.commandName }
QGCColoredImage {
height: ScreenTools.defaultFontPixelWidth
width: height
fillMode: Image.PreserveAspectFit
smooth: true
antialiasing: true
color: qgcPal.text
source: "/qmlimages/arrow-down.png"
}
} }
QGCMenuSeparator { QGCMouseArea {
visible: missionItem.isSimpleItem && !_waypointsOnlyMode fillItem: parent
onClicked: mainWindow.showComponentDialog(commandDialog, qsTr("Select Mission Command"), mainWindow.showDialogDefaultWidth, StandardButton.Cancel)
} }
QGCMenuItem { Component {
text: qsTr("Show all values") id: commandDialog
checkable: true
checked: missionItem.isSimpleItem ? missionItem.rawEdit : false
visible: missionItem.isSimpleItem && !_waypointsOnlyMode
onTriggered: { MissionCommandDialog {
if (missionItem.rawEdit) { missionItem: _root.missionItem
if (missionItem.friendlyEditAllowed) { map: _root.map
missionItem.rawEdit = false // FIXME: Disabling fly through commands doesn't work since you may need to change from an RTL to something else
} else { flyThroughCommandsAllowed: true //_missionController.flyThroughCommandsAllowed
mainWindow.showMessageDialog(qsTr("Mission Edit"), qsTr("You have made changes to the mission item which cannot be shown in Simple Mode"))
}
} else {
missionItem.rawEdit = true
}
checked = missionItem.rawEdit
} }
} }
}
QGCMenuItem { QGCLabel {
text: qsTr("Item #%1").arg(missionItem.sequenceNumber) id: commandLabel
enabled: false anchors.verticalCenter: parent.verticalCenter
} width: commandPicker.width
height: commandPicker.height
visible: !missionItem.isCurrentItem || !missionItem.isSimpleItem || _waypointsOnlyMode || missionItem.isTakeoffItem
verticalAlignment: Text.AlignVCenter
text: missionItem.commandName
color: _outerTextColor
} }
} }
QGCColoredImage { QGCColoredImage {
id: deleteButton id: hamburger
anchors.margins: _margin anchors.margins: _margin
anchors.left: parent.left anchors.right: parent.right
anchors.verticalCenter: commandPicker.verticalCenter anchors.verticalCenter: parent.verticalCenter
width: _hamburgerSize
height: _hamburgerSize height: _hamburgerSize
width: height sourceSize.height: _hamburgerSize
sourceSize.height: height source: "qrc:/qmlimages/Hamburger.svg"
fillMode: Image.PreserveAspectFit visible: missionItem.isCurrentItem && missionItem.sequenceNumber !== 0
mipmap: true
smooth: true
color: qgcPal.text color: qgcPal.text
visible: _currentItem && missionItem.sequenceNumber !== 0
source: "/res/TrashDelete.svg"
QGCMouseArea { QGCMouseArea {
fillItem: parent fillItem: hamburger
onClicked: remove() onClicked: {
} currentItemScope.focus = true
} hamburgerMenu.popup()
}
Rectangle { QGCMenu {
id: commandPicker id: hamburgerMenu
anchors.margins: _margin
anchors.left: deleteButton.right
anchors.top: parent.top
height: ScreenTools.implicitComboBoxHeight
width: innerLayout.x + innerLayout.width + ScreenTools.comboBoxPadding
visible: !commandLabel.visible
color: qgcPal.window
border.width: 1
border.color: qgcPal.text
RowLayout {
id: innerLayout
anchors.margins: _padding
anchors.left: parent.left
anchors.verticalCenter: parent.verticalCenter
spacing: _padding
property real _padding: ScreenTools.comboBoxPadding QGCMenuItem {
text: qsTr("Move to vehicle position")
visible: missionItem.specifiesCoordinate
enabled: _activeVehicle
onTriggered: missionItem.coordinate = _activeVehicle.coordinate
}
QGCLabel { text: missionItem.commandName } QGCMenuItem {
text: qsTr("Move to previous item position")
visible: _missionController.previousCoordinate.isValid
onTriggered: missionItem.coordinate = _missionController.previousCoordinate
}
QGCColoredImage { QGCMenuItem {
height: ScreenTools.defaultFontPixelWidth text: qsTr("Edit position...")
width: height visible: missionItem.specifiesCoordinate
fillMode: Image.PreserveAspectFit onTriggered: mainWindow.showComponentDialog(editPositionDialog, qsTr("Edit Position"), mainWindow.showDialogDefaultWidth, StandardButton.Close)
smooth: true }
antialiasing: true
color: qgcPal.text
source: "/qmlimages/arrow-down.png"
}
}
QGCMouseArea { QGCMenuSeparator {
fillItem: parent visible: missionItem.isSimpleItem && !_waypointsOnlyMode
onClicked: mainWindow.showComponentDialog(commandDialog, qsTr("Select Mission Command"), mainWindow.showDialogDefaultWidth, StandardButton.Cancel) }
}
Component { QGCMenuItem {
id: commandDialog text: qsTr("Show all values")
checkable: true
checked: missionItem.isSimpleItem ? missionItem.rawEdit : false
visible: missionItem.isSimpleItem && !_waypointsOnlyMode
onTriggered: {
if (missionItem.rawEdit) {
if (missionItem.friendlyEditAllowed) {
missionItem.rawEdit = false
} else {
mainWindow.showMessageDialog(qsTr("Mission Edit"), qsTr("You have made changes to the mission item which cannot be shown in Simple Mode"))
}
} else {
missionItem.rawEdit = true
}
checked = missionItem.rawEdit
}
}
MissionCommandDialog { QGCMenuItem {
missionItem: _root.missionItem text: qsTr("Item #%1").arg(missionItem.sequenceNumber)
map: _root.map enabled: false
// FIXME: Disabling fly through commands doesn't work since you may need to change from an RTL to something else }
flyThroughCommandsAllowed: true //_missionController.flyThroughCommandsAllowed
} }
} }
} }
/*
QGCLabel { QGCLabel {
id: commandLabel id: notReadyForSaveLabel
anchors.leftMargin: ScreenTools.comboBoxPadding anchors.margins: _margin
anchors.fill: commandPicker anchors.left: notReadyForSaveIndicator.right
visible: !missionItem.isCurrentItem || !missionItem.isSimpleItem || _waypointsOnlyMode || missionItem.isTakeoffItem anchors.right: parent.right
verticalAlignment: Text.AlignVCenter anchors.top: commandPicker.bottom
text: missionItem.commandName visible: _currentItem && !_readyForSave
color: _outerTextColor text: missionItem.readyForSaveState === VisualMissionItem.NotReadyForSaveTerrain ?
qsTr("Incomplete: Waiting on terrain data.") :
qsTr("Incomplete: Item not fully specified.")
wrapMode: Text.WordWrap
horizontalAlignment: Text.AlignHCenter
color: qgcPal.warningText
} }
*/
Loader { Loader {
id: editorLoader id: editorLoader
anchors.margins: _margin anchors.margins: _innerMargin
anchors.left: parent.left anchors.left: parent.left
anchors.top: _readyForSave ? commandPicker.bottom : notReadyForSaveLabel.bottom anchors.top: topRowLayout.bottom
source: missionItem.editorQml source: missionItem.editorQml
visible: _currentItem visible: _currentItem
property var masterController: _masterController property var masterController: _masterController
property real availableWidth: _root.width - (_margin * 2) ///< How wide the editor should be property real availableWidth: _root.width - (anchors.margins * 2) ///< How wide the editor should be
property var editorRoot: _root property var editorRoot: _root
} }
} // Rectangle } // Rectangle
...@@ -49,7 +49,7 @@ Item { ...@@ -49,7 +49,7 @@ Item {
property bool _addWaypointOnClick: false property bool _addWaypointOnClick: false
property bool _addROIOnClick: false property bool _addROIOnClick: false
property bool _singleComplexItem: _missionController.complexMissionItemNames.length === 1 property bool _singleComplexItem: _missionController.complexMissionItemNames.length === 1
property int _editingLayer: bar.currentIndex ? _layers[bar.currentIndex] : _layerMission property int _editingLayer: layerTabBar.currentIndex ? _layers[layerTabBar.currentIndex] : _layerMission
property int _toolStripBottom: toolStrip.height + toolStrip.y property int _toolStripBottom: toolStrip.height + toolStrip.y
property var _appSettings: QGroundControl.settingsManager.appSettings property var _appSettings: QGroundControl.settingsManager.appSettings
property var _planViewSettings: QGroundControl.settingsManager.planViewSettings property var _planViewSettings: QGroundControl.settingsManager.planViewSettings
...@@ -704,7 +704,7 @@ Item { ...@@ -704,7 +704,7 @@ Item {
height: parent.height height: parent.height
width: _rightPanelWidth width: _rightPanelWidth
color: qgcPal.window color: qgcPal.window
opacity: planExpanded.visible ? 0.2 : 0 opacity: layerTabBar.visible ? 0.2 : 0
anchors.bottom: parent.bottom anchors.bottom: parent.bottom
anchors.right: parent.right anchors.right: parent.right
anchors.rightMargin: _toolsMargin anchors.rightMargin: _toolsMargin
...@@ -781,38 +781,21 @@ Item { ...@@ -781,38 +781,21 @@ Item {
} }
//------------------------------------------------------- //-------------------------------------------------------
// Mission Controls (Expanded) // Mission Controls (Expanded)
Rectangle { QGCTabBar {
id: planExpanded id: layerTabBar
width: parent.width width: parent.width
height: (!planControlColapsed || !_airspaceEnabled) ? bar.height + ScreenTools.defaultFontPixelHeight : 0
color: qgcPal.missionItemEditor
radius: _radius
visible: (!planControlColapsed || !_airspaceEnabled) && QGroundControl.corePlugin.options.enablePlanViewSelector visible: (!planControlColapsed || !_airspaceEnabled) && QGroundControl.corePlugin.options.enablePlanViewSelector
Item { Component.onCompleted: currentIndex = 0
height: bar.height QGCTabButton {
anchors.left: parent.left text: qsTr("Mission")
anchors.right: parent.right }
anchors.margins: ScreenTools.defaultFontPixelWidth QGCTabButton {
anchors.verticalCenter: parent.verticalCenter text: qsTr("Fence")
QGCTabBar { enabled: _geoFenceController.supported
id: bar }
width: parent.width QGCTabButton {
anchors.centerIn: parent text: qsTr("Rally")
Component.onCompleted: { enabled: _rallyPointController.supported
currentIndex = 0
}
QGCTabButton {
text: qsTr("Mission")
}
QGCTabButton {
text: qsTr("Fence")
enabled: _geoFenceController.supported
}
QGCTabButton {
text: qsTr("Rally")
enabled: _rallyPointController.supported
}
}
} }
} }
} }
......
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