]> git.sesse.net Git - kdenlive/commitdiff
small ui improvements
authorJean-Baptiste Mardelle <jb@kdenlive.org>
Fri, 29 Feb 2008 17:00:16 +0000 (17:00 +0000)
committerJean-Baptiste Mardelle <jb@kdenlive.org>
Fri, 29 Feb 2008 17:00:16 +0000 (17:00 +0000)
svn path=/branches/KDE4/; revision=1964

src/clipitem.cpp
src/clipitem.h
src/projectlistview.cpp
src/widgets/effectlist_ui.ui

index d7b929d7fb7d959fee62cacb81ed1aa1e9041555..398727e1e2965355283abf278841ab05325995d2 100644 (file)
@@ -34,7 +34,7 @@
 #include "kdenlivesettings.h"
 
 ClipItem::ClipItem(DocClipBase *clip, int track, int startpos, const QRectF & rect, int duration)
-: QGraphicsRectItem(rect), m_clip(clip), m_resizeMode(NONE), m_grabPoint(0), m_maxTrack(0), m_track(track), m_startPos(startpos), m_hasThumbs(false), startThumbTimer(NULL), endThumbTimer(NULL), m_startFade(0), m_endFade(0), m_effectsCounter(0),audioThumbWasDrawn(false),audioThumbReady(false)
+: QGraphicsRectItem(rect), m_clip(clip), m_resizeMode(NONE), m_grabPoint(0), m_maxTrack(0), m_track(track), m_startPos(startpos), m_hasThumbs(false), startThumbTimer(NULL), endThumbTimer(NULL), m_startFade(0), m_endFade(0), m_effectsCounter(0),audioThumbWasDrawn(false),audioThumbReady(false), m_opacity(1.0), m_timeLine(0)
 {
   //setToolTip(name);
   kDebug()<<"*******  CREATING NEW TML CLIP, DUR: "<<duration;
@@ -46,6 +46,7 @@ ClipItem::ClipItem(DocClipBase *clip, int track, int startpos, const QRectF & re
   m_maxDuration = duration;
   if (duration != -1) m_cropDuration = duration;
   else m_cropDuration = m_maxDuration;
+  setAcceptDrops (true);
 
 /*
   m_cropStart = xml.attribute("in", 0).toInt();
@@ -173,13 +174,29 @@ int ClipItem::endPos()
   return m_startPos + m_cropDuration;
 }
 
+void ClipItem::flashClip()
+{
+  if (m_timeLine == 0) {
+    m_timeLine = new QTimeLine(750, this);
+    connect(m_timeLine, SIGNAL(valueChanged(qreal)), this, SLOT(animate(qreal)));
+  }
+  m_timeLine->start();
+}
+
+void ClipItem::animate(qreal value)
+{
+  m_opacity = value;
+  update();
+}
+
 // virtual 
  void ClipItem::paint(QPainter *painter,
                            const QStyleOptionGraphicsItem *option,
                            QWidget *widget)
  {
+    painter->setOpacity(m_opacity);
     QRectF br = rect();
-        QRect rectInView;//this is the rect that is visiable by the user
+        QRect rectInView;//this is the rect that is visible by the user
         if (scene()->views().size()>0){ 
                rectInView=scene()->views()[0]->viewport()->rect();
                rectInView.moveTo(scene()->views()[0]->horizontalScrollBar()->value(),scene()->views()[0]->verticalScrollBar()->value());
@@ -309,11 +326,12 @@ int ClipItem::endPos()
       painter->setFont(font);
     }
 
+    if (isSelected())  painter->fillRect(br.intersected(rectInView), QBrush(QColor(200,20,0,80)));
     pen.setColor(Qt::red);
     //pen.setStyle(Qt::DashDotDotLine); //Qt::DotLine);
     if (isSelected()) painter->setPen(pen);
-        painter->setClipRect(option->exposedRect);
-        painter->drawPath(roundRectPathUpper.united(roundRectPathLower).intersected(clippath));
+    painter->setClipRect(option->exposedRect);
+    painter->drawPath(roundRectPathUpper.united(roundRectPathLower).intersected(clippath));
 
     QRectF txtBounding = painter->boundingRect(br, Qt::AlignCenter, " " + m_clipName + " ");
     painter->fillRect(txtBounding, QBrush(QColor(255,255,255,150)));
@@ -626,6 +644,7 @@ QMap <QString, QString> ClipItem::addEffect(QDomElement effect)
     if (!e.isNull())
       effectParams[e.attribute("name")] = e.attribute("value");
   }
+  flashClip();
   update(boundingRect());
   return effectParams;
 }
@@ -666,6 +685,7 @@ void ClipItem::deleteEffect(QString index)
       break;
     }
   }
+  flashClip();
   update(boundingRect());
 }
 
index a4976072c35a00474c8498796cb9798e62a31e49..6d89f16b6aa58bf6174660f49499dbcb34b17b12 100644 (file)
@@ -24,6 +24,7 @@
 #include <QGraphicsRectItem>
 #include <QDomElement>
 #include <QGraphicsSceneMouseEvent>
+#include <QTimeLine>
 
 #include "definitions.h"
 #include "gentime.h"
@@ -79,6 +80,7 @@ class ClipItem : public QObject, public QGraphicsRectItem
     QDomElement effectAt(int ix);
     /** Replace effect at pos ix with given value */
     void setEffectAt(int ix, QDomElement effect);
+    void flashClip();
 
   protected:
     virtual void mouseMoveEvent ( QGraphicsSceneMouseEvent * event );
@@ -109,12 +111,15 @@ class ClipItem : public QObject, public QGraphicsRectItem
     uint m_endFade;
     /** counter used to provide a unique id to each effect */
     int m_effectsCounter;
+    double m_opacity;
+    QTimeLine *m_timeLine;
     
     EffectsList m_effectList;
     QMap<int,QPixmap> audioThumbCachePic;
     bool audioThumbWasDrawn,audioThumbReady;
     double framePixelWidth;
     QMap<int,QPainterPath > channelPaths;
+
   private slots:
     void slotThumbReady(int frame, QPixmap pix);
     void slotFetchThumbs();
@@ -122,6 +127,8 @@ class ClipItem : public QObject, public QGraphicsRectItem
     void slotGetEndThumb();
     void slotGotAudioData();
     void slotPrepareAudioThumb(double,QPainterPath,int,int);
+    void animate(qreal value);
+
   signals:
     void getThumb(int, int);
     void prepareAudioThumb(double,QPainterPath,int,int);
index 1eae496a1f44a077c2925fe7666a33c93707992e..e03bfea5732f339ca6e4dd298f240d216ca8bdb9 100644 (file)
@@ -31,6 +31,7 @@ ProjectListView::ProjectListView(QWidget *parent)
   setSelectionMode(QAbstractItemView::ExtendedSelection);
   setDragDropMode(QAbstractItemView::DragDrop);
   setDropIndicatorShown(true);
+  setAlternatingRowColors(true);
   setDragEnabled(true);
   setAcceptDrops(true);
 }
index 7789cb21ba2959e8829fd1c8d8a210d792caa6ae..3b423f9e52c5f933662a4b92b1e61c32fe40bfb1 100644 (file)
      <property name="orientation" >
       <enum>Qt::Vertical</enum>
      </property>
-     <widget class="KListWidget" name="effectlist" />
+     <widget class="KListWidget" name="effectlist" >
+      <property name="dragEnabled" >
+       <bool>true</bool>
+      </property>
+      <property name="alternatingRowColors" >
+       <bool>true</bool>
+      </property>
+     </widget>
      <widget class="QTextEdit" name="infopanel" >
       <property name="frameShape" >
        <enum>QFrame::StyledPanel</enum>