]> git.sesse.net Git - kdenlive/commitdiff
start implementing monitor zone
authorJean-Baptiste Mardelle <jb@kdenlive.org>
Mon, 22 Sep 2008 17:42:12 +0000 (17:42 +0000)
committerJean-Baptiste Mardelle <jb@kdenlive.org>
Mon, 22 Sep 2008 17:42:12 +0000 (17:42 +0000)
svn path=/branches/KDE4/; revision=2403

src/customruler.cpp
src/customruler.h
src/mainwindow.cpp
src/monitor.cpp
src/monitor.h
src/smallruler.cpp
src/smallruler.h
src/trackview.cpp
src/trackview.h

index c5031c065ac2d99d405aede3435e58eb165078bb..dde85f1d4c317464f9afba005a3c6b8b4ba83d93 100644 (file)
@@ -107,6 +107,7 @@ void CustomRuler::mouseMoveEvent(QMouseEvent * event) {
             m_zoneStart += move;
             m_zoneEnd += move;
         }
+        emit zoneMoved(m_zoneStart, m_zoneEnd);
         m_view->setDocumentModified();
         update();
     } else {
@@ -197,12 +198,12 @@ void CustomRuler::paintEvent(QPaintEvent *e) {
     p.setClipRect(e->rect());
 
     const int projectEnd = (int)(m_duration * m_factor);
-    p.fillRect(QRect(- offset(), e->rect().y(), projectEnd, e->rect().height()), QBrush(QColor(245, 245, 245)));
+    p.fillRect(QRect(0, 0, projectEnd - offset(), height()), QBrush(QColor(245, 245, 245)));
 
     const int zoneStart = (int)(m_zoneStart * m_factor);
     const int zoneEnd = (int)(m_zoneEnd * m_factor);
 
-    p.fillRect(QRect(zoneStart - offset(), e->rect().y() + e->rect().height() / 2, zoneEnd - zoneStart, e->rect().height() / 2), QBrush(QColor(133, 255, 143)));
+    p.fillRect(QRect(zoneStart - offset(), height() / 2, zoneEnd - zoneStart, height() / 2), QBrush(QColor(133, 255, 143)));
 
     const int value  = m_view->cursorPos() * m_factor - offset();
     const int minval = minimum();
index e35aca6b932150aa4d4ec303e07d163f2146732e..edcf7b60713c7de756d6af80eb6cde7c0dd929af 100644 (file)
@@ -40,6 +40,9 @@ private:
 public slots:
     void slotMoveRuler(int newPos);
     void slotCursorMoved(int oldpos, int newpos);
+
+signals:
+    void zoneMoved(int, int);
 };
 
 #endif
index 45ea96dfde24ce158527c127435f73f6d6ee1ace..0fc4cbc7516b5f522f1f0752ee70961fd6ab4ed7 100644 (file)
@@ -1119,6 +1119,7 @@ void MainWindow::connectDocument(TrackView *trackView, KdenliveDoc *doc) { //cha
             disconnect(transitionConfig, SIGNAL(transitionUpdated(Transition *, QDomElement)), trackView->projectView() , SLOT(slotTransitionUpdated(Transition *, QDomElement)));
             disconnect(transitionConfig, SIGNAL(seekTimeline(int)), trackView->projectView() , SLOT(setCursorPos(int)));
             disconnect(m_activeTimeline->projectView(), SIGNAL(activateDocumentMonitor()), m_projectMonitor, SLOT(activateMonitor()));
+            disconnect(trackView, SIGNAL(zoneMoved(int, int)), m_projectMonitor, SLOT(slotZoneMoved(int, int)));
             effectStack->clear();
         }
         m_activeDocument->setRenderer(NULL);
@@ -1170,6 +1171,8 @@ void MainWindow::connectDocument(TrackView *trackView, KdenliveDoc *doc) { //cha
     connect(effectStack, SIGNAL(reloadEffects()), this, SLOT(slotReloadEffects()));
 
     connect(trackView->projectView(), SIGNAL(activateDocumentMonitor()), m_projectMonitor, SLOT(activateMonitor()));
+    connect(trackView, SIGNAL(zoneMoved(int, int)), m_projectMonitor, SLOT(slotZoneMoved(int, int)));
+
     trackView->projectView()->setContextMenu(m_timelineContextMenu, m_timelineContextClipMenu, m_timelineContextTransitionMenu);
     m_activeTimeline = trackView;
     if (m_renderWidget) m_renderWidget->setDocumentStandard(doc->getDocumentStandard());
index 6e1cde0c6e3d0496cd700703b2fdd35cdfb95bed..29116122a7766d0cd40ac65b7426d141adfc9eaf 100644 (file)
@@ -190,10 +190,14 @@ void Monitor::resetSize() {
     ui.video_frame->setMinimumSize(0, 0);
 }
 
+void Monitor::slotZoneMoved(int start, int end) {
+    m_ruler->setZone(start, end);
+}
+
 // virtual
 void Monitor::mousePressEvent(QMouseEvent * event) {
     if (event->button() != Qt::RightButton) {
-        slotPlay();
+        if (ui.video_frame->underMouse()) slotPlay();
     } else m_contextMenu->popup(event->globalPos());
 }
 
index 6dba626f8c8a1ff5221b552bce052e1903e481df..b91d929a9650952d80599209cea0857307675c0e 100644 (file)
@@ -102,6 +102,7 @@ public slots:
     void saveSceneList(QString path, QDomElement info = QDomElement());
     void slotStart();
     void slotEnd();
+    void slotZoneMoved(int start, int end);
 
 signals:
     void renderPosition(int);
index 901660918bcbc6cba8eefe519efbb584fca8a069..2a41544c966e0b8ece69365bf18ef10ee1c133d9 100644 (file)
@@ -28,6 +28,8 @@
 
 SmallRuler::SmallRuler(QWidget *parent)
         : QWidget(parent), m_scale(1), m_maxval(25) {
+    m_zoneStart = 10;
+    m_zoneEnd = 60;
 }
 
 void SmallRuler::adjustScale(int maximum) {
@@ -49,6 +51,12 @@ void SmallRuler::adjustScale(int maximum) {
     update();
 }
 
+void SmallRuler::setZone(int start, int end) {
+    m_zoneStart = start;
+    m_zoneEnd = end;
+    update();
+}
+
 // virtual
 void SmallRuler::mousePressEvent(QMouseEvent * event) {
     const int pos = event->x() / m_scale;
@@ -87,6 +95,11 @@ void SmallRuler::paintEvent(QPaintEvent *e) {
     double f, fend;
     p.setPen(palette().dark().color());
 
+    const int zoneStart = (int)(m_zoneStart * m_scale);
+    const int zoneEnd = (int)(m_zoneEnd * m_scale);
+
+    p.fillRect(QRect(zoneStart, height() / 2, zoneEnd - zoneStart, height() / 2), QBrush(QColor(133, 255, 143)));
+
     if (r.top() < 9) {
         // draw the little marks
         fend = m_scale * m_small;
index 02f55433e0b63940087b27d3280b9cd316c5e3b4..7e0a907206fc2c7b229925ffe9c4ef006c2c774f 100644 (file)
@@ -31,6 +31,7 @@ public:
     virtual void mousePressEvent(QMouseEvent * event);
     virtual void mouseMoveEvent(QMouseEvent * event);
     void adjustScale(int maximum);
+    void setZone(int start, int end);
 
 protected:
     virtual void paintEvent(QPaintEvent *e);
@@ -43,6 +44,8 @@ private:
     int m_medium;
     int m_small;
     int m_maxval;
+    int m_zoneStart;
+    int m_zoneEnd;
 
 public slots:
     void slotNewValue(int value);
index a22093b2f32c24885e00097166f6f435e92e91ed..6611a1886bf1c3a84fa2f1216ab7c92b7e7af40b 100644 (file)
@@ -49,6 +49,7 @@ TrackView::TrackView(KdenliveDoc *doc, QWidget *parent)
     //m_scene->addRect(QRectF(0, 0, 100, 100), QPen(), QBrush(Qt::red));
 
     m_ruler = new CustomRuler(doc->timecode(), m_trackview);
+    connect(m_ruler, SIGNAL(zoneMoved(int, int)), this, SIGNAL(zoneMoved(int, int)));
     QHBoxLayout *layout = new QHBoxLayout;
     view->ruler_frame->setLayout(layout);
     int left_margin;
index 1d4b979497eaaaa0f14f6c0dd0e723000cffa9df..977461e8149ce8db888201e39dae8459617870b2 100644 (file)
@@ -98,6 +98,7 @@ signals:
     void cursorMoved();
     void clipItemSelected(ClipItem*);
     void transitionItemSelected(Transition*);
+    void zoneMoved(int, int);
 };
 
 #endif