]> git.sesse.net Git - kdenlive/blobdiff - src/docclipbase.cpp
Clip markers can now have a category that is shown as a color.
[kdenlive] / src / docclipbase.cpp
index 09494c9e83944845e7cba057f2c08f22df7e25eb..13d1c40b02a78ad701f521d755eb4fa29f682d07 100644 (file)
@@ -290,22 +290,21 @@ QList < CommentedTime > DocClipBase::commentedSnapMarkers() const
 }
 
 
-void DocClipBase::addSnapMarker(const GenTime & time, QString comment)
+void DocClipBase::addSnapMarker(const CommentedTime marker)
 {
     QList < CommentedTime >::Iterator it = m_snapMarkers.begin();
     for (it = m_snapMarkers.begin(); it != m_snapMarkers.end(); ++it) {
-        if ((*it).time() >= time)
+        if ((*it).time() >= marker.time())
             break;
     }
 
-    if ((it != m_snapMarkers.end()) && ((*it).time() == time)) {
-        (*it).setComment(comment);
+    if ((it != m_snapMarkers.end()) && ((*it).time() == marker.time())) {
+        (*it).setComment(marker.comment());
+       (*it).setMarkerType(marker.markerType());
         //kError() << "trying to add Snap Marker that already exists, this will cause inconsistancies with undo/redo";
     } else {
-        CommentedTime t(time, comment);
-        m_snapMarkers.insert(it, t);
+        m_snapMarkers.insert(it, marker);
     }
-
 }
 
 void DocClipBase::editSnapMarker(const GenTime & time, QString comment)
@@ -378,10 +377,9 @@ GenTime DocClipBase::findNextSnapMarker(const GenTime & currTime)
     return duration();
 }
 
-QString DocClipBase::markerComment(GenTime t)
+QString DocClipBase::markerComment(GenTime t) const
 {
-    QList < CommentedTime >::Iterator itt = m_snapMarkers.begin();
-
+    QList < CommentedTime >::ConstIterator itt = m_snapMarkers.begin();
     while (itt != m_snapMarkers.end()) {
         if ((*itt).time() == t)
             return (*itt).comment();
@@ -390,6 +388,17 @@ QString DocClipBase::markerComment(GenTime t)
     return QString();
 }
 
+CommentedTime DocClipBase::markerAt(GenTime t) const
+{
+    QList < CommentedTime >::ConstIterator itt = m_snapMarkers.begin();
+    while (itt != m_snapMarkers.end()) {
+        if ((*itt).time() == t)
+            return (*itt);
+        ++itt;
+    }
+    return CommentedTime();
+}
+
 void DocClipBase::clearThumbProducer()
 {
     if (m_thumbProd) m_thumbProd->clearProducer();