]> git.sesse.net Git - kdenlive/blobdiff - src/projectlistview.cpp
Allow editing of clip names again (for color, titles & slideshows), fix saving issue:
[kdenlive] / src / projectlistview.cpp
index 4ef4653ca08df36a91d5b028b94d85f8642e4e7d..4e041938456a754c132e0b7b637a519020802c77 100644 (file)
@@ -112,8 +112,13 @@ void ProjectListView::contextMenuEvent(QContextMenuEvent * event) {
 void ProjectListView::mouseDoubleClickEvent(QMouseEvent * event) {
     ProjectItem *item = static_cast <ProjectItem *>(itemAt(event->pos()));
     if (!item) emit addClip();
-    else if ((item->clipType() == FOLDER && columnAt(event->pos().x()) == 1) || columnAt(event->pos().x()) == 2) QTreeWidget::mouseDoubleClickEvent(event);
-    else emit showProperties(item->referencedClip());
+    else if (item->isGroup()) {
+        if ((columnAt(event->pos().x()) == 1)) QTreeWidget::mouseDoubleClickEvent(event);
+    } else {
+        if ((columnAt(event->pos().x()) == 1) && (item->clipType() == SLIDESHOW || item->clipType() == TEXT || item->clipType() == COLOR)) QTreeWidget::mouseDoubleClickEvent(event);
+        else if ((columnAt(event->pos().x()) == 2)) QTreeWidget::mouseDoubleClickEvent(event);
+        else emit showProperties(item->referencedClip());
+    }
 }
 
 // virtual
@@ -137,7 +142,7 @@ void ProjectListView::dropEvent(QDropEvent *event) {
         }
         const QList <QUrl> list = event->mimeData()->urls();
         foreach(const QUrl &url, list) {
-            emit addClip(url, groupName);
+            emit addClip(KUrl(url), groupName);
         }
 
     } else if (event->mimeData()->hasFormat("kdenlive/producerslist")) {
@@ -175,8 +180,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");
+                    }
                 }
             }
         }
@@ -198,7 +207,7 @@ void ProjectListView::mousePressEvent(QMouseEvent *event) {
 
 // virtual
 void ProjectListView::mouseMoveEvent(QMouseEvent *event) {
-    kDebug() << "// DRAG STARTED, MOUSE MOVED: ";
+    //kDebug() << "// DRAG STARTED, MOUSE MOVED: ";
     if (!m_dragStarted) return;
 
     if ((event->pos() - m_DragStartPosition).manhattanLength()
@@ -214,9 +223,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);
@@ -237,15 +253,15 @@ void ProjectListView::mouseMoveEvent(QMouseEvent *event) {
     }
 }
 
+// virtual
 void ProjectListView::dragMoveEvent(QDragMoveEvent * event) {
-    QTreeWidgetItem * item = itemAt(event->pos());
     event->setDropAction(Qt::IgnoreAction);
-    //if (item) {
     event->setDropAction(Qt::MoveAction);
     if (event->mimeData()->hasText()) {
         event->acceptProposedAction();
     }
-    //}
+    // stop playing because we get a crash otherwise when fetching the thumbnails
+    emit pauseMonitor();
 }
 
 QStringList ProjectListView::mimeTypes() const {