Commit 69e5440c authored by Don Gagne's avatar Don Gagne

Instrument panel swipe view, plus vibe page

parent 6dead834
......@@ -109,7 +109,9 @@
<file alias="QGroundControl/FlightMap/QGCSlider.qml">src/FlightMap/Widgets/QGCSlider.qml</file>
<file alias="QGroundControl/FlightMap/QGCVideoBackground.qml">src/FlightMap/QGCVideoBackground.qml</file>
<file alias="QGroundControl/FlightMap/ValuesWidget.qml">src/FlightMap/Widgets/ValuesWidget.qml</file>
<file alias="QGroundControl/FlightMap/VibrationWidget.qml">src/FlightMap/Widgets/VibrationWidget.qml</file>
<file alias="QGroundControl/FlightMap/VehicleMapItem.qml">src/FlightMap/MapItems/VehicleMapItem.qml</file>
<file alias="QGroundControl/FlightMap/InstrumentSwipeView.qml">src/FlightMap/Widgets/InstrumentSwipeView.qml</file>
<file alias="QGroundControl/ScreenTools/qmldir">src/QmlControls/QGroundControl.ScreenTools.qmldir</file>
<file alias="QGroundControl/ScreenTools/ScreenTools.qml">src/QmlControls/ScreenTools.qml</file>
......@@ -158,5 +160,6 @@
<file alias="Vehicle/BatteryFact.json">src/Vehicle/BatteryFact.json</file>
<file alias="Vehicle/GPSFact.json">src/Vehicle/GPSFact.json</file>
<file alias="Vehicle/WindFact.json">src/Vehicle/WindFact.json</file>
<file alias="Vehicle/VibrationFact.json">src/Vehicle/VibrationFact.json</file>
</qresource>
</RCC>
import QtQuick 2.5
import QtQuick.Controls 1.4
import QGroundControl.Palette 1.0
import QGroundControl.ScreenTools 1.0
import QGroundControl.FlightMap 1.0
Item {
id: _root
clip: true
height: valuesPage.height + pageIndicatorRow.anchors.topMargin + pageIndicatorRow.height
property var qgcView ///< QGCView to use for showing dialogs
property color textColor
property color backgroundColor
property var maxHeight ///< Maximum height that should be taken, smaller than this is ok
property real _margins: ScreenTools.defaultFontPixelWidth / 2
ValuesWidget {
id: valuesPage
width: _root.width
qgcView: _root.qgcView
textColor: _root.textColor
maxHeight: _root.maxHeight
}
VibrationWidget {
id: vibrationPage
anchors.left: valuesPage.right
width: _root.width
textColor: _root.textColor
backgroundColor: _root.backgroundColor
maxHeight: _root.maxHeight
}
Row {
id: pageIndicatorRow
anchors.bottom: parent.bottom
anchors.horizontalCenter: parent.horizontalCenter
spacing: _margins
visible: multiVehicleManager.activeVehicle
Rectangle {
id: valuesPageIndicator
height: radius * 2
width: radius * 2
radius: 2.5
border.color: textColor
border.width: 1
color: textColor
}
Rectangle {
id: vibrationPageIndicator
height: radius * 2
width: radius * 2
radius: 2.5
border.color: textColor
border.width: 1
color: "transparent"
}
}
MouseArea {
anchors.fill: parent
property real xDragStart
property real xValuesPageSave
onPressed: {
if (mouse.button == Qt.LeftButton) {
mouse.accepted = true
xDragStart = mouse.x
xValuesPageSave = valuesPage.x
}
}
onPositionChanged: {
valuesPage.x = xValuesPageSave + mouse.x - xDragStart
}
onReleased: {
if (mouse.x < xDragStart) {
if (xValuesPageSave == 0) {
valuesPage.x = -valuesPage.width
_root.height = vibrationPage.height + pageIndicatorRow.anchors.topMargin + pageIndicatorRow.height
valuesPageIndicator.color = "transparent"
vibrationPageIndicator.color = textColor
} else {
valuesPage.x = xValuesPageSave
}
} else {
if (xValuesPageSave != 0) {
valuesPage.x = 0
_root.height = valuesPage.height + pageIndicatorRow.anchors.topMargin + pageIndicatorRow.height
valuesPageIndicator.color = textColor
vibrationPageIndicator.color = "transparent"
} else {
valuesPage.x = xValuesPageSave
}
}
}
}
}
......@@ -39,7 +39,7 @@ Rectangle {
height: compass.y + compass.height + _topBottomMargin
width: size
radius: size / 2
color: isSatellite ? Qt.rgba(1,1,1,0.75) : Qt.rgba(0,0,0,0.75)
color: _backgroundColor
property alias heading: compass.heading
property alias rollAngle: attitude.rollAngle
......@@ -56,12 +56,13 @@ Rectangle {
property real _defaultSize: ScreenTools.defaultFontPixelSize * (9)
property real _sizeRatio: ScreenTools.isTinyScreen ? (size / _defaultSize) * 0.5 : size / _defaultSize
property real _bigFontSize: ScreenTools.defaultFontPixelSize * 2.5 * _sizeRatio
property real _normalFontSize:ScreenTools.defaultFontPixelSize * 1.5 * _sizeRatio
property real _labelFontSize: ScreenTools.defaultFontPixelSize * 0.75 * _sizeRatio
property real _spacing: ScreenTools.defaultFontPixelSize * 0.33
property real _topBottomMargin: (size * 0.05) / 2
property color _backgroundColor: isSatellite ? Qt.rgba(1,1,1,0.75) : Qt.rgba(0,0,0,0.75)
property real _sizeRatio: ScreenTools.isTinyScreen ? (size / _defaultSize) * 0.5 : size / _defaultSize
property real _bigFontSize: ScreenTools.defaultFontPixelSize * 2.5 * _sizeRatio
property real _normalFontSize: ScreenTools.defaultFontPixelSize * 1.5 * _sizeRatio
property real _labelFontSize: ScreenTools.defaultFontPixelSize * 0.75 * _sizeRatio
property real _spacing: ScreenTools.defaultFontPixelSize * 0.33
property real _topBottomMargin: (size * 0.05) / 2
property real _availableValueHeight: maxHeight - (attitude.height + _spacer1.height + _spacer2.height + compass.height + (_spacing * 4))
MouseArea {
......@@ -87,16 +88,27 @@ Rectangle {
anchors.horizontalCenter: parent.horizontalCenter
}
ValuesWidget {
InstrumentSwipeView {
id: _valuesWidget
anchors.topMargin: _spacing
anchors.top: _spacer1.bottom
width: parent.width
qgcView: instrumentPanel.qgcView
textColor: isSatellite ? "black" : "white"
backgroundColor: _backgroundColor
maxHeight: _availableValueHeight
}
Component {
id: valuesPage
Rectangle {
width: 100
height: 100
color: index == 0 ? "red" : "blue"
}
}
Rectangle {
id: _spacer2
anchors.topMargin: _spacing
......
/*=====================================================================
QGroundControl Open Source Ground Control Station
(c) 2009, 2015 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>
This file is part of the QGROUNDCONTROL project
QGROUNDCONTROL is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
QGROUNDCONTROL is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with QGROUNDCONTROL. If not, see <http://www.gnu.org/licenses/>.
======================================================================*/
import QtQuick 2.4
import QtQuick.Controls 1.4
import QGroundControl.Controls 1.0
import QGroundControl.ScreenTools 1.0
import QGroundControl.FactSystem 1.0
import QGroundControl.Controllers 1.0
import QGroundControl.Palette 1.0
import QGroundControl 1.0
QGCFlickable {
id: _root
visible: _activeVehicle
height: Math.min(maxHeight, innerItem.height)
contentHeight: innerItem.height
flickableDirection: Flickable.VerticalFlick
clip: true
property color textColor
property color backgroundColor
property var maxHeight
property var _activeVehicle: QGroundControl.multiVehicleManager.activeVehicle
property real _margins: ScreenTools.defaultFontPixelWidth / 2
property real _barWidth: Math.round(ScreenTools.defaultFontPixelWidth * 3)
readonly property real _barMinimum: 0.0
readonly property real _barMaximum: 90.0
readonly property real _barBadValue: 60.0
QGCPalette { id:qgcPal; colorGroupEnabled: true }
Item {
id: innerItem
width: parent.width
height: barRow.y + barRow.height
QGCLabel {
id: title
color: textColor
text: "Vibe"
anchors.horizontalCenter: barRow.horizontalCenter
}
Row {
id: barRow
anchors.margins: _margins
anchors.top: title.bottom
anchors.left: parent.left
spacing: _margins
Column {
ProgressBar {
id: xBar
height: 50
orientation: Qt.Vertical
minimumValue: _barMinimum
maximumValue: _barMaximum
value: _activeVehicle ? _activeVehicle.vibration.xAxis.value : 0
}
QGCLabel {
id: xBarLabel
color: textColor
text: "X"
anchors.horizontalCenter: xBar.horizontalCenter
}
}
Column {
ProgressBar {
id: yBar
height: 50
orientation: Qt.Vertical
minimumValue: _barMinimum
maximumValue: _barMaximum
value: _activeVehicle ? _activeVehicle.vibration.yAxis.value : 0
}
QGCLabel {
anchors.horizontalCenter: yBar.horizontalCenter
color: textColor
text: "Y"
}
}
Column {
ProgressBar {
id: zBar
height: 50
orientation: Qt.Vertical
minimumValue: _barMinimum
maximumValue: _barMaximum
value: _activeVehicle ? _activeVehicle.vibration.zAxis.value : 0
}
QGCLabel {
anchors.horizontalCenter: zBar.horizontalCenter
color: textColor
text: "Z"
}
}
} // Row
// Max vibe indication line at 60
Rectangle {
anchors.topMargin: xBar.height * (1.0 - ((_barBadValue - _barMinimum) / (_barMaximum - _barMinimum)))
anchors.top: barRow.top
anchors.left: barRow.left
anchors.right: barRow.right
width: barRow.width
height: 1
color: "red"
Component.onCompleted: console.log(anchors.topMargin, xBar.height, _barBadValue, _barMaximum, _barMinimum)
}
QGCLabel {
id: clipLabel
anchors.margins: _margins
anchors.left: barRow.right
anchors.right: parent.right
color: textColor
text: "Clip count"
horizontalAlignment: Text.AlignHCenter
}
Column {
id: clipColumn
anchors.top: barRow.top
anchors.horizontalCenter: clipLabel.horizontalCenter
QGCLabel {
text: "Accel 1: " + (_activeVehicle ? _activeVehicle.vibration.clipCount1.valueString : "")
color: textColor
}
QGCLabel {
text: "Accel 2: " + (_activeVehicle ? _activeVehicle.vibration.clipCount2.valueString : "")
color: textColor
}
QGCLabel {
text: "Accel 2: " + (_activeVehicle ? _activeVehicle.vibration.clipCount3.valueString : "")
color: textColor
}
}
// Not available overlay
Rectangle {
anchors.fill: parent
color: backgroundColor
opacity: 0.95
visible: _activeVehicle ? isNaN(_activeVehicle.vibration.xAxis.value) : false
QGCLabel {
anchors.fill: parent
text: "Not Available"
color: textColor
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
}
}
} // Item
} // QGCFLickable
......@@ -5,6 +5,7 @@ FlightMap 1.0 FlightMap.qml
QGCVideoBackground 1.0 QGCVideoBackground.qml
# Widgets
InstrumentSwipeView 1.0 InstrumentSwipeView.qml
QGCArtificialHorizon 1.0 QGCArtificialHorizon.qml
QGCAttitudeHUD 1.0 QGCAttitudeHUD.qml
QGCAttitudeWidget 1.0 QGCAttitudeWidget.qml
......@@ -14,6 +15,7 @@ QGCInstrumentWidgetAlternate 1.0 QGCInstrumentWidgetAlternate.qml
QGCPitchIndicator 1.0 QGCPitchIndicator.qml
QGCSlider 1.0 QGCSlider.qml
ValuesWidget 1.0 ValuesWidget.qml
VibrationWidget 1.0 VibrationWidget.qml
# Map items
MissionItemIndicator 1.0 MissionItemIndicator.qml
......
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