From 35a5c83d59396a357f49d73a7c5127cc06bbb686 Mon Sep 17 00:00:00 2001 From: Till Theato Date: Sun, 18 Jul 2010 11:39:37 +0000 Subject: [PATCH] Also show duration of group or selection the clip under the mouse is in in status bar: http://www.kdenlive.org/mantis/view.php?id=1576 svn path=/trunk/kdenlive/; revision=4596 --- src/abstractgroupitem.cpp | 21 +++++++++++++++++++++ src/abstractgroupitem.h | 2 ++ src/customtrackview.cpp | 12 ++++++++++++ 3 files changed, 35 insertions(+) diff --git a/src/abstractgroupitem.cpp b/src/abstractgroupitem.cpp index 53f94057..e4286b65 100644 --- a/src/abstractgroupitem.cpp +++ b/src/abstractgroupitem.cpp @@ -420,3 +420,24 @@ void AbstractGroupItem::clearResizeInfos() // m_resizeInfos.clear() will crash in some cases for unknown reasons - ttill m_resizeInfos = QList (); } + +GenTime AbstractGroupItem::duration() +{ + QList children = childItems(); + GenTime start = GenTime(-1.0); + GenTime end = GenTime(); + for (int i = 0; i < children.count(); ++i) { + if (children.at(i)->type() != GROUPWIDGET) { + AbstractClipItem *item = static_cast (children.at(i)); + if (item) { + if (start < GenTime() || item->startPos() < start) + start = item->startPos(); + if (item->endPos() > end) + end = item->endPos(); + } + } else { + children << children.at(i)->childItems(); + } + } + return end - start; +} diff --git a/src/abstractgroupitem.h b/src/abstractgroupitem.h index bf080a26..23bf850c 100644 --- a/src/abstractgroupitem.h +++ b/src/abstractgroupitem.h @@ -52,6 +52,8 @@ public: QList resizeInfos(); /** @brief Clears m_resizeInfos */ void clearResizeInfos(); + /** @brief Gets the duration (length) of the group. */ + GenTime duration(); protected: virtual QVariant itemChange(GraphicsItemChange change, const QVariant &value); diff --git a/src/customtrackview.cpp b/src/customtrackview.cpp index 8e475935..e61448e9 100644 --- a/src/customtrackview.cpp +++ b/src/customtrackview.cpp @@ -575,6 +575,18 @@ void CustomTrackView::mouseMoveEvent(QMouseEvent * event) QString message = ci->clipName() + i18n(":"); message.append(i18n(" Position:") + m_document->timecode().getDisplayTimecode(ci->info().startPos, KdenliveSettings::frametimecode())); message.append(i18n(" Duration:") + m_document->timecode().getDisplayTimecode(ci->cropDuration(), KdenliveSettings::frametimecode())); + if (clip->parentItem() && clip->parentItem()->type() == GROUPWIDGET) { + AbstractGroupItem *parent = static_cast (clip->parentItem()); + if (clip->parentItem() == m_selectionGroup) + message.append(i18n(" Selection duration:")); + else + message.append(i18n(" Group duration:")); + message.append(m_document->timecode().getDisplayTimecode(parent->duration(), KdenliveSettings::frametimecode())); + if (parent->parentItem() && parent->parentItem()->type() == GROUPWIDGET) { + AbstractGroupItem *parent2 = static_cast (parent->parentItem()); + message.append(i18n(" Selection duration:") + m_document->timecode().getDisplayTimecode(parent2->duration(), KdenliveSettings::frametimecode())); + } + } emit displayMessage(message, InformationMessage); } else if (opMode == RESIZESTART) { setCursor(KCursor("left_side", Qt::SizeHorCursor)); -- 2.39.2