Commit 21923ab9 authored by Don Gagne's avatar Don Gagne Committed by GitHub

Merge pull request #4651 from DonLakeFlyer/TriggerCamera

Trigger camera in instrument panel page
parents 1f342e61 8339e840
...@@ -144,6 +144,7 @@ ...@@ -144,6 +144,7 @@
<file alias="QGroundControl/FlightMap/QGCPitchIndicator.qml">src/FlightMap/Widgets/QGCPitchIndicator.qml</file> <file alias="QGroundControl/FlightMap/QGCPitchIndicator.qml">src/FlightMap/Widgets/QGCPitchIndicator.qml</file>
<file alias="QGroundControl/FlightMap/QGCVideoBackground.qml">src/FlightMap/QGCVideoBackground.qml</file> <file alias="QGroundControl/FlightMap/QGCVideoBackground.qml">src/FlightMap/QGCVideoBackground.qml</file>
<file alias="QGroundControl/FlightMap/qmldir">src/FlightMap/qmldir</file> <file alias="QGroundControl/FlightMap/qmldir">src/FlightMap/qmldir</file>
<file alias="QGroundControl/FlightMap/CameraWidget.qml">src/FlightMap/Widgets/CameraWidget.qml</file>
<file alias="QGroundControl/FlightMap/ValuesWidget.qml">src/FlightMap/Widgets/ValuesWidget.qml</file> <file alias="QGroundControl/FlightMap/ValuesWidget.qml">src/FlightMap/Widgets/ValuesWidget.qml</file>
<file alias="QGroundControl/FlightMap/VehicleHealthWidget.qml">src/FlightMap/Widgets/VehicleHealthWidget.qml</file> <file alias="QGroundControl/FlightMap/VehicleHealthWidget.qml">src/FlightMap/Widgets/VehicleHealthWidget.qml</file>
<file alias="QGroundControl/FlightMap/VehicleMapItem.qml">src/FlightMap/MapItems/VehicleMapItem.qml</file> <file alias="QGroundControl/FlightMap/VehicleMapItem.qml">src/FlightMap/MapItems/VehicleMapItem.qml</file>
......
/****************************************************************************
*
* (c) 2009-2016 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>
*
* QGroundControl is licensed according to the terms in the file
* COPYING.md in the root of the source code directory.
*
****************************************************************************/
import QtQuick 2.4
import QtQuick.Layouts 1.2
import QGroundControl 1.0
import QGroundControl.Controls 1.0
import QGroundControl.ScreenTools 1.0
/// Camera controls used in InstrumentSwipeView
QGCFlickable {
id: _root
height: Math.min(maxHeight, column.height)
contentHeight: column.height
flickableDirection: Flickable.VerticalFlick
clip: true
property var qgcView
property color textColor
property var maxHeight
property var _activeVehicle: QGroundControl.multiVehicleManager.activeVehicle
MouseArea {
anchors.fill: parent
onClicked: showNextPage()
}
Column {
id: column
width: parent.width
spacing: ScreenTools.defaultFontPixelHeight
QGCLabel {
anchors.horizontalCenter: parent.horizontalCenter
color: textColor
text: qsTr("Camera Controls")
}
QGCButton {
anchors.horizontalCenter: parent.horizontalCenter
text: qsTr("Trigger Camera")
onClicked: _activeVehicle.triggerCamera()
enabled: _activeVehicle
}
}
}
import QtQuick 2.5 import QtQuick 2.5
import QtQuick.Controls 1.4 import QtQuick.Controls 2.0
import QtQuick.Layouts 1.3
import QGroundControl.Palette 1.0 import QGroundControl.Palette 1.0
import QGroundControl.ScreenTools 1.0 import QGroundControl.ScreenTools 1.0
import QGroundControl.FlightMap 1.0 import QGroundControl.FlightMap 1.0
Item { Item {
id: _root id: _root
clip: true clip: true
height: valuesPage.height + pageIndicatorRow.anchors.topMargin + pageIndicatorRow.height height: column.height
property var qgcView ///< QGCView to use for showing dialogs property var qgcView ///< QGCView to use for showing dialogs
property color textColor property color textColor
property color backgroundColor property color backgroundColor
property var maxHeight ///< Maximum height that should be taken, smaller than this is ok property var maxHeight ///< Maximum height that should be taken, smaller than this is ok
property real _margins: ScreenTools.defaultFontPixelWidth / 2 property real _margins: ScreenTools.defaultFontPixelWidth / 2
property real _pageWidth: _root.width property real _pageWidth: _root.width
property int _currentPage: 0 property int _currentPage: 0
property int _maxPage: 2 property int _maxPage: 3
onWidthChanged: showPage(_currentPage)
function showPicker() { function showPicker() {
valuesPage.showPicker() valuesPage.showPicker()
} }
function showPage(pageIndex) { function showPage(pageIndex) {
_root.height = Qt.binding(function() { return _root.children[pageIndex].height + pageIndicatorRow.anchors.topMargin + pageIndicatorRow.height } ) pageRow.x = -(pageIndex * _pageWidth)
_root.children[0].x = -(pageIndex * _pageWidth)
}
ValuesWidget {
id: valuesPage
width: _pageWidth
qgcView: _root.qgcView
textColor: _root.textColor
maxHeight: _root.maxHeight
}
VehicleHealthWidget {
id: healthPage
anchors.left: valuesPage.right
width: _pageWidth
qgcView: _root.qgcView
textColor: _root.textColor
maxHeight: _root.maxHeight
} }
VibrationWidget { function showNextPage() {
id: vibrationPage if (_currentPage == _maxPage) {
anchors.left: healthPage.right _currentPage = 0
width: _pageWidth } else {
textColor: _root.textColor _currentPage++
backgroundColor: _root.backgroundColor
maxHeight: _root.maxHeight
}
Row {
id: pageIndicatorRow
anchors.bottom: parent.bottom
anchors.horizontalCenter: parent.horizontalCenter
spacing: _margins
Repeater {
model: _maxPage + 1
Rectangle {
height: radius * 2
width: radius * 2
radius: ScreenTools.defaultFontPixelWidth / 3
border.color: textColor
border.width: 1
color: _currentPage == index ? textColor : "transparent"
}
} }
showPage(_currentPage)
} }
MouseArea { MouseArea {
anchors.fill: parent anchors.fill: parent
onClicked: showNextPage()
onClicked: {
if (_currentPage == _maxPage) {
_currentPage = 0
} else {
_currentPage++
}
showPage(_currentPage)
}
} }
/* Column {
Switching from swipe to click to change pages. Keeping swipe code for now in case of change back. id: column
MouseArea { anchors.left: parent.left
anchors.fill: parent anchors.right: parent.right
property real xDragStart Row {
property real xFirstPageSave id: pageRow
onPressed: { ValuesWidget {
if (mouse.button == Qt.LeftButton) { id: valuesPage
mouse.accepted = true width: _pageWidth
xDragStart = mouse.x qgcView: _root.qgcView
xFirstPageSave = _root.children[0].x textColor: _root.textColor
maxHeight: _root.maxHeight
}
CameraWidget {
width: _pageWidth
qgcView: _root.qgcView
textColor: _root.textColor
maxHeight: _root.maxHeight
}
VehicleHealthWidget {
width: _pageWidth
qgcView: _root.qgcView
textColor: _root.textColor
maxHeight: _root.maxHeight
}
VibrationWidget {
width: _pageWidth
textColor: _root.textColor
backgroundColor: _root.backgroundColor
maxHeight: _root.maxHeight
} }
} }
onPositionChanged: { Row {
_root.children[0].x = xFirstPageSave + mouse.x - xDragStart anchors.horizontalCenter: parent.horizontalCenter
} spacing: _margins
onReleased: { Repeater {
if (mouse.x < xDragStart) { model: _maxPage + 1
// Swipe left
_currentPage = Math.min(_currentPage + 1, _maxPage) Rectangle {
} else { height: radius * 2
// Swipe right width: radius * 2
_currentPage = Math.max(_currentPage - 1, 0) radius: ScreenTools.defaultFontPixelWidth / 3
border.color: textColor
border.width: 1
color: _currentPage == index ? textColor : "transparent"
}
} }
showPage(_currentPage)
} }
} }
*/
} }
...@@ -54,7 +54,7 @@ QGCFlickable { ...@@ -54,7 +54,7 @@ QGCFlickable {
MouseArea { MouseArea {
anchors.fill: parent anchors.fill: parent
onClicked: showPicker() onClicked: showNextPage()
} }
Column { Column {
......
...@@ -34,6 +34,11 @@ QGCFlickable { ...@@ -34,6 +34,11 @@ QGCFlickable {
} }
} }
MouseArea {
anchors.fill: parent
onClicked: showNextPage()
}
Column { Column {
id: healthColumn id: healthColumn
width: parent.width width: parent.width
......
...@@ -39,6 +39,11 @@ QGCFlickable { ...@@ -39,6 +39,11 @@ QGCFlickable {
QGCPalette { id:qgcPal; colorGroupEnabled: true } QGCPalette { id:qgcPal; colorGroupEnabled: true }
MouseArea {
anchors.fill: parent
onClicked: showNextPage()
}
Item { Item {
id: innerItem id: innerItem
width: parent.width width: parent.width
......
...@@ -5,20 +5,21 @@ FlightMap 1.0 FlightMap.qml ...@@ -5,20 +5,21 @@ FlightMap 1.0 FlightMap.qml
QGCVideoBackground 1.0 QGCVideoBackground.qml QGCVideoBackground 1.0 QGCVideoBackground.qml
# Widgets # Widgets
CenterMapDropButton 1.0 CenterMapDropButton.qml CameraWidget 1.0 CameraWidget.qml
CenterMapDropPanel 1.0 CenterMapDropPanel.qml CenterMapDropButton 1.0 CenterMapDropButton.qml
InstrumentSwipeView 1.0 InstrumentSwipeView.qml CenterMapDropPanel 1.0 CenterMapDropPanel.qml
MapFitFunctions 1.0 MapFitFunctions.qml InstrumentSwipeView 1.0 InstrumentSwipeView.qml
MapScale 1.0 MapScale.qml MapFitFunctions 1.0 MapFitFunctions.qml
QGCArtificialHorizon 1.0 QGCArtificialHorizon.qml MapScale 1.0 MapScale.qml
QGCAttitudeHUD 1.0 QGCAttitudeHUD.qml QGCArtificialHorizon 1.0 QGCArtificialHorizon.qml
QGCAttitudeWidget 1.0 QGCAttitudeWidget.qml QGCAttitudeHUD 1.0 QGCAttitudeHUD.qml
QGCCompassWidget 1.0 QGCCompassWidget.qml QGCAttitudeWidget 1.0 QGCAttitudeWidget.qml
QGCPitchIndicator 1.0 QGCPitchIndicator.qml QGCCompassWidget 1.0 QGCCompassWidget.qml
QGCSlider 1.0 QGCSlider.qml QGCPitchIndicator 1.0 QGCPitchIndicator.qml
ValuesWidget 1.0 ValuesWidget.qml QGCSlider 1.0 QGCSlider.qml
VehicleHealthWidget 1.0 VehicleHealthWidget.qml ValuesWidget 1.0 ValuesWidget.qml
VibrationWidget 1.0 VibrationWidget.qml VehicleHealthWidget 1.0 VehicleHealthWidget.qml
VibrationWidget 1.0 VibrationWidget.qml
# Map items # Map items
MissionItemIndicator 1.0 MissionItemIndicator.qml MissionItemIndicator 1.0 MissionItemIndicator.qml
......
...@@ -2241,6 +2241,15 @@ void Vehicle::setOfflineEditingDefaultComponentId(int defaultComponentId) ...@@ -2241,6 +2241,15 @@ void Vehicle::setOfflineEditingDefaultComponentId(int defaultComponentId)
} }
} }
void Vehicle::triggerCamera(void)
{
sendMavCommand(FactSystem::defaultComponentId,
MAV_CMD_DO_DIGICAM_CONTROL,
true, // show errors
0.0, 0.0, 0.0, 0.0, // param 1-4 unused
1.0); // trigger camera
}
const char* VehicleGPSFactGroup::_hdopFactName = "hdop"; const char* VehicleGPSFactGroup::_hdopFactName = "hdop";
const char* VehicleGPSFactGroup::_vdopFactName = "vdop"; const char* VehicleGPSFactGroup::_vdopFactName = "vdop";
const char* VehicleGPSFactGroup::_courseOverGroundFactName = "courseOverGround"; const char* VehicleGPSFactGroup::_courseOverGroundFactName = "courseOverGround";
......
...@@ -409,6 +409,8 @@ public: ...@@ -409,6 +409,8 @@ public:
/// Clear Messages /// Clear Messages
Q_INVOKABLE void clearMessages(); Q_INVOKABLE void clearMessages();
Q_INVOKABLE void triggerCamera(void);
#if 0 #if 0
// Temporarily removed, waiting for new command implementation // Temporarily removed, waiting for new command implementation
/// Test motor /// Test motor
......
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