]> git.sesse.net Git - kdenlive/blobdiff - src/projectlistview.cpp
Clip cuts in project tree can now have a description
[kdenlive] / src / projectlistview.cpp
index ce2f683322b2d4561d6dce6607dee2bf4b890d19..35b2bc89a8070e960b6c18bc781133d0ede46018 100644 (file)
@@ -44,9 +44,9 @@ ProjectListView::ProjectListView(QWidget *parent) :
     setAcceptDrops(true);
 
 
-    setColumnCount(4);
+    setColumnCount(3);
     QStringList headers;
-    headers << i18n("Thumbnail") << i18n("Filename") << i18n("Description") << i18n("Rating");
+    headers << i18n("Clip") << i18n("Description") << i18n("Rating");
     setHeaderLabels(headers);
 
     QHeaderView* headerView = header();
@@ -56,25 +56,24 @@ ProjectListView::ProjectListView(QWidget *parent) :
     headerView->setClickable(true);
     headerView->setSortIndicatorShown(true);
     headerView->setMovable(false);
-    sortByColumn(1, Qt::AscendingOrder);
+    sortByColumn(0, Qt::AscendingOrder);
     setSortingEnabled(true);
 
-    if (!KdenliveSettings::showdescriptioncolumn()) hideColumn(2);
-    if (!KdenliveSettings::showratingcolumn()) hideColumn(3);
+    if (!KdenliveSettings::showdescriptioncolumn()) hideColumn(1);
+    if (!KdenliveSettings::showratingcolumn()) hideColumn(2);
 }
 
 ProjectListView::~ProjectListView()
 {
 }
 
-
 void ProjectListView::configureColumns(const QPoint& pos)
 {
     KMenu popup(this);
     popup.addTitle(i18nc("@title:menu", "Columns"));
 
     QHeaderView* headerView = header();
-    for (int i = 2; i < headerView->count(); ++i) {
+    for (int i = 1; i < headerView->count(); ++i) {
         const QString text = model()->headerData(i, Qt::Horizontal).toString();
         QAction* action = popup.addAction(text);
         action->setCheckable(true);
@@ -89,10 +88,10 @@ void ProjectListView::configureColumns(const QPoint& pos)
         // remember the changed column visibility in the settings
         const int columnIndex = activatedAction->data().toInt();
         switch (columnIndex) {
-        case 2:
+        case 1:
             KdenliveSettings::setShowdescriptioncolumn(show);
             break;
-        case 3:
+        case 2:
             KdenliveSettings::setShowratingcolumn(show);
             break;
         default:
@@ -124,17 +123,21 @@ void ProjectListView::mouseDoubleClickEvent(QMouseEvent * event)
     }
     ProjectItem *item;
     if (it->type() == PROJECTFOLDERTYPE) {
-        if ((columnAt(event->pos().x()) == 1)) QTreeWidget::mouseDoubleClickEvent(event);
+        if ((columnAt(event->pos().x()) == 0)) QTreeWidget::mouseDoubleClickEvent(event);
         return;
     }
     if (it->type() == PROJECTSUBCLIPTYPE) {
         // subitem
+        if ((columnAt(event->pos().x()) == 1)) {
+            QTreeWidget::mouseDoubleClickEvent(event);
+            return;
+        }
         item = static_cast <ProjectItem *>(it->parent());
     } else item = static_cast <ProjectItem *>(it);
 
     if (!(item->flags() & Qt::ItemIsDragEnabled)) return;
-    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) && it->type() != PROJECTSUBCLIPTYPE) QTreeWidget::mouseDoubleClickEvent(event);
+    if ((columnAt(event->pos().x()) == 0) && (item->clipType() == SLIDESHOW || item->clipType() == TEXT || item->clipType() == COLOR)) QTreeWidget::mouseDoubleClickEvent(event);
+    else if ((columnAt(event->pos().x()) == 1) && it->type() != PROJECTSUBCLIPTYPE) QTreeWidget::mouseDoubleClickEvent(event);
     else emit showProperties(item->referencedClip());
 }
 
@@ -260,7 +263,7 @@ void ProjectListView::mouseMoveEvent(QMouseEvent *event)
             data.append(list.join(";").toUtf8());
             mimeData->setData("kdenlive/clip", data);
             drag->setMimeData(mimeData);
-            drag->setPixmap(clickItem->icon(0).pixmap(iconSize()));
+            drag->setPixmap(clickItem->data(0, Qt::DecorationRole).value<QPixmap>());
             drag->setHotSpot(QPoint(0, 50));
             drag->exec();
         }
@@ -288,7 +291,7 @@ void ProjectListView::mouseMoveEvent(QMouseEvent *event)
             //mimeData->setText(ids.join(";")); //doc.toString());
             //mimeData->setImageData(image);
             drag->setMimeData(mimeData);
-            drag->setPixmap(it->icon(0).pixmap(iconSize()));
+            drag->setPixmap(it->data(0, Qt::DecorationRole).value<QPixmap>());
             drag->setHotSpot(QPoint(0, 50));
             drag->exec();
         }