]> git.sesse.net Git - kdenlive/commitdiff
Also show duration of group or selection the clip under the mouse is in in status...
authorTill Theato <root@ttill.de>
Sun, 18 Jul 2010 11:39:37 +0000 (11:39 +0000)
committerTill Theato <root@ttill.de>
Sun, 18 Jul 2010 11:39:37 +0000 (11:39 +0000)
http://www.kdenlive.org/mantis/view.php?id=1576

svn path=/trunk/kdenlive/; revision=4596

src/abstractgroupitem.cpp
src/abstractgroupitem.h
src/customtrackview.cpp

index 53f9405795029e7e93ef2f98efc91da595766b0a..e4286b6592123dfcd596aad0af21cd554656ac7c 100644 (file)
@@ -420,3 +420,24 @@ void AbstractGroupItem::clearResizeInfos()
     // m_resizeInfos.clear() will crash in some cases for unknown reasons - ttill
     m_resizeInfos = QList <ItemInfo>();
 }
+
+GenTime AbstractGroupItem::duration()
+{
+    QList <QGraphicsItem *> 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 <AbstractClipItem *>(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;
+}
index bf080a264e86d62961e3fc82ff7d3791dee29a57..23bf850ce54e7ad880b31b5ed54198fa24baff09 100644 (file)
@@ -52,6 +52,8 @@ public:
     QList <ItemInfo> 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);
index 8e4759354f2aafbc824170343cf54e8c3648c82e..e61448e9ff598bb123cb6a851d9eef4d4620e803 100644 (file)
@@ -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 <AbstractGroupItem *>(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 <AbstractGroupItem *>(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));