Commit 439ff491 authored by Stefan Dunca's avatar Stefan Dunca

Fix gimbal indicator display

Fix gimbal indicator so that angle values match the markers
Select thermal mode on thermal menu selection
parent 6ebae0ae
...@@ -12,12 +12,18 @@ Item { ...@@ -12,12 +12,18 @@ Item {
property real zoomLevel: NaN property real zoomLevel: NaN
property alias zoomLevelVisible: zoomStatusItem.visible property alias zoomLevelVisible: zoomStatusItem.visible
property bool showZoomPrecision: true property bool showZoomPrecision: true
property bool onlyContinousZoom: false
signal zoomIn() signal zoomIn()
signal zoomOut() signal zoomOut()
signal continuousZoomStart(var zoomIn) signal continuousZoomStart(var zoomIn)
signal continuousZoomStop() signal continuousZoomStop()
//
// Beware the buttons were switched
//
//
height: zoomStatusTextItem.height * 2 height: zoomStatusTextItem.height * 2
width: (zoomLevelVisible ? (zoomStatusItem.width - zoomInButton.width/2) : 0) + zoomInButton.width + zoomOutButton.width width: (zoomLevelVisible ? (zoomStatusItem.width - zoomInButton.width/2) : 0) + zoomInButton.width + zoomOutButton.width
...@@ -69,7 +75,12 @@ Item { ...@@ -69,7 +75,12 @@ Item {
property bool holding: false property bool holding: false
onPressed: { onPressed: {
_root.zoomIn() if(onlyContinousZoom) {
holding = true
}
else {
_root.zoomOut()
}
} }
onPressAndHold: { onPressAndHold: {
...@@ -82,7 +93,7 @@ Item { ...@@ -82,7 +93,7 @@ Item {
background: Rectangle { background: Rectangle {
anchors.fill: zoomInButton anchors.fill: zoomInButton
radius: zoomInButton.width/2 radius: zoomInButton.width/10
color: _root.mainColor color: _root.mainColor
} }
...@@ -96,14 +107,6 @@ Item { ...@@ -96,14 +107,6 @@ Item {
width: zoomInButton.width * 0.4 width: zoomInButton.width * 0.4
height: zoomInButton.height * 0.05 height: zoomInButton.height * 0.05
color: _root.contentColor
}
Rectangle {
anchors.centerIn: parent
width: zoomInMinusRectangle.height
height: zoomInMinusRectangle.width
color: _root.contentColor color: _root.contentColor
} }
} }
...@@ -140,7 +143,12 @@ Item { ...@@ -140,7 +143,12 @@ Item {
property bool holding: false property bool holding: false
onPressed: { onPressed: {
_root.zoomOut() if(onlyContinousZoom) {
holding = true
}
else {
_root.zoomIn()
}
} }
onPressAndHold: { onPressAndHold: {
...@@ -153,7 +161,7 @@ Item { ...@@ -153,7 +161,7 @@ Item {
background: Rectangle { background: Rectangle {
anchors.fill: zoomOutButton anchors.fill: zoomOutButton
radius: zoomOutButton.width/2 radius: zoomOutButton.width/10
color: _root.mainColor color: _root.mainColor
} }
...@@ -167,6 +175,14 @@ Item { ...@@ -167,6 +175,14 @@ Item {
width: zoomInMinusRectangle.width width: zoomInMinusRectangle.width
height: zoomInMinusRectangle.height height: zoomInMinusRectangle.height
color: _root.contentColor
}
Rectangle {
anchors.centerIn: parent
width: zoomOutMinusRectangle.height
height: zoomOutMinusRectangle.width
color: _root.contentColor color: _root.contentColor
} }
} }
...@@ -203,11 +219,11 @@ Item { ...@@ -203,11 +219,11 @@ Item {
}, },
State { State {
name: "ZoomingIn" name: "ZoomingIn"
when: zoomInButton.holding === true when: zoomOutButton.holding === true
}, },
State { State {
name: "ZoomingOut" name: "ZoomingOut"
when: zoomOutButton.holding === true when: zoomInButton.holding === true
} }
] ]
} }
...@@ -13,6 +13,7 @@ import QtQuick 2.11 ...@@ -13,6 +13,7 @@ import QtQuick 2.11
import QtQuick.Controls 2.4 import QtQuick.Controls 2.4
import QtQuick.Layouts 1.11 import QtQuick.Layouts 1.11
import QtQuick.Dialogs 1.3 import QtQuick.Dialogs 1.3
import QtGraphicalEffects 1.0
import QtMultimedia 5.9 import QtMultimedia 5.9
import QtPositioning 5.2 import QtPositioning 5.2
...@@ -31,6 +32,7 @@ import Custom.Widgets 1.0 ...@@ -31,6 +32,7 @@ import Custom.Widgets 1.0
import Custom.Camera 1.0 import Custom.Camera 1.0
Item { Item {
id: _root
height: mainColumn.height height: mainColumn.height
width: mainColumn.width + (ScreenTools.defaultFontPixelWidth * 2) width: mainColumn.width + (ScreenTools.defaultFontPixelWidth * 2)
visible: !QGroundControl.videoManager.fullScreen visible: !QGroundControl.videoManager.fullScreen
...@@ -399,10 +401,11 @@ Item { ...@@ -399,10 +401,11 @@ Item {
} }
//-- Gimbal Indicator //-- Gimbal Indicator
Rectangle { Rectangle {
id: gimbalBackground
width: _hasGimbal ? ScreenTools.defaultFontPixelWidth * 6 : 0 width: _hasGimbal ? ScreenTools.defaultFontPixelWidth * 6 : 0
height: _hasGimbal ? (gimbalCol.height + (ScreenTools.defaultFontPixelHeight * 2)) : 0 height: _hasGimbal ? (gimbalCol.height + (ScreenTools.defaultFontPixelHeight * 2)) : 0
visible: _hasGimbal visible: _hasGimbal
color: Qt.rgba(0,0,0,0.5) color: Qt.rgba(qgcPal.window.r, qgcPal.window.g, qgcPal.window.b, 0.5)
radius: ScreenTools.defaultFontPixelWidth * 0.5 radius: ScreenTools.defaultFontPixelWidth * 0.5
anchors.verticalCenter: cameraRect.verticalCenter anchors.verticalCenter: cameraRect.verticalCenter
Column { Column {
...@@ -410,6 +413,7 @@ Item { ...@@ -410,6 +413,7 @@ Item {
spacing: ScreenTools.defaultFontPixelHeight * 0.75 spacing: ScreenTools.defaultFontPixelHeight * 0.75
anchors.centerIn: parent anchors.centerIn: parent
Image { Image {
id: gimbalIcon
source: "/custom/img/gimbal_icon.svg" source: "/custom/img/gimbal_icon.svg"
width: ScreenTools.defaultFontPixelWidth * 2 width: ScreenTools.defaultFontPixelWidth * 2
height: width height: width
...@@ -418,7 +422,7 @@ Item { ...@@ -418,7 +422,7 @@ Item {
antialiasing: true antialiasing: true
fillMode: Image.PreserveAspectFit fillMode: Image.PreserveAspectFit
sourceSize.width: width sourceSize.width: width
anchors.horizontalCenter: parent.horizontalCenter z: stickItem.z + 1
} }
Image { Image {
id: pitchScale id: pitchScale
...@@ -429,34 +433,42 @@ Item { ...@@ -429,34 +433,42 @@ Item {
smooth: true smooth: true
mipmap: true mipmap: true
antialiasing: true antialiasing: true
anchors.horizontalCenter: parent.horizontalCenter
Image { Image {
id: yawIndicator id: yawIndicator
width: ScreenTools.defaultFontPixelWidth * 4 width: ScreenTools.defaultFontPixelWidth * 4
source: "/custom/img/gimbal_position.svg" source: "/custom/img/gimbal_position.svg"
fillMode: Image.PreserveAspectFit fillMode: Image.PreserveAspectFit
sourceSize.width: width sourceSize.width: width
y: (parent.height * _pitch / 105) x: pitchScale.width/2
y: (pitchScale.height * pitchScale.scaleRatio) + (pitchScale._pitch / pitchScale.rangeValue) * pitchScale.height
smooth: true smooth: true
mipmap: true mipmap: true
anchors.horizontalCenter: parent.horizontalCenter transform: [
transform: Rotation { Translate {
origin.x: yawIndicator.width / 2 x: -yawIndicator.width / 2
origin.y: yawIndicator.height / 2 y: -yawIndicator.height / 2
angle: _gimbalYaw },
} Rotation {
property real _pitch: _gimbalPitch < -15 ? -15 : (_gimbalPitch > 90 ? 90 : _gimbalPitch) angle: _gimbalYaw
}
]
} }
readonly property real minValue: -15
readonly property real centerValue: 0
readonly property real maxValue: 90
readonly property real rangeValue: maxValue - minValue
readonly property real scaleRatio: 1/7
property real _pitch: _gimbalPitch < minValue ? minValue : (_gimbalPitch > maxValue ? maxValue : _gimbalPitch)
} }
QGCLabel { QGCLabel {
id: gimbalLabel id: gimbalLabel
text: _gimbalPitch ? _gimbalPitch.toFixed(0) : 0 text: _gimbalPitch ? pitchScale._pitch.toFixed(0) : 0
color: "#FFF" color: "#FFF"
font.pointSize: ScreenTools.smallFontPointSize font.pointSize: ScreenTools.smallFontPointSize
anchors.horizontalCenter: parent.horizontalCenter
} }
} }
} } // Gimbal Indicator
} }
//-- Zoom Buttons //-- Zoom Buttons
ZoomControl { ZoomControl {
...@@ -468,6 +480,7 @@ Item { ...@@ -468,6 +480,7 @@ Item {
zoomLevelVisible: false zoomLevelVisible: false
zoomLevel: _hasZoom ? _camera.zoomLevel : NaN zoomLevel: _hasZoom ? _camera.zoomLevel : NaN
anchors.horizontalCenter: parent.horizontalCenter anchors.horizontalCenter: parent.horizontalCenter
onlyContinousZoom: true
onZoomIn: { onZoomIn: {
_camera.stepZoom(1) _camera.stepZoom(1)
} }
...@@ -940,18 +953,18 @@ Item { ...@@ -940,18 +953,18 @@ Item {
id: thermalPalettes id: thermalPalettes
width: Math.min(mainWindow.width * 0.666, ScreenTools.defaultFontPixelWidth * 40) width: Math.min(mainWindow.width * 0.666, ScreenTools.defaultFontPixelWidth * 40)
height: mainWindow.height * 0.5 height: mainWindow.height * 0.5
//modal: true modal: true
focus: true focus: true
parent: Overlay.overlay parent: Overlay.overlay
x: Math.round((mainWindow.width - width) * 0.5) x: Math.round((mainWindow.width - width) * 0.5)
y: Math.round((mainWindow.height - height) * 0.5) y: Math.round((mainWindow.height - height) * 0.5)
closePolicy: Popup.CloseOnEscape | Popup.CloseOnPressOutside closePolicy: Popup.CloseOnEscape | Popup.CloseOnPressOutside
property int selectedIndex: 0
background: Rectangle { background: Rectangle {
anchors.fill: parent anchors.fill: parent
color: qgcPal.globalTheme === QGCPalette.Light ? Qt.rgba(1,1,1,0.95) : Qt.rgba(0,0,0,0.75) color: qgcPal.globalTheme === QGCPalette.Light ? Qt.rgba(1,1,1,0.95) : Qt.rgba(0,0,0,0.75)
border.color: qgcPal.text border.color: qgcPal.text
radius: ScreenTools.defaultFontPixelWidth radius: ScreenTools.defaultFontPixelWidth * 0.5
} }
Item { Item {
anchors.fill: parent anchors.fill: parent
...@@ -987,6 +1000,7 @@ Item { ...@@ -987,6 +1000,7 @@ Item {
if(thermalBackgroundRect.visible) { if(thermalBackgroundRect.visible) {
if(_camera.thermalMode !== QGCCameraControl.THERMAL_PIP && _camera.thermalMode !== QGCCameraControl.THERMAL_FULL) { if(_camera.thermalMode !== QGCCameraControl.THERMAL_PIP && _camera.thermalMode !== QGCCameraControl.THERMAL_FULL) {
_camera.thermalMode = QGCCameraControl.THERMAL_FULL _camera.thermalMode = QGCCameraControl.THERMAL_FULL
thermalFull.checked = 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