]> git.sesse.net Git - kdenlive/commitdiff
progress on clip view
authorJean-Baptiste Mardelle <jb@kdenlive.org>
Sat, 26 Jan 2008 00:03:25 +0000 (00:03 +0000)
committerJean-Baptiste Mardelle <jb@kdenlive.org>
Sat, 26 Jan 2008 00:03:25 +0000 (00:03 +0000)
svn path=/branches/KDE4/; revision=1820

src/clipitem.cpp
src/clipitem.h
src/customtrackview.cpp
src/definitions.h

index 1e1049f5921f4879fa4432e3895fb793602501b1..a3764ee60d57e198f83f4ca2c4a50a2f6b4a8ab5 100644 (file)
@@ -34,7 +34,7 @@
 #include "kdenlivesettings.h"
 
 ClipItem::ClipItem(QDomElement xml, int track, int startpos, const QRectF & rect, int duration)
-    : QGraphicsRectItem(rect), m_xml(xml), m_resizeMode(NONE), m_grabPoint(0), m_maxTrack(0), m_track(track), m_startPos(startpos)
+    : QGraphicsRectItem(rect), m_xml(xml), m_resizeMode(NONE), m_grabPoint(0), m_maxTrack(0), m_track(track), m_startPos(startpos), m_thumbProd(NULL)
 {
   //setToolTip(name);
 
@@ -43,7 +43,7 @@ ClipItem::ClipItem(QDomElement xml, int track, int startpos, const QRectF & rect
 
   m_producer = xml.attribute("id").toInt();
 
-  m_clipType = xml.attribute("type").toInt();
+  m_clipType = (CLIPTYPE) xml.attribute("type").toInt();
 
   m_cropStart = xml.attribute("in", 0).toInt();
   m_maxDuration = xml.attribute("duration", 0).toInt();
@@ -59,11 +59,17 @@ ClipItem::ClipItem(QDomElement xml, int track, int startpos, const QRectF & rect
   m_textWidth = textRect.width();
   m_label->setPos(rect.x() + rect.width()/2 - m_textWidth/2, rect.y() + rect.height() / 2 - textRect.height()/2);
   setBrush(QColor(100, 100, 150));
-  m_thumbProd = new KThumb(KUrl(xml.attribute("resource")));
-  connect(this, SIGNAL(getThumb(int, int, int, int)), m_thumbProd, SLOT(extractImage(int, int, int, int)));
-  connect(m_thumbProd, SIGNAL(thumbReady(int, QPixmap)), this, SLOT(slotThumbReady(int, QPixmap)));
-  QTimer::singleShot(300, this, SLOT(slotFetchThumbs())); 
-
+  if (m_clipType == VIDEO || m_clipType == AV) {
+    m_thumbProd = new KThumb(KUrl(xml.attribute("resource")));
+    connect(this, SIGNAL(getThumb(int, int, int, int)), m_thumbProd, SLOT(extractImage(int, int, int, int)));
+    connect(m_thumbProd, SIGNAL(thumbReady(int, QPixmap)), this, SLOT(slotThumbReady(int, QPixmap)));
+    QTimer::singleShot(300, this, SLOT(slotFetchThumbs())); 
+  }
+  else if (m_clipType == COLOR) {
+    QString colour = xml.attribute("colour");
+    colour = colour.replace(0, 2, "#");
+    setBrush(QColor(colour.left(7)));
+  }
   //m_startPix.load("/home/one/Desktop/thumb.jpg");
 }
 
@@ -142,16 +148,24 @@ int ClipItem::startPos()
     roundRectPath.lineTo(br.x() + br .width() - roundingX, br.y() + br.height() - offset);
     roundRectPath.arcTo(br.x() + br .width() - roundingX - offset, br.y() + br.height() - roundingY - offset, roundingX, roundingY, 270.0, 90.0);
     roundRectPath.closeSubpath();
-    painter->fillPath(roundRectPath, brush()); //, QBrush(QColor(Qt::red)));
     painter->setClipPath(roundRectPath, Qt::IntersectClip);
-    painter->drawPixmap(QPointF(br.x() + br.width() - m_endPix.width(), br.y()), m_endPix);
-    QLineF l(br.x() + br.width() - m_endPix.width(), br.y(), br.x() + br.width() - m_endPix.width(), br.y() + br.height());
-    painter->drawLine(l);
-
-    painter->drawPixmap(QPointF(br.x(), br.y()), m_startPix);
-    QLineF l2(br.x() + m_startPix.width(), br.y(), br.x() + m_startPix.width(), br.y() + br.height());
-    painter->drawLine(l2);
+    //painter->fillPath(roundRectPath, brush()); //, QBrush(QColor(Qt::red)));
+    painter->fillRect(br, brush());
+    //painter->fillRect(QRectF(br.x() + br.width() - m_endPix.width(), br.y(), m_endPix.width(), br.height()), QBrush(QColor(Qt::black)));
+    if (!m_startPix.isNull()) {
+      painter->drawPixmap(QPointF(br.x() + br.width() - m_endPix.width(), br.y()), m_endPix);
+      QLineF l(br.x() + br.width() - m_endPix.width(), br.y(), br.x() + br.width() - m_endPix.width(), br.y() + br.height());
+      painter->drawLine(l);
+
+      painter->drawPixmap(QPointF(br.x(), br.y()), m_startPix);
+      QLineF l2(br.x() + m_startPix.width(), br.y(), br.x() + m_startPix.width(), br.y() + br.height());
+      painter->drawLine(l2);
+    }
     painter->setClipRect(option->exposedRect);
+    QPen pen = painter->pen();
+    pen.setColor(Qt::red);
+    pen.setStyle(Qt::DashDotDotLine); //Qt::DotLine);
+    if (isSelected()) painter->setPen(pen);
     painter->drawPath(roundRectPath);
     //painter->fillRect(QRect(br.x(), br.y(), roundingX, roundingY), QBrush(QColor(Qt::green)));
 
index 853c24e0c03060727a2def6504568b39a5a3ccbf..f8c4740f8fb0a884cbe048d5c331debe55df2b28 100644 (file)
@@ -64,7 +64,7 @@ class ClipItem : public QObject, public QGraphicsRectItem
     OPERATIONTYPE m_resizeMode;
     int m_grabPoint;
     int m_producer;
-    int m_clipType;
+    CLIPTYPE m_clipType;
     QString m_clipName;
     int m_maxDuration;
     int m_cropStart;
index d92fcd5427d0630659fbff5f2fa490e1f9f97b21..b386c73a78a25a469407db5781a6f2b97d94fbd9 100644 (file)
@@ -257,7 +257,7 @@ void CustomTrackView::mousePressEvent ( QMouseEvent * event )
       m_clickPoint = mapToScene(event->pos()).x() - m_dragItem->startPos() * m_scale;
       m_operationMode = m_dragItem->operationMode(item->mapFromScene(mapToScene(event->pos())));
       if (m_operationMode == MOVE || m_operationMode == RESIZESTART) m_startPos = QPointF(m_dragItem->startPos(), m_dragItem->track());
-      else if (m_operationMode == RESIZEEND) m_startPos = QPointF(m_dragItem->rect().x() + m_dragItem->rect().width(), m_dragItem->rect().y());
+      else if (m_operationMode == RESIZEEND) m_startPos = QPointF(m_dragItem->startPos() + m_dragItem->duration(), m_dragItem->track());
 
      kDebug()<<"//////// ITEM CLICKED: "<<m_startPos;
       /*while (item->parentItem()) 
index c0fb385806c9c00d4dd80161b1c434bf50402d02..41b8976ef451eb9c65116d486c81bb5c83344e40 100644 (file)
@@ -24,6 +24,7 @@
 #define FRAME_SIZE 90
 
 enum OPERATIONTYPE { NONE = 0, MOVE = 1, RESIZESTART = 2, RESIZEEND = 3, FADEIN = 4, FADEOUT = 5};
+enum CLIPTYPE { UNKNOWN = 0, AUDIO = 1, VIDEO = 2, AV = 3, COLOR = 4, IMAGE = 5, TEXT = 6, SLIDESHOW = 7, VIRTUAL = 8, PLAYLIST = 9};
 
 struct TrackViewClip {
   int startTime;