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()) == 2)) QTreeWidget::mouseDoubleClickEvent(event);
+ else emit showProperties(item->referencedClip());
+ }
}
// virtual
else if (item->parent() && ((ProjectItem *) item->parent())->isGroup())
groupName = item->parent()->text(1);
}
- QList <QUrl> list;
- list = event->mimeData()->urls();
+ const QList <QUrl> list = event->mimeData()->urls();
foreach(const QUrl &url, list) {
emit addClip(url, groupName);
}
if (item->isGroup()) {
//emit addClip(event->mimeData->text());
kDebug() << "//////////////// DROPPED RIGHT 1 ";
- QList <QTreeWidgetItem *> list;
- list = selectedItems();
+ const QList <QTreeWidgetItem *> list = selectedItems();
ProjectItem *clone;
- int parentId = item->clipId();
+ QString parentId = item->clipId();
foreach(QTreeWidgetItem *it, list) {
// TODO allow dragging of folders ?
- if (!((ProjectItem *) it)->isGroup() && ((ProjectItem *) it)->clipId() < 10000) {
+ if (!((ProjectItem *) it)->isGroup()/* && ((ProjectItem *) it)->clipId() < 10000*/) {
if (it->parent()) clone = (ProjectItem*) it->parent()->takeChild(it->parent()->indexOfChild(it));
else clone = (ProjectItem*) takeTopLevelItem(indexOfTopLevelItem(it));
if (clone) {
item->addChild(clone);
QMap <QString, QString> props;
props.insert("groupname", item->groupName());
- props.insert("groupid", QString::number(parentId));
+ props.insert("groupid", parentId);
clone->setProperties(props);
}
}
if (!item) {
kDebug() << "//////////////// DROPPED ONÂ EMPTY ZONE";
// item dropped in empty zone, move it to top level
- QList <QTreeWidgetItem *> list;
- list = selectedItems();
+ const QList <QTreeWidgetItem *> list = selectedItems();
ProjectItem *clone;
foreach(QTreeWidgetItem *it, list) {
QTreeWidgetItem *parent = it->parent();
- if (parent && ((ProjectItem *) it)->clipId() < 10000) {
+ 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");
+ }
}
}
}
QDrag *drag = new QDrag(this);
QMimeData *mimeData = new QMimeData;
QDomDocument doc;
- QList <QTreeWidgetItem *> list;
- list = selectedItems();
+ const QList <QTreeWidgetItem *> list = selectedItems();
QStringList ids;
foreach(const QTreeWidgetItem *item, list) {
- // TODO allow dragging of folders
- ids.append(QString::number(((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);
}
}
+// virtual
void ProjectListView::dragMoveEvent(QDragMoveEvent * event) {
QTreeWidgetItem * item = itemAt(event->pos());
event->setDropAction(Qt::IgnoreAction);