]> git.sesse.net Git - kdenlive/blobdiff - src/projectlistview.cpp
Cleanup last commit and some real mess in profile switching
[kdenlive] / src / projectlistview.cpp
index 01ea4a34b9aed8da3e1df700c9d0747636b71ba1..74cafd6cb8b6c537fb00443290c5bd572ced7ae2 100644 (file)
@@ -114,7 +114,10 @@ void ProjectListView::mouseDoubleClickEvent(QMouseEvent * event) {
     if (!item) emit addClip();
     else if (item->isGroup()) {
         if ((columnAt(event->pos().x()) == 1)) QTreeWidget::mouseDoubleClickEvent(event);
-    } else emit showProperties(item->referencedClip());
+    } else {
+        if ((columnAt(event->pos().x()) == 2)) QTreeWidget::mouseDoubleClickEvent(event);
+        else emit showProperties(item->referencedClip());
+    }
 }
 
 // virtual
@@ -138,7 +141,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")) {
@@ -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");
+                    }
                 }
             }
         }
@@ -199,7 +206,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()
@@ -215,16 +222,16 @@ void ProjectListView::mouseMoveEvent(QMouseEvent *event) {
             const QList <QTreeWidgetItem *> list = selectedItems();
             QStringList ids;
             foreach(const QTreeWidgetItem *item, list) {
-               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());
-                   }
-               }
+                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;
+            if (ids.isEmpty()) return;
             QByteArray data;
             data.append(ids.join(";").toUtf8()); //doc.toString().toUtf8());
             mimeData->setData("kdenlive/producerslist", data);
@@ -247,14 +254,13 @@ 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 {