Commit 6940e70c authored by Gus Grubba's avatar Gus Grubba

Plan View Work

Toggle Rally Point insertion on/off.
Highlight current Rally Point and current Waypoint.
Use tab bar instead of a row of radio buttons for selection (Mission, Fence, Rally).
Fix QGCHoverButton to handle proper checked state toggle.
Get rid of the many arrays used to define behaviors for the ToolStrip. They are now all defined within its model.
Fixed color for disabled text within ToolStrip (it was invisible)
parent 4dbbe70a
...@@ -581,9 +581,6 @@ Item { ...@@ -581,9 +581,6 @@ Item {
z: _mapAndVideo.z + 4 z: _mapAndVideo.z + 4
maxHeight: (_flightVideo.visible ? _flightVideo.y : parent.height) - toolStrip.y maxHeight: (_flightVideo.visible ? _flightVideo.y : parent.height) - toolStrip.y
buttonVisible: [true, _useChecklist, _guidedController.showTakeoff || !_guidedController.showLand, _guidedController.showLand && !_guidedController.showTakeoff, true, _guidedController.showPause, !_guidedController.showPause ]
buttonEnabled: [true, _useChecklist && activeVehicle && !activeVehicle.armed, _guidedController.showTakeoff, _guidedController.showLand, _guidedController.showRTL, _guidedController.showPause, _anyActionAvailable ]
property bool _anyActionAvailable: _guidedController.showStartMission || _guidedController.showResumeMission || _guidedController.showChangeAlt || _guidedController.showLandAbort property bool _anyActionAvailable: _guidedController.showStartMission || _guidedController.showResumeMission || _guidedController.showChangeAlt || _guidedController.showLandAbort
property var _actionModel: [ property var _actionModel: [
{ {
...@@ -622,34 +619,48 @@ Item { ...@@ -622,34 +619,48 @@ Item {
{ {
name: "Plan", name: "Plan",
iconSource: "/qmlimages/Plan.svg", iconSource: "/qmlimages/Plan.svg",
buttonVisible: true,
buttonEnabled: true,
}, },
{ {
name: "Checklist", name: "Checklist",
iconSource: "/qmlimages/check.svg", iconSource: "/qmlimages/check.svg",
buttonVisible: _useChecklist,
buttonEnabled: _useChecklist && activeVehicle && !activeVehicle.armed,
}, },
{ {
name: _guidedController.takeoffTitle, name: _guidedController.takeoffTitle,
iconSource: "/res/takeoff.svg", iconSource: "/res/takeoff.svg",
buttonVisible: _guidedController.showTakeoff || !_guidedController.showLand,
buttonEnabled: _guidedController.showTakeoff,
action: _guidedController.actionTakeoff action: _guidedController.actionTakeoff
}, },
{ {
name: _guidedController.landTitle, name: _guidedController.landTitle,
iconSource: "/res/land.svg", iconSource: "/res/land.svg",
buttonVisible: _guidedController.showLand && !_guidedController.showTakeoff,
buttonEnabled: _guidedController.showLand,
action: _guidedController.actionLand action: _guidedController.actionLand
}, },
{ {
name: _guidedController.rtlTitle, name: _guidedController.rtlTitle,
iconSource: "/res/rtl.svg", iconSource: "/res/rtl.svg",
buttonVisible: true,
buttonEnabled: _guidedController.showRTL,
action: _guidedController.actionRTL action: _guidedController.actionRTL
}, },
{ {
name: _guidedController.pauseTitle, name: _guidedController.pauseTitle,
iconSource: "/res/pause-mission.svg", iconSource: "/res/pause-mission.svg",
buttonVisible: _guidedController.showPause,
buttonEnabled: _guidedController.showPause,
action: _guidedController.actionPause action: _guidedController.actionPause
}, },
{ {
name: qsTr("Action"), name: qsTr("Action"),
iconSource: "/res/action.svg", iconSource: "/res/action.svg",
buttonVisible: !_guidedController.showPause,
buttonEnabled: _anyActionAvailable,
action: -1 action: -1
} }
] ]
......
...@@ -74,7 +74,7 @@ Rectangle { ...@@ -74,7 +74,7 @@ Rectangle {
QGCLabel { QGCLabel {
id: actionMessage id: actionMessage
text: modelData.text text: modelData.text ? modelData.text : ""
horizontalAlignment: Text.AlignHCenter horizontalAlignment: Text.AlignHCenter
wrapMode: Text.WordWrap wrapMode: Text.WordWrap
Layout.minimumWidth: _width Layout.minimumWidth: _width
......
...@@ -36,8 +36,8 @@ MapQuickItem { ...@@ -36,8 +36,8 @@ MapQuickItem {
gimbalYaw: missionItem.missionGimbalYaw gimbalYaw: missionItem.missionGimbalYaw
vehicleYaw: missionItem.missionVehicleYaw vehicleYaw: missionItem.missionVehicleYaw
showGimbalYaw: !isNaN(missionItem.missionGimbalYaw) showGimbalYaw: !isNaN(missionItem.missionGimbalYaw)
highlightSelected: true
onClicked: _item.clicked() onClicked: _item.clicked()
property bool _isCurrentItem: missionItem ? missionItem.isCurrentItem : false property bool _isCurrentItem: missionItem ? missionItem.isCurrentItem : false
} }
} }
...@@ -33,15 +33,12 @@ MapItemView { ...@@ -33,15 +33,12 @@ MapItemView {
parent._retaskSequence = object.sequenceNumber parent._retaskSequence = object.sequenceNumber
parent.flightWidgets.guidedModeBar.confirmAction(parent.flightWidgets.guidedModeBar.confirmRetask) parent.flightWidgets.guidedModeBar.confirmAction(parent.flightWidgets.guidedModeBar.confirmRetask)
} }
// These are the non-coordinate child mission items attached to this item // These are the non-coordinate child mission items attached to this item
Row { Row {
anchors.top: parent.top anchors.top: parent.top
anchors.left: parent.right anchors.left: parent.right
Repeater { Repeater {
model: object.childItems model: object.childItems
delegate: MissionItemIndexLabel { delegate: MissionItemIndexLabel {
label: object.abbreviation label: object.abbreviation
checked: object.isCurrentItem checked: object.isCurrentItem
......
...@@ -33,8 +33,8 @@ public: ...@@ -33,8 +33,8 @@ public:
Q_PROPERTY(QString editorQml READ editorQml CONSTANT) Q_PROPERTY(QString editorQml READ editorQml CONSTANT)
Q_PROPERTY(QObject* currentRallyPoint READ currentRallyPoint WRITE setCurrentRallyPoint NOTIFY currentRallyPointChanged) Q_PROPERTY(QObject* currentRallyPoint READ currentRallyPoint WRITE setCurrentRallyPoint NOTIFY currentRallyPointChanged)
Q_INVOKABLE void addPoint(QGeoCoordinate point); Q_INVOKABLE void addPoint (QGeoCoordinate point);
Q_INVOKABLE void removePoint(QObject* rallyPoint); Q_INVOKABLE void removePoint (QObject* rallyPoint);
bool supported (void) const final; bool supported (void) const final;
void save (QJsonObject& json) final; void save (QJsonObject& json) final;
......
This diff is collapsed.
...@@ -36,7 +36,7 @@ QGCFlickable { ...@@ -36,7 +36,7 @@ QGCFlickable {
anchors.left: parent.left anchors.left: parent.left
anchors.right: parent.right anchors.right: parent.right
anchors.top: editorLabel.bottom anchors.top: editorLabel.bottom
height: helpLabel.height + helpLabel.height + (_margin * 2) height: infoLabel.height + (_margin * 2)
color: qgcPal.windowShadeDark color: qgcPal.windowShadeDark
radius: _radius radius: _radius
...@@ -51,6 +51,7 @@ QGCFlickable { ...@@ -51,6 +51,7 @@ QGCFlickable {
text: qsTr("Rally Points provide alternate landing points when performing a Return to Launch (RTL).") text: qsTr("Rally Points provide alternate landing points when performing a Return to Launch (RTL).")
} }
/*
QGCLabel { QGCLabel {
id: helpLabel id: helpLabel
anchors.margins: _margin anchors.margins: _margin
...@@ -62,6 +63,7 @@ QGCFlickable { ...@@ -62,6 +63,7 @@ QGCFlickable {
qsTr("Click in the map to add new rally points.") : qsTr("Click in the map to add new rally points.") :
qsTr("This vehicle does not support Rally Points.") qsTr("This vehicle does not support Rally Points.")
} }
*/
} }
} }
} }
...@@ -14,11 +14,13 @@ Rectangle { ...@@ -14,11 +14,13 @@ Rectangle {
color: _currentItem ? qgcPal.missionItemEditor : qgcPal.windowShade color: _currentItem ? qgcPal.missionItemEditor : qgcPal.windowShade
radius: _radius radius: _radius
signal clicked()
property var rallyPoint ///< RallyPoint object associated with editor property var rallyPoint ///< RallyPoint object associated with editor
property var controller ///< RallyPointController property var controller ///< RallyPointController
property bool _currentItem: rallyPoint ? rallyPoint === controller.currentRallyPoint : false property bool _currentItem: rallyPoint ? rallyPoint === controller.currentRallyPoint : false
property color _outerTextColor: _currentItem ? "black" : qgcPal.text property color _outerTextColor: qgcPal.text // _currentItem ? "black" : qgcPal.text
readonly property real _margin: ScreenTools.defaultFontPixelWidth / 2 readonly property real _margin: ScreenTools.defaultFontPixelWidth / 2
readonly property real _radius: ScreenTools.defaultFontPixelWidth / 2 readonly property real _radius: ScreenTools.defaultFontPixelWidth / 2
...@@ -101,7 +103,6 @@ Rectangle { ...@@ -101,7 +103,6 @@ Rectangle {
Repeater { Repeater {
model: rallyPoint ? rallyPoint.textFieldFacts : 0 model: rallyPoint ? rallyPoint.textFieldFacts : 0
QGCLabel { QGCLabel {
text: modelData.name + ":" text: modelData.name + ":"
} }
...@@ -109,7 +110,6 @@ Rectangle { ...@@ -109,7 +110,6 @@ Rectangle {
Repeater { Repeater {
model: rallyPoint ? rallyPoint.textFieldFacts : 0 model: rallyPoint ? rallyPoint.textFieldFacts : 0
FactTextField { FactTextField {
Layout.fillWidth: true Layout.fillWidth: true
showUnits: true showUnits: true
......
...@@ -70,7 +70,7 @@ Item { ...@@ -70,7 +70,7 @@ Item {
id: itemIndexLabel id: itemIndexLabel
label: qsTr("R", "rally point map item label") label: qsTr("R", "rally point map item label")
checked: _editingLayer == _layerRallyPoints ? rallyPointObject === myRallyPointController.currentRallyPoint : false checked: _editingLayer == _layerRallyPoints ? rallyPointObject === myRallyPointController.currentRallyPoint : false
highlightSelected: true
onClicked: myRallyPointController.currentRallyPoint = rallyPointObject onClicked: myRallyPointController.currentRallyPoint = rallyPointObject
} }
} }
......
...@@ -108,24 +108,19 @@ Item { ...@@ -108,24 +108,19 @@ Item {
z: QGroundControl.zOrderMapItems z: QGroundControl.zOrderMapItems
missionItem: _missionItem missionItem: _missionItem
sequenceNumber: _missionItem.sequenceNumber sequenceNumber: _missionItem.sequenceNumber
onClicked: _root.clicked(_missionItem.sequenceNumber) onClicked: _root.clicked(_missionItem.sequenceNumber)
// These are the non-coordinate child mission items attached to this item // These are the non-coordinate child mission items attached to this item
Row { Row {
anchors.top: parent.top anchors.top: parent.top
anchors.left: parent.right anchors.left: parent.right
Repeater { Repeater {
model: _missionItem.childItems model: _missionItem.childItems
delegate: MissionItemIndexLabel { delegate: MissionItemIndexLabel {
z: 2 z: 2
label: object.abbreviation.length === 0 ? object.sequenceNumber : object.abbreviation.charAt(0) label: object.abbreviation.length === 0 ? object.sequenceNumber : object.abbreviation.charAt(0)
checked: object.isCurrentItem checked: object.isCurrentItem
child: true child: true
specifiesCoordinate: false specifiesCoordinate: false
onClicked: _root.clicked(object.sequenceNumber) onClicked: _root.clicked(object.sequenceNumber)
} }
} }
......
...@@ -56,7 +56,7 @@ void QGCPalette::_buildMap() ...@@ -56,7 +56,7 @@ void QGCPalette::_buildMap()
DECLARE_QGC_COLOR(text, "#9d9d9d", "#000000", "#707070", "#ffffff") DECLARE_QGC_COLOR(text, "#9d9d9d", "#000000", "#707070", "#ffffff")
DECLARE_QGC_COLOR(warningText, "#cc0808", "#cc0808", "#f85761", "#f85761") DECLARE_QGC_COLOR(warningText, "#cc0808", "#cc0808", "#f85761", "#f85761")
DECLARE_QGC_COLOR(button, "#ffffff", "#ffffff", "#707070", "#626270") DECLARE_QGC_COLOR(button, "#ffffff", "#ffffff", "#707070", "#626270")
DECLARE_QGC_COLOR(buttonText, "#9d9d9d", "#000000", "#202020", "#ffffff") DECLARE_QGC_COLOR(buttonText, "#9d9d9d", "#000000", "#A6A6A6", "#ffffff")
DECLARE_QGC_COLOR(buttonHighlight, "#e4e4e4", "#946120", "#3a3a3a", "#fff291") DECLARE_QGC_COLOR(buttonHighlight, "#e4e4e4", "#946120", "#3a3a3a", "#fff291")
DECLARE_QGC_COLOR(buttonHighlightText, "#2c2c2c", "#ffffff", "#2c2c2c", "#000000") DECLARE_QGC_COLOR(buttonHighlightText, "#2c2c2c", "#ffffff", "#2c2c2c", "#000000")
DECLARE_QGC_COLOR(primaryButton, "#585858", "#8cb3be", "#585858", "#8cb3be") DECLARE_QGC_COLOR(primaryButton, "#585858", "#8cb3be", "#585858", "#8cb3be")
......
...@@ -17,6 +17,7 @@ Canvas { ...@@ -17,6 +17,7 @@ Canvas {
property bool checked: false property bool checked: false
property bool small: false property bool small: false
property bool child: false property bool child: false
property bool highlightSelected: false
property var color: checked ? "green" : (child ? qgcPal.mapIndicatorChild : qgcPal.mapIndicator) property var color: checked ? "green" : (child ? qgcPal.mapIndicatorChild : qgcPal.mapIndicator)
property real anchorPointX: _height / 2 property real anchorPointX: _height / 2
property real anchorPointY: _height / 2 property real anchorPointY: _height / 2
...@@ -114,6 +115,17 @@ Canvas { ...@@ -114,6 +115,17 @@ Canvas {
} }
} }
Rectangle {
width: indicator.width * 2
height: width
radius: width * 0.5
color: Qt.rgba(0,0,0,0)
border.color: Qt.rgba(1,1,1,0.5)
border.width: 1
visible: checked && highlightSelected
anchors.centerIn: indicator
}
QGCMouseArea { QGCMouseArea {
fillItem: parent fillItem: parent
onClicked: { onClicked: {
......
...@@ -32,8 +32,6 @@ Button { ...@@ -32,8 +32,6 @@ Button {
// Initial state // Initial state
state: "Default" state: "Default"
// Update state on status changed // Update state on status changed
onEnabledChanged: state = "Default"
// Content Icon + Text // Content Icon + Text
contentItem: Item { contentItem: Item {
id: contentLayoutItem id: contentLayoutItem
...@@ -115,12 +113,12 @@ Button { ...@@ -115,12 +113,12 @@ Button {
// Process hover events // Process hover events
MouseArea { MouseArea {
enabled: !ScreenTools.isMobile enabled: !ScreenTools.isMobile
hoverEnabled: true
propagateComposedEvents: true propagateComposedEvents: true
hoverEnabled: true
preventStealing: true preventStealing: true
anchors.fill: button anchors.fill: button
onEntered: { button.state = 'Hovering'; } onEntered: button.state = 'Hovering'
onExited: { button.state = 'Default'; } onExited: button.state = 'Default'
// Propagate events down // Propagate events down
onClicked: { mouse.accepted = false; } onClicked: { mouse.accepted = false; }
onDoubleClicked: { mouse.accepted = false; } onDoubleClicked: { mouse.accepted = false; }
......
...@@ -9,12 +9,13 @@ import QGroundControl.ScreenTools 1.0 ...@@ -9,12 +9,13 @@ import QGroundControl.ScreenTools 1.0
TabButton { TabButton {
id: control id: control
property bool _showHighlight: (pressed | hovered | checked) property bool _showHighlight: (pressed | hovered | checked)
QGCPalette { id: qgcPalDisabled; colorGroupEnabled: false }
background: Rectangle { background: Rectangle {
color: _showHighlight ? qgcPal.buttonHighlight : qgcPal.button color: enabled ? (_showHighlight ? qgcPal.buttonHighlight : qgcPal.button) : qgcPalDisabled.button
} }
contentItem: QGCLabel { contentItem: QGCLabel {
text: control.text text: control.text
color: _showHighlight ? qgcPal.buttonHighlightText : qgcPal.buttonText color: enabled ? (_showHighlight ? qgcPal.buttonHighlightText : qgcPal.buttonText) : qgcPalDisabled.buttonText
horizontalAlignment: Text.AlignHCenter horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter verticalAlignment: Text.AlignVCenter
elide: Text.ElideRight elide: Text.ElideRight
......
...@@ -23,12 +23,7 @@ Rectangle { ...@@ -23,12 +23,7 @@ Rectangle {
radius: ScreenTools.defaultFontPixelWidth / 2 radius: ScreenTools.defaultFontPixelWidth / 2
property alias model: repeater.model property alias model: repeater.model
property var rotateImage ///< List of bool values, one for each button in strip - true: animation rotation, false: static image
property var animateImage ///< List of bool values, one for each button in strip - true: animate image, false: static image
property var buttonEnabled ///< List of bool values, one for each button in strip - true: button enabled, false: button disabled
property var buttonVisible ///< List of bool values, one for each button in strip - true: button visible, false: button invisible
property real maxHeight ///< Maximum height for control, determines whether text is hidden to make control shorter property real maxHeight ///< Maximum height for control, determines whether text is hidden to make control shorter
property var showAlternateIcon ///< List of bool values, one for each button in strip - true: show alternate icon, false: show normal icon
property AbstractButton lastClickedButton: null property AbstractButton lastClickedButton: null
...@@ -37,9 +32,17 @@ Rectangle { ...@@ -37,9 +32,17 @@ Rectangle {
signal clicked(int index, bool checked) signal clicked(int index, bool checked)
function setChecked(idx, check) {
repeater.itemAt(idx).checked = check
}
function getChecked(idx) {
return repeater.itemAt(idx).checked
}
ButtonGroup { ButtonGroup {
id: buttonGroup id: buttonGroup
exclusive: false buttons: toolStripColumn.children
} }
Column { Column {
...@@ -61,14 +64,13 @@ Rectangle { ...@@ -61,14 +64,13 @@ Rectangle {
height: width height: width
radius: ScreenTools.defaultFontPixelWidth / 2 radius: ScreenTools.defaultFontPixelWidth / 2
fontPointSize: ScreenTools.smallFontPointSize fontPointSize: ScreenTools.smallFontPointSize
autoExclusive: true
enabled: _root.buttonEnabled ? _root.buttonEnabled[index] : true enabled: modelData.buttonEnabled
visible: _root.buttonVisible ? _root.buttonVisible[index] : true visible: modelData.buttonVisible
imageSource: (_root.showAlternateIcon && _root.showAlternateIcon[index]) ? _alternateIconSource : _iconSource imageSource: modelData.showAlternateIcon ? modelData.alternateIconSource : modelData.iconSource
text: modelData.name text: modelData.name
checked: modelData.checked !== undefined ? modelData.checked : checked
property var _iconSource: modelData.iconSource
property var _alternateIconSource: modelData.alternateIconSource
ButtonGroup.group: buttonGroup ButtonGroup.group: buttonGroup
// Only drop pannel and toggleable are checkable // Only drop pannel and toggleable are checkable
...@@ -76,23 +78,14 @@ Rectangle { ...@@ -76,23 +78,14 @@ Rectangle {
onClicked: { onClicked: {
dropPanel.hide() // DropPanel will call hide on "lastClickedButton" dropPanel.hide() // DropPanel will call hide on "lastClickedButton"
// Uncheck other checked buttons
// TODO: Implement ButtonGroup exclusive with checkable and uncheckable and get rid of this workaround
for(var i = 0; i < buttonGroup.buttons.length; i++) {
var b = buttonGroup.buttons[i]
if(b !== buttonTemplate) {
b.checked = false;
}
}
if (modelData.dropPanelComponent === undefined) { if (modelData.dropPanelComponent === undefined) {
_root.clicked(index, checked) _root.clicked(index, checked)
} else if (checked) { } else if (checked) {
var panelEdgeTopPoint = mapToItem(_root, width, 0) var panelEdgeTopPoint = mapToItem(_root, width, 0)
dropPanel.show(panelEdgeTopPoint, height, modelData.dropPanelComponent) dropPanel.show(panelEdgeTopPoint, height, modelData.dropPanelComponent)
} }
lastClickedButton = buttonTemplate if(_root && buttonTemplate)
_root.lastClickedButton = buttonTemplate
} }
} }
} }
......
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