X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=src%2Fabstractgroupitem.cpp;h=2b74e01e108e7459cfe7c80d1ea605b060b818de;hb=56aee6aedeeed3efd10ada8fe3c229eddc01ef05;hp=e91d1f81a310108101e4efb937ab80000424e1dc;hpb=71ad8e582bd637fa61d1f8157de79ed546257cf9;p=kdenlive diff --git a/src/abstractgroupitem.cpp b/src/abstractgroupitem.cpp index e91d1f81..2b74e01e 100644 --- a/src/abstractgroupitem.cpp +++ b/src/abstractgroupitem.cpp @@ -48,7 +48,7 @@ AbstractGroupItem::AbstractGroupItem(double /* fps */) : int AbstractGroupItem::type() const { - return GROUPWIDGET; + return GroupWidget; } int AbstractGroupItem::track() const @@ -57,7 +57,7 @@ int AbstractGroupItem::track() const int topTrack = -1; QList children = childItems(); for (int i = 0; i < children.count(); ++i) { - if (children.at(i)->type() == GROUPWIDGET) { + if (children.at(i)->type() == GroupWidget) { children.append(children.at(i)->childItems()); continue; } @@ -94,20 +94,20 @@ CustomTrackScene* AbstractGroupItem::projectScene() QPainterPath AbstractGroupItem::clipGroupSpacerShape(const QPointF &offset) const { - return spacerGroupShape(AVWIDGET, offset); + return spacerGroupShape(AVWidget, offset); } QPainterPath AbstractGroupItem::clipGroupShape(const QPointF &offset) const { - return groupShape(AVWIDGET, offset); + return groupShape(AVWidget, offset); } QPainterPath AbstractGroupItem::transitionGroupShape(const QPointF &offset) const { - return groupShape(TRANSITIONWIDGET, offset); + return groupShape(TransitionWidget, offset); } -QPainterPath AbstractGroupItem::groupShape(GRAPHICSRECTITEM type, const QPointF &offset) const +QPainterPath AbstractGroupItem::groupShape(GraphicsRectItem type, const QPointF &offset) const { QPainterPath path; QList children = childItems(); @@ -116,7 +116,7 @@ QPainterPath AbstractGroupItem::groupShape(GRAPHICSRECTITEM type, const QPointF QRectF r(children.at(i)->sceneBoundingRect()); r.translate(offset); path.addRect(r); - } else if (children.at(i)->type() == GROUPWIDGET) { + } else if (children.at(i)->type() == GroupWidget) { QList subchildren = children.at(i)->childItems(); for (int j = 0; j < subchildren.count(); j++) { if (subchildren.at(j)->type() == (int)type) { @@ -130,7 +130,7 @@ QPainterPath AbstractGroupItem::groupShape(GRAPHICSRECTITEM type, const QPointF return path; } -QPainterPath AbstractGroupItem::spacerGroupShape(GRAPHICSRECTITEM type, const QPointF &offset) const +QPainterPath AbstractGroupItem::spacerGroupShape(GraphicsRectItem type, const QPointF &offset) const { QPainterPath path; QList children = childItems(); @@ -140,7 +140,7 @@ QPainterPath AbstractGroupItem::spacerGroupShape(GRAPHICSRECTITEM type, const QP r.translate(offset); r.setRight(scene()->width()); path.addRect(r); - } else if (children.at(i)->type() == GROUPWIDGET) { + } else if (children.at(i)->type() == GroupWidget) { QList subchildren = children.at(i)->childItems(); for (int j = 0; j < subchildren.count(); j++) { if (subchildren.at(j)->type() == (int)type) { @@ -223,29 +223,29 @@ QVariant AbstractGroupItem::itemChange(GraphicsItemChange change, const QVariant QList children = childItems(); for (int i = 0; i < children.count(); ++i) { int currentTrack = 0; - if (children.at(i)->type() == AVWIDGET || children.at(i)->type() == TRANSITIONWIDGET) { + if (children.at(i)->type() == AVWidget || children.at(i)->type() == TransitionWidget) { currentTrack = static_cast (children.at(i))->track(); if (!groupTracks.contains(currentTrack)) groupTracks.append(currentTrack); } - else if (children.at(i)->type() == GROUPWIDGET) { + else if (children.at(i)->type() == GroupWidget) { currentTrack = static_cast (children.at(i))->track(); } else continue; - if (children.at(i)->type() == AVWIDGET) { + if (children.at(i)->type() == AVWidget) { if (topTrack == -1 || currentTrack <= topTrack) { offset = 0; topTrack = currentTrack; } - } else if (children.at(i)->type() == TRANSITIONWIDGET) { + } else if (children.at(i)->type() == TransitionWidget) { if (topTrack == -1 || currentTrack < topTrack) { offset = (int)(trackHeight / 3 * 2 - 1); topTrack = currentTrack; } - } else if (children.at(i)->type() == GROUPWIDGET) { + } else if (children.at(i)->type() == GroupWidget) { QList subchildren = children.at(i)->childItems(); bool clipGroup = false; for (int j = 0; j < subchildren.count(); j++) { - if (subchildren.at(j)->type() == AVWIDGET || subchildren.at(j)->type() == TRANSITIONWIDGET) { + if (subchildren.at(j)->type() == AVWidget || subchildren.at(j)->type() == TransitionWidget) { int subTrack = static_cast (subchildren.at(j))->track(); if (!groupTracks.contains(subTrack)) groupTracks.append(subTrack); clipGroup = true; @@ -292,12 +292,12 @@ QVariant AbstractGroupItem::itemChange(GraphicsItemChange change, const QVariant QList collidingItems; QPainterPath shape; - if (projectScene()->editMode() == NORMALEDIT) { + if (projectScene()->editMode() == NormalEdit) { shape = clipGroupShape(newPos - pos()); collidingItems = scene()->items(shape, Qt::IntersectsItemShape); collidingItems.removeAll(this); for (int i = 0; i < children.count(); ++i) { - if (children.at(i)->type() == GROUPWIDGET) { + if (children.at(i)->type() == GroupWidget) { QList subchildren = children.at(i)->childItems(); for (int j = 0; j < subchildren.count(); j++) { collidingItems.removeAll(subchildren.at(j)); @@ -311,7 +311,7 @@ QVariant AbstractGroupItem::itemChange(GraphicsItemChange change, const QVariant int offset = 0; for (int i = 0; i < collidingItems.count(); ++i) { QGraphicsItem *collision = collidingItems.at(i); - if (collision->type() == AVWIDGET) { + if (collision->type() == AVWidget) { // Collision if (newPos.y() != pos().y()) { // Track change results in collision, restore original position @@ -343,7 +343,7 @@ QVariant AbstractGroupItem::itemChange(GraphicsItemChange change, const QVariant collidingItems = scene()->items(clipGroupShape(newPos - pos()), Qt::IntersectsItemShape); collidingItems.removeAll(this); for (int i = 0; i < children.count(); ++i) { - if (children.at(i)->type() == GROUPWIDGET) { + if (children.at(i)->type() == GroupWidget) { QList subchildren = children.at(i)->childItems(); for (int j = 0; j < subchildren.count(); j++) { collidingItems.removeAll(subchildren.at(j)); @@ -352,16 +352,16 @@ QVariant AbstractGroupItem::itemChange(GraphicsItemChange change, const QVariant collidingItems.removeAll(children.at(i)); } for (int i = 0; i < collidingItems.count(); ++i) - if (collidingItems.at(i)->type() == AVWIDGET) return pos(); + if (collidingItems.at(i)->type() == AVWidget) return pos(); } } - if (projectScene()->editMode() == NORMALEDIT) { + if (projectScene()->editMode() == NormalEdit) { shape = transitionGroupShape(newPos - pos()); collidingItems = scene()->items(shape, Qt::IntersectsItemShape); collidingItems.removeAll(this); for (int i = 0; i < children.count(); ++i) { - if (children.at(i)->type() == GROUPWIDGET) { + if (children.at(i)->type() == GroupWidget) { QList subchildren = children.at(i)->childItems(); for (int j = 0; j < subchildren.count(); j++) { collidingItems.removeAll(subchildren.at(j)); @@ -376,7 +376,7 @@ QVariant AbstractGroupItem::itemChange(GraphicsItemChange change, const QVariant int offset = 0; for (int i = 0; i < collidingItems.count(); ++i) { QGraphicsItem *collision = collidingItems.at(i); - if (collision->type() == TRANSITIONWIDGET) { + if (collision->type() == TransitionWidget) { // Collision if (newPos.y() != pos().y()) { // Track change results in collision, restore original position @@ -410,7 +410,7 @@ QVariant AbstractGroupItem::itemChange(GraphicsItemChange change, const QVariant collidingItems.removeAll(children.at(i)); } for (int i = 0; i < collidingItems.count(); ++i) - if (collidingItems.at(i)->type() == TRANSITIONWIDGET) return pos(); + if (collidingItems.at(i)->type() == TransitionWidget) return pos(); } } return newPos; @@ -431,7 +431,7 @@ void AbstractGroupItem::dropEvent(QGraphicsSceneDragDropEvent * event) QList selection = scene()->items(dropPos); AbstractClipItem *dropChild = NULL; for (int i = 0; i < selection.count(); ++i) { - if (selection.at(i)->type() == AVWIDGET) { + if (selection.at(i)->type() == AVWidget) { dropChild = (AbstractClipItem *) selection.at(i); break; } @@ -460,7 +460,7 @@ void AbstractGroupItem::mousePressEvent(QGraphicsSceneMouseEvent * event) QList list = scene()->items(event->scenePos()); // only allow group move if we click over an item in the group foreach(const QGraphicsItem *item, list) { - if (item->type() == TRANSITIONWIDGET || item->type() == AVWIDGET) { + if (item->type() == TransitionWidget || item->type() == AVWidget) { QGraphicsItem::mousePressEvent(event); return; } @@ -480,7 +480,7 @@ void AbstractGroupItem::resizeStart(int diff) int itemcount = 0; for (int i = 0; i < children.count(); ++i) { AbstractClipItem *item = static_cast (children.at(i)); - if (item && item->type() == AVWIDGET) { + if (item && item->type() == AVWidget) { items << item; if (info) m_resizeInfos << item->info(); @@ -507,7 +507,7 @@ void AbstractGroupItem::resizeEnd(int diff) int itemcount = 0; for (int i = 0; i < children.count(); ++i) { AbstractClipItem *item = static_cast (children.at(i)); - if (item && item->type() == AVWIDGET) { + if (item && item->type() == AVWidget) { items << item; if (info) m_resizeInfos << item->info(); @@ -540,7 +540,7 @@ GenTime AbstractGroupItem::duration() GenTime start = GenTime(-1.0); GenTime end = GenTime(); for (int i = 0; i < children.count(); ++i) { - if (children.at(i)->type() != GROUPWIDGET) { + if (children.at(i)->type() != GroupWidget) { AbstractClipItem *item = static_cast (children.at(i)); if (item) { if (start < GenTime() || item->startPos() < start)