]> git.sesse.net Git - kdenlive/blobdiff - src/projectlistview.cpp
Try to fix audio mixing bug ( http://www.kdenlive.org:80/mantis/view.php?id=228 )
[kdenlive] / src / projectlistview.cpp
index 79459753a9ba034365d7f60cd65a6f182aadbf4f..d7de11cce011aa95489109d525a23744ae22554f 100644 (file)
@@ -113,8 +113,11 @@ void ProjectListView::mouseDoubleClickEvent(QMouseEvent * event) {
     ProjectItem *item = static_cast <ProjectItem *>(itemAt(event->pos()));
     if (!item) emit addClip();
     else if (item->isGroup()) {
-        if ((columnAt(event->pos().x()) == 1) || columnAt(event->pos().x()) == 2) QTreeWidget::mouseDoubleClickEvent(event);
-    } else emit showProperties(item->referencedClip());
+        if ((columnAt(event->pos().x()) == 1)) QTreeWidget::mouseDoubleClickEvent(event);
+    } else {
+        if ((columnAt(event->pos().x()) == 2)) QTreeWidget::mouseDoubleClickEvent(event);
+        else emit showProperties(item->referencedClip());
+    }
 }
 
 // virtual
@@ -176,8 +179,12 @@ void ProjectListView::dropEvent(QDropEvent *event) {
                 QTreeWidgetItem *parent = it->parent();
                 if (parent/* && ((ProjectItem *) it)->clipId() < 10000*/)  {
                     kDebug() << "++ item parent: " << parent->text(1);
-                    clone = (ProjectItem*) parent->takeChild(parent->indexOfChild(it));
-                    if (clone) addTopLevelItem(clone);
+                    clone = static_cast <ProjectItem*>(parent->takeChild(parent->indexOfChild(it)));
+                    if (clone) {
+                        addTopLevelItem(clone);
+                        clone->clearProperty("groupname");
+                        clone->clearProperty("groupid");
+                    }
                 }
             }
         }
@@ -215,9 +222,16 @@ void ProjectListView::mouseMoveEvent(QMouseEvent *event) {
             const QList <QTreeWidgetItem *> list = selectedItems();
             QStringList ids;
             foreach(const QTreeWidgetItem *item, list) {
-                // TODO allow dragging of folders
-                ids.append(((ProjectItem *) item)->clipId());
+                const ProjectItem *clip = static_cast <const ProjectItem *>(item);
+                if (!clip->isGroup()) ids.append(clip->clipId());
+                else {
+                    const int children = item->childCount();
+                    for (int i = 0; i < children; i++) {
+                        ids.append(static_cast <ProjectItem *>(item->child(i))->clipId());
+                    }
+                }
             }
+            if (ids.isEmpty()) return;
             QByteArray data;
             data.append(ids.join(";").toUtf8()); //doc.toString().toUtf8());
             mimeData->setData("kdenlive/producerslist", data);