Unverified Commit 543ba3f3 authored by Don Gagne's avatar Don Gagne Committed by GitHub

Merge pull request #9003 from DonLakeFlyer/PhotoVideoControl

Unified photo/video control which works with mavlink cameras and and video stream
parents 19310246 d6cd32a5
...@@ -36,7 +36,6 @@ ...@@ -36,7 +36,6 @@
<file alias="AnalyzeView.qml">src/AnalyzeView/AnalyzeView.qml</file> <file alias="AnalyzeView.qml">src/AnalyzeView/AnalyzeView.qml</file>
<file alias="AppSettings.qml">src/ui/AppSettings.qml</file> <file alias="AppSettings.qml">src/ui/AppSettings.qml</file>
<file alias="BluetoothSettings.qml">src/ui/preferences/BluetoothSettings.qml</file> <file alias="BluetoothSettings.qml">src/ui/preferences/BluetoothSettings.qml</file>
<file alias="CameraPageWidget.qml">src/FlightMap/Widgets/CameraPageWidget.qml</file>
<file alias="CorridorScanEditor.qml">src/PlanView/CorridorScanEditor.qml</file> <file alias="CorridorScanEditor.qml">src/PlanView/CorridorScanEditor.qml</file>
<file alias="DebugWindow.qml">src/ui/preferences/DebugWindow.qml</file> <file alias="DebugWindow.qml">src/ui/preferences/DebugWindow.qml</file>
<file alias="ESP8266Component.qml">src/AutoPilotPlugins/Common/ESP8266Component.qml</file> <file alias="ESP8266Component.qml">src/AutoPilotPlugins/Common/ESP8266Component.qml</file>
...@@ -117,7 +116,6 @@ ...@@ -117,7 +116,6 @@
<file alias="QGroundControl/Controls/ModeSwitchDisplay.qml">src/QmlControls/ModeSwitchDisplay.qml</file> <file alias="QGroundControl/Controls/ModeSwitchDisplay.qml">src/QmlControls/ModeSwitchDisplay.qml</file>
<file alias="QGroundControl/Controls/MultiRotorMotorDisplay.qml">src/QmlControls/MultiRotorMotorDisplay.qml</file> <file alias="QGroundControl/Controls/MultiRotorMotorDisplay.qml">src/QmlControls/MultiRotorMotorDisplay.qml</file>
<file alias="QGroundControl/Controls/OfflineMapButton.qml">src/QmlControls/OfflineMapButton.qml</file> <file alias="QGroundControl/Controls/OfflineMapButton.qml">src/QmlControls/OfflineMapButton.qml</file>
<file alias="QGroundControl/Controls/PageView.qml">src/QmlControls/PageView.qml</file>
<file alias="QGroundControl/Controls/ParameterEditor.qml">src/QmlControls/ParameterEditor.qml</file> <file alias="QGroundControl/Controls/ParameterEditor.qml">src/QmlControls/ParameterEditor.qml</file>
<file alias="QGroundControl/Controls/ParameterEditorDialog.qml">src/QmlControls/ParameterEditorDialog.qml</file> <file alias="QGroundControl/Controls/ParameterEditorDialog.qml">src/QmlControls/ParameterEditorDialog.qml</file>
<file alias="QGroundControl/Controls/PIDTuning.qml">src/QmlControls/PIDTuning.qml</file> <file alias="QGroundControl/Controls/PIDTuning.qml">src/QmlControls/PIDTuning.qml</file>
...@@ -222,7 +220,6 @@ ...@@ -222,7 +220,6 @@
<file alias="QGroundControl/FlightDisplay/GuidedAltitudeSlider.qml">src/FlightDisplay/GuidedAltitudeSlider.qml</file> <file alias="QGroundControl/FlightDisplay/GuidedAltitudeSlider.qml">src/FlightDisplay/GuidedAltitudeSlider.qml</file>
<file alias="QGroundControl/FlightDisplay/GuidedToolStripAction.qml">src/FlightDisplay/GuidedToolStripAction.qml</file> <file alias="QGroundControl/FlightDisplay/GuidedToolStripAction.qml">src/FlightDisplay/GuidedToolStripAction.qml</file>
<file alias="QGroundControl/FlightDisplay/MultiVehicleList.qml">src/FlightDisplay/MultiVehicleList.qml</file> <file alias="QGroundControl/FlightDisplay/MultiVehicleList.qml">src/FlightDisplay/MultiVehicleList.qml</file>
<file alias="QGroundControl/FlightDisplay/MultiVehiclePanel.qml">src/FlightDisplay/MultiVehiclePanel.qml</file>
<file alias="QGroundControl/FlightDisplay/PreFlightBatteryCheck.qml">src/FlightDisplay/PreFlightBatteryCheck.qml</file> <file alias="QGroundControl/FlightDisplay/PreFlightBatteryCheck.qml">src/FlightDisplay/PreFlightBatteryCheck.qml</file>
<file alias="QGroundControl/FlightDisplay/PreFlightGPSCheck.qml">src/FlightDisplay/PreFlightGPSCheck.qml</file> <file alias="QGroundControl/FlightDisplay/PreFlightGPSCheck.qml">src/FlightDisplay/PreFlightGPSCheck.qml</file>
<file alias="QGroundControl/FlightDisplay/PreFlightRCCheck.qml">src/FlightDisplay/PreFlightRCCheck.qml</file> <file alias="QGroundControl/FlightDisplay/PreFlightRCCheck.qml">src/FlightDisplay/PreFlightRCCheck.qml</file>
...@@ -246,6 +243,7 @@ ...@@ -246,6 +243,7 @@
<file alias="QGroundControl/FlightMap/MissionItemIndicatorDrag.qml">src/FlightMap/MapItems/MissionItemIndicatorDrag.qml</file> <file alias="QGroundControl/FlightMap/MissionItemIndicatorDrag.qml">src/FlightMap/MapItems/MissionItemIndicatorDrag.qml</file>
<file alias="QGroundControl/FlightMap/MissionItemView.qml">src/FlightMap/MapItems/MissionItemView.qml</file> <file alias="QGroundControl/FlightMap/MissionItemView.qml">src/FlightMap/MapItems/MissionItemView.qml</file>
<file alias="QGroundControl/FlightMap/MissionLineView.qml">src/FlightMap/MapItems/MissionLineView.qml</file> <file alias="QGroundControl/FlightMap/MissionLineView.qml">src/FlightMap/MapItems/MissionLineView.qml</file>
<file alias="QGroundControl/FlightMap/PhotoVideoControl.qml">src/FlightMap/Widgets/PhotoVideoControl.qml</file>
<file alias="QGroundControl/FlightMap/PlanMapItems.qml">src/FlightMap/MapItems/PlanMapItems.qml</file> <file alias="QGroundControl/FlightMap/PlanMapItems.qml">src/FlightMap/MapItems/PlanMapItems.qml</file>
<file alias="QGroundControl/FlightMap/PolygonEditor.qml">src/FlightMap/MapItems/PolygonEditor.qml</file> <file alias="QGroundControl/FlightMap/PolygonEditor.qml">src/FlightMap/MapItems/PolygonEditor.qml</file>
<file alias="QGroundControl/FlightMap/QGCArtificialHorizon.qml">src/FlightMap/Widgets/QGCArtificialHorizon.qml</file> <file alias="QGroundControl/FlightMap/QGCArtificialHorizon.qml">src/FlightMap/Widgets/QGCArtificialHorizon.qml</file>
...@@ -271,10 +269,8 @@ ...@@ -271,10 +269,8 @@
<file alias="TcpSettings.qml">src/ui/preferences/TcpSettings.qml</file> <file alias="TcpSettings.qml">src/ui/preferences/TcpSettings.qml</file>
<file alias="test.qml">src/test.qml</file> <file alias="test.qml">src/test.qml</file>
<file alias="UdpSettings.qml">src/ui/preferences/UdpSettings.qml</file> <file alias="UdpSettings.qml">src/ui/preferences/UdpSettings.qml</file>
<file alias="ValuePageWidget.qml">src/FlightMap/Widgets/ValuePageWidget.qml</file>
<file alias="VehicleSummary.qml">src/VehicleSetup/VehicleSummary.qml</file> <file alias="VehicleSummary.qml">src/VehicleSetup/VehicleSummary.qml</file>
<file alias="VibrationPage.qml">src/AnalyzeView/VibrationPage.qml</file> <file alias="VibrationPage.qml">src/AnalyzeView/VibrationPage.qml</file>
<file alias="VideoPageWidget.qml">src/FlightMap/Widgets/VideoPageWidget.qml</file>
<file alias="VirtualJoystick.qml">src/FlightDisplay/VirtualJoystick.qml</file> <file alias="VirtualJoystick.qml">src/FlightDisplay/VirtualJoystick.qml</file>
<file alias="VTOLLandingPatternEditor.qml">src/PlanView/VTOLLandingPatternEditor.qml</file> <file alias="VTOLLandingPatternEditor.qml">src/PlanView/VTOLLandingPatternEditor.qml</file>
</qresource> </qresource>
......
...@@ -300,17 +300,6 @@ SetupPage { ...@@ -300,17 +300,6 @@ SetupPage {
} }
} }
} // QGCGroupBox - Hardware Settings } // QGCGroupBox - Hardware Settings
QGCGroupBox {
title: qsTr("Camera Test")
Layout.fillWidth: true
QGCButton {
anchors.horizontalCenter: parent.horizontalCenter
text: qsTr("Trigger Camera")
onClicked: controller.vehicle.triggerCamera()
}
}
} }
} }
} }
......
...@@ -1590,7 +1590,7 @@ QGCCameraControl::handleVideoInfo(const mavlink_video_stream_information_t* vi) ...@@ -1590,7 +1590,7 @@ QGCCameraControl::handleVideoInfo(const mavlink_video_stream_information_t* vi)
qCDebug(CameraControlLog) << "All stream handlers done"; qCDebug(CameraControlLog) << "All stream handlers done";
_streamInfoTimer.stop(); _streamInfoTimer.stop();
emit autoStreamChanged(); emit autoStreamChanged();
emit _vehicle->dynamicCameras()->streamChanged(); emit _vehicle->cameraManager()->streamChanged();
} }
} }
...@@ -1636,7 +1636,7 @@ QGCCameraControl::setCurrentStream(int stream) ...@@ -1636,7 +1636,7 @@ QGCCameraControl::setCurrentStream(int stream)
_requestStreamStatus(static_cast<uint8_t>(pInfo->streamID())); _requestStreamStatus(static_cast<uint8_t>(pInfo->streamID()));
} }
emit currentStreamChanged(); emit currentStreamChanged();
emit _vehicle->dynamicCameras()->streamChanged(); emit _vehicle->cameraManager()->streamChanged();
} }
} }
} }
...@@ -1786,7 +1786,7 @@ QGCCameraControl::_streamTimeout() ...@@ -1786,7 +1786,7 @@ QGCCameraControl::_streamTimeout()
//-- If we have at least one stream, work with what we have. //-- If we have at least one stream, work with what we have.
if(_streams.count()) { if(_streams.count()) {
emit autoStreamChanged(); emit autoStreamChanged();
emit _vehicle->dynamicCameras()->streamChanged(); emit _vehicle->cameraManager()->streamChanged();
} }
return; return;
} }
...@@ -2140,7 +2140,7 @@ QGCCameraControl::wb() ...@@ -2140,7 +2140,7 @@ QGCCameraControl::wb()
Fact* Fact*
QGCCameraControl::mode() QGCCameraControl::mode()
{ {
return _paramComplete ? getFact(kCAM_MODE) : nullptr; return _paramComplete && factExists(kCAM_MODE) ? getFact(kCAM_MODE) : nullptr;
} }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
......
...@@ -53,6 +53,29 @@ void FactGroup::_setupTimer() ...@@ -53,6 +53,29 @@ void FactGroup::_setupTimer()
} }
} }
bool FactGroup::factExists(const QString& name)
{
if (name.contains(".")) {
QStringList parts = name.split(".");
if (parts.count() != 2) {
qWarning() << "Only single level of hierarchy supported";
return false;
}
FactGroup * factGroup = getFactGroup(parts[0]);
if (!factGroup) {
qWarning() << "Unknown FactGroup" << parts[0];
return false;
}
return factGroup->factExists(parts[1]);
}
QString camelCaseName = _ignoreCamelCase ? name : _camelCase(name);
return _nameToFactMap.contains(camelCaseName);
}
Fact* FactGroup::getFact(const QString& name) Fact* FactGroup::getFact(const QString& name)
{ {
if (name.contains(".")) { if (name.contains(".")) {
......
...@@ -32,10 +32,15 @@ public: ...@@ -32,10 +32,15 @@ public:
Q_PROPERTY(QStringList factNames READ factNames CONSTANT) Q_PROPERTY(QStringList factNames READ factNames CONSTANT)
Q_PROPERTY(QStringList factGroupNames READ factGroupNames CONSTANT) Q_PROPERTY(QStringList factGroupNames READ factGroupNames CONSTANT)
/// @ return true: if the fact exists in the group
Q_INVOKABLE bool factExists(const QString& name);
/// @return Fact for specified name, NULL if not found /// @return Fact for specified name, NULL if not found
/// Note: Requesting a fact which doesn't exists is considered an internal error and will spit out a qWarning
Q_INVOKABLE Fact* getFact(const QString& name); Q_INVOKABLE Fact* getFact(const QString& name);
/// @return FactGroup for specified name, NULL if not found /// @return FactGroup for specified name, NULL if not found
/// Note: Requesting a fact group which doesn't exists is considered an internal error and will spit out a qWarning
Q_INVOKABLE FactGroup* getFactGroup(const QString& name); Q_INVOKABLE FactGroup* getFactGroup(const QString& name);
/// Turning on live updates will allow value changes to flow through as they are received. /// Turning on live updates will allow value changes to flow through as they are received.
......
...@@ -28,7 +28,7 @@ Item { ...@@ -28,7 +28,7 @@ Item {
property double _ar: QGroundControl.videoManager.aspectRatio property double _ar: QGroundControl.videoManager.aspectRatio
property bool _showGrid: QGroundControl.settingsManager.videoSettings.gridLines.rawValue > 0 property bool _showGrid: QGroundControl.settingsManager.videoSettings.gridLines.rawValue > 0
property var _dynamicCameras: activeVehicle ? activeVehicle.dynamicCameras : null property var _dynamicCameras: activeVehicle ? activeVehicle.cameraManager : null
property bool _connected: activeVehicle ? !activeVehicle.connectionLost : false property bool _connected: activeVehicle ? !activeVehicle.connectionLost : false
property int _curCameraIndex: _dynamicCameras ? _dynamicCameras.currentCamera : 0 property int _curCameraIndex: _dynamicCameras ? _dynamicCameras.currentCamera : 0
property bool _isCamera: _dynamicCameras ? _dynamicCameras.cameras.count > 0 : false property bool _isCamera: _dynamicCameras ? _dynamicCameras.cameras.count > 0 : false
......
...@@ -26,15 +26,11 @@ Column { ...@@ -26,15 +26,11 @@ Column {
id: _root id: _root
spacing: ScreenTools.defaultFontPixelHeight * 0.25 spacing: ScreenTools.defaultFontPixelHeight * 0.25
property var missionController property var missionController
property real availableHeight
Loader { Loader {
width: parent.width width: parent.width
source: QGroundControl.settingsManager.flyViewSettings.alternateInstrumentPanel.rawValue ? source: QGroundControl.settingsManager.flyViewSettings.alternateInstrumentPanel.rawValue ?
"qrc:/qml/QGCInstrumentWidgetAlternate.qml" : "qrc:/qml/QGCInstrumentWidget.qml" "qrc:/qml/QGCInstrumentWidgetAlternate.qml" : "qrc:/qml/QGCInstrumentWidget.qml"
property real maxHeight: availableHeight - y
property bool showValues: !QGroundControl.airspaceManager.airspaceVisible
} }
} }
...@@ -23,12 +23,6 @@ Column { ...@@ -23,12 +23,6 @@ Column {
property real availableHeight property real availableHeight
MultiVehiclePanel {
id: multiVehiclePanel
width: parent.width
availableHeight: parent.height - y
}
AirspaceControl { AirspaceControl {
id: airspaceControl id: airspaceControl
width: parent.width width: parent.width
...@@ -40,7 +34,5 @@ Column { ...@@ -40,7 +34,5 @@ Column {
id: flightDisplayViewWidgets id: flightDisplayViewWidgets
width: parent.width width: parent.width
missionController: _missionController missionController: _missionController
availableHeight: _root.availableHeight - y
visible: multiVehiclePanel.singleVehiclePanel
} }
} }
...@@ -71,20 +71,61 @@ Item { ...@@ -71,20 +71,61 @@ Item {
rallyPointController: _rallyPointController rallyPointController: _rallyPointController
} }
Row {
id: multiVehiclePanelSelector
anchors.margins: _toolsMargin
anchors.top: parent.top
anchors.right: parent.right
width: _rightPanelWidth
spacing: ScreenTools.defaultFontPixelWidth
visible: QGroundControl.multiVehicleManager.vehicles.count > 1 && QGroundControl.corePlugin.options.flyView.showMultiVehicleList
property bool showSingleVehiclePanel: !visible || singleVehicleRadio.checked
QGCMapPalette { id: mapPal; lightColors: true }
QGCRadioButton {
id: singleVehicleRadio
text: qsTr("Single")
checked: true
textColor: mapPal.text
}
QGCRadioButton {
text: qsTr("Multi-Vehicle")
textColor: mapPal.text
}
}
MultiVehicleList {
anchors.margins: _toolsMargin
anchors.top: multiVehiclePanelSelector.bottom
anchors.right: parent.right
width: _rightPanelWidth
height: parent.height - y - _toolsMargin
visible: !multiVehiclePanelSelector.showSingleVehiclePanel
}
FlyViewInstrumentPanel { FlyViewInstrumentPanel {
id: instrumentPanel id: instrumentPanel
anchors.margins: _toolsMargin anchors.margins: _toolsMargin
anchors.top: parent.top anchors.top: multiVehiclePanelSelector.visible ? multiVehiclePanelSelector.bottom : parent.top
anchors.bottom: parent.bottom
anchors.right: parent.right anchors.right: parent.right
width: _rightPanelWidth width: _rightPanelWidth
spacing: _toolsMargin spacing: _toolsMargin
visible: QGroundControl.corePlugin.options.flyView.showInstrumentPanel visible: QGroundControl.corePlugin.options.flyView.showInstrumentPanel && multiVehiclePanelSelector.showSingleVehiclePanel
availableHeight: parent.height - y - _toolsMargin availableHeight: parent.height - y - _toolsMargin
property real rightInset: visible ? parent.width - x : 0 property real rightInset: visible ? parent.width - x : 0
} }
PhotoVideoControl {
anchors.margins: _toolsMargin
anchors.verticalCenter: parent.verticalCenter
anchors.right: parent.right
width: _rightPanelWidth
}
TelemetryValuesBar { TelemetryValuesBar {
id: telemetryPanel id: telemetryPanel
x: recalcXPosition() x: recalcXPosition()
......
/****************************************************************************
*
* (c) 2009-2020 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.12
import QtQuick.Controls 2.4
import QtQuick.Layouts 1.12
import QGroundControl 1.0
import QGroundControl.Controls 1.0
import QGroundControl.FlightDisplay 1.0
import QGroundControl.ScreenTools 1.0
import QGroundControl.Palette 1.0
/// Multi vehicle panel for Fly View
Item {
id: _root
height: singleVehiclePanel ? selectorRow.height : availableHeight
visible: QGroundControl.multiVehicleManager.vehicles.count > 1 && QGroundControl.corePlugin.options.flyView.showMultiVehicleList
property alias singleVehiclePanel: singleVehicleView.checked
property real availableHeight
QGCMapPalette { id: mapPal; lightColors: true }
Row {
id: selectorRow
spacing: ScreenTools.defaultFontPixelWidth
QGCRadioButton {
id: singleVehicleView
text: qsTr("Single")
checked: true
textColor: mapPal.text
}
QGCRadioButton {
text: qsTr("Multi-Vehicle")
textColor: mapPal.text
}
}
MultiVehicleList {
anchors.topMargin: ScreenTools.defaultFontPixelHeight / 2
anchors.top: selectorRow.bottom
anchors.bottom: parent.bottom
width: parent.width
visible: !singleVehiclePanel && !QGroundControl.videoManager.fullScreen && QGroundControl.corePlugin.options.showMultiVehicleList
}
}
This diff is collapsed.
This diff is collapsed.
...@@ -22,15 +22,10 @@ ColumnLayout { ...@@ -22,15 +22,10 @@ ColumnLayout {
id: root id: root
spacing: ScreenTools.defaultFontPixelHeight / 4 spacing: ScreenTools.defaultFontPixelHeight / 4
// These properties are expected to be in the Loader
// property real maxHeight
// property bool showValues - true: show value pages
property real _innerRadius: (width - (_topBottomMargin * 3)) / 4 property real _innerRadius: (width - (_topBottomMargin * 3)) / 4
property real _outerRadius: _innerRadius + _topBottomMargin property real _outerRadius: _innerRadius + _topBottomMargin
property real _spacing: ScreenTools.defaultFontPixelHeight * 0.33 property real _spacing: ScreenTools.defaultFontPixelHeight * 0.33
property real _topBottomMargin: (width * 0.05) / 2 property real _topBottomMargin: (width * 0.05) / 2
property real _availableValueHeight: maxHeight - _valuesItem.y
QGCPalette { id: qgcPal } QGCPalette { id: qgcPal }
...@@ -65,26 +60,4 @@ ColumnLayout { ...@@ -65,26 +60,4 @@ ColumnLayout {
TerrainProgress { TerrainProgress {
Layout.fillWidth: true Layout.fillWidth: true
} }
Item {
id: _valuesItem
Layout.fillWidth: true
height: _valuesWidget.height
visible: showValues
DeadMouseArea { anchors.fill: parent }
Rectangle {
anchors.fill: _valuesWidget
color: qgcPal.window
}
PageView {
id: _valuesWidget
anchors.margins: 1
anchors.left: parent.left
anchors.right: parent.right
maxHeight: _availableValueHeight
}
}
} }
...@@ -27,11 +27,9 @@ Rectangle { ...@@ -27,11 +27,9 @@ Rectangle {
// property real maxHeight // property real maxHeight
// property bool showValues - true: show value pages // property bool showValues - true: show value pages
property real _innerRadius: (width - (_topBottomMargin * 2)) / 2 property real _innerRadius: (width - (_topBottomMargin * 2)) / 2
property real _outerRadius: _innerRadius + _topBottomMargin * 2 property real _outerRadius: _innerRadius + _topBottomMargin * 2
property real _spacing: ScreenTools.defaultFontPixelHeight * 0.33 property real _margins: (width * 0.05) / 2
property real _topBottomMargin: (width * 0.05) / 2
property real _availableValueHeight: maxHeight - (attitude.height + compass.height)
// Prevent all clicks from going through to lower layers // Prevent all clicks from going through to lower layers
DeadMouseArea { DeadMouseArea {
...@@ -41,51 +39,20 @@ Rectangle { ...@@ -41,51 +39,20 @@ Rectangle {
QGCPalette { id: qgcPal } QGCPalette { id: qgcPal }
QGCAttitudeWidget { QGCAttitudeWidget {
id: attitude id: attitude
anchors.topMargin : _topBottomMargin anchors.horizontalCenter: parent.horizontalCenter
anchors.bottomMargin: _topBottomMargin anchors.margins : _margins
anchors.top: parent.top anchors.top: parent.top
size: _innerRadius * 2 size: _innerRadius * 2
vehicle: activeVehicle vehicle: activeVehicle
anchors.horizontalCenter: parent.horizontalCenter
}
Item {
id: _valuesItem
anchors.topMargin: ScreenTools.defaultFontPixelHeight / 4
anchors.bottomMargin: ScreenTools.defaultFontPixelHeight / 4
anchors.top: attitude.bottom
anchors.bottom: compass.top
width: parent.width
height: _valuesWidget.height
visible: showValues
// Prevent all clicks from going through to lower layers
DeadMouseArea {
anchors.fill: parent
}
Rectangle {
anchors.fill: _valuesWidget
color: qgcPal.window
}
PageView {
id: _valuesWidget
anchors.margins: 1
anchors.left: parent.left
anchors.right: parent.right
maxHeight: _availableValueHeight
}
} }
QGCCompassWidget { QGCCompassWidget {
id: compass id: compass
anchors.bottom : parent.bottom anchors.horizontalCenter: parent.horizontalCenter
anchors.bottomMargin: _topBottomMargin anchors.margins: _margins
anchors.topMargin: _topBottomMargin anchors.top: attitude.bottom
size: _innerRadius * 2 size: _innerRadius * 2
vehicle: activeVehicle vehicle: activeVehicle
anchors.horizontalCenter: parent.horizontalCenter
} }
} }
/****************************************************************************
*
* (c) 2009-2020 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.12
import QtQuick.Dialogs 1.3
import QtQuick.Layouts 1.2
import QtQuick.Controls 2.5
import QtQml 2.12
import QGroundControl.Controls 1.0
import QGroundControl.ScreenTools 1.0
import QGroundControl.FactSystem 1.0
import QGroundControl.FactControls 1.0
import QGroundControl.Controllers 1.0
import QGroundControl.Palette 1.0
import QGroundControl.FlightMap 1.0
import QGroundControl 1.0
/// Value page for InstrumentPanel PageView
VerticalFactValueGrid {
id: _root
width: pageWidth
userSettingsGroup: valuePageUserSettingsGroup
defaultSettingsGroup: valuePageDefaultSettingsGroup
property bool showSettingsIcon: true
property bool showLockIcon: true
function showSettings(settingsUnlocked) {
_root.settingsUnlocked = settingsUnlocked
}
}
/****************************************************************************
*
* (c) 2009-2020 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.11
import QtPositioning 5.2
import QtQuick.Layouts 1.2
import QtQuick.Controls 2.4
import QtQuick.Dialogs 1.2
import QtGraphicalEffects 1.0
import QGroundControl 1.0
import QGroundControl.ScreenTools 1.0
import QGroundControl.Controls 1.0
import QGroundControl.Palette 1.0
import QGroundControl.Vehicle 1.0
import QGroundControl.Controllers 1.0
import QGroundControl.FactSystem 1.0
import QGroundControl.FactControls 1.0
/// Video streaming page for Instrument Panel PageView
Item {
width: pageWidth
height: videoGrid.y + videoGrid.height + _margins
anchors.margins: ScreenTools.defaultFontPixelWidth * 2
anchors.centerIn: parent
property bool _communicationLost: activeVehicle ? activeVehicle.connectionLost : false
property bool _recordingVideo: QGroundControl.videoManager.recording
property bool _decodingVideo: QGroundControl.videoManager.decoding
property bool _streamingEnabled: QGroundControl.settingsManager.videoSettings.streamConfigured
property var _dynamicCameras: activeVehicle ? activeVehicle.dynamicCameras : null
property int _curCameraIndex: _dynamicCameras ? _dynamicCameras.currentCamera : 0
property bool _isCamera: _dynamicCameras ? _dynamicCameras.cameras.count > 0 : false
property var _camera: _isCamera ? (_dynamicCameras.cameras.get(_curCameraIndex) && _dynamicCameras.cameras.get(_curCameraIndex).paramComplete ? _dynamicCameras.cameras.get(_curCameraIndex) : null) : null
property real _margins: ScreenTools.defaultFontPixelWidth / 2
QGCPalette { id:qgcPal; colorGroupEnabled: true }
GridLayout {
id: videoGrid
anchors.margins: _margins
anchors.top: parent.top
anchors.left: parent.left
anchors.right: parent.right
columns: 2
columnSpacing: _margins
rowSpacing: ScreenTools.defaultFontPixelHeight
Connections {
// For some reason, the normal signal is not reflected in the control below
target: QGroundControl.settingsManager.videoSettings.streamEnabled
onRawValueChanged: {
enableSwitch.checked = QGroundControl.settingsManager.videoSettings.streamEnabled.rawValue
}
}
// Enable/Disable Video Streaming
QGCLabel {
text: qsTr("Enable")
font.pointSize: ScreenTools.smallFontPointSize
visible: !_camera || !_camera.autoStream
}
QGCSwitch {
id: enableSwitch
visible: !_camera || !_camera.autoStream
enabled: _streamingEnabled
checked: QGroundControl.settingsManager.videoSettings.streamEnabled.rawValue
Layout.alignment: Qt.AlignHCenter
onClicked: {
if(checked) {
QGroundControl.settingsManager.videoSettings.streamEnabled.rawValue = 1
QGroundControl.videoManager.startVideo()
} else {
QGroundControl.settingsManager.videoSettings.streamEnabled.rawValue = 0
QGroundControl.videoManager.stopVideo()
}
}
}
// Grid Lines
QGCLabel {
text: qsTr("Grid Lines")
font.pointSize: ScreenTools.smallFontPointSize
visible: QGroundControl.videoManager.isGStreamer && QGroundControl.settingsManager.videoSettings.gridLines.visible
}
QGCSwitch {
enabled: _streamingEnabled && activeVehicle
checked: QGroundControl.settingsManager.videoSettings.gridLines.rawValue
visible: QGroundControl.videoManager.isGStreamer && QGroundControl.settingsManager.videoSettings.gridLines.visible
Layout.alignment: Qt.AlignHCenter
onClicked: {
if(checked) {
QGroundControl.settingsManager.videoSettings.gridLines.rawValue = 1
} else {
QGroundControl.settingsManager.videoSettings.gridLines.rawValue = 0
}
}
}
//-- Video Fit
QGCLabel {
text: qsTr("Video Fit")
visible: QGroundControl.videoManager.isGStreamer
font.pointSize: ScreenTools.smallFontPointSize
}
FactComboBox {
fact: QGroundControl.settingsManager.videoSettings.videoFit
visible: QGroundControl.videoManager.isGStreamer
indexModel: false
Layout.alignment: Qt.AlignHCenter
}
QGCLabel {
text: qsTr("File Name");
font.pointSize: ScreenTools.smallFontPointSize
visible: QGroundControl.videoManager.isGStreamer
}