]> git.sesse.net Git - kdenlive/blobdiff - src/docclipbase.cpp
* internal rework: switch clip id's from integer to string
[kdenlive] / src / docclipbase.cpp
index 0cdc17a700aa4c2146d339cbdb94ad5d043d4453..3c6620ccd721f0a1c2814ce276e3a1773d14ae9e 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++) {
@@ -102,11 +101,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 +138,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);
 }
@@ -358,6 +361,7 @@ QString DocClipBase::markerComment(GenTime t) {
 
 void DocClipBase::setProducer(Mlt::Producer *producer) {
     m_clipProducer = producer;
+    m_clipProducer->set("transparency", m_properties.value("transparency").toInt());
     if (m_thumbProd) m_thumbProd->setProducer(producer);
 }
 
@@ -398,10 +402,10 @@ void DocClipBase::slotRefreshProducer() {
                 char *tmp = (char *) qstrdup(resource.toUtf8().data());
                 filter->set("luma.resource", tmp);
                 delete[] tmp;
-               if (getProperty("softness") != QString()) {
-                   int soft = getProperty("softness").toInt();
-                   filter->set("luma.softness", (double) soft / 100.0);
-               }
+                if (getProperty("softness") != QString()) {
+                    int soft = getProperty("softness").toInt();
+                    filter->set("luma.softness", (double) soft / 100.0);
+                }
             } else {
                 // filter does not exist, create it...
                 Mlt::Filter *filter = new Mlt::Filter(*(m_clipProducer->profile()), "luma");
@@ -411,10 +415,10 @@ void DocClipBase::slotRefreshProducer() {
                 char *tmp = (char *) qstrdup(resource.toUtf8().data());
                 filter->set("luma.resource", tmp);
                 delete[] tmp;
-               if (getProperty("softness") != QString()) {
-                   int soft = getProperty("softness").toInt();
-                   filter->set("luma.softness", (double) soft / 100.0);
-               }
+                if (getProperty("softness") != QString()) {
+                    int soft = getProperty("softness").toInt();
+                    filter->set("luma.softness", (double) soft / 100.0);
+                }
                 clipService.attach(*filter);
             }
         } else {
@@ -445,6 +449,7 @@ 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());
     }
     if (refreshProducer) slotRefreshProducer();
 }
@@ -453,6 +458,7 @@ 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());
 }
 
 QMap <QString, QString> DocClipBase::properties() const {