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 {
z: _mapAndVideo.z + 4
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 var _actionModel: [
{
......@@ -622,35 +619,49 @@ Item {
{
name: "Plan",
iconSource: "/qmlimages/Plan.svg",
buttonVisible: true,
buttonEnabled: true,
},
{
name: "Checklist",
iconSource: "/qmlimages/check.svg",
buttonVisible: _useChecklist,
buttonEnabled: _useChecklist && activeVehicle && !activeVehicle.armed,
},
{
name: _guidedController.takeoffTitle,
iconSource: "/res/takeoff.svg",
action: _guidedController.actionTakeoff
name: _guidedController.takeoffTitle,
iconSource: "/res/takeoff.svg",
buttonVisible: _guidedController.showTakeoff || !_guidedController.showLand,
buttonEnabled: _guidedController.showTakeoff,
action: _guidedController.actionTakeoff
},
{
name: _guidedController.landTitle,
iconSource: "/res/land.svg",
action: _guidedController.actionLand
name: _guidedController.landTitle,
iconSource: "/res/land.svg",
buttonVisible: _guidedController.showLand && !_guidedController.showTakeoff,
buttonEnabled: _guidedController.showLand,
action: _guidedController.actionLand
},
{
name: _guidedController.rtlTitle,
iconSource: "/res/rtl.svg",
action: _guidedController.actionRTL
name: _guidedController.rtlTitle,
iconSource: "/res/rtl.svg",
buttonVisible: true,
buttonEnabled: _guidedController.showRTL,
action: _guidedController.actionRTL
},
{
name: _guidedController.pauseTitle,
iconSource: "/res/pause-mission.svg",
action: _guidedController.actionPause
name: _guidedController.pauseTitle,
iconSource: "/res/pause-mission.svg",
buttonVisible: _guidedController.showPause,
buttonEnabled: _guidedController.showPause,
action: _guidedController.actionPause
},
{
name: qsTr("Action"),
iconSource: "/res/action.svg",
action: -1
name: qsTr("Action"),
iconSource: "/res/action.svg",
buttonVisible: !_guidedController.showPause,
buttonEnabled: _anyActionAvailable,
action: -1
}
]
......
......@@ -74,7 +74,7 @@ Rectangle {
QGCLabel {
id: actionMessage
text: modelData.text
text: modelData.text ? modelData.text : ""
horizontalAlignment: Text.AlignHCenter
wrapMode: Text.WordWrap
Layout.minimumWidth: _width
......
......@@ -36,8 +36,8 @@ MapQuickItem {
gimbalYaw: missionItem.missionGimbalYaw
vehicleYaw: missionItem.missionVehicleYaw
showGimbalYaw: !isNaN(missionItem.missionGimbalYaw)
highlightSelected: true
onClicked: _item.clicked()
property bool _isCurrentItem: missionItem ? missionItem.isCurrentItem : false
}
}
......@@ -33,19 +33,16 @@ MapItemView {
parent._retaskSequence = object.sequenceNumber
parent.flightWidgets.guidedModeBar.confirmAction(parent.flightWidgets.guidedModeBar.confirmRetask)
}
// These are the non-coordinate child mission items attached to this item
Row {
anchors.top: parent.top
anchors.left: parent.right
Repeater {
model: object.childItems
model: object.childItems
delegate: MissionItemIndexLabel {
label: object.abbreviation
checked: object.isCurrentItem
z: 2
label: object.abbreviation
checked: object.isCurrentItem
z: 2
}
}
}
......
......@@ -33,8 +33,8 @@ public:
Q_PROPERTY(QString editorQml READ editorQml CONSTANT)
Q_PROPERTY(QObject* currentRallyPoint READ currentRallyPoint WRITE setCurrentRallyPoint NOTIFY currentRallyPointChanged)
Q_INVOKABLE void addPoint(QGeoCoordinate point);
Q_INVOKABLE void removePoint(QObject* rallyPoint);
Q_INVOKABLE void addPoint (QGeoCoordinate point);
Q_INVOKABLE void removePoint (QObject* rallyPoint);
bool supported (void) const final;
void save (QJsonObject& json) final;
......
This diff is collapsed.
......@@ -36,7 +36,7 @@ QGCFlickable {
anchors.left: parent.left
anchors.right: parent.right
anchors.top: editorLabel.bottom
height: helpLabel.height + helpLabel.height + (_margin * 2)
height: infoLabel.height + (_margin * 2)
color: qgcPal.windowShadeDark
radius: _radius
......@@ -51,6 +51,7 @@ QGCFlickable {
text: qsTr("Rally Points provide alternate landing points when performing a Return to Launch (RTL).")
}
/*
QGCLabel {
id: helpLabel
anchors.margins: _margin
......@@ -62,6 +63,7 @@ QGCFlickable {
qsTr("Click in the map to add new rally points.") :
qsTr("This vehicle does not support Rally Points.")
}
*/
}
}
}
......@@ -14,11 +14,13 @@ Rectangle {
color: _currentItem ? qgcPal.missionItemEditor : qgcPal.windowShade
radius: _radius
signal clicked()
property var rallyPoint ///< RallyPoint object associated with editor
property var controller ///< RallyPointController
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 _radius: ScreenTools.defaultFontPixelWidth / 2
......@@ -101,7 +103,6 @@ Rectangle {
Repeater {
model: rallyPoint ? rallyPoint.textFieldFacts : 0
QGCLabel {
text: modelData.name + ":"
}
......@@ -109,7 +110,6 @@ Rectangle {
Repeater {
model: rallyPoint ? rallyPoint.textFieldFacts : 0
FactTextField {
Layout.fillWidth: true
showUnits: true
......
......@@ -67,11 +67,11 @@ Item {
property var rallyPointObject
sourceItem: MissionItemIndexLabel {
id: itemIndexLabel
label: qsTr("R", "rally point map item label")
checked: _editingLayer == _layerRallyPoints ? rallyPointObject === myRallyPointController.currentRallyPoint : false
onClicked: myRallyPointController.currentRallyPoint = rallyPointObject
id: itemIndexLabel
label: qsTr("R", "rally point map item label")
checked: _editingLayer == _layerRallyPoints ? rallyPointObject === myRallyPointController.currentRallyPoint : false
highlightSelected: true
onClicked: myRallyPointController.currentRallyPoint = rallyPointObject
}
}
}
......
......@@ -108,25 +108,20 @@ Item {
z: QGroundControl.zOrderMapItems
missionItem: _missionItem
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
Row {
anchors.top: parent.top
anchors.left: parent.right
Repeater {
model: _missionItem.childItems
delegate: MissionItemIndexLabel {
z: 2
label: object.abbreviation.length === 0 ? object.sequenceNumber : object.abbreviation.charAt(0)
checked: object.isCurrentItem
child: true
specifiesCoordinate: false
onClicked: _root.clicked(object.sequenceNumber)
onClicked: _root.clicked(object.sequenceNumber)
}
}
}
......
......@@ -56,7 +56,7 @@ void QGCPalette::_buildMap()
DECLARE_QGC_COLOR(text, "#9d9d9d", "#000000", "#707070", "#ffffff")
DECLARE_QGC_COLOR(warningText, "#cc0808", "#cc0808", "#f85761", "#f85761")
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(buttonHighlightText, "#2c2c2c", "#ffffff", "#2c2c2c", "#000000")
DECLARE_QGC_COLOR(primaryButton, "#585858", "#8cb3be", "#585858", "#8cb3be")
......
......@@ -17,6 +17,7 @@ Canvas {
property bool checked: false
property bool small: false
property bool child: false
property bool highlightSelected: false
property var color: checked ? "green" : (child ? qgcPal.mapIndicatorChild : qgcPal.mapIndicator)
property real anchorPointX: _height / 2
property real anchorPointY: _height / 2
......@@ -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 {
fillItem: parent
onClicked: {
......
......@@ -30,10 +30,8 @@ Button {
QGCPalette { id: qgcPalDisabled; colorGroupEnabled: false }
// Initial state
state: "Default"
state: "Default"
// Update state on status changed
onEnabledChanged: state = "Default"
// Content Icon + Text
contentItem: Item {
id: contentLayoutItem
......@@ -79,8 +77,8 @@ Button {
name: "Hovering"
PropertyChanges {
target: button;
_currentColor: (checked || pressed) ? qgcPal.buttonHighlight : qgcPal.hoverColor
_currentContentColor: qgcPal.buttonHighlightText
_currentColor: (checked || pressed) ? qgcPal.buttonHighlight : qgcPal.hoverColor
_currentContentColor: qgcPal.buttonHighlightText
}
PropertyChanges {
target: buttonBkRect
......@@ -91,8 +89,8 @@ Button {
name: "Default"
PropertyChanges {
target: button;
_currentColor: enabled ? ((checked || pressed) ? qgcPal.buttonHighlight : qgcPal.button) : qgcPalDisabled.button
_currentContentColor: enabled ? ((checked || pressed) ? qgcPal.buttonHighlightText : qgcPal.buttonText) : qgcPalDisabled.buttonText
_currentColor: enabled ? ((checked || pressed) ? qgcPal.buttonHighlight : qgcPal.button) : qgcPalDisabled.button
_currentContentColor: enabled ? ((checked || pressed) ? qgcPal.buttonHighlightText : qgcPal.buttonText) : qgcPalDisabled.buttonText
}
PropertyChanges {
target: buttonBkRect
......@@ -114,19 +112,19 @@ Button {
// Process hover events
MouseArea {
enabled: !ScreenTools.isMobile
hoverEnabled: true
enabled: !ScreenTools.isMobile
propagateComposedEvents: true
preventStealing: true
anchors.fill: button
onEntered: { button.state = 'Hovering'; }
onExited: { button.state = 'Default'; }
hoverEnabled: true
preventStealing: true
anchors.fill: button
onEntered: button.state = 'Hovering'
onExited: button.state = 'Default'
// Propagate events down
onClicked: { mouse.accepted = false; }
onDoubleClicked: { mouse.accepted = false; }
onPositionChanged: { mouse.accepted = false; }
onPressAndHold: { mouse.accepted = false; }
onPressed: { mouse.accepted = false }
onReleased: { mouse.accepted = false }
onClicked: { mouse.accepted = false; }
onDoubleClicked: { mouse.accepted = false; }
onPositionChanged: { mouse.accepted = false; }
onPressAndHold: { mouse.accepted = false; }
onPressed: { mouse.accepted = false }
onReleased: { mouse.accepted = false }
}
}
......@@ -9,12 +9,13 @@ import QGroundControl.ScreenTools 1.0
TabButton {
id: control
property bool _showHighlight: (pressed | hovered | checked)
QGCPalette { id: qgcPalDisabled; colorGroupEnabled: false }
background: Rectangle {
color: _showHighlight ? qgcPal.buttonHighlight : qgcPal.button
color: enabled ? (_showHighlight ? qgcPal.buttonHighlight : qgcPal.button) : qgcPalDisabled.button
}
contentItem: QGCLabel {
text: control.text
color: _showHighlight ? qgcPal.buttonHighlightText : qgcPal.buttonText
color: enabled ? (_showHighlight ? qgcPal.buttonHighlightText : qgcPal.buttonText) : qgcPalDisabled.buttonText
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
elide: Text.ElideRight
......
......@@ -23,12 +23,7 @@ Rectangle {
radius: ScreenTools.defaultFontPixelWidth / 2
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 var showAlternateIcon ///< List of bool values, one for each button in strip - true: show alternate icon, false: show normal icon
property AbstractButton lastClickedButton: null
......@@ -37,9 +32,17 @@ Rectangle {
signal clicked(int index, bool checked)
function setChecked(idx, check) {
repeater.itemAt(idx).checked = check
}
function getChecked(idx) {
return repeater.itemAt(idx).checked
}
ButtonGroup {
id: buttonGroup
exclusive: false
id: buttonGroup
buttons: toolStripColumn.children
}
Column {
......@@ -54,21 +57,20 @@ Rectangle {
id: repeater
QGCHoverButton {
id: buttonTemplate
id: buttonTemplate
anchors.left: toolStripColumn.left
anchors.right: toolStripColumn.right
height: width
radius: ScreenTools.defaultFontPixelWidth / 2
fontPointSize: ScreenTools.smallFontPointSize
autoExclusive: true
enabled: _root.buttonEnabled ? _root.buttonEnabled[index] : true
visible: _root.buttonVisible ? _root.buttonVisible[index] : true
imageSource: (_root.showAlternateIcon && _root.showAlternateIcon[index]) ? _alternateIconSource : _iconSource
enabled: modelData.buttonEnabled
visible: modelData.buttonVisible
imageSource: modelData.showAlternateIcon ? modelData.alternateIconSource : modelData.iconSource
text: modelData.name
property var _iconSource: modelData.iconSource
property var _alternateIconSource: modelData.alternateIconSource
checked: modelData.checked !== undefined ? modelData.checked : checked
ButtonGroup.group: buttonGroup
// Only drop pannel and toggleable are checkable
......@@ -76,23 +78,14 @@ Rectangle {
onClicked: {
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) {
_root.clicked(index, checked)
} else if (checked) {
var panelEdgeTopPoint = mapToItem(_root, width, 0)
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