return NULL;
}
-QPainterPath AbstractGroupItem::clipGroupSpacerShape(QPointF offset) const
+QPainterPath AbstractGroupItem::clipGroupSpacerShape(const QPointF &offset) const
{
return spacerGroupShape(AVWIDGET, offset);
}
-QPainterPath AbstractGroupItem::clipGroupShape(QPointF offset) const
+QPainterPath AbstractGroupItem::clipGroupShape(const QPointF &offset) const
{
return groupShape(AVWIDGET, offset);
}
-QPainterPath AbstractGroupItem::transitionGroupShape(QPointF offset) const
+QPainterPath AbstractGroupItem::transitionGroupShape(const QPointF &offset) const
{
return groupShape(TRANSITIONWIDGET, offset);
}
-QPainterPath AbstractGroupItem::groupShape(GRAPHICSRECTITEM type, QPointF offset) const
+QPainterPath AbstractGroupItem::groupShape(GRAPHICSRECTITEM type, const QPointF &offset) const
{
QPainterPath path;
QList<QGraphicsItem *> children = childItems();
- for (int i = 0; i < children.count(); i++) {
+ for (int i = 0; i < children.count(); ++i) {
if (children.at(i)->type() == (int)type) {
QRectF r(children.at(i)->sceneBoundingRect());
r.translate(offset);
return path;
}
-QPainterPath AbstractGroupItem::spacerGroupShape(GRAPHICSRECTITEM type, QPointF offset) const
+QPainterPath AbstractGroupItem::spacerGroupShape(GRAPHICSRECTITEM type, const QPointF &offset) const
{
QPainterPath path;
QList<QGraphicsItem *> children = childItems();
- for (int i = 0; i < children.count(); i++) {
+ for (int i = 0; i < children.count(); ++i) {
if (children.at(i)->type() == (int)type) {
QRectF r(children.at(i)->sceneBoundingRect());
r.translate(offset);
int xpos = projectScene()->getSnapPointForPos((int)(start.x() + newPos.x() - pos().x()), KdenliveSettings::snaptopoints());
xpos = qMax(xpos, 0);
- //kDebug()<<"GRP XPOS:"<<xpos<<", START:"<<start.x()<<",NEW:"<<newPos.x()<<"; SCENE:"<<scenePos().x()<<",POS:"<<pos().x();
+ //kDebug()<<"GRP XPOS:"<<xpos<<", START:"<<start.x()<<",NEW:"<<newPos.x()<<"; SCENE:"<<scenePos().x()<<",POS:"<<pos().x();
newPos.setX((int)(pos().x() + xpos - (int) start.x()));
QStringList lockedTracks = property("locked_tracks").toStringList();
int proposedTrack = (property("y_absolute").toInt() + newPos.y()) / trackHeight;
int topTrack = -1;
QList<int> groupTracks;
QList<QGraphicsItem *> children = childItems();
- for (int i = 0; i < children.count(); i++) {
+ for (int i = 0; i < children.count(); ++i) {
int currentTrack = 0;
if (children.at(i)->type() == AVWIDGET || children.at(i)->type() == TRANSITIONWIDGET) {
currentTrack = static_cast <AbstractClipItem*> (children.at(i))->track();
// Check no clip in the group goes outside of existing tracks
int maximumTrack = projectScene()->tracksCount() - 1;
int groupHeight = 0;
- for (int i = 0; i < groupTracks.count(); i++) {
+ for (int i = 0; i < groupTracks.count(); ++i) {
int offset = groupTracks.at(i) - topTrack;
if (offset > groupHeight) groupHeight = offset;
}
proposedTrack = qMax(proposedTrack, 0);
int groupOffset = proposedTrack - topTrack;
if (!lockedTracks.isEmpty()) {
- for (int i = 0; i < groupTracks.count(); i++) {
+ for (int i = 0; i < groupTracks.count(); ++i) {
if (lockedTracks.contains(QString::number(groupTracks.at(i) + groupOffset))) {
return pos();
}
shape = clipGroupShape(newPos - pos());
collidingItems = scene()->items(shape, Qt::IntersectsItemShape);
collidingItems.removeAll(this);
- for (int i = 0; i < children.count(); i++) {
+ for (int i = 0; i < children.count(); ++i) {
if (children.at(i)->type() == GROUPWIDGET) {
QList<QGraphicsItem *> subchildren = children.at(i)->childItems();
for (int j = 0; j < subchildren.count(); j++) {
if (!collidingItems.isEmpty()) {
bool forwardMove = xpos > start.x();
int offset = 0;
- for (int i = 0; i < collidingItems.count(); i++) {
+ for (int i = 0; i < collidingItems.count(); ++i) {
QGraphicsItem *collision = collidingItems.at(i);
if (collision->type() == AVWIDGET) {
// Collision
// If there is still a collision after our position adjust, restore original pos
collidingItems = scene()->items(clipGroupShape(newPos - pos()), Qt::IntersectsItemShape);
collidingItems.removeAll(this);
- for (int i = 0; i < children.count(); i++) {
+ for (int i = 0; i < children.count(); ++i) {
if (children.at(i)->type() == GROUPWIDGET) {
QList<QGraphicsItem *> subchildren = children.at(i)->childItems();
for (int j = 0; j < subchildren.count(); j++) {
}
collidingItems.removeAll(children.at(i));
}
- for (int i = 0; i < collidingItems.count(); i++)
+ for (int i = 0; i < collidingItems.count(); ++i)
if (collidingItems.at(i)->type() == AVWIDGET) return pos();
}
}
shape = transitionGroupShape(newPos - pos());
collidingItems = scene()->items(shape, Qt::IntersectsItemShape);
collidingItems.removeAll(this);
- for (int i = 0; i < children.count(); i++) {
+ for (int i = 0; i < children.count(); ++i) {
if (children.at(i)->type() == GROUPWIDGET) {
QList<QGraphicsItem *> subchildren = children.at(i)->childItems();
for (int j = 0; j < subchildren.count(); j++) {
else {
bool forwardMove = xpos > start.x();
int offset = 0;
- for (int i = 0; i < collidingItems.count(); i++) {
+ for (int i = 0; i < collidingItems.count(); ++i) {
QGraphicsItem *collision = collidingItems.at(i);
if (collision->type() == TRANSITIONWIDGET) {
// Collision
}
// If there is still a collision after our position adjust, restore original pos
collidingItems = scene()->items(transitionGroupShape(newPos - pos()), Qt::IntersectsItemShape);
- for (int i = 0; i < children.count(); i++) {
+ for (int i = 0; i < children.count(); ++i) {
collidingItems.removeAll(children.at(i));
}
- for (int i = 0; i < collidingItems.count(); i++)
+ for (int i = 0; i < collidingItems.count(); ++i)
if (collidingItems.at(i)->type() == TRANSITIONWIDGET) return pos();
}
}
QPointF dropPos = event->scenePos();
QList<QGraphicsItem *> selection = scene()->items(dropPos);
AbstractClipItem *dropChild = NULL;
- for (int i = 0; i < selection.count(); i++) {
+ for (int i = 0; i < selection.count(); ++i) {
if (selection.at(i)->type() == AVWIDGET) {
dropChild = (AbstractClipItem *) selection.at(i);
break;
}
return end - start;
}
+
+#include "abstractgroupitem.moc"