diff --git a/resources/.directory b/resources/.directory new file mode 100644 index 0000000000000000000000000000000000000000..4803c4f1265106a0fb6e8efa999742eead606768 --- /dev/null +++ b/resources/.directory @@ -0,0 +1,4 @@ +[Dolphin] +PreviewsShown=true +Timestamp=2020,2,21,14,47,12 +Version=4 diff --git a/resources/mavs/.directory b/resources/mavs/.directory new file mode 100644 index 0000000000000000000000000000000000000000..a89ea9307bf855ab2248ddc435d4ebd096d2f7b3 --- /dev/null +++ b/resources/mavs/.directory @@ -0,0 +1,3 @@ +[Dolphin] +Timestamp=2020,2,21,14,48,2 +Version=4 diff --git a/src/FlightDisplay/FlightDisplayView.qml b/src/FlightDisplay/FlightDisplayView.qml index 07194b4b50908f84d2b8dbee9939b8a9fa4136cd..a2a58958e78466c015685279e931e1b78b4feef4 100644 --- a/src/FlightDisplay/FlightDisplayView.qml +++ b/src/FlightDisplay/FlightDisplayView.qml @@ -679,6 +679,8 @@ QGCView { maxHeight: (_flightVideo.visible ? _flightVideo.y : parent.height) - toolStrip.y buttonVisible: [ _useChecklist, _guidedController.showTakeoff || !_guidedController.showLand, _guidedController.showLand && !_guidedController.showTakeoff, true, true, true ] buttonEnabled: [ _useChecklist && _activeVehicle, _guidedController.showTakeoff, _guidedController.showLand, _guidedController.showRTL, _guidedController.showPause, _anyActionAvailable ] + horizontal: true + enableSwitchButton: true property bool _anyActionAvailable: _guidedController.showStartMission || _guidedController.showResumeMission || _guidedController.showChangeAlt || _guidedController.showLandAbort property var _actionModel: [ diff --git a/src/QmlControls/ToolStrip.qml b/src/QmlControls/ToolStrip.qml index 8e1335c50845b1d6d4a2ad970ff3ee48196861c1..cf7ae912c2ab3515a61536c0630537a62b84a8a5 100644 --- a/src/QmlControls/ToolStrip.qml +++ b/src/QmlControls/ToolStrip.qml @@ -9,6 +9,7 @@ import QtQuick 2.11 import QtQuick.Controls 1.4 +import QtQuick.Layouts 1.11 import QGroundControl.ScreenTools 1.0 import QGroundControl.Palette 1.0 @@ -16,8 +17,8 @@ import QGroundControl.Palette 1.0 Rectangle { id: _root color: qgcPal.window - width: ScreenTools.isMobile ? ScreenTools.minTouchPixels : ScreenTools.defaultFontPixelWidth * 7 - height: toolStripColumn.height + (toolStripColumn.anchors.margins * 2) + width: toolStripGrid.width + (toolStripGrid.anchors.margins * 2) + height: toolStripGrid.height + (toolStripGrid.anchors.margins * 2) radius: _radius border.width: 1 border.color: qgcPal.globalTheme === QGCPalette.Light ? Qt.rgba(0,0,0,0.35) : Qt.rgba(1,1,1,0.35) @@ -30,6 +31,11 @@ Rectangle { 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 bool horizontal: false /// toolstrip horizontal or vertical ? + property bool enableSwitchButton: false /// enable horizontal vertical button ? + + + property real _horizontal: horizontal signal clicked(int index, bool checked) @@ -37,6 +43,8 @@ Rectangle { readonly property real _margin: ScreenTools.defaultFontPixelWidth / 2 readonly property real _buttonSpacing: ScreenTools.defaultFontPixelHeight / 4 + readonly property real _imageWidthHeight: ScreenTools.isMobile ? ScreenTools.minTouchPixels : ScreenTools.defaultFontPixelWidth * 5 + QGCPalette { id: qgcPal } ExclusiveGroup { id: dropButtonsExclusiveGroup } @@ -54,40 +62,46 @@ Rectangle { anchors.fill: parent } - Column { - id: toolStripColumn + GridLayout { + id: toolStripGrid anchors.margins: ScreenTools.defaultFontPixelWidth / 2 anchors.top: parent.top anchors.left: parent.left - anchors.right: parent.right - spacing: _buttonSpacing + columnSpacing: _buttonSpacing + rowSpacing: _buttonSpacing + rows: _horizontal ? 1 : model.length + columns: _horizontal ? model.length : 1 QGCLabel { - anchors.horizontalCenter: parent.horizontalCenter text: title font.pointSize: ScreenTools.mobile ? ScreenTools.smallFontPointSize : ScreenTools.defaultFontPointSize + Layout.alignment: _horizontal ? Qt.AlignVCenter : Qt.AlignHCenter } + // separator Rectangle { - anchors.left: parent.left - anchors.right: parent.right - height: 1 + height: _horizontal ? undefined : 1 + width: _horizontal ? 1 : undefined + Layout.fillWidth: _horizontal ? false : true + Layout.fillHeight: _horizontal ? true : false color: qgcPal.text } - Column { - anchors.left: parent.left - anchors.right: parent.right - spacing: _buttonSpacing + GridLayout { + rows: _horizontal ? 1 : model.length + columns: _horizontal ? model.length : 1 + columnSpacing: _buttonSpacing + rowSpacing: _buttonSpacing Repeater { id: repeater delegate: FocusScope { id: scope - width: toolStripColumn.width + width: buttonRect.width height: buttonRect.height visible: _root.buttonVisible ? _root.buttonVisible[index] : true + Layout.alignment: _horizontal ? Qt.AlignVCenter : Qt.AlignHCenter property bool checked: false property ExclusiveGroup exclusiveGroup: dropButtonsExclusiveGroup @@ -130,21 +144,21 @@ Rectangle { Rectangle { id: buttonRect anchors.left: parent.left - anchors.right: parent.right + anchors.top: parent.top height: buttonColumn.height + width: buttonColumn.width color: _showHighlight ? _repeaterPal.buttonHighlight : _repeaterPal.window Column { id: buttonColumn + anchors.top: parent.top anchors.left: parent.left - anchors.right: parent.right - spacing: -buttonImage.height / 8 + spacing: _buttonSpacing QGCColoredImage { id: buttonImage - anchors.left: parent.left - anchors.right: parent.right - height: width * 0.8 + height: _imageWidthHeight + width: _imageWidthHeight //anchors.centerIn: parent source: _source sourceSize.height: height @@ -217,9 +231,81 @@ Rectangle { } } // Rectangle } // FocusScope - } + } // Repeater + } // GridLayout + + // separator + Rectangle { + height: _horizontal ? undefined : 1 + width: _horizontal ? 1 : undefined + Layout.fillWidth: _horizontal ? false : true + Layout.fillHeight: _horizontal ? true : false + color: qgcPal.text + visible: enableSwitchButton } - } + + // switch button, tool strip horizontal <-> vertical + Rectangle { + id: switchButtonRect + height: switchButtonColumn.height + width: switchButtonColumn.width + color: _showHighlight ? _switchButtonPal.buttonHighlight : _switchButtonPal.window + visible: enableSwitchButton + + property bool _hovered: false + property bool _showHighlight: (enableSwitchButton && _hovered) + + QGCPalette { id: _switchButtonPal; colorGroupEnabled: enableSwitchButton } + + Column { + id: switchButtonColumn + anchors.top: parent.top + anchors.left: parent.left + spacing: _buttonSpacing + + QGCColoredImage { + id: switchButtonImage + height: _imageWidthHeight + width: _imageWidthHeight + //anchors.centerIn: parent + source: "/res/clockwise-arrow.svg" + sourceSize.height: height + fillMode: Image.PreserveAspectFit + mipmap: true + smooth: true + color: switchButtonRect._showHighlight ? _switchButtonPal.buttonHighlightText : _switchButtonPal.text + } + + QGCLabel { + id: switchButtonLabel + anchors.horizontalCenter: parent.horizontalCenter + font.pointSize: ScreenTools.smallFontPointSize + text: _horizontal ? "Vert" : "Hor" + color: switchButtonRect._showHighlight ? _switchButtonPal.buttonHighlightText : _switchButtonPal.text + enabled: enableSwitchButton + } + } // Column + + QGCMouseArea { + anchors.fill: parent + visible: enableSwitchButton + hoverEnabled: true + preventStealing: true + + onContainsMouseChanged: switchButtonRect._hovered = containsMouse + onContainsPressChanged: switchButtonRect._hovered = containsPress + + onClicked: { + dropPanel.hide() // hide affects checked, so this needs to be duplicated inside not outside if + if (_root._horizontal === true) { + _root._horizontal = false + } else { + _root._horizontal = true + } + } + } + } // switchButton Rectangle + } // GridLayout DropPanel { id: dropPanel diff --git a/src/Vehicle/Vehicle.cc b/src/Vehicle/Vehicle.cc index 9f540b7fc56959c81724739fc555a40d91a64ea0..8ec8626b2b84147f8033bdd24a4417cfbf24414c 100644 --- a/src/Vehicle/Vehicle.cc +++ b/src/Vehicle/Vehicle.cc @@ -1425,6 +1425,7 @@ void Vehicle::_handleExtendedSysState(mavlink_message_t& message) mavlink_extended_sys_state_t extendedState; mavlink_msg_extended_sys_state_decode(&message, &extendedState); + qWarning() << "Vehicle::_handleExtendedSysState: land_state: " << extendedState.landed_state; switch (extendedState.landed_state) { case MAV_LANDED_STATE_ON_GROUND: _setFlying(false);