]> git.sesse.net Git - kdenlive/blobdiff - src/docclipbase.cpp
Fix "delete" key not working in project tree, allow deletion of several clips at...
[kdenlive] / src / docclipbase.cpp
index 0dc9b1a8322c5959ecaaf95420896fe5fb0be8e5..e57bca60a67757f03a2eb72b7923b1cd3fc75c4e 100644 (file)
 #include "kthumb.h"
 #include "clipmanager.h"
 
-DocClipBase::DocClipBase(ClipManager *clipManager, QDomElement xml, uint id):
+DocClipBase::DocClipBase(ClipManager *clipManager, QDomElement xml, const QString &id):
         m_id(id), m_description(QString()), m_refcount(0), m_audioThumbCreated(false), m_duration(GenTime()), m_thumbProd(NULL), m_audioTimer(NULL), m_clipProducer(NULL) {
     int type = xml.attribute("type").toInt();
     m_clipType = (CLIPTYPE) type;
     m_name = xml.attribute("name");
-    m_id = id;
 
     QDomNamedNodeMap attributes = xml.attributes();
     for (unsigned int i = 0; i < attributes.count(); i++) {
@@ -44,7 +43,8 @@ DocClipBase::DocClipBase(ClipManager *clipManager, QDomElement xml, uint id):
     }
     if (m_name.isEmpty()) m_name = url.fileName();
 
-    if (!url.isEmpty() && QFile::exists(url.path())) {
+    //if (!url.isEmpty() && QFile::exists(url.path()))
+    {
         m_thumbProd = new KThumb(clipManager, url);
         if (m_clipType == AV || m_clipType == AUDIO) slotCreateAudioTimer();
     }
@@ -102,11 +102,11 @@ const QString & DocClipBase::name() const {
     return m_name;
 }
 
-uint DocClipBase::getId() const {
+const QString &DocClipBase::getId() const {
     return m_id;
 }
 
-void DocClipBase::setId(const uint &newId) {
+void DocClipBase::setId(const QString &newId) {
     m_id = newId;
 }
 
@@ -139,6 +139,10 @@ const QString DocClipBase::description() const {
     return m_properties.value("description");
 }
 
+bool DocClipBase::isTransparent() const {
+    return (m_properties.value("transparency") == "1");
+}
+
 const QString DocClipBase::getProperty(const QString prop) const {
     return m_properties.value(prop);
 }
@@ -357,7 +361,9 @@ QString DocClipBase::markerComment(GenTime t) {
 }
 
 void DocClipBase::setProducer(Mlt::Producer *producer) {
+    if (producer == NULL) return;
     m_clipProducer = producer;
+    m_clipProducer->set("transparency", m_properties.value("transparency").toInt());
     if (m_thumbProd) m_thumbProd->setProducer(producer);
 }
 
@@ -445,6 +451,14 @@ void DocClipBase::setProperties(QMap <QString, QString> properties) {
         if (i.key() == "resource") m_thumbProd->updateClipUrl(KUrl(i.value()));
         else if (i.key() == "out") setDuration(GenTime(i.value().toInt(), KdenliveSettings::project_fps()));
         else if (m_clipType == SLIDESHOW && keys.contains(i.key())) refreshProducer = true;
+        else if (i.key() == "transparency") m_clipProducer->set("transparency", i.value().toInt());
+        else if (i.key() == "colour") {
+            char *tmp = (char *) qstrdup(i.value().toUtf8().data());
+            m_clipProducer->set("colour", tmp);
+            delete[] tmp;
+        } else if (i.key() == "xmldata") {
+            m_clipProducer->set("force_reload", 1);
+        }
     }
     if (refreshProducer) slotRefreshProducer();
 }
@@ -453,6 +467,14 @@ void DocClipBase::setProperty(QString key, QString value) {
     m_properties.insert(key, value);
     if (key == "resource") m_thumbProd->updateClipUrl(KUrl(value));
     else if (key == "out") setDuration(GenTime(value.toInt(), KdenliveSettings::project_fps()));
+    else if (key == "transparency") m_clipProducer->set("transparency", value.toInt());
+    else if (key == "colour") {
+        char *tmp = (char *) qstrdup(value.toUtf8().data());
+        m_clipProducer->set("colour", tmp);
+        delete[] tmp;
+    } else if (key == "xmldata") {
+        m_clipProducer->set("force_reload", 1);
+    }
 }
 
 QMap <QString, QString> DocClipBase::properties() const {