]> git.sesse.net Git - kdenlive/blobdiff - src/docclipbase.cpp
Add explicit keyword, const'ref, minor optimization
[kdenlive] / src / docclipbase.cpp
index dcf4ca822a80e433a9d342eeeb4506774750ac05..61632374a4731e89e32c12756190e0420ad39777 100644 (file)
@@ -218,7 +218,7 @@ const QString DocClipBase::getProperty(const QString &prop) const
     return m_properties.value(prop);
 }
 
-void DocClipBase::setDuration(GenTime dur)
+void DocClipBase::setDuration(const GenTime &dur)
 {
     m_duration = dur;
     m_properties.insert("duration", QString::number((int) dur.frames(KdenliveSettings::project_fps())));
@@ -299,6 +299,57 @@ QDomElement DocClipBase::toXML(bool hideTemporaryProperties) const
     return doc.documentElement();
 }
 
+const QString DocClipBase::shortInfo() const
+{
+  
+    QString info;
+    if (m_clipType == AV || m_clipType == VIDEO || m_clipType == IMAGE || m_clipType == PLAYLIST) {
+       info = m_properties.value("frame_size") + " ";
+       if (m_properties.contains("fps")) {
+           info.append(i18n("%1 fps", m_properties.value("fps").left(5)));
+       }
+       if (!info.simplified().isEmpty()) info.prepend(" - ");
+    }
+    else if (m_clipType == AUDIO) {
+       info = " - " + m_properties.value("frequency") + i18n("Hz");
+    }
+    QString tip = "<b>";
+    switch (m_clipType) {
+    case AUDIO:
+        tip.append(i18n("Audio clip") + "</b>" + info + "<br />" + fileURL().path());
+        break;
+    case VIDEO:
+        tip.append(i18n("Mute video clip") + "</b>" + info + "<br />" + fileURL().path());
+        break;
+    case AV:
+        tip.append(i18n("Video clip") + "</b>" + info + "<br />" + fileURL().path());
+        break;
+    case COLOR:
+        tip.append(i18n("Color clip"));
+        break;
+    case IMAGE:
+        tip.append(i18n("Image clip") + "</b>" + info + "<br />" + fileURL().path());
+        break;
+    case TEXT:
+        if (!fileURL().isEmpty() && getProperty("xmldata").isEmpty()) tip.append(i18n("Template text clip") + "</b><br />" + fileURL().path());
+        else tip.append(i18n("Text clip") + "</b><br />" + fileURL().path());
+        break;
+    case SLIDESHOW:
+        tip.append(i18n("Slideshow clip") + "</b><br />" + fileURL().directory());
+        break;
+    case VIRTUAL:
+        tip.append(i18n("Virtual clip"));
+        break;
+    case PLAYLIST:
+        tip.append(i18n("Playlist clip") + "</b>" + info + "<br />" + fileURL().path());
+        break;
+    default:
+        tip.append(i18n("Unknown clip"));
+        break;
+    }
+    return tip;
+}
+
 
 void DocClipBase::setAudioThumbCreated(bool isDone)
 {
@@ -329,7 +380,7 @@ QList < CommentedTime > DocClipBase::commentedSnapMarkers() const
 }
 
 
-void DocClipBase::addSnapMarker(const CommentedTime marker)
+void DocClipBase::addSnapMarker(const CommentedTime &marker)
 {
     QList < CommentedTime >::Iterator it = m_snapMarkers.begin();
     for (it = m_snapMarkers.begin(); it != m_snapMarkers.end(); ++it) {
@@ -346,7 +397,7 @@ void DocClipBase::addSnapMarker(const CommentedTime marker)
     }
 }
 
-void DocClipBase::editSnapMarker(const GenTime & time, QString comment)
+void DocClipBase::editSnapMarker(const GenTime & time, const QString &comment)
 {
     QList < CommentedTime >::Iterator it;
     for (it = m_snapMarkers.begin(); it != m_snapMarkers.end(); ++it) {