diff --git a/src/FlightDisplay/FlightDisplayViewVideo.qml b/src/FlightDisplay/FlightDisplayViewVideo.qml index 65d9af211b26a2299e44bd5587136e00bbdfe5ec..275bfd6abd60a3b9a00cf6127b23d6a3bc91678f 100644 --- a/src/FlightDisplay/FlightDisplayViewVideo.qml +++ b/src/FlightDisplay/FlightDisplayViewVideo.qml @@ -23,7 +23,9 @@ import QGroundControl.Controllers 1.0 Item { id: root - property double _ar: QGroundControl.settingsManager.videoSettings.aspectRatio.rawValue + property double _ar: QGroundControl.settingsManager.videoSettings.aspectRatio.rawValue + property bool _showGrid: QGroundControl.settingsManager.videoSettings.gridLines.rawValue > 0 + Rectangle { id: noVideo anchors.fill: parent @@ -50,4 +52,32 @@ Item { visible: QGroundControl.videoManager.videoRunning } } + Rectangle { + color: Qt.rgba(1,1,1,0.5) + height: parent.height + width: 1 + x: parent.width * 0.33 + visible: _showGrid + } + Rectangle { + color: Qt.rgba(1,1,1,0.5) + height: parent.height + width: 1 + x: parent.width * 0.66 + visible: _showGrid + } + Rectangle { + color: Qt.rgba(1,1,1,0.5) + width: parent.width + height: 1 + y: parent.height * 0.33 + visible: _showGrid + } + Rectangle { + color: Qt.rgba(1,1,1,0.5) + width: parent.width + height: 1 + y: parent.height * 0.66 + visible: _showGrid + } } diff --git a/src/Settings/Video.SettingsGroup.json b/src/Settings/Video.SettingsGroup.json index 17e8254dbc69731c4ad2b84340a83ab5fd31cbc9..457a519c274f87171d725a012a2097ee175eabb9 100644 --- a/src/Settings/Video.SettingsGroup.json +++ b/src/Settings/Video.SettingsGroup.json @@ -35,5 +35,14 @@ "type": "float", "decimalPlaces": 6, "defaultValue": 1.777777 +}, +{ + "name": "VideoGridLines", + "shortDescription": "Video Grid Lines", + "longDescription": "Displays a grid overlayed over the video view.", + "type": "uint32", + "enumStrings": "Hide,Show", + "enumValues": "1,0", + "defaultValue": 0 } ] diff --git a/src/Settings/VideoSettings.cc b/src/Settings/VideoSettings.cc index f36751d24d363518904b32840c873a1f1f63706f..52cf5961587d209565a7d96047b5adf758122567 100644 --- a/src/Settings/VideoSettings.cc +++ b/src/Settings/VideoSettings.cc @@ -24,6 +24,7 @@ const char* VideoSettings::udpPortName = "VideoUDPPort"; const char* VideoSettings::rtspUrlName = "VideoRTSPUrl"; const char* VideoSettings::videoSavePathName = "VideoSavePath"; const char* VideoSettings::videoAspectRatioName = "VideoAspectRatio"; +const char* VideoSettings::videoGridLinesName = "VideoGridLines"; const char* VideoSettings::videoSourceNoVideo = "No Video Available"; const char* VideoSettings::videoSourceUDP = "UDP Video Stream"; @@ -36,6 +37,7 @@ VideoSettings::VideoSettings(QObject* parent) , _rtspUrlFact(NULL) , _videoSavePathFact(NULL) , _videoAspectRatioFact(NULL) + , _gridLinesFact(NULL) { QQmlEngine::setObjectOwnership(this, QQmlEngine::CppOwnership); qmlRegisterUncreatableType("QGroundControl.SettingsManager", 1, 0, "VideoSettings", "Reference only"); @@ -115,3 +117,12 @@ Fact* VideoSettings::aspectRatio(void) return _videoAspectRatioFact; } + +Fact* VideoSettings::gridLines(void) +{ + if (!_gridLinesFact) { + _gridLinesFact = _createSettingsFact(videoGridLinesName); + } + + return _gridLinesFact; +} diff --git a/src/Settings/VideoSettings.h b/src/Settings/VideoSettings.h index d914fc7019fa3d1445a1919a08079e4ccec1b31c..48eb53dfc9844de55d3823561282da80658ffd1e 100644 --- a/src/Settings/VideoSettings.h +++ b/src/Settings/VideoSettings.h @@ -24,12 +24,14 @@ public: Q_PROPERTY(Fact* rtspUrl READ rtspUrl CONSTANT) Q_PROPERTY(Fact* videoSavePath READ videoSavePath CONSTANT) Q_PROPERTY(Fact* aspectRatio READ aspectRatio CONSTANT) + Q_PROPERTY(Fact* gridLines READ gridLines CONSTANT) Fact* videoSource (void); Fact* udpPort (void); Fact* rtspUrl (void); Fact* videoSavePath (void); Fact* aspectRatio (void); + Fact* gridLines (void); static const char* videoSettingsGroupName; @@ -38,6 +40,7 @@ public: static const char* rtspUrlName; static const char* videoSavePathName; static const char* videoAspectRatioName; + static const char* videoGridLinesName; static const char* videoSourceNoVideo; static const char* videoSourceUDP; @@ -49,6 +52,7 @@ private: SettingsFact* _rtspUrlFact; SettingsFact* _videoSavePathFact; SettingsFact* _videoAspectRatioFact; + SettingsFact* _gridLinesFact; }; #endif diff --git a/src/ui/preferences/GeneralSettings.qml b/src/ui/preferences/GeneralSettings.qml index 4993e8c7e0d706ed44529865a49fd84d1fa63796..4506b9174cbbbb677b6defdebe9f48430d380c6e 100644 --- a/src/ui/preferences/GeneralSettings.qml +++ b/src/ui/preferences/GeneralSettings.qml @@ -512,6 +512,20 @@ QGCView { fact: QGroundControl.settingsManager.videoSettings.aspectRatio } } + Row { + spacing: ScreenTools.defaultFontPixelWidth + visible: QGroundControl.videoManager.isGStreamer && videoSource.currentIndex < 2 && QGroundControl.settingsManager.videoSettings.gridLines.visible + QGCLabel { + anchors.baseline: gridField.baseline + text: qsTr("Grid Lines:") + width: _labelWidth + } + FactComboBox { + id: gridField + width: _editFieldWidth + fact: QGroundControl.settingsManager.videoSettings.gridLines + } + } Row { spacing: ScreenTools.defaultFontPixelWidth visible: QGroundControl.settingsManager.videoSettings.videoSavePath.visible && QGroundControl.videoManager.isGStreamer && QGroundControl.videoManager.recordingEnabled