]> git.sesse.net Git - kdenlive/commitdiff
Fix timeline seek sometimes not refreshing on last frame of the seek, small update...
authorJean-Baptiste Mardelle <jb@kdenlive.org>
Sat, 9 Feb 2013 18:49:18 +0000 (19:49 +0100)
committerJean-Baptiste Mardelle <jb@kdenlive.org>
Sat, 9 Feb 2013 18:49:18 +0000 (19:49 +0100)
src/customruler.cpp
src/renderer.cpp
src/smallruler.cpp
src/smallruler.h

index a02c2f6d98d76656ba64804789c4dff974aded1f..92141986ce4cc17f2a468c65928083468aaec1a6 100644 (file)
@@ -76,6 +76,7 @@ CustomRuler::CustomRuler(Timecode tc, CustomTrackView *parent) :
     updateFrameSize();
     m_scale = 3;
     m_zoneColor = KStatefulBrush(KColorScheme::View, KColorScheme::FocusColor, KSharedConfig::openConfig(KdenliveSettings::colortheme())).brush(this).color();
+    m_zoneColor.setAlpha(180);
     m_zoneStart = 0;
     m_zoneEnd = 100;
     m_contextMenu = new QMenu(this);
@@ -95,6 +96,7 @@ CustomRuler::CustomRuler(Timecode tc, CustomTrackView *parent) :
 void CustomRuler::updatePalette()
 {
     m_zoneColor = KStatefulBrush(KColorScheme::View, KColorScheme::FocusColor, KSharedConfig::openConfig(KdenliveSettings::colortheme())).brush(this).color();
+    m_zoneColor.setAlpha(180);
 }
 
 void CustomRuler::updateProjectFps(Timecode t)
@@ -222,10 +224,10 @@ void CustomRuler::mouseMoveEvent(QMouseEvent * event)
         int pos = (int)((event->x() + m_offset));
        if (m_cursorColor == palette().text() && qAbs(pos - m_view->cursorPos() * m_factor) < 7) {
            // Mouse is over cursor
-           m_cursorColor = palette().highlight();
+           m_cursorColor = palette().link();
            update(m_view->cursorPos() * m_factor - m_offset - 10, LABEL_SIZE + 2, 20, MAX_HEIGHT - LABEL_SIZE - 2);
        }
