]> git.sesse.net Git - kdenlive/blobdiff - src/onmonitoritems/onmonitorpathitem.cpp
fix gcc warnings
[kdenlive] / src / onmonitoritems / onmonitorpathitem.cpp
index c3b79df524fbeb6cd08d452f4b14f56afb573fd7..d6a04e7de2ee62a86b5d154b063ca71ae8334213 100644 (file)
 #include <mlt++/Mlt.h>
 
 OnMonitorPathItem::OnMonitorPathItem(double dar, QGraphicsItem* parent) :
-        QGraphicsPathItem(parent),
-        m_dar(dar),
-        m_modified(false),
-        m_view(NULL),
-        m_activePoint(-1)
+    QGraphicsPathItem(parent),
+    m_dar(dar),
+    m_modified(false),
+    m_view(NULL),
+    m_activePoint(-1)
 {
     setFlags(QGraphicsItem::ItemIsMovable);
 
@@ -52,9 +52,9 @@ void OnMonitorPathItem::setPoints(Mlt::Geometry *geometry)
     int pos = 0;
     Mlt::GeometryItem item;
     while (!geometry->next_key(&item, pos)) {
-       r = QRectF(item.x(), item.y(), item.w(), item.h());
-       m_points << r.center();
-       pos = item.frame() + 1;
+        r = QRectF(item.x(), item.y(), item.w(), item.h());
+        m_points << r.center();
+        pos = item.frame() + 1;
     }
     rebuildShape();
 }
@@ -66,16 +66,16 @@ void OnMonitorPathItem::rebuildShape()
     QPainterPath shape;
 
     if (!m_points.isEmpty()) {
-       QRectF r(0, 0, 20, 20);
-       r.moveCenter(m_points.at(0));
-       shape.addRect(r);
-       
-       p.moveTo(m_points.at(0));
-       for (int i = 1; i < m_points.count(); ++i) {
-           p.lineTo(m_points.at(i));
-           r.moveCenter(m_points.at(i));
-           shape.addRect(r);
-       }
+        QRectF r(0, 0, 20, 20);
+        r.moveCenter(m_points.at(0));
+        shape.addRect(r);
+
+        p.moveTo(m_points.at(0));
+        for (int i = 1; i < m_points.count(); ++i) {
+            p.lineTo(m_points.at(i));
+            r.moveCenter(m_points.at(i));
+            shape.addRect(r);
+        }
     }
     prepareGeometryChange();
     m_shape = shape;
@@ -90,10 +90,10 @@ void OnMonitorPathItem::getMode(const QPointF &pos)
     }
     // Item mapped coordinates
     for (int i = 0; i < m_points.count(); ++i) {
-       if ((pos - m_points.at(i)).manhattanLength() <= dist) {
-           m_activePoint = i;
-           return;
-       }
+        if ((pos - m_points.at(i)).manhattanLength() <= dist) {
+            m_activePoint = i;
+            return;
+        }
     }
     m_activePoint = -1;
 }
@@ -106,11 +106,11 @@ void OnMonitorPathItem::mouseMoveEvent(QGraphicsSceneMouseEvent* event)
     }*/
 
     if (m_activePoint >= 0 && event->buttons() & Qt::LeftButton) {
-       QPointF mousePos = event->pos();
-       m_points[m_activePoint] = mousePos;
-       rebuildShape();
-       m_modified = true;
-       update();
+        QPointF mousePos = event->pos();
+        m_points[m_activePoint] = mousePos;
+        rebuildShape();
+        m_modified = true;
+        update();
     }
 
     if (m_modified) {
@@ -151,8 +151,8 @@ QPainterPath OnMonitorPathItem::shape () const
 void OnMonitorPathItem::hoverLeaveEvent(QGraphicsSceneHoverEvent* /*event*/)
 {
     if (m_activePoint != -1) {
-       m_activePoint = -1;
-       update();
+        m_activePoint = -1;
+        update();
     }
     unsetCursor();
 }
@@ -179,12 +179,12 @@ void OnMonitorPathItem::paint(QPainter* painter, const QStyleOptionGraphicsItem*
     double h = 6;
     if (getView()) {
         w /= m_view->matrix().m11();
-       h /= m_view->matrix().m22();
+        h /= m_view->matrix().m22();
     }
 
     QRectF handle(0, 0, w, h);
     for (int i = 0; i < m_points.count(); ++i) {
-       handle.moveCenter(m_points.at(i));
+        handle.moveCenter(m_points.at(i));
         painter->fillRect(handle, m_activePoint == i ? Qt::blue : pen().color());
     }
 }