]> git.sesse.net Git - kdenlive/commitdiff
Fix folder names not saved
authorJean-Baptiste Mardelle <jb@kdenlive.org>
Mon, 13 Oct 2008 15:10:40 +0000 (15:10 +0000)
committerJean-Baptiste Mardelle <jb@kdenlive.org>
Mon, 13 Oct 2008 15:10:40 +0000 (15:10 +0000)
svn path=/branches/KDE4/; revision=2459

src/docclipbase.cpp
src/docclipbase.h
src/projectitem.cpp
src/projectitem.h
src/projectlist.cpp

index e57bca60a67757f03a2eb72b7923b1cd3fc75c4e..6263062b06516a9997776e9db4d6ec2a26110415 100644 (file)
@@ -463,7 +463,7 @@ void DocClipBase::setProperties(QMap <QString, QString> properties) {
     if (refreshProducer) slotRefreshProducer();
 }
 
-void DocClipBase::setProperty(QString key, QString value) {
+void DocClipBase::setProperty(const QString &key, const 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()));
index e78f223712ef27624170428bfcc2f41e24528722..5a33f7b71a308bba5183382d0f6c81dfa6ba8049 100644 (file)
@@ -71,7 +71,7 @@ Q_OBJECT public:
 
     /** Returns any property of this clip. */
     const QString getProperty(const QString prop) const;
-    void setProperty(QString key, QString value);
+    void setProperty(const QString &key, const QString &value);
 
     /** Returns the internal unique id of the clip. */
     const QString &getId() const;
index a6442fabd417db33ccced353cdf03c7747523b15..f8bc113cbbe032d99bdc06ffea61fe1880bcab6f 100644 (file)
@@ -134,6 +134,10 @@ void ProjectItem::setProperties(QMap <QString, QString> props) {
     m_clip->setProperties(props);
 }
 
+void ProjectItem::setProperty(const QString &key, const QString &value) {
+    m_clip->setProperty(key, value);
+}
+
 DocClipBase *ProjectItem::referencedClip() {
     return m_clip;
 }
index da261c427fc2e669bca7cd86f3297feebc442385..c39fa7376a616499c74c54238e4a2ea0f16c0101 100644 (file)
@@ -53,6 +53,7 @@ public:
     void changeDuration(int frames);
     DocClipBase *referencedClip();
     void setProperties(QMap <QString, QString> props);
+    void setProperty(const QString &key, const QString &value);
 
 private:
     QString m_groupName;
index 617ae1ae78efbc1e38c1f5e77fc6e644092fc309..872f4ca4ab5c775c71f9bf868ecf924ca04139bc 100644 (file)
@@ -187,6 +187,11 @@ void ProjectList::slotItemEdited(QTreeWidgetItem *item, int column) {
         slotUpdateClipProperties(clip, props);
     } else if (column == 1 && clip->isGroup()) {
         m_doc->slotEditFolder(item->text(1), clip->groupName(), clip->clipId());
+        const int children = item->childCount();
+        for (int i = 0; i < children; i++) {
+            ProjectItem *child = static_cast <ProjectItem *>(item->child(i));
+            child->setProperty("groupname", item->text(1));
+        }
     }
 }
 
@@ -213,7 +218,7 @@ void ProjectList::slotRemoveClip() {
         else ids << item->clipId();
         if (item->numReferences() > 0) {
             if (KMessageBox::questionYesNo(this, i18np("Delete clip <b>%2</b> ?<br>This will also remove the clip in timeline", "Delete clip <b>%2</b> ?<br>This will also remove its %1 clips in timeline", item->numReferences(), item->names().at(1)), i18n("Delete Clip")) != KMessageBox::Yes) return;
-        } else if (item->clipType() == FOLDER && item->childCount() > 0) {
+        } else if (item->isGroup() && item->childCount() > 0) {
             int children = item->childCount();
             if (KMessageBox::questionYesNo(this, i18n("Delete folder <b>%2</b> ?<br>This will also remove the %1 clips in that folder", children, item->names().at(1)), i18n("Delete Folder")) != KMessageBox::Yes) return;
             for (int i = 0; i < children; ++i) {
@@ -256,7 +261,7 @@ void ProjectList::slotAddFolder(const QString foldername, const QString &clipId,
         QTreeWidgetItemIterator it(listView);
         while (*it) {
             item = static_cast <ProjectItem *>(*it);
-            if (item->clipType() == FOLDER && item->clipId() == clipId) {
+            if (item->isGroup() && item->clipId() == clipId) {
                 delete item;
                 break;
             }
@@ -269,8 +274,13 @@ void ProjectList::slotAddFolder(const QString foldername, const QString &clipId,
             QTreeWidgetItemIterator it(listView);
             while (*it) {
                 item = static_cast <ProjectItem *>(*it);
-                if (item->clipType() == FOLDER && item->clipId() == clipId) {
+                if (item->isGroup() && item->clipId() == clipId) {
                     item->setText(1, foldername);
+                    const int children = item->childCount();
+                    for (int i = 0; i < children; i++) {
+                        ProjectItem *child = static_cast <ProjectItem *>(item->child(i));
+                        child->setProperty("groupname", foldername);
+                    }
                     break;
                 }
                 ++it;