Commit 45cc573d authored by Gus Grubba's avatar Gus Grubba Committed by Lorenz Meier

Add grid lines to video view

parent 21923ab9
......@@ -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
}
}
......@@ -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
}
]
......@@ -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<VideoSettings>("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;
}
......@@ -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
......@@ -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
......
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