Commit b9bb4442 authored by Valentin Platzgummer's avatar Valentin Platzgummer

Toolstrip.qml edited, almost finised

parent 2814c345
...@@ -679,7 +679,7 @@ QGCView { ...@@ -679,7 +679,7 @@ 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 horizontal: false
enableSwitchButton: 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
......
/**************************************************************************** /****************************************************************************
* *
* (c) 2009-2016 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org> * (c) 2009-2016 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>
* *
...@@ -35,7 +35,6 @@ Rectangle { ...@@ -35,7 +35,6 @@ Rectangle {
property bool enableSwitchButton: false /// enable horizontal vertical button ? property bool enableSwitchButton: false /// enable horizontal vertical button ?
property real _horizontal: horizontal
signal clicked(int index, bool checked) signal clicked(int index, bool checked)
...@@ -43,7 +42,11 @@ Rectangle { ...@@ -43,7 +42,11 @@ 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 readonly property real _buttonWidthHeight: ScreenTools.isMobile ? ScreenTools.minTouchPixels : ScreenTools.defaultFontPixelWidth * 8
Component.onCompleted: toolStripGrid.horizontal = _root.horizontal
onHorizontalChanged: toolStripGrid.horizontal = _root.horizontal
QGCPalette { id: qgcPal } QGCPalette { id: qgcPal }
ExclusiveGroup { id: dropButtonsExclusiveGroup } ExclusiveGroup { id: dropButtonsExclusiveGroup }
...@@ -62,37 +65,40 @@ Rectangle { ...@@ -62,37 +65,40 @@ Rectangle {
anchors.fill: parent anchors.fill: parent
} }
GridLayout { Grid {
id: toolStripGrid 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
columnSpacing: _buttonSpacing columnSpacing: _buttonSpacing
rowSpacing: _buttonSpacing rowSpacing: _buttonSpacing
rows: _horizontal ? 1 : model.length rows: toolStripGrid.horizontal ? 1 : model.length
columns: _horizontal ? model.length : 1 columns: toolStripGrid.horizontal ? model.length : 1
property bool horizontal
QGCLabel { QGCLabel {
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 Layout.alignment: toolStripGrid.horizontal ? Qt.AlignVCenter : Qt.AlignHCenter
} }
// separator // separator
Rectangle { Rectangle {
height: _horizontal ? undefined : 1 height: toolStripGrid.horizontal ? _buttonWidthHeight : 1
width: _horizontal ? 1 : undefined width: toolStripGrid.horizontal ? 1 : _buttonWidthHeight
Layout.fillWidth: _horizontal ? false : true
Layout.fillHeight: _horizontal ? true : false
color: qgcPal.text color: qgcPal.text
} }
GridLayout { GridLayout {
rows: _horizontal ? 1 : model.length rows: toolStripGrid.horizontal ? 1 : model.length
columns: _horizontal ? model.length : 1 columns: toolStripGrid.horizontal ? model.length : 1
columnSpacing: _buttonSpacing columnSpacing: _buttonSpacing
rowSpacing: _buttonSpacing rowSpacing: _buttonSpacing
Repeater { Repeater {
id: repeater id: repeater
...@@ -101,7 +107,7 @@ Rectangle { ...@@ -101,7 +107,7 @@ Rectangle {
width: buttonRect.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 Layout.alignment: toolStripGrid.horizontal ? Qt.AlignVCenter : Qt.AlignHCenter
property bool checked: false property bool checked: false
property ExclusiveGroup exclusiveGroup: dropButtonsExclusiveGroup property ExclusiveGroup exclusiveGroup: dropButtonsExclusiveGroup
...@@ -145,24 +151,21 @@ Rectangle { ...@@ -145,24 +151,21 @@ Rectangle {
id: buttonRect id: buttonRect
anchors.left: parent.left anchors.left: parent.left
anchors.top: parent.top anchors.top: parent.top
height: buttonColumn.height height: _buttonWidthHeight
width: buttonColumn.width width: _buttonWidthHeight
color: _showHighlight ? _repeaterPal.buttonHighlight : _repeaterPal.window color: _showHighlight ? _repeaterPal.buttonHighlight : _repeaterPal.window
clip: true
Column { radius: ScreenTools.defaultFontPixelWidth/2
id: buttonColumn
anchors.top: parent.top
anchors.left: parent.left
spacing: _buttonSpacing
QGCColoredImage { QGCColoredImage {
id: buttonImage id: buttonImage
height: _imageWidthHeight height: _buttonWidthHeight-buttonLabel.height
width: _imageWidthHeight width: _buttonWidthHeight-buttonLabel.height
//anchors.centerIn: parent anchors.centerIn: parent
source: _source source: _source
sourceSize.height: height sourceSize.height: _buttonWidthHeight-buttonLabel.height
fillMode: Image.PreserveAspectFit sourceSize.width: _buttonWidthHeight-buttonLabel.height
fillMode: Image.PreserveAspectCrop
mipmap: true mipmap: true
smooth: true smooth: true
color: _showHighlight ? _repeaterPal.buttonHighlightText : _repeaterPal.text color: _showHighlight ? _repeaterPal.buttonHighlightText : _repeaterPal.text
...@@ -189,12 +192,13 @@ Rectangle { ...@@ -189,12 +192,13 @@ Rectangle {
QGCLabel { QGCLabel {
id: buttonLabel id: buttonLabel
anchors.horizontalCenter: parent.horizontalCenter anchors.horizontalCenter: parent.horizontalCenter
anchors.bottom: parent.bottom
font.pointSize: ScreenTools.smallFontPointSize font.pointSize: ScreenTools.smallFontPointSize
text: modelData.name text: modelData.name
color: _showHighlight ? _repeaterPal.buttonHighlightText : _repeaterPal.text color: _showHighlight ? _repeaterPal.buttonHighlightText : _repeaterPal.text
enabled: _buttonEnabled enabled: _buttonEnabled
} }
} // Column
QGCMouseArea { QGCMouseArea {
anchors.fill: parent anchors.fill: parent
...@@ -236,10 +240,8 @@ Rectangle { ...@@ -236,10 +240,8 @@ Rectangle {
// separator // separator
Rectangle { Rectangle {
height: _horizontal ? undefined : 1 height: toolStripGrid.horizontal ? _buttonWidthHeight : 1
width: _horizontal ? 1 : undefined width: toolStripGrid.horizontal ? 1 : _buttonWidthHeight
Layout.fillWidth: _horizontal ? false : true
Layout.fillHeight: _horizontal ? true : false
color: qgcPal.text color: qgcPal.text
visible: enableSwitchButton visible: enableSwitchButton
} }
...@@ -247,30 +249,27 @@ Rectangle { ...@@ -247,30 +249,27 @@ Rectangle {
// switch button, tool strip horizontal <-> vertical // switch button, tool strip horizontal <-> vertical
Rectangle { Rectangle {
id: switchButtonRect id: switchButtonRect
height: switchButtonColumn.height height: _buttonWidthHeight
width: switchButtonColumn.width width: _buttonWidthHeight
color: _showHighlight ? _switchButtonPal.buttonHighlight : _switchButtonPal.window color: _showHighlight ? _switchButtonPal.buttonHighlight : _switchButtonPal.window
visible: enableSwitchButton visible: enableSwitchButton
radius: ScreenTools.defaultFontPixelWidth/2
property bool _hovered: false property bool _hovered: false
property bool _showHighlight: (enableSwitchButton && _hovered) property bool _showHighlight: (enableSwitchButton && _hovered)
QGCPalette { id: _switchButtonPal; colorGroupEnabled: enableSwitchButton } QGCPalette { id: _switchButtonPal; colorGroupEnabled: enableSwitchButton }
Column {
id: switchButtonColumn
anchors.top: parent.top
anchors.left: parent.left
spacing: _buttonSpacing
QGCColoredImage { QGCColoredImage {
id: switchButtonImage id: switchButtonImage
height: _imageWidthHeight height: _buttonWidthHeight-switchButtonLabel.height
width: _imageWidthHeight width: _buttonWidthHeight-switchButtonLabel.height
//anchors.centerIn: parent anchors.top: parent.top
anchors.centerIn: parent
source: "/res/clockwise-arrow.svg" source: "/res/clockwise-arrow.svg"
sourceSize.height: height sourceSize.height: _buttonWidthHeight-switchButtonLabel.height
fillMode: Image.PreserveAspectFit sourceSize.width: _buttonWidthHeight-switchButtonLabel.height
fillMode: Image.PreserveAspectCrop
mipmap: true mipmap: true
smooth: true smooth: true
color: switchButtonRect._showHighlight ? _switchButtonPal.buttonHighlightText : _switchButtonPal.text color: switchButtonRect._showHighlight ? _switchButtonPal.buttonHighlightText : _switchButtonPal.text
...@@ -279,12 +278,12 @@ Rectangle { ...@@ -279,12 +278,12 @@ Rectangle {
QGCLabel { QGCLabel {
id: switchButtonLabel id: switchButtonLabel
anchors.horizontalCenter: parent.horizontalCenter anchors.horizontalCenter: parent.horizontalCenter
anchors.bottom: parent.bottom
font.pointSize: ScreenTools.smallFontPointSize font.pointSize: ScreenTools.smallFontPointSize
text: _horizontal ? "Vert" : "Hor" text: toolStripGrid.horizontal ? "Vert" : "Hor"
color: switchButtonRect._showHighlight ? _switchButtonPal.buttonHighlightText : _switchButtonPal.text color: switchButtonRect._showHighlight ? _switchButtonPal.buttonHighlightText : _switchButtonPal.text
enabled: enableSwitchButton enabled: enableSwitchButton
} }
} // Column
QGCMouseArea { QGCMouseArea {
anchors.fill: parent anchors.fill: parent
...@@ -297,10 +296,10 @@ Rectangle { ...@@ -297,10 +296,10 @@ Rectangle {
onClicked: { onClicked: {
dropPanel.hide() // hide affects checked, so this needs to be duplicated inside not outside if dropPanel.hide() // hide affects checked, so this needs to be duplicated inside not outside if
if (_root._horizontal === true) { if (toolStripGrid.horizontal === true) {
_root._horizontal = false toolStripGrid.horizontal = false
} else { } else {
_root._horizontal = true toolStripGrid.horizontal = true
} }
} }
} }
......
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