]> git.sesse.net Git - kdenlive/commitdiff
Cleanup ruler painting
authorJean-Baptiste Mardelle <jb@kdenlive.org>
Tue, 31 Mar 2009 14:10:46 +0000 (14:10 +0000)
committerJean-Baptiste Mardelle <jb@kdenlive.org>
Tue, 31 Mar 2009 14:10:46 +0000 (14:10 +0000)
svn path=/trunk/kdenlive/; revision=3194

src/customruler.cpp
src/customruler.h
src/smallruler.cpp
src/smallruler.h

index 18a31922f0d2814d7b637a33b0c68bcd8174f3c9..68cdf01b3eb330000d98bd0950ff0d9133f3bf52 100644 (file)
@@ -56,6 +56,8 @@ CustomRuler::CustomRuler(Timecode tc, CustomTrackView *parent)
         : QWidget(parent), m_timecode(tc), m_view(parent), m_duration(0), m_offset(0) {
     setFont(KGlobalSettings::toolBarFont());
     m_scale = 3;
+    m_bgColor = QColor(245, 245, 245);
+    m_zoneColor = QColor(133, 255, 143);
     littleMarkDistance = FRAME_SIZE;
     mediumMarkDistance = FRAME_SIZE * m_timecode.fps();
     bigMarkDistance = FRAME_SIZE * m_timecode.fps() * 60;
@@ -223,12 +225,13 @@ void CustomRuler::paintEvent(QPaintEvent *e) {
     p.setClipRect(e->rect());
 
     const int projectEnd = (int)(m_duration * m_factor);
-    p.fillRect(QRect(0, 0, projectEnd - m_offset, height()), QBrush(QColor(245, 245, 245)));
+    p.fillRect(0, 0, projectEnd - m_offset, height(), m_bgColor);
 
     const int zoneStart = (int)(m_zoneStart * m_factor);
     const int zoneEnd = (int)(m_zoneEnd * m_factor);
+    const QRect zoneRect();
 
-    p.fillRect(QRect(zoneStart - offset(), height() / 2, zoneEnd - zoneStart, height() / 2), QBrush(QColor(133, 255, 143)));
+    p.fillRect(zoneStart - offset(), height() / 2, zoneEnd - zoneStart, height() / 2, m_zoneColor);
 
     const int value  = m_view->cursorPos() * m_factor - offset();
     int minval = (e->rect().left() + m_offset) / FRAME_SIZE - 1;
index f84fdb56b3cb81c16b4bd545bba26860c65fce25..3073ae4041fdc0f988b33b126963b057875d7164 100644 (file)
@@ -53,6 +53,8 @@ private:
     int m_zoneStart;
     int m_zoneEnd;
     int m_duration;
+    QColor m_bgColor;
+    QColor m_zoneColor;
     double m_textSpacing;
     double m_factor;
     double m_scale;
index a07d1755fbbd2368bfef71103f49f7cf12e7e3f2..b75dd03f79416e417fe5e43ec17f8dd27b712d51 100644 (file)
@@ -29,6 +29,7 @@ SmallRuler::SmallRuler(QWidget *parent)
         : QWidget(parent), m_scale(1), m_maxval(25) {
     m_zoneStart = 10;
     m_zoneEnd = 60;
+    m_zoneColor = QColor(133, 255, 143);
 }
 
 void SmallRuler::adjustScale(int maximum) {
@@ -124,7 +125,7 @@ void SmallRuler::paintEvent(QPaintEvent *e) {
     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)));
+    p.fillRect(zoneStart, height() / 2, zoneEnd - zoneStart, height() / 2, m_zoneColor);
 
     if (r.top() < 9) {
         // draw the little marks
index cee54b2e943f5283a7d7266340760c2b5ae30e24..9d5d07d095ff28a5e92f55b904af0d9c0329c17a 100644 (file)
@@ -47,6 +47,7 @@ private:
     int m_maxval;
     int m_zoneStart;
     int m_zoneEnd;
+    QColor m_zoneColor;
 
 public slots:
     void slotNewValue(int value);