monitor overlay: stop setting property on root object and use context properties

parent bdb11198
......@@ -649,7 +649,8 @@ void GLWidget::refresh()
bool GLWidget::checkFrameNumber(int pos)
{
emit seekPosition(pos);
rootObject()->setProperty("consumerPosition", pos);
//TODO: cleanup and move logic to proper proxy class
m_proxy->setPosition(pos);
if (pos == m_proxy->seekPosition()) {
m_proxy->setSeekPosition(SEEK_INACTIVE);
return true;
......@@ -918,8 +919,7 @@ int GLWidget::setProducer(Mlt::Producer *producer, bool isActive, int position)
startConsumer();
}
// emit durationChanged(m_producer->get_length() - 1, m_producer->get_in());
position = m_producer->position();
rootObject()->setProperty("consumerPosition", position);
m_proxy->setPosition(m_producer->position());
return error;
}
......
......@@ -291,19 +291,24 @@ class MonitorProxy : public QObject
{
Q_OBJECT
// Q_PROPERTY(int consumerPosition READ consumerPosition NOTIFY consumerPositionChanged)
Q_PROPERTY(int position READ position NOTIFY positionChanged)
Q_PROPERTY(int seekPosition READ seekPosition WRITE setSeekPosition NOTIFY seekPositionChanged)
Q_PROPERTY(int zoneIn READ zoneIn WRITE setZoneIn NOTIFY zoneChanged)
Q_PROPERTY(int zoneOut READ zoneOut WRITE setZoneOut NOTIFY zoneChanged)
Q_PROPERTY(QString markerComment READ markerComment NOTIFY markerCommentChanged)
public:
MonitorProxy(GLWidget *parent)
: QObject(parent)
, q(parent)
, m_position(0)
, m_seekPosition(-1)
, m_zoneIn(0)
, m_zoneOut(-1)
{
}
int seekPosition() const { return m_seekPosition; }
int position() const { return m_position; }
QString markerComment() const { return m_markerComment; }
Q_INVOKABLE void requestSeekPosition(int pos)
{
q->activateMonitor();
......@@ -311,6 +316,19 @@ public:
emit seekPositionChanged();
emit seekRequestChanged();
}
void setPosition(int pos)
{
m_position = pos;
emit positionChanged();
}
void setMarkerComment(const QString &comment)
{
if (m_markerComment == comment) {
return;
}
m_markerComment = comment;
emit markerCommentChanged();
}
void setSeekPosition(int pos)
{
m_seekPosition = pos;
......@@ -348,9 +366,11 @@ public:
}
QPoint zone() const { return QPoint(m_zoneIn, m_zoneOut); }
signals:
void positionChanged();
void seekPositionChanged();
void seekRequestChanged();
void zoneChanged();
void markerCommentChanged();
private:
GLWidget *q;
......@@ -358,6 +378,7 @@ private:
int m_seekPosition;
int m_zoneIn;
int m_zoneOut;
QString m_markerComment;
};
#endif
......@@ -1105,8 +1105,7 @@ void Monitor::checkOverlay(int pos)
overlayText = marker.comment();
}
}
m_glMonitor->rootObject()->setProperty("markerText", overlayText);
// m_qmlManager->setProperty(QLatin1String("markerText"), overlayText);
m_glMonitor->getControllerProxy()->setMarkerComment(overlayText);
}
int Monitor::getZoneStart()
......
......@@ -188,10 +188,10 @@ import QtQuick 2.4
TimelinePlayhead {
id: playhead
visible: root.consumerPosition > -1
visible: controller.position > -1
height: ruler.height * 0.5
width: ruler.height * 1
anchors.top: ruler.top
x: root.consumerPosition * root.timeScale - (width / 2)
x: controller.position * root.timeScale - (width / 2)
}
}
......@@ -31,7 +31,6 @@ Item {
property int duration: 300
property bool mouseOverRuler: false
property int mouseRulerPos: 0
property int consumerPosition: -1
property double frameSize: 10
property double timeScale: 1
property int rulerHeight: 20
......@@ -191,12 +190,12 @@ Item {
bottom: parent.bottom
}
visible: root.showMarkers && text != ""
text: root.markerText
text: controller.markerComment
maximumLength: 20
style: TextFieldStyle {
textColor: "white"
background: Rectangle {
color: "#99ff0000"
color: "#66ff0000"
width: marker.width
}
}
......
......@@ -31,7 +31,6 @@ Item {
property int duration: 300
property bool mouseOverRuler: false
property int mouseRulerPos: 0
property int consumerPosition: -1
property double frameSize: 10
property double timeScale: 1
property int rulerHeight: 20
......@@ -159,7 +158,7 @@ Item {
bottom: parent.bottom
}
visible: root.showMarkers && text != ""
text: root.markerText
text: controller.markerComment
maximumLength: 20
style: TextFieldStyle {
textColor: "white"
......
......@@ -25,7 +25,6 @@ Item {
property int duration: 300
property bool mouseOverRuler: false
property int mouseRulerPos: 0
property int consumerPosition: -1
onScalexChanged: canvas.requestPaint()
onScaleyChanged: canvas.requestPaint()
onOffsetxChanged: canvas.requestPaint()
......
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