Permalink
Browse files

engine: add Z-Index to Video function

  • Loading branch information...
mcallegari committed Nov 23, 2018
1 parent bdc8d1f commit 8397956b0602cf130efad71445a73b26ab0cc22a
Showing with 32 additions and 0 deletions.
  1. +24 −0 engine/src/video.cpp
  2. +8 −0 engine/src/video.h
@@ -31,6 +31,7 @@
#define KXMLQLCVideoFullscreen "Fullscreen"
#define KXMLQLCVideoGeometry "Geometry"
#define KXMLQLCVideoRotation "Rotation"
#define KXMLQLCVideoZIndex "ZIndex"
const QStringList Video::m_defaultVideoCaps =
QStringList() << "*.avi" << "*.wmv" << "*.mkv" << "*.mp4" << "*.mov" << "*.mpg" << "*.mpeg" << "*.flv" << "*.webm";
@@ -50,6 +51,7 @@ Video::Video(Doc* doc)
, m_resolution(QSize(0,0))
, m_customGeometry(QRect())
, m_rotation(QVector3D(0, 0, 0))
, m_zIndex(1)
, m_screen(0)
, m_fullscreen(false)
{
@@ -204,6 +206,20 @@ void Video::setRotation(QVector3D rotation)
emit rotationChanged(m_rotation);
}
int Video::zIndex() const
{
return m_zIndex;
}
void Video::setZIndex(int idx)
{
if (m_zIndex == idx)
return;
m_zIndex = idx;
emit zIndexChanged(m_zIndex);
}
void Video::setAudioCodec(QString codec)
{
m_audioCodec = codec;
@@ -234,7 +250,10 @@ bool Video::setSourceUrl(QString filename)
QString fileExt = "*" + filename.mid(filename.lastIndexOf('.'));
if (m_defaultPictureCaps.contains(fileExt))
{
m_isPicture = true;
setZIndex(2);
}
if (m_sourceUrl.contains("://"))
{
@@ -376,6 +395,7 @@ bool Video::saveXML(QXmlStreamWriter *doc)
QString rot = QString("%1,%2,%3").arg(m_rotation.x()).arg(m_rotation.y()).arg(m_rotation.z());
doc->writeAttribute(KXMLQLCVideoRotation, rot);
}
doc->writeAttribute(KXMLQLCVideoZIndex, QString::number(m_zIndex));
#endif
if (m_sourceUrl.contains("://"))
doc->writeCharacters(m_sourceUrl);
@@ -449,6 +469,10 @@ bool Video::loadXML(QXmlStreamReader &root)
setRotation(v);
}
}
if (attrs.hasAttribute(KXMLQLCVideoZIndex))
{
setZIndex(attrs.value(KXMLQLCVideoZIndex).toInt());
}
#endif
QString path = root.readElementText();
@@ -42,6 +42,7 @@ class Video : public Function
Q_PROPERTY(qreal intensity READ intensity NOTIFY intensityChanged)
Q_PROPERTY(QRect customGeometry READ customGeometry WRITE setCustomGeometry NOTIFY customGeometryChanged)
Q_PROPERTY(QVector3D rotation READ rotation WRITE setRotation NOTIFY rotationChanged)
Q_PROPERTY(int zIndex READ zIndex WRITE setZIndex NOTIFY zIndexChanged)
Q_PROPERTY(bool fullscreen READ fullscreen WRITE setFullscreen)
/*********************************************************************
@@ -114,6 +115,10 @@ public slots:
QVector3D rotation() const;
void setRotation(QVector3D rotation);
/** Get/Set the video Z-Index used for layering */
int zIndex() const;
void setZIndex(int idx);
/** Get/Set the audio codec for this Video Function */
QString audioCodec();
void setAudioCodec(QString codec);
@@ -148,6 +153,7 @@ public slots:
void intensityChanged();
void customGeometryChanged(QRect rect);
void rotationChanged(QVector3D rotation);
void zIndexChanged(int index);
void totalTimeChanged(qint64);
void metaDataChanged(QString key, QVariant data);
void requestPlayback();
@@ -171,6 +177,8 @@ public slots:
QRect m_customGeometry;
/** The video XYZ rotation as a 3D vector */
QVector3D m_rotation;
/** The video Z-Index */
int m_zIndex;
/** Index of the screen where to render the video */
int m_screen;
/** Flag that indicates if the video has to go fullscreen */

0 comments on commit 8397956

Please sign in to comment.