-       else if (m_cursorColor == palette().highlight() && qAbs(pos - m_view->cursorPos() * m_factor) >= 7) {
+       else if (m_cursorColor == palette().link() && qAbs(pos - m_view->cursorPos() * m_factor) >= 7) {
            m_cursorColor = palette().text();
            update(m_view->cursorPos() * m_factor - m_offset - 10, LABEL_SIZE + 2, 20, MAX_HEIGHT - LABEL_SIZE - 2);
        }
@@ -256,7 +258,7 @@ void CustomRuler::mouseMoveEvent(QMouseEvent * event)
 void CustomRuler::leaveEvent(QEvent * event)
 {
     QWidget::leaveEvent(event);
-    if (m_cursorColor == palette().highlight()) {
+    if (m_cursorColor == palette().link()) {
        m_cursorColor = palette().text();
        update();
     }
@@ -489,7 +491,7 @@ void CustomRuler::paintEvent(QPaintEvent *e)
     p.drawPolygon(pa);
     
     if (m_lastSeekPosition != SEEK_INACTIVE && m_lastSeekPosition != m_view->cursorPos()) {
-       p.fillRect(m_lastSeekPosition * m_factor - m_offset - 1, BIG_MARK_X + 1, 3, MAX_HEIGHT - BIG_MARK_X - 1, palette().highlight());
+       p.fillRect(m_lastSeekPosition * m_factor - m_offset - 1, BIG_MARK_X + 1, 3, MAX_HEIGHT - BIG_MARK_X - 1, palette().linkVisited());
     }
 
 }
index 23503f07a996549843aeb6806dcbcbb1347331b3..eea8cd84f194add246ba746ff5d0114954943d6b 100644 (file)
@@ -1803,13 +1803,15 @@ int Render::getCurrentSeekPosition() const
 void Render::emitFrameNumber()
 {
     int currentPos = m_mltConsumer->position();
-    if (currentPos == requestedSeekPosition) requestedSeekPosition = SEEK_INACTIVE;
+    if (currentPos == requestedSeekPosition) {
+       requestedSeekPosition = SEEK_INACTIVE;
+       m_paused = true;
+    }
     emit rendererPosition(currentPos);
     if (requestedSeekPosition != SEEK_INACTIVE) {
        m_mltConsumer->purge();
        m_mltProducer->seek(requestedSeekPosition);
-       if (m_mltProducer->get_speed() == 0 && m_paused) {
-           m_paused = false;
+       if (m_mltProducer->get_speed() == 0 && !m_paused) {
            m_mltConsumer->set("refresh", 1);
        }
        requestedSeekPosition = SEEK_INACTIVE;
index 2d45f57ea49d1b7b821bb38fd87aefea6842d039..cc5f1999a25408ab1a897b069c9cd00f6d05b5ee 100644 (file)
@@ -43,7 +43,8 @@ SmallRuler::SmallRuler(Monitor *monitor, Render *render, QWidget *parent) :
     m_zoneStart = 10;
     m_zoneEnd = 60;
     KSharedConfigPtr config = KSharedConfig::openConfig(KdenliveSettings::colortheme());
-    m_zoneBrush = KStatefulBrush(KColorScheme::View, KColorScheme::FocusColor, config);
+    m_zoneColor = KStatefulBrush(KColorScheme::View, KColorScheme::FocusColor, config).brush(this).color();
+    m_zoneColor.setAlpha(180);
 
     setMouseTracking(true);
     setMinimumHeight(8);
@@ -148,7 +149,7 @@ void SmallRuler::mouseReleaseEvent(QMouseEvent * event)
 void SmallRuler::leaveEvent(QEvent * event)
 {
     QWidget::leaveEvent(event);
-    if (m_cursorColor == palette().highlight()) {
+    if (m_cursorColor == palette().link()) {
        m_cursorColor = palette().text();
        update();
     }
@@ -168,10 +169,10 @@ void SmallRuler::mouseMoveEvent(QMouseEvent * event)
     else {
        if (m_cursorColor == palette().text() && qAbs(pos - m_cursorFramePosition) * m_scale < 7) {
            // Mouse is over cursor
-           m_cursorColor = palette().highlight();
+           m_cursorColor = palette().link();
            update();
        }
-       else if (m_cursorColor == palette().highlight() && qAbs(pos - m_cursorFramePosition) * m_scale >= 7) {
+       else if (m_cursorColor == palette().link() && qAbs(pos - m_cursorFramePosition) * m_scale >= 7) {
            m_cursorColor = palette().text();
            update();
        }
@@ -240,9 +241,7 @@ void SmallRuler::updatePixmap()
 
     const int zoneStart = (int)(m_zoneStart * m_scale);
     const int zoneEnd = (int)(m_zoneEnd * m_scale);
-    p.setPen(Qt::NoPen);
-    p.setBrush(m_zoneBrush.brush(this));
-    p.drawRect(zoneStart, 0, zoneEnd - zoneStart, height());
+    p.fillRect(zoneStart, 0, zoneEnd - zoneStart, height(), QBrush(m_zoneColor));
 
     // draw ruler
     p.setPen(palette().midlight().color());
@@ -294,14 +293,15 @@ void SmallRuler::paintEvent(QPaintEvent *e)
 
     // Draw seeking pointer
     if (m_lastSeekPosition != SEEK_INACTIVE && m_lastSeekPosition != m_cursorFramePosition) {
-       p.fillRect(m_lastSeekPosition * m_scale - 1, 0, 3, height(), palette().highlight());
+       p.fillRect(m_lastSeekPosition * m_scale - 1, 0, 3, height(), palette().linkVisited());
     }
 }
 
 void SmallRuler::updatePalette()
 {
     KSharedConfigPtr config = KSharedConfig::openConfig(KdenliveSettings::colortheme());
-    m_zoneBrush = KStatefulBrush(KColorScheme::View, KColorScheme::FocusColor, config);
+    m_zoneColor = KStatefulBrush(KColorScheme::View, KColorScheme::FocusColor, config).brush(this).color();
+    m_zoneColor.setAlpha(180);
     updatePixmap();
 }
 
index 30b09413c3618182e2136ffd1c5166262a1b26e8..0453a8c5ac23db08b1c508585cd3151be4bd6038 100644 (file)
@@ -59,7 +59,7 @@ private:
     int m_maxval;
     int m_zoneStart;
     int m_zoneEnd;
-    KStatefulBrush m_zoneBrush;
+    QColor m_zoneColor;
     QList <CommentedTime> m_markers;
     QPixmap m_pixmap;
     Monitor *m_monitor;