Commit 2814c345 authored by Valentin Platzgummer's avatar Valentin Platzgummer

vertical ToolStrip.qml feature added

parent b750c08c
[Dolphin]
PreviewsShown=true
Timestamp=2020,2,21,14,47,12
Version=4
[Dolphin]
Timestamp=2020,2,21,14,48,2
Version=4
...@@ -679,6 +679,8 @@ QGCView { ...@@ -679,6 +679,8 @@ QGCView {
maxHeight: (_flightVideo.visible ? _flightVideo.y : parent.height) - toolStrip.y maxHeight: (_flightVideo.visible ? _flightVideo.y : parent.height) - toolStrip.y
buttonVisible: [ _useChecklist, _guidedController.showTakeoff || !_guidedController.showLand, _guidedController.showLand && !_guidedController.showTakeoff, true, true, true ] 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 ] 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 bool _anyActionAvailable: _guidedController.showStartMission || _guidedController.showResumeMission || _guidedController.showChangeAlt || _guidedController.showLandAbort
property var _actionModel: [ property var _actionModel: [
......
...@@ -9,6 +9,7 @@ ...@@ -9,6 +9,7 @@
import QtQuick 2.11 import QtQuick 2.11
import QtQuick.Controls 1.4 import QtQuick.Controls 1.4
import QtQuick.Layouts 1.11
import QGroundControl.ScreenTools 1.0 import QGroundControl.ScreenTools 1.0
import QGroundControl.Palette 1.0 import QGroundControl.Palette 1.0
...@@ -16,8 +17,8 @@ import QGroundControl.Palette 1.0 ...@@ -16,8 +17,8 @@ import QGroundControl.Palette 1.0
Rectangle { Rectangle {
id: _root id: _root
color: qgcPal.window color: qgcPal.window
width: ScreenTools.isMobile ? ScreenTools.minTouchPixels : ScreenTools.defaultFontPixelWidth * 7 width: toolStripGrid.width + (toolStripGrid.anchors.margins * 2)
height: toolStripColumn.height + (toolStripColumn.anchors.margins * 2) height: toolStripGrid.height + (toolStripGrid.anchors.margins * 2)
radius: _radius radius: _radius
border.width: 1 border.width: 1
border.color: qgcPal.globalTheme === QGCPalette.Light ? Qt.rgba(0,0,0,0.35) : Qt.rgba(1,1,1,0.35) 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 { ...@@ -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 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 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 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) signal clicked(int index, bool checked)
...@@ -37,6 +43,8 @@ Rectangle { ...@@ -37,6 +43,8 @@ Rectangle {
readonly property real _margin: ScreenTools.defaultFontPixelWidth / 2 readonly property real _margin: ScreenTools.defaultFontPixelWidth / 2
readonly property real _buttonSpacing: ScreenTools.defaultFontPixelHeight / 4 readonly property real _buttonSpacing: ScreenTools.defaultFontPixelHeight / 4
readonly property real _imageWidthHeight: ScreenTools.isMobile ? ScreenTools.minTouchPixels : ScreenTools.defaultFontPixelWidth * 5
QGCPalette { id: qgcPal } QGCPalette { id: qgcPal }
ExclusiveGroup { id: dropButtonsExclusiveGroup } ExclusiveGroup { id: dropButtonsExclusiveGroup }
...@@ -54,40 +62,46 @@ Rectangle { ...@@ -54,40 +62,46 @@ Rectangle {
anchors.fill: parent anchors.fill: parent
} }
Column { GridLayout {
id: toolStripColumn id: toolStripGrid
anchors.margins: ScreenTools.defaultFontPixelWidth / 2 anchors.margins: ScreenTools.defaultFontPixelWidth / 2
anchors.top: parent.top anchors.top: parent.top
anchors.left: parent.left anchors.left: parent.left
anchors.right: parent.right columnSpacing: _buttonSpacing
spacing: _buttonSpacing rowSpacing: _buttonSpacing
rows: _horizontal ? 1 : model.length
columns: _horizontal ? model.length : 1
QGCLabel { QGCLabel {
anchors.horizontalCenter: parent.horizontalCenter
text: title text: title
font.pointSize: ScreenTools.mobile ? ScreenTools.smallFontPointSize : ScreenTools.defaultFontPointSize font.pointSize: ScreenTools.mobile ? ScreenTools.smallFontPointSize : ScreenTools.defaultFontPointSize
Layout.alignment: _horizontal ? Qt.AlignVCenter : Qt.AlignHCenter
} }
// separator
Rectangle { Rectangle {
anchors.left: parent.left height: _horizontal ? undefined : 1
anchors.right: parent.right width: _horizontal ? 1 : undefined
height: 1 Layout.fillWidth: _horizontal ? false : true
Layout.fillHeight: _horizontal ? true : false
color: qgcPal.text color: qgcPal.text
} }
Column { GridLayout {
anchors.left: parent.left rows: _horizontal ? 1 : model.length
anchors.right: parent.right columns: _horizontal ? model.length : 1
spacing: _buttonSpacing columnSpacing: _buttonSpacing
rowSpacing: _buttonSpacing
Repeater { Repeater {
id: repeater id: repeater
delegate: FocusScope { delegate: FocusScope {
id: scope id: scope
width: toolStripColumn.width width: buttonRect.width
height: buttonRect.height height: buttonRect.height
visible: _root.buttonVisible ? _root.buttonVisible[index] : true visible: _root.buttonVisible ? _root.buttonVisible[index] : true
Layout.alignment: _horizontal ? Qt.AlignVCenter : Qt.AlignHCenter
property bool checked: false property bool checked: false
property ExclusiveGroup exclusiveGroup: dropButtonsExclusiveGroup property ExclusiveGroup exclusiveGroup: dropButtonsExclusiveGroup
...@@ -130,21 +144,21 @@ Rectangle { ...@@ -130,21 +144,21 @@ Rectangle {
Rectangle { Rectangle {
id: buttonRect id: buttonRect
anchors.left: parent.left anchors.left: parent.left
anchors.right: parent.right anchors.top: parent.top
height: buttonColumn.height height: buttonColumn.height
width: buttonColumn.width
color: _showHighlight ? _repeaterPal.buttonHighlight : _repeaterPal.window color: _showHighlight ? _repeaterPal.buttonHighlight : _repeaterPal.window
Column { Column {
id: buttonColumn id: buttonColumn
anchors.top: parent.top
anchors.left: parent.left anchors.left: parent.left
anchors.right: parent.right spacing: _buttonSpacing
spacing: -buttonImage.height / 8
QGCColoredImage { QGCColoredImage {
id: buttonImage id: buttonImage
anchors.left: parent.left height: _imageWidthHeight
anchors.right: parent.right width: _imageWidthHeight
height: width * 0.8
//anchors.centerIn: parent //anchors.centerIn: parent
source: _source source: _source
sourceSize.height: height sourceSize.height: height
...@@ -217,9 +231,81 @@ Rectangle { ...@@ -217,9 +231,81 @@ Rectangle {
} }
} // Rectangle } // Rectangle
} // FocusScope } // 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 { DropPanel {
id: dropPanel id: dropPanel
......
...@@ -1425,6 +1425,7 @@ void Vehicle::_handleExtendedSysState(mavlink_message_t& message) ...@@ -1425,6 +1425,7 @@ void Vehicle::_handleExtendedSysState(mavlink_message_t& message)
mavlink_extended_sys_state_t extendedState; mavlink_extended_sys_state_t extendedState;
mavlink_msg_extended_sys_state_decode(&message, &extendedState); mavlink_msg_extended_sys_state_decode(&message, &extendedState);
qWarning() << "Vehicle::_handleExtendedSysState: land_state: " << extendedState.landed_state;
switch (extendedState.landed_state) { switch (extendedState.landed_state) {
case MAV_LANDED_STATE_ON_GROUND: case MAV_LANDED_STATE_ON_GROUND:
_setFlying(false); _setFlying(false);
......
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