1 /***************************************************************************
2 * Copyright (C) 2007 by Jean-Baptiste Mardelle (jb@kdenlive.org) *
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. *
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. *
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 ***************************************************************************/
21 #include <QMouseEvent>
22 #include <QStylePainter>
31 #include <KFileDialog>
32 #include <KInputDialog>
33 #include <KMessageBox>
35 #include <nepomuk/global.h>
36 #include <nepomuk/resource.h>
37 #include <nepomuk/tag.h>
39 #include "projectlist.h"
40 #include "projectitem.h"
41 #include "kdenlivesettings.h"
42 #include "slideshowclip.h"
43 #include "ui_colorclip_ui.h"
44 #include "titlewidget.h"
47 #include "definitions.h"
48 #include "clipmanager.h"
49 #include "docclipbase.h"
50 #include "kdenlivedoc.h"
53 #include "projectlistview.h"
54 #include "editclipcommand.h"
56 ProjectList::ProjectList(QWidget *parent)
57 : QWidget(parent), m_render(NULL), m_fps(-1), m_commandStack(NULL), m_selectedItem(NULL), m_infoQueue(QMap <QString, QDomElement> ()), m_thumbnailQueue(QList <QString> ()), m_refreshed(false) {
59 QWidget *vbox = new QWidget;
60 listView = new ProjectListView(this);;
61 QVBoxLayout *layout = new QVBoxLayout;
62 layout->setContentsMargins(0, 0, 0, 0);
65 searchView = new KTreeWidgetSearchLine(this);
66 m_toolbar = new QToolBar("projectToolBar", this);
67 m_toolbar->addWidget(searchView);
69 m_addButton = new QToolButton(m_toolbar);
70 m_addButton->setPopupMode(QToolButton::MenuButtonPopup);
71 m_toolbar->addWidget(m_addButton);
73 m_deleteAction = m_toolbar->addAction(KIcon("edit-delete"), i18n("Delete Clip"));
74 connect(m_deleteAction, SIGNAL(triggered()), this, SLOT(slotRemoveClip()));
76 m_editAction = m_toolbar->addAction(KIcon("document-properties"), i18n("Edit Clip"));
77 connect(m_editAction, SIGNAL(triggered()), this, SLOT(slotEditClip()));
79 layout->addWidget(m_toolbar);
80 layout->addWidget(listView);
82 //m_toolbar->setEnabled(false);
84 searchView->setTreeWidget(listView);
86 connect(listView, SIGNAL(itemSelectionChanged()), this, SLOT(slotClipSelected()));
87 connect(listView, SIGNAL(focusMonitor()), this, SLOT(slotClipSelected()));
88 connect(listView, SIGNAL(pauseMonitor()), this, SLOT(slotPauseMonitor()));
89 connect(listView, SIGNAL(requestMenu(const QPoint &, QTreeWidgetItem *)), this, SLOT(slotContextMenu(const QPoint &, QTreeWidgetItem *)));
90 connect(listView, SIGNAL(addClip()), this, SLOT(slotAddClip()));
91 connect(listView, SIGNAL(addClip(KUrl, const QString &)), this, SLOT(slotAddClip(KUrl, const QString &)));
92 connect(listView, SIGNAL(itemChanged(QTreeWidgetItem *, int)), this, SLOT(slotItemEdited(QTreeWidgetItem *, int)));
93 connect(listView, SIGNAL(showProperties(DocClipBase *)), this, SIGNAL(showClipProperties(DocClipBase *)));
95 ItemDelegate *listViewDelegate = new ItemDelegate(listView);
96 listView->setItemDelegate(listViewDelegate);
99 ProjectList::~ProjectList() {
104 void ProjectList::setupMenu(QMenu *addMenu, QAction *defaultAction) {
105 m_addButton->setMenu(addMenu);
106 m_addButton->setDefaultAction(defaultAction);
107 m_menu = new QMenu();
108 m_menu->addActions(addMenu->actions());
111 void ProjectList::setupGeneratorMenu(QMenu *addMenu) {
112 if (!addMenu) return;
113 QMenu *menu = m_addButton->menu();
114 menu->addMenu(addMenu);
115 m_addButton->setMenu(menu);
117 m_menu->addMenu(addMenu);
118 if (addMenu->isEmpty()) addMenu->setEnabled(false);
119 m_menu->addAction(m_editAction);
120 m_menu->addAction(m_deleteAction);
121 m_menu->insertSeparator(m_deleteAction);
125 QByteArray ProjectList::headerInfo() {
126 return listView->header()->saveState();
129 void ProjectList::setHeaderInfo(const QByteArray &state) {
130 listView->header()->restoreState(state);
133 void ProjectList::slotEditClip() {
134 ProjectItem *item = static_cast <ProjectItem*>(listView->currentItem());
135 if (item && !item->isGroup()) {
136 emit clipSelected(item->referencedClip());
137 emit showClipProperties(item->referencedClip());
143 void ProjectList::setRenderer(Render *projectRender) {
144 m_render = projectRender;
147 void ProjectList::slotClipSelected() {
148 if (listView->currentItem()) {
149 ProjectItem *clip = static_cast <ProjectItem*>(listView->currentItem());
150 if (!clip->isGroup()) {
151 m_selectedItem = clip;
152 emit clipSelected(clip->referencedClip());
154 m_editAction->setEnabled(true);
155 m_deleteAction->setEnabled(true);
157 emit clipSelected(NULL);
158 m_editAction->setEnabled(false);
159 m_deleteAction->setEnabled(false);
163 void ProjectList::slotPauseMonitor() {
164 if (m_render) m_render->pause();
167 void ProjectList::slotUpdateClipProperties(const QString &id, QMap <QString, QString> properties) {
168 ProjectItem *item = getItemById(id);
170 slotUpdateClipProperties(item, properties);
171 if (properties.contains("colour") || properties.contains("resource") || properties.contains("xmldata")) slotRefreshClipThumbnail(item);
172 if (properties.contains("out")) item->changeDuration(properties.value("out").toInt());
176 void ProjectList::slotUpdateClipProperties(ProjectItem *clip, QMap <QString, QString> properties) {
178 if (!clip->isGroup()) clip->setProperties(properties);
179 if (properties.contains("name")) {
180 listView->blockSignals(true);
181 clip->setText(1, properties.value("name"));
182 listView->blockSignals(false);
183 emit clipNameChanged(clip->clipId(), properties.value("name"));
185 if (properties.contains("description")) {
186 CLIPTYPE type = clip->clipType();
187 listView->blockSignals(true);
188 clip->setText(2, properties.value("description"));
189 listView->blockSignals(false);
190 if (KdenliveSettings::activate_nepomuk() && (type == AUDIO || type == VIDEO || type == AV || type == IMAGE || type == PLAYLIST)) {
191 // Use Nepomuk system to store clip description
192 Nepomuk::Resource f(clip->clipUrl().path());
194 f.setDescription(properties.value("description"));
196 KMessageBox::sorry(this, i18n("Cannot access Desktop Search info for %1.\nDisabling Desktop Search integration.", clip->clipUrl().path()));
197 KdenliveSettings::setActivate_nepomuk(false);
200 emit projectModified();
204 void ProjectList::slotItemEdited(QTreeWidgetItem *item, int column) {
205 ProjectItem *clip = static_cast <ProjectItem*>(item);
207 if (clip->referencedClip()) {
208 QMap <QString, QString> oldprops;
209 QMap <QString, QString> newprops;
210 oldprops["description"] = clip->referencedClip()->getProperty("description");
211 newprops["description"] = item->text(2);
212 slotUpdateClipProperties(clip, newprops);
213 EditClipCommand *command = new EditClipCommand(this, clip->clipId(), oldprops, newprops, false);
214 m_commandStack->push(command);
216 } else if (column == 1) {
217 if (clip->isGroup()) {
218 m_doc->slotEditFolder(item->text(1), clip->groupName(), clip->clipId());
219 clip->setGroupName(item->text(1));
220 const int children = item->childCount();
221 for (int i = 0; i < children; i++) {
222 ProjectItem *child = static_cast <ProjectItem *>(item->child(i));
223 child->setProperty("groupname", item->text(1));
226 if (clip->referencedClip()) {
227 QMap <QString, QString> oldprops;
228 QMap <QString, QString> newprops;
229 oldprops["name"] = clip->referencedClip()->getProperty("name");
230 newprops["name"] = item->text(1);
231 slotUpdateClipProperties(clip, newprops);
232 emit projectModified();
233 EditClipCommand *command = new EditClipCommand(this, clip->clipId(), oldprops, newprops, false);
234 m_commandStack->push(command);
240 void ProjectList::slotContextMenu(const QPoint &pos, QTreeWidgetItem *item) {
245 m_editAction->setEnabled(enable);
246 m_deleteAction->setEnabled(enable);
250 void ProjectList::slotRemoveClip() {
251 if (!listView->currentItem()) return;
253 QMap <QString, QString> folderids;
254 QList<QTreeWidgetItem *> selected = listView->selectedItems();
256 for (int i = 0; i < selected.count(); i++) {
257 item = static_cast <ProjectItem *>(selected.at(i));
258 if (item->isGroup()) folderids[item->groupName()] = item->clipId();
259 else ids << item->clipId();
260 if (item->numReferences() > 0) {
261 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;
262 } else if (item->isGroup() && item->childCount() > 0) {
263 int children = item->childCount();
264 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;
265 for (int i = 0; i < children; ++i) {
266 ProjectItem *child = static_cast <ProjectItem *>(item->child(i));
267 ids << child->clipId();
271 if (!ids.isEmpty()) m_doc->deleteProjectClip(ids);
272 if (!folderids.isEmpty()) m_doc->deleteProjectFolder(folderids);
273 if (listView->topLevelItemCount() == 0) {
274 m_editAction->setEnabled(false);
275 m_deleteAction->setEnabled(false);
279 void ProjectList::selectItemById(const QString &clipId) {
280 ProjectItem *item = getItemById(clipId);
281 if (item) listView->setCurrentItem(item);
285 void ProjectList::slotDeleteClip(const QString &clipId) {
286 ProjectItem *item = getItemById(clipId);
287 QTreeWidgetItem *p = item->parent();
289 kDebug() << "/////// DELETED CLIP HAS A PARENT... " << p->indexOfChild(item);
290 QTreeWidgetItem *clone = p->takeChild(p->indexOfChild(item));
296 void ProjectList::slotAddFolder() {
298 // QString folderName = KInputDialog::getText(i18n("New Folder"), i18n("Enter new folder name: "));
299 // if (folderName.isEmpty()) return;
300 m_doc->slotAddFolder(i18n("Folder")); //folderName);
303 void ProjectList::slotAddFolder(const QString foldername, const QString &clipId, bool remove, bool edit) {
306 QTreeWidgetItemIterator it(listView);
308 item = static_cast <ProjectItem *>(*it);
309 if (item->isGroup() && item->clipId() == clipId) {
318 QTreeWidgetItemIterator it(listView);
320 item = static_cast <ProjectItem *>(*it);
321 if (item->isGroup() && item->clipId() == clipId) {
322 listView->blockSignals(true);
323 item->setGroupName(foldername);
324 listView->blockSignals(false);
325 const int children = item->childCount();
326 for (int i = 0; i < children; i++) {
327 ProjectItem *child = static_cast <ProjectItem *>(item->child(i));
328 child->setProperty("groupname", foldername);
336 text << QString() << foldername;
337 (void) new ProjectItem(listView, text, clipId);
342 void ProjectList::slotAddClip(DocClipBase *clip, bool getProperties) {
343 if (getProperties) listView->setEnabled(false);
344 listView->blockSignals(true);
345 const QString parent = clip->getProperty("groupid");
346 //kDebug() << "Adding clip with groupid: " << parent;
347 ProjectItem *item = NULL;
348 if (!parent.isEmpty()) {
349 ProjectItem *parentitem = getFolderItemById(parent);
352 QString groupName = clip->getProperty("groupname");
353 //kDebug() << "Adding clip to new group: " << groupName;
354 if (groupName.isEmpty()) groupName = i18n("Folder");
355 text << QString() << groupName;
356 parentitem = new ProjectItem(listView, text, parent);
358 //kDebug() << "Adding clip to existing group: " << parentitem->groupName();
360 if (parentitem) item = new ProjectItem(parentitem, clip);
362 if (item == NULL) item = new ProjectItem(listView, clip);
364 KUrl url = clip->fileURL();
365 if (!url.isEmpty() && KdenliveSettings::activate_nepomuk()) {
366 // if file has Nepomuk comment, use it
367 Nepomuk::Resource f(url.path());
370 annotation = f.description();
372 Nepomuk::Tag tag("test");
375 KMessageBox::sorry(this, i18n("Cannot access Desktop Search info for %1.\nDisabling Desktop Search integration.", url.path()));
376 KdenliveSettings::setActivate_nepomuk(false);
378 if (!annotation.isEmpty()) item->setText(2, annotation);
380 listView->blockSignals(false);
383 void ProjectList::requestClipInfo(const QDomElement xml, const QString id) {
384 kDebug() << " PRG LISTĀ REQUEST CLP INFO: " << id;
385 m_infoQueue.insert(id, xml);
386 listView->setEnabled(false);
387 if (m_infoQueue.count() == 1) QTimer::singleShot(300, this, SLOT(slotProcessNextClipInQueue()));
390 void ProjectList::slotProcessNextClipInQueue() {
391 if (m_infoQueue.isEmpty()) {
392 listView->setEnabled(true);
395 QMap<QString, QDomElement>::const_iterator i = m_infoQueue.constBegin();
396 if (i != m_infoQueue.constEnd()) {
397 const QDomElement dom = i.value();
398 const QString id = i.key();
399 m_infoQueue.remove(i.key());
400 emit getFileProperties(dom, id);
402 if (m_infoQueue.isEmpty()) listView->setEnabled(true);
405 void ProjectList::slotUpdateClip(const QString &id) {
406 ProjectItem *item = getItemById(id);
407 listView->blockSignals(true);
408 if (item) item->setData(1, UsageRole, QString::number(item->numReferences()));
409 listView->blockSignals(false);
412 void ProjectList::updateAllClips() {
413 QTreeWidgetItemIterator it(listView);
415 ProjectItem *item = static_cast <ProjectItem *>(*it);
416 if (!item->isGroup()) {
417 if (item->referencedClip()->producer() == NULL) {
418 DocClipBase *clip = item->referencedClip();
419 if (clip->clipType() == TEXT && !QFile::exists(clip->fileURL().path())) {
420 // regenerate text clip image if required
421 TitleWidget *dia_ui = new TitleWidget(KUrl(), QString(), m_render, this);
423 doc.setContent(clip->getProperty("xmldata"));
425 QImage pix = dia_ui->renderedPixmap();
426 pix.save(clip->fileURL().path());
429 requestClipInfo(clip->toXML(), clip->getId());
431 QString cachedPixmap = m_doc->projectFolder().path() + "/thumbs/" + item->getClipHash() + ".png";
432 if (QFile::exists(cachedPixmap)) {
433 //kDebug()<<"// USING CACHED PIX: "<<cachedPixmap;
434 listView->blockSignals(true);
435 item->setIcon(0, QPixmap(cachedPixmap));
436 listView->blockSignals(false);
437 } else requestClipThumbnail(item->clipId());
438 listView->blockSignals(true);
439 item->changeDuration(item->referencedClip()->producer()->get_playtime());
440 listView->blockSignals(false);
442 listView->blockSignals(true);
443 item->setData(1, UsageRole, QString::number(item->numReferences()));
444 listView->blockSignals(false);
445 qApp->processEvents();
449 QTimer::singleShot(500, this, SLOT(slotCheckForEmptyQueue()));
452 void ProjectList::slotAddClip(KUrl givenUrl, QString group) {
453 if (!m_commandStack) kDebug() << "!!!!!!!!!!!!!!!! NO CMD STK";
455 if (givenUrl.isEmpty()) {
456 list = KFileDialog::getOpenUrls(KUrl("kfiledialog:///clipfolder"), "application/x-kdenlive video/x-flv application/vnd.rn-realmedia video/x-dv video/dv video/x-msvideo video/mpeg video/x-ms-wmv audio/mpeg audio/x-mp3 audio/x-wav application/ogg 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 video/mlt-playlist audio/x-flac audio/mp4", this);
457 } else list.append(givenUrl);
458 if (list.isEmpty()) return;
460 QString groupId = QString();
461 if (group.isEmpty()) {
462 ProjectItem *item = static_cast <ProjectItem*>(listView->currentItem());
463 if (item && !item->isGroup()) {
464 while (item->parent()) {
465 item = static_cast <ProjectItem*>(item->parent());
466 if (item->isGroup()) break;
469 if (item && item->isGroup()) {
470 group = item->groupName();
471 groupId = item->clipId();
474 m_doc->slotAddClipList(list, group, groupId);
477 void ProjectList::slotRemoveInvalidClip(const QString &id) {
478 ProjectItem *item = getItemById(id);
480 const QString path = item->referencedClip()->fileURL().path();
481 if (!path.isEmpty()) KMessageBox::sorry(this, i18n("Clip <b>%1</b><br>is invalid, will be removed from project.", path));
484 m_doc->deleteProjectClip(ids);
486 if (!m_infoQueue.isEmpty()) QTimer::singleShot(300, this, SLOT(slotProcessNextClipInQueue()));
489 void ProjectList::slotAddColorClip() {
490 if (!m_commandStack) kDebug() << "!!!!!!!!!!!!!!!! NO CMD STK";
491 QDialog *dia = new QDialog(this);
492 Ui::ColorClip_UI *dia_ui = new Ui::ColorClip_UI();
493 dia_ui->setupUi(dia);
494 dia_ui->clip_name->setText(i18n("Color Clip"));
495 dia_ui->clip_duration->setText(KdenliveSettings::color_duration());
496 if (dia->exec() == QDialog::Accepted) {
497 QString color = dia_ui->clip_color->color().name();
498 color = color.replace(0, 1, "0x") + "ff";
500 QString group = QString();
501 QString groupId = QString();
502 ProjectItem *item = static_cast <ProjectItem*>(listView->currentItem());
503 if (item && !item->isGroup()) {
504 while (item->parent()) {
505 item = static_cast <ProjectItem*>(item->parent());
506 if (item->isGroup()) break;
509 if (item && item->isGroup()) {
510 group = item->groupName();
511 groupId = item->clipId();
514 m_doc->slotAddColorClipFile(dia_ui->clip_name->text(), color, dia_ui->clip_duration->text(), group, groupId);
521 void ProjectList::slotAddSlideshowClip() {
522 if (!m_commandStack) kDebug() << "!!!!!!!!!!!!!!!! NO CMD STK";
523 SlideshowClip *dia = new SlideshowClip(this);
525 if (dia->exec() == QDialog::Accepted) {
527 QString group = QString();
528 QString groupId = QString();
529 ProjectItem *item = static_cast <ProjectItem*>(listView->currentItem());
530 if (item && !item->isGroup()) {
531 while (item->parent()) {
532 item = static_cast <ProjectItem*>(item->parent());
533 if (item->isGroup()) break;
536 if (item && item->isGroup()) {
537 group = item->groupName();
538 groupId = item->clipId();
541 m_doc->slotAddSlideshowClipFile(dia->clipName(), dia->selectedPath(), dia->imageCount(), dia->clipDuration(), dia->loop(), dia->fade(), dia->lumaDuration(), dia->lumaFile(), dia->softness(), group, groupId);
546 void ProjectList::slotAddTitleClip() {
547 QString group = QString();
548 QString groupId = QString();
549 ProjectItem *item = static_cast <ProjectItem*>(listView->currentItem());
550 if (item && !item->isGroup()) {
551 while (item->parent()) {
552 item = static_cast <ProjectItem*>(item->parent());
553 if (item->isGroup()) break;
556 if (item && item->isGroup()) {
557 group = item->groupName();
558 groupId = item->clipId();
561 m_doc->slotCreateTextClip(group, groupId);
564 void ProjectList::setDocument(KdenliveDoc *doc) {
565 listView->blockSignals(true);
567 m_thumbnailQueue.clear();
570 QList <DocClipBase*> list = doc->clipManager()->documentClipList();
571 for (int i = 0; i < list.count(); i++) {
572 slotAddClip(list.at(i), false);
576 m_timecode = doc->timecode();
577 m_commandStack = doc->commandStack();
579 QTreeWidgetItem *first = listView->topLevelItem(0);
580 if (first) listView->setCurrentItem(first);
581 listView->blockSignals(false);
582 m_toolbar->setEnabled(true);
585 QDomElement ProjectList::producersList() {
587 QDomElement prods = doc.createElement("producerlist");
588 doc.appendChild(prods);
589 kDebug() << "//////////// PRO LISTĀ BUILD PRDSLIST ";
590 QTreeWidgetItemIterator it(listView);
592 if (!((ProjectItem *)(*it))->isGroup())
593 prods.appendChild(doc.importNode(((ProjectItem *)(*it))->toXml(), true));
599 void ProjectList::slotCheckForEmptyQueue() {
600 if (!m_refreshed && m_thumbnailQueue.isEmpty() && m_infoQueue.isEmpty()) {
602 emit loadingIsOver();
603 } else QTimer::singleShot(500, this, SLOT(slotCheckForEmptyQueue()));
606 void ProjectList::requestClipThumbnail(const QString &id) {
607 m_thumbnailQueue.append(id);
608 if (m_thumbnailQueue.count() == 1) QTimer::singleShot(300, this, SLOT(slotProcessNextThumbnail()));
611 void ProjectList::slotProcessNextThumbnail() {
612 if (m_thumbnailQueue.isEmpty()) {
615 slotRefreshClipThumbnail(m_thumbnailQueue.takeFirst(), false);
618 void ProjectList::slotRefreshClipThumbnail(const QString &clipId, bool update) {
619 ProjectItem *item = getItemById(clipId);
620 if (item) slotRefreshClipThumbnail(item, update);
621 else slotProcessNextThumbnail();
624 void ProjectList::slotRefreshClipThumbnail(ProjectItem *item, bool update) {
626 if (!item->referencedClip()) return;
628 int width = (int)(height * m_render->dar());
629 DocClipBase *clip = item->referencedClip();
630 if (!clip) slotProcessNextThumbnail();
632 if (clip->clipType() == AUDIO) pix = KIcon("audio-x-generic").pixmap(QSize(width, height));
633 else pix = item->referencedClip()->thumbProducer()->extractImage(item->referencedClip()->getClipThumbFrame(), width, height);
634 listView->blockSignals(true);
635 item->setIcon(0, pix);
636 listView->blockSignals(false);
637 m_doc->cachePixmap(item->getClipHash(), pix);
638 if (update) emit projectModified();
639 if (!m_thumbnailQueue.isEmpty()) QTimer::singleShot(300, this, SLOT(slotProcessNextThumbnail()));
643 void ProjectList::slotReplyGetFileProperties(const QString &clipId, Mlt::Producer *producer, const QMap < QString, QString > &properties, const QMap < QString, QString > &metadata) {
644 ProjectItem *item = getItemById(clipId);
645 if (item && producer) {
646 listView->blockSignals(true);
647 item->setProperties(properties, metadata);
648 item->referencedClip()->setProducer(producer);
649 emit receivedClipDuration(clipId, item->clipMaxDuration());
650 listView->blockSignals(false);
651 } else kDebug() << "//////// COULD NOT FIND CLIP TO UPDATE PRPS...";
652 if (!m_infoQueue.isEmpty()) QTimer::singleShot(300, this, SLOT(slotProcessNextClipInQueue()));
653 else listView->setEnabled(true);
656 void ProjectList::slotReplyGetImage(const QString &clipId, int pos, const QPixmap &pix, int w, int h) {
657 ProjectItem *item = getItemById(clipId);
659 listView->blockSignals(true);
660 item->setIcon(0, pix);
661 m_doc->cachePixmap(item->getClipHash(), pix);
662 listView->blockSignals(false);
666 ProjectItem *ProjectList::getItemById(const QString &id) {
668 QTreeWidgetItemIterator it(listView);
670 item = static_cast<ProjectItem *>(*it);
671 if (item->clipId() == id && item->clipType() != FOLDER)
678 ProjectItem *ProjectList::getFolderItemById(const QString &id) {
680 QTreeWidgetItemIterator it(listView);
682 item = static_cast<ProjectItem *>(*it);
683 if (item->clipId() == id && item->clipType() == FOLDER)
690 void ProjectList::slotSelectClip(const QString &ix) {
691 ProjectItem *p = getItemById(ix);
693 listView->setCurrentItem(p);
694 listView->scrollToItem(p);
695 m_editAction->setEnabled(true);
696 m_deleteAction->setEnabled(true);
700 #include "projectlist.moc"