]> git.sesse.net Git - kdenlive/commitdiff
use enum instead of num for typeof QGraphicsRectItem
authorMarco Gittler <marco@gitma.de>
Tue, 11 Mar 2008 11:25:38 +0000 (11:25 +0000)
committerMarco Gittler <marco@gitma.de>
Tue, 11 Mar 2008 11:25:38 +0000 (11:25 +0000)
svn path=/branches/KDE4/; revision=2049

src/abstractclipitem.cpp
src/clipitem.cpp
src/customtrackview.cpp
src/labelitem.cpp
src/transition.cpp

index 08f6c27cf77b2049bdf17bfa74a7583a6f397e8b..1d62b93f86537ab14b29f76c1e5c65b98a8266a2 100644 (file)
@@ -61,7 +61,7 @@ void AbstractClipItem::resizeStart(int posx, double scale) {
     if (durationDiff == GenTime()) return;
     //kDebug() << "-- RESCALE: CROP=" << m_cropStart << ", DIFF = " << durationDiff;
 
-    if (m_cropStart + durationDiff < GenTime() && type() == 70000) {
+    if (m_cropStart + durationDiff < GenTime() && type() == AVWIDGET) {
         durationDiff = GenTime() - m_cropStart;
     } else if (durationDiff >= m_cropDuration) {
         durationDiff = m_cropDuration - GenTime(3, m_fps);
index cd60dff0fa6213fa4c93be392ce84665abc02b16..3823623f22f80b939cc4a53fe49471eae1ffde74 100644 (file)
@@ -131,7 +131,7 @@ void ClipItem::slotGotAudioData() {
 }
 
 int ClipItem::type() const {
-    return 70000;
+    return AVWIDGET;
 }
 
 DocClipBase *ClipItem::baseClip() {
index dd569e52c12f74ecad0b7bba3723d2bc1abba734..e1ef2afe8c6a08e6b189065ef704c16673f4902b 100644 (file)
@@ -99,7 +99,7 @@ void CustomTrackView::mouseMoveEvent(QMouseEvent * event) {
             if (m_operationMode == MOVE) {
                 double snappedPos = getSnapPointForPos(mapToScene(event->pos()).x() - m_clickPoint);
                 kDebug() << "///////  MOVE CLIP, EVENT Y: ";//<<event->scenePos().y()<<", SCENE HEIGHT: "<<scene()->sceneRect().height();
-                int moveTrack = (int)  mapToScene(event->pos() - QPoint(0, (m_dragItem->type() == 70001 ? 25 : 0))).y() / 50;
+                int moveTrack = (int)  mapToScene(event->pos() - QPoint(0, (m_dragItem->type() == TRANSITIONWIDGET ? 25 : 0))).y() / 50;
                 int currentTrack = m_dragItem->track();
 
                 if (moveTrack > m_tracksCount - 1) moveTrack = m_tracksCount - 1;
@@ -134,7 +134,7 @@ void CustomTrackView::mouseMoveEvent(QMouseEvent * event) {
         int i = 0;
         QGraphicsRectItem *item = NULL;
         for (int i = 0; i < itemList.count(); i++) {
-            if (itemList.at(i)->type() == 70000 || itemList.at(i)->type() == 70001) {
+            if (itemList.at(i)->type() == AVWIDGET || itemList.at(i)->type() == TRANSITIONWIDGET) {
                 item = (QGraphicsRectItem*) itemList.at(i);
                 break;
             }
@@ -325,7 +325,7 @@ void CustomTrackView::mousePressEvent(QMouseEvent * event) {
         QList<QGraphicsItem *> collisionList = items(event->pos());
         for (int i = 0; i < collisionList.size(); ++i) {
             QGraphicsItem *item = collisionList.at(i);
-            if (item->type() == 70000 || item->type() == 70001) {
+            if (item->type() == AVWIDGET || item->type() == TRANSITIONWIDGET) {
                 // select item
                 if (!item->isSelected()) {
                     QList<QGraphicsItem *> itemList = items();
@@ -336,7 +336,7 @@ void CustomTrackView::mousePressEvent(QMouseEvent * event) {
                 }
 
                 m_dragItem = (AbstractClipItem *) item;
-                if (item->type() == 70000) {
+                if (item->type() == AVWIDGET) {
                     emit clipItemSelected((ClipItem*) m_dragItem);
                 }
                 m_clickPoint = mapToScene(event->pos()).x() - m_dragItem->startPos().frames(m_document->fps()) * m_scale;
@@ -432,7 +432,7 @@ void CustomTrackView::slotAddEffect(QDomElement effect, GenTime pos, int track)
     }
     kDebug() << "// REQUESTING EFFECT ON CLIP: " << pos.frames(25) << ", TRK: " << track;
     for (int i = 0; i < itemList.count(); i++) {
-        if (itemList.at(i)->type() == 70000 && (itemList.at(i)->isSelected() || track != -1)) {
+        if (itemList.at(i)->type() == AVWIDGET && (itemList.at(i)->isSelected() || track != -1)) {
             ClipItem *item = (ClipItem *)itemList.at(i);
             // the kdenlive_ix int is used to identify an effect in mlt's playlist, should
             // not be changed
@@ -554,7 +554,7 @@ void CustomTrackView::removeTrack() {
 void CustomTrackView::deleteClip(int clipId) {
     QList<QGraphicsItem *> itemList = items();
     for (int i = 0; i < itemList.count(); i++) {
-        if (itemList.at(i)->type() == 70000) {
+        if (itemList.at(i)->type() == AVWIDGET) {
             ClipItem *item = (ClipItem *)itemList.at(i);
             if (item->clipProducer() == clipId) {
                 AddTimelineClipCommand *command = new AddTimelineClipCommand(this, item->xml(), item->clipProducer(), item->track(), item->startPos(), item->rect(), item->duration(), true, true);
@@ -698,7 +698,7 @@ void CustomTrackView::updateSnapPoints(AbstractClipItem *selected) {
     if (selected) offset = selected->duration();
     QList<QGraphicsItem *> itemList = items();
     for (int i = 0; i < itemList.count(); i++) {
-        if (itemList.at(i)->type() == 70000 && itemList.at(i) != selected) {
+        if (itemList.at(i)->type() == AVWIDGET && itemList.at(i) != selected) {
             ClipItem *item = (ClipItem *)itemList.at(i);
             GenTime start = item->startPos();
             GenTime end = item->endPos();
@@ -724,7 +724,7 @@ void CustomTrackView::setScale(double scaleFactor) {
     QList<QGraphicsItem *> itemList = items();
 
     for (int i = 0; i < itemList.count(); i++) {
-        if (itemList.at(i)->type() == 70000 || itemList.at(i)->type() == 70001) {
+        if (itemList.at(i)->type() == AVWIDGET || itemList.at(i)->type() == TRANSITIONWIDGET) {
             AbstractClipItem *clip = (AbstractClipItem *)itemList.at(i);
             clip->setRect(clip->startPos().frames(m_document->fps()) * m_scale, clip->rect().y(), clip->duration().frames(m_document->fps()) * m_scale, clip->rect().height());
         }
index 83076da5fcfa001c9137ef73c7697623f155dfb0..e486b84cc1556ec8156714ec7893dd0082eedbfd 100644 (file)
@@ -25,6 +25,7 @@
 
 
 #include "labelitem.h"
+#include "definitions.h"
 
 LabelItem::LabelItem(QString text, QGraphicsRectItem *parent)
         : QGraphicsSimpleTextItem(" " + text + " ", parent) {
@@ -34,7 +35,7 @@ LabelItem::LabelItem(QString text, QGraphicsRectItem *parent)
 }
 
 int LabelItem::type() const {
-    return 70001;
+    return LABELWIDGET;
 }
 
 // virtual
index 70b60b627f9b53405786205d85a4f68a9b6b8871..ca816ee5424f9a7391a211a24e581a44464c10e1 100644 (file)
@@ -267,13 +267,13 @@ void Transition::paint(QPainter *painter,
 
     painter->setClipPath(resultClipPath.intersected(clippath), Qt::IntersectClip);
     //painter->fillPath(roundRectPath, brush()); //, QBrush(QColor(Qt::red)));
-    painter->fillRect(br.intersected(rectInView), QBrush(QColor(200, 200, 0, 160)));
+    painter->fillRect(br.intersected(rectInView), QBrush(QColor(200, 200, 0, 160)/*,Qt::Dense4Pattern*/));
     painter->setClipRect(option->exposedRect);
     painter->drawPath(resultClipPath.intersected(clippath));
 }
 
 int Transition::type() const {
-    return 70001;
+    return TRANSITIONWIDGET;
 }
 OPERATIONTYPE Transition::operationMode(QPointF pos, double scale) {
     if (abs((int)(pos.x() - rect().x())) < 6) return RESIZESTART;