]> git.sesse.net Git - kdenlive/blob - src/projectlist.cpp
*Re-introduce slideshow clips
[kdenlive] / src / projectlist.cpp
1 /***************************************************************************
2  *   Copyright (C) 2007 by Jean-Baptiste Mardelle (jb@kdenlive.org)        *
3  *                                                                         *
4  *   This program is free software; you can redistribute it and/or modify  *
5  *   it under the terms of the GNU General Public License as published by  *
6  *   the Free Software Foundation; either version 2 of the License, or     *
7  *   (at your option) any later version.                                   *
8  *                                                                         *
9  *   This program is distributed in the hope that it will be useful,       *
10  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
11  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
12  *   GNU General Public License for more details.                          *
13  *                                                                         *
14  *   You should have received a copy of the GNU General Public License     *
15  *   along with this program; if not, write to the                         *
16  *   Free Software Foundation, Inc.,                                       *
17  *   51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA          *
18  ***************************************************************************/
19
20
21 #include <QMouseEvent>
22 #include <QStylePainter>
23 #include <QPixmap>
24 #include <QIcon>
25 #include <QDialog>
26 #include <QtGui>
27
28 #include <KDebug>
29 #include <KAction>
30 #include <KLocale>
31 #include <KFileDialog>
32 #include <KInputDialog>
33 #include <kio/netaccess.h>
34 #include <KMessageBox>
35
36 #include <nepomuk/global.h>
37 #include <nepomuk/resource.h>
38 #include <nepomuk/tag.h>
39
40 #include "projectlist.h"
41 #include "projectitem.h"
42 #include "kdenlivesettings.h"
43 #include "slideshowclip.h"
44 #include "ui_colorclip_ui.h"
45
46
47 #include "definitions.h"
48 #include "clipmanager.h"
49 #include "docclipbase.h"
50 #include "kdenlivedoc.h"
51 #include "renderer.h"
52 #include "kthumb.h"
53 #include "projectlistview.h"
54
55 ProjectList::ProjectList(QWidget *parent)
56         : QWidget(parent), m_render(NULL), m_fps(-1), m_commandStack(NULL) {
57
58     QWidget *vbox = new QWidget;
59     listView = new ProjectListView(this);;
60     QVBoxLayout *layout = new QVBoxLayout;
61     m_clipIdCounter = 0;
62
63     // setup toolbar
64     searchView = new KTreeWidgetSearchLine(this);
65     m_toolbar = new QToolBar("projectToolBar", this);
66     m_toolbar->addWidget(searchView);
67
68     QToolButton *addButton = new QToolButton(m_toolbar);
69     QMenu *addMenu = new QMenu(this);
70     addButton->setMenu(addMenu);
71     addButton->setPopupMode(QToolButton::MenuButtonPopup);
72     m_toolbar->addWidget(addButton);
73
74     QAction *addClipButton = addMenu->addAction(KIcon("document-new"), i18n("Add Clip"));
75     connect(addClipButton, SIGNAL(triggered()), this, SLOT(slotAddClip()));
76
77     QAction *addColorClip = addMenu->addAction(KIcon("document-new"), i18n("Add Color Clip"));
78     connect(addColorClip, SIGNAL(triggered()), this, SLOT(slotAddColorClip()));
79
80     QAction *addSlideClip = addMenu->addAction(KIcon("document-new"), i18n("Add Slideshow Clip"));
81     connect(addSlideClip, SIGNAL(triggered()), this, SLOT(slotAddSlideshowClip()));
82
83     QAction *addTitleClip = addMenu->addAction(KIcon("document-new"), i18n("Add Title Clip"));
84     connect(addTitleClip, SIGNAL(triggered()), this, SLOT(slotAddTitleClip()));
85
86     m_deleteAction = m_toolbar->addAction(KIcon("edit-delete"), i18n("Delete Clip"));
87     connect(m_deleteAction, SIGNAL(triggered()), this, SLOT(slotRemoveClip()));
88
89     m_editAction = m_toolbar->addAction(KIcon("document-properties"), i18n("Edit Clip"));
90     connect(m_editAction, SIGNAL(triggered()), this, SLOT(slotEditClip()));
91
92     QAction *addFolderButton = addMenu->addAction(KIcon("folder-new"), i18n("Create Folder"));
93     connect(addFolderButton, SIGNAL(triggered()), this, SLOT(slotAddFolder()));
94
95     addButton->setDefaultAction(addClipButton);
96
97     layout->addWidget(m_toolbar);
98     layout->addWidget(listView);
99     setLayout(layout);
100     //m_toolbar->setEnabled(false);
101
102     searchView->setTreeWidget(listView);
103
104     m_menu = new QMenu();
105     m_menu->addAction(addClipButton);
106     m_menu->addAction(addColorClip);
107     m_menu->addAction(addTitleClip);
108     m_menu->addAction(m_editAction);
109     m_menu->addAction(m_deleteAction);
110     m_menu->addAction(addFolderButton);
111     m_menu->insertSeparator(m_deleteAction);
112
113     connect(listView, SIGNAL(itemSelectionChanged()), this, SLOT(slotClipSelected()));
114     connect(listView, SIGNAL(requestMenu(const QPoint &, QTreeWidgetItem *)), this, SLOT(slotContextMenu(const QPoint &, QTreeWidgetItem *)));
115     connect(listView, SIGNAL(addClip()), this, SLOT(slotAddClip()));
116     connect(listView, SIGNAL(addClip(QUrl, const QString &)), this, SLOT(slotAddClip(QUrl, const QString &)));
117     connect(listView, SIGNAL(itemChanged(QTreeWidgetItem *, int)), this, SLOT(slotItemEdited(QTreeWidgetItem *, int)));
118     connect(listView, SIGNAL(showProperties(DocClipBase *)), this, SIGNAL(showClipProperties(DocClipBase *)));
119
120     m_listViewDelegate = new ItemDelegate(listView);
121     listView->setItemDelegate(m_listViewDelegate);
122 }
123
124 ProjectList::~ProjectList() {
125     delete m_menu;
126     delete m_toolbar;
127 }
128
129
130
131 void ProjectList::setRenderer(Render *projectRender) {
132     m_render = projectRender;
133 }
134
135 void ProjectList::slotClipSelected() {
136     ProjectItem *item = static_cast <ProjectItem*>(listView->currentItem());
137     if (item && !item->isGroup()) emit clipSelected(item->toXml());
138 }
139
140 void ProjectList::slotUpdateClipProperties(int id, QMap <QString, QString> properties) {
141     ProjectItem *item = getItemById(id);
142     if (item) {
143       slotUpdateClipProperties(item, properties);
144       if (properties.contains("colour")) slotRefreshClipThumbnail(item);
145   }
146 }
147
148 void ProjectList::slotUpdateClipProperties(ProjectItem *clip, QMap <QString, QString> properties) {
149     if (!clip) return;
150     clip->setProperties(properties);
151     if (properties.contains("description")) {
152         CLIPTYPE type = clip->clipType();
153         clip->setText(2, properties.value("description"));
154         if (type == AUDIO || type == VIDEO || type == AV || type == IMAGE || type == PLAYLIST) {
155             // Use Nepomuk system to store clip description
156             Nepomuk::Resource f(clip->clipUrl().path());
157             if (f.isValid()) f.setDescription(properties.value("description"));
158         }
159     }
160 }
161
162 void ProjectList::slotItemEdited(QTreeWidgetItem *item, int column) {
163     ProjectItem *clip = static_cast <ProjectItem*>(item);
164     if (column == 2) {
165         QMap <QString, QString> props;
166         props["description"] = item->text(2);
167         slotUpdateClipProperties(clip, props);
168     } else if (column == 1 && clip->clipType() == FOLDER) {
169         m_doc->slotEditFolder(item->text(1), clip->groupName(), clip->clipId());
170     }
171 }
172
173 void ProjectList::slotContextMenu(const QPoint &pos, QTreeWidgetItem *item) {
174     bool enable = false;
175     if (item) {
176         enable = true;
177     }
178     m_editAction->setEnabled(enable);
179     m_deleteAction->setEnabled(enable);
180
181     m_menu->popup(pos);
182 }
183
184 void ProjectList::slotRemoveClip() {
185     if (!listView->currentItem()) return;
186     ProjectItem *item = static_cast <ProjectItem *>(listView->currentItem());
187     QList <int> ids;
188     QMap <QString, int> folderids;
189     if (item->clipType() == FOLDER) folderids[item->groupName()] = item->clipId();
190     else ids << item->clipId();
191     if (item->numReferences() > 0) {
192         if (KMessageBox::questionYesNo(this, i18np("Delete clip <b>%2</b> ?<br>This will also remove the clip in timeline", "Delete clip <b>%2</b> ?<br>This will also remove its %1 clips in timeline", item->numReferences(), item->names().at(1)), i18n("Delete Clip")) != KMessageBox::Yes) return;
193     } else if (item->clipType() == FOLDER && item->childCount() > 0) {
194         int children = item->childCount();
195         if (KMessageBox::questionYesNo(this, i18n("Delete folder <b>%2</b> ?<br>This will also remove the %1 clips in that folder", children, item->names().at(1)), i18n("Delete Folder")) != KMessageBox::Yes) return;
196         for (int i = 0; i < children; ++i) {
197             ProjectItem *child = static_cast <ProjectItem *>(item->child(i));
198             ids << child->clipId();
199         }
200     }
201     if (!ids.isEmpty()) m_doc->deleteProjectClip(ids);
202     if (!folderids.isEmpty()) m_doc->deleteProjectFolder(folderids);
203 }
204
205 void ProjectList::selectItemById(const int clipId) {
206     ProjectItem *item = getItemById(clipId);
207     if (item) listView->setCurrentItem(item);
208 }
209
210 void ProjectList::addClip(const QStringList &name, const QDomElement &elem, const int clipId, const KUrl &url, const QString &group, int parentId) {
211     kDebug() << "/////////  ADDING VCLIP=: " << name;
212     ProjectItem *item;
213     ProjectItem *groupItem = NULL;
214     QString groupName;
215     if (group.isEmpty()) groupName = elem.attribute("groupname", QString::null);
216     else groupName = group;
217     if (elem.isNull() && url.isEmpty()) {
218         // this is a folder
219         groupName = name.at(1);
220         QList<QTreeWidgetItem *> groupList = listView->findItems(groupName, Qt::MatchExactly, 1);
221         if (groupList.isEmpty())  {
222             (void) new ProjectItem(listView, name, m_doc->getFreeClipId());
223         }
224         return;
225     }
226
227     if (parentId != -1) {
228         groupItem = getItemById(parentId);
229     } else if (!groupName.isEmpty()) {
230         // Clip is in a group
231         QList<QTreeWidgetItem *> groupList = listView->findItems(groupName, Qt::MatchExactly, 1);
232
233         if (groupList.isEmpty())  {
234             QStringList itemName;
235             itemName << QString::null << groupName;
236             kDebug() << "-------  CREATING NEW GRP: " << itemName;
237             groupItem = new ProjectItem(listView, itemName, m_doc->getFreeClipId());
238         } else groupItem = (ProjectItem *) groupList.first();
239     }
240     if (groupItem) item = new ProjectItem(groupItem, name, elem, clipId);
241     else item = new ProjectItem(listView, name, elem, clipId);
242     if (!url.isEmpty()) {
243         // if file has Nepomuk comment, use it
244         Nepomuk::Resource f(url.path());
245         QString annotation;
246         if (f.isValid()) annotation = f.description();
247
248         if (!annotation.isEmpty()) item->setText(2, annotation);
249         QString resource = url.path();
250         if (resource.endsWith("westley") || resource.endsWith("kdenlive")) {
251             QString tmpfile;
252             QDomDocument doc;
253             if (KIO::NetAccess::download(url, tmpfile, 0)) {
254                 QFile file(tmpfile);
255                 if (file.open(QIODevice::ReadOnly)) {
256                     doc.setContent(&file, false);
257                     file.close();
258                 }
259                 KIO::NetAccess::removeTempFile(tmpfile);
260
261                 QDomNodeList subProds = doc.elementsByTagName("producer");
262                 int ct = subProds.count();
263                 for (int i = 0; i <  ct ; i++) {
264                     QDomElement e = subProds.item(i).toElement();
265                     if (!e.isNull()) {
266                         addProducer(e, clipId);
267                     }
268                 }
269             }
270         }
271
272     }
273
274     if (elem.isNull()) {
275         QDomDocument doc;
276         QDomElement element = doc.createElement("producer");
277         element.setAttribute("resource", url.path());
278         emit getFileProperties(element, clipId);
279     } else emit getFileProperties(elem, clipId);
280     selectItemById(clipId);
281 }
282
283 void ProjectList::slotDeleteClip(int clipId) {
284     ProjectItem *item = getItemById(clipId);
285     QTreeWidgetItem *p = item->parent();
286     if (p) {
287         kDebug() << "///////  DELETEED CLIP HAS A PARENT... " << p->indexOfChild(item);
288         QTreeWidgetItem *clone = p->takeChild(p->indexOfChild(item));
289     } else if (item) delete item;
290 }
291
292 void ProjectList::slotAddFolder() {
293
294     // QString folderName = KInputDialog::getText(i18n("New Folder"), i18n("Enter new folder name: "));
295     // if (folderName.isEmpty()) return;
296     m_doc->slotAddFolder(i18n("Folder")); //folderName);
297 }
298
299 void ProjectList::slotAddFolder(const QString foldername, int clipId, bool remove, bool edit) {
300     if (remove) {
301         ProjectItem *item;
302         QTreeWidgetItemIterator it(listView);
303         while (*it) {
304             item = static_cast <ProjectItem *>(*it);
305             if (item->clipType() == FOLDER && item->clipId() == clipId) {
306                 delete item;
307                 break;
308             }
309             ++it;
310         }
311     } else {
312         if (edit) {
313             disconnect(listView, SIGNAL(itemChanged(QTreeWidgetItem *, int)), this, SLOT(slotUpdateItemDescription(QTreeWidgetItem *, int)));
314             ProjectItem *item;
315             QTreeWidgetItemIterator it(listView);
316             while (*it) {
317                 item = static_cast <ProjectItem *>(*it);
318                 if (item->clipType() == FOLDER && item->clipId() == clipId) {
319                     item->setText(1, foldername);
320                     break;
321                 }
322                 ++it;
323             }
324             connect(listView, SIGNAL(itemChanged(QTreeWidgetItem *, int)), this, SLOT(slotUpdateItemDescription(QTreeWidgetItem *, int)));
325         } else {
326             QStringList text;
327             text << QString() << foldername;
328             (void) new ProjectItem(listView, text, clipId);
329         }
330     }
331 }
332
333 void ProjectList::slotAddClip(DocClipBase *clip) {
334     const int parent = clip->toXML().attribute("groupid").toInt();
335     ProjectItem *item = NULL;
336     if (parent != 0) {
337         ProjectItem *parentitem = getItemById(parent);
338         if (parentitem) item = new ProjectItem(parentitem, clip);
339     }
340     if (item == NULL) item = new ProjectItem(listView, clip);
341
342     KUrl url = clip->fileURL();
343     if (!url.isEmpty()) {
344         // if file has Nepomuk comment, use it
345         Nepomuk::Resource f(url.path());
346         QString annotation;
347         if (f.isValid()) {
348             annotation = f.description();
349             /*
350             Nepomuk::Tag tag("test");
351             f.addTag(tag);*/
352         } else kDebug() << "---  CANNOT CONTACT NEPOMUK";
353         if (!annotation.isEmpty()) item->setText(2, annotation);
354     }
355     emit getFileProperties(clip->toXML(), clip->getId());
356 }
357
358 void ProjectList::slotUpdateClip(int id) {
359     ProjectItem *item = getItemById(id);
360     item->setData(1, UsageRole, QString::number(item->numReferences()));
361 }
362
363 void ProjectList::slotAddClip(QUrl givenUrl, QString group) {
364     if (!m_commandStack) kDebug() << "!!!!!!!!!!!!!!!!  NO CMD STK";
365     KUrl::List list;
366     if (givenUrl.isEmpty())
367         list = KFileDialog::getOpenUrls(KUrl(), "application/vnd.kde.kdenlive application/vnd.westley.scenelist application/flv application/vnd.rn-realmedia video/x-dv video/x-msvideo video/mpeg video/x-ms-wmv audio/mpeg audio/x-mp3 audio/x-wav application/ogg *.m2t *.dv video/mp4 video/quicktime image/gif image/jpeg image/png image/x-bmp image/svg+xml image/tiff image/x-xcf-gimp image/x-vnd.adobe.photoshop image/x-pcx image/x-exr");
368     else list.append(givenUrl);
369     if (list.isEmpty()) return;
370     KUrl::List::Iterator it;
371     int groupId = -1;
372     if (group.isEmpty()) {
373         ProjectItem *item = static_cast <ProjectItem*>(listView->currentItem());
374         if (item && item->clipType() != FOLDER) {
375             while (item->parent()) {
376                 item = static_cast <ProjectItem*>(item->parent());
377                 if (item->clipType() == FOLDER) break;
378             }
379         }
380         if (item && item->clipType() == FOLDER) {
381             group = item->groupName();
382             groupId = item->clipId();
383         }
384     }
385     for (it = list.begin(); it != list.end(); it++) {
386         m_doc->slotAddClipFile(*it, group, groupId);
387     }
388 }
389
390 void ProjectList::slotAddColorClip() {
391     if (!m_commandStack) kDebug() << "!!!!!!!!!!!!!!!!  NO CMD STK";
392     QDialog *dia = new QDialog(this);
393     Ui::ColorClip_UI *dia_ui = new Ui::ColorClip_UI();
394     dia_ui->setupUi(dia);
395     dia_ui->clip_name->setText(i18n("Color Clip"));
396     dia_ui->clip_duration->setText(KdenliveSettings::color_duration());
397     if (dia->exec() == QDialog::Accepted) {
398         QString color = dia_ui->clip_color->color().name();
399         color = color.replace(0, 1, "0x") + "ff";
400
401         QString group = QString();
402         int groupId = -1;
403         ProjectItem *item = static_cast <ProjectItem*>(listView->currentItem());
404         if (item && item->clipType() != FOLDER) {
405             while (item->parent()) {
406                 item = static_cast <ProjectItem*>(item->parent());
407                 if (item->clipType() == FOLDER) break;
408             }
409         }
410         if (item && item->clipType() == FOLDER) {
411             group = item->groupName();
412             groupId = item->clipId();
413         }
414
415         m_doc->slotAddColorClipFile(dia_ui->clip_name->text(), color, dia_ui->clip_duration->text(), group, groupId);
416     }
417     delete dia_ui;
418     delete dia;
419 }
420
421
422 void ProjectList::slotAddSlideshowClip() {
423     if (!m_commandStack) kDebug() << "!!!!!!!!!!!!!!!!  NO CMD STK";
424     SlideshowClip *dia = new SlideshowClip();
425
426     if (dia->exec() == QDialog::Accepted) {
427
428         QString group = QString();
429         int groupId = -1;
430         ProjectItem *item = static_cast <ProjectItem*>(listView->currentItem());
431         if (item && item->clipType() != FOLDER) {
432             while (item->parent()) {
433                 item = static_cast <ProjectItem*>(item->parent());
434                 if (item->clipType() == FOLDER) break;
435             }
436         }
437         if (item && item->clipType() == FOLDER) {
438             group = item->groupName();
439             groupId = item->clipId();
440         }
441
442         m_doc->slotAddSlideshowClipFile(dia->clipName(), dia->selectedPath(), dia->imageCount(), dia->clipDuration(), dia->loop(), group, groupId);
443     }
444     delete dia;
445 }
446 void ProjectList::slotAddTitleClip() {
447     QString group = QString();
448     int groupId = -1;
449     ProjectItem *item = static_cast <ProjectItem*>(listView->currentItem());
450     if (item && item->clipType() != FOLDER) {
451         while (item->parent()) {
452             item = static_cast <ProjectItem*>(item->parent());
453             if (item->clipType() == FOLDER) break;
454         }
455     }
456     if (item && item->clipType() == FOLDER) {
457         group = item->groupName();
458         groupId = item->clipId();
459     }
460
461     m_doc->slotCreateTextClip(group, groupId);
462 }
463
464 void ProjectList::setDocument(KdenliveDoc *doc) {
465     listView->clear();
466     QList <DocClipBase*> list = doc->clipManager()->documentClipList();
467     for (int i = 0; i < list.count(); i++) {
468         slotAddClip(list.at(i));
469     }
470
471     m_fps = doc->fps();
472     m_timecode = doc->timecode();
473     m_commandStack = doc->commandStack();
474     m_doc = doc;
475     /*    QDomNodeList prods = doc->producersList();
476         int ct = prods.count();
477         kDebug() << "////////////  SETTING DOC, FOUND CLIPS: " << prods.count();
478         listView->clear();
479         for (int i = 0; i <  ct ; i++) {
480             QDomElement e = prods.item(i).toElement();
481             kDebug() << "// IMPORT: " << i << ", :" << e.attribute("id", "non") << ", NAME: " << e.attribute("name", "non");
482             if (!e.isNull()) addProducer(e);
483         }*/
484     QTreeWidgetItem *first = listView->topLevelItem(0);
485     if (first) listView->setCurrentItem(first);
486     m_toolbar->setEnabled(true);
487 }
488
489 QDomElement ProjectList::producersList() {
490     QDomDocument doc;
491     QDomElement prods = doc.createElement("producerlist");
492     doc.appendChild(prods);
493     kDebug() << "////////////  PRO LIST BUILD PRDSLIST ";
494     QTreeWidgetItemIterator it(listView);
495     while (*it) {
496         if (!((ProjectItem *)(*it))->isGroup())
497             prods.appendChild(doc.importNode(((ProjectItem *)(*it))->toXml(), true));
498         ++it;
499     }
500     return prods;
501 }
502
503 void ProjectList::slotRefreshClipThumbnail(int clipId) {
504     ProjectItem *item = getItemById(clipId);
505     if (item) slotRefreshClipThumbnail(item);
506 }
507
508 void ProjectList::slotRefreshClipThumbnail(ProjectItem *item) {
509     if (item) {
510         int height = 40;
511         int width = (int)(height  * (double) m_render->renderWidth() / m_render->renderHeight());
512         QPixmap pix = KThumb::getImage(item->toXml(), item->referencedClip()->getProjectThumbFrame(), width, height);
513         //QPixmap pix = KThumb::getFrame(item->toXml()), 0, width, height);
514         item->setIcon(0, pix);
515     }
516 }
517
518 void ProjectList::slotReplyGetFileProperties(int clipId, const QMap < QString, QString > &properties, const QMap < QString, QString > &metadata) {
519     ProjectItem *item = getItemById(clipId);
520     if (item) {
521         item->setProperties(properties, metadata);
522         listView->setCurrentItem(item);
523         emit receivedClipDuration(clipId, item->clipMaxDuration());
524     }
525 }
526
527 void ProjectList::slotReplyGetImage(int clipId, int pos, const QPixmap &pix, int w, int h) {
528     ProjectItem *item = getItemById(clipId);
529     if (item) item->setIcon(0, pix);
530 }
531
532 ProjectItem *ProjectList::getItemById(int id) {
533     QTreeWidgetItemIterator it(listView);
534     while (*it) {
535         if (((ProjectItem *)(*it))->clipId() == id)
536             break;
537         ++it;
538     }
539     if (*it) return ((ProjectItem *)(*it));
540     return NULL;
541 }
542
543
544 void ProjectList::addProducer(QDomElement producer, int parentId) {
545     if (!m_commandStack) kDebug() << "!!!!!!!!!!!!!!!!  NO CMD STK";
546     CLIPTYPE type = (CLIPTYPE) producer.attribute("type").toInt();
547
548     /*QDomDocument doc;
549     QDomElement prods = doc.createElement("list");
550     doc.appendChild(prods);
551     prods.appendChild(doc.importNode(producer, true));*/
552
553
554     //kDebug()<<"//////  ADDING PRODUCER:\n "<<doc.toString()<<"\n+++++++++++++++++";
555     int id = producer.attribute("id").toInt();
556     QString groupName = producer.attribute("groupname");
557     if (id >= m_clipIdCounter) m_clipIdCounter = id + 1;
558     else if (id == 0) id = m_clipIdCounter++;
559
560     if (parentId != -1) {
561         // item is a westley playlist, adjust subproducers ids
562         id = (parentId + 1) * 10000 + id;
563     }
564     if (type == AUDIO || type == VIDEO || type == AV || type == IMAGE  || type == PLAYLIST) {
565         KUrl resource = KUrl(producer.attribute("resource"));
566         if (!resource.isEmpty()) {
567             QStringList itemEntry;
568             itemEntry.append(QString::null);
569             itemEntry.append(resource.fileName());
570             addClip(itemEntry, producer, id, resource, groupName, parentId);
571         }
572     } else if (type == COLOR) {
573         QString colour = producer.attribute("colour");
574         QPixmap pix(60, 40);
575         colour = colour.replace(0, 2, "#");
576         pix.fill(QColor(colour.left(7)));
577         QStringList itemEntry;
578         itemEntry.append(QString::null);
579         itemEntry.append(producer.attribute("name", i18n("Color clip")));
580         addClip(itemEntry, producer, id, KUrl(), groupName, parentId);
581     }
582
583 }
584
585 #include "projectlist.moc"