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 ***************************************************************************/
20 #include "projectlist.h"
21 #include "projectitem.h"
22 #include "addfoldercommand.h"
23 #include "kdenlivesettings.h"
24 #include "slideshowclip.h"
25 #include "ui_colorclip_ui.h"
26 #include "titlewidget.h"
27 #include "definitions.h"
28 #include "clipmanager.h"
29 #include "docclipbase.h"
30 #include "kdenlivedoc.h"
33 #include "projectlistview.h"
34 #include "timecodedisplay.h"
35 #include "profilesdialog.h"
36 #include "editclipcommand.h"
37 #include "editclipcutcommand.h"
38 #include "editfoldercommand.h"
39 #include "addclipcutcommand.h"
41 #include "ui_templateclip_ui.h"
46 #include <KFileDialog>
47 #include <KInputDialog>
48 #include <KMessageBox>
49 #include <KIO/NetAccess>
51 #include <KApplication>
53 #include <nepomuk/global.h>
54 #include <nepomuk/resourcemanager.h>
55 //#include <nepomuk/tag.h>
58 #include <QMouseEvent>
59 #include <QStylePainter>
64 #include <QHeaderView>
65 #include <QInputDialog>
67 ProjectList::ProjectList(QWidget *parent) :
74 m_transcodeAction(NULL),
80 QVBoxLayout *layout = new QVBoxLayout;
81 layout->setContentsMargins(0, 0, 0, 0);
82 layout->setSpacing(0);
85 QFrame *frame = new QFrame;
86 frame->setFrameStyle(QFrame::NoFrame);
87 QHBoxLayout *box = new QHBoxLayout;
88 KTreeWidgetSearchLine *searchView = new KTreeWidgetSearchLine;
90 box->addWidget(searchView);
91 //int s = style()->pixelMetric(QStyle::PM_SmallIconSize);
92 //m_toolbar->setIconSize(QSize(s, s));
94 m_addButton = new QToolButton;
95 m_addButton->setPopupMode(QToolButton::MenuButtonPopup);
96 m_addButton->setAutoRaise(true);
97 box->addWidget(m_addButton);
99 m_editButton = new QToolButton;
100 m_editButton->setAutoRaise(true);
101 box->addWidget(m_editButton);
103 m_deleteButton = new QToolButton;
104 m_deleteButton->setAutoRaise(true);
105 box->addWidget(m_deleteButton);
106 frame->setLayout(box);
107 layout->addWidget(frame);
109 m_listView = new ProjectListView;
110 layout->addWidget(m_listView);
112 searchView->setTreeWidget(m_listView);
114 m_proxyAction = new QAction(i18n("Proxy clip"), this);
115 m_proxyAction->setCheckable(true);
116 m_proxyAction->setChecked(false);
117 connect(m_proxyAction, SIGNAL(toggled(bool)), this, SLOT(slotProxyCurrentItem(bool)));
120 m_queueTimer.setInterval(100);
121 connect(&m_queueTimer, SIGNAL(timeout()), this, SLOT(slotProcessNextClipInQueue()));
122 m_queueTimer.setSingleShot(true);
125 connect(m_listView, SIGNAL(projectModified()), this, SIGNAL(projectModified()));
126 connect(m_listView, SIGNAL(itemSelectionChanged()), this, SLOT(slotClipSelected()));
127 connect(m_listView, SIGNAL(focusMonitor()), this, SLOT(slotClipSelected()));
128 connect(m_listView, SIGNAL(pauseMonitor()), this, SLOT(slotPauseMonitor()));
129 connect(m_listView, SIGNAL(requestMenu(const QPoint &, QTreeWidgetItem *)), this, SLOT(slotContextMenu(const QPoint &, QTreeWidgetItem *)));
130 connect(m_listView, SIGNAL(addClip()), this, SLOT(slotAddClip()));
131 connect(m_listView, SIGNAL(addClip(const QList <QUrl>, const QString &, const QString &)), this, SLOT(slotAddClip(const QList <QUrl>, const QString &, const QString &)));
132 connect(m_listView, SIGNAL(addClipCut(const QString &, int, int)), this, SLOT(slotAddClipCut(const QString &, int, int)));
133 connect(m_listView, SIGNAL(itemChanged(QTreeWidgetItem *, int)), this, SLOT(slotItemEdited(QTreeWidgetItem *, int)));
134 connect(m_listView, SIGNAL(showProperties(DocClipBase *)), this, SIGNAL(showClipProperties(DocClipBase *)));
136 m_listViewDelegate = new ItemDelegate(m_listView);
137 m_listView->setItemDelegate(m_listViewDelegate);
139 if (KdenliveSettings::activate_nepomuk()) {
140 Nepomuk::ResourceManager::instance()->init();
141 if (!Nepomuk::ResourceManager::instance()->initialized()) {
142 kDebug() << "Cannot communicate with Nepomuk, DISABLING it";
143 KdenliveSettings::setActivate_nepomuk(false);
149 ProjectList::~ProjectList()
152 m_listView->blockSignals(true);
154 delete m_listViewDelegate;
157 void ProjectList::focusTree() const
159 m_listView->setFocus();
162 void ProjectList::setupMenu(QMenu *addMenu, QAction *defaultAction)
164 QList <QAction *> actions = addMenu->actions();
165 for (int i = 0; i < actions.count(); i++) {
166 if (actions.at(i)->data().toString() == "clip_properties") {
167 m_editButton->setDefaultAction(actions.at(i));
170 } else if (actions.at(i)->data().toString() == "delete_clip") {
171 m_deleteButton->setDefaultAction(actions.at(i));
174 } else if (actions.at(i)->data().toString() == "edit_clip") {
175 m_openAction = actions.at(i);
178 } else if (actions.at(i)->data().toString() == "reload_clip") {
179 m_reloadAction = actions.at(i);
185 QMenu *m = new QMenu();
186 m->addActions(actions);
187 m_addButton->setMenu(m);
188 m_addButton->setDefaultAction(defaultAction);
189 m_menu = new QMenu();
190 m_menu->addActions(addMenu->actions());
193 void ProjectList::setupGeneratorMenu(QMenu *addMenu, QMenu *transcodeMenu, QMenu *inTimelineMenu)
197 QMenu *menu = m_addButton->menu();
198 menu->addMenu(addMenu);
199 m_addButton->setMenu(menu);
201 m_menu->addMenu(addMenu);
202 if (addMenu->isEmpty())
203 addMenu->setEnabled(false);
204 m_menu->addMenu(transcodeMenu);
205 if (transcodeMenu->isEmpty())
206 transcodeMenu->setEnabled(false);
207 m_transcodeAction = transcodeMenu;
208 m_menu->addAction(m_reloadAction);
209 m_menu->addAction(m_proxyAction);
210 m_menu->addMenu(inTimelineMenu);
211 inTimelineMenu->setEnabled(false);
212 m_menu->addAction(m_editButton->defaultAction());
213 m_menu->addAction(m_openAction);
214 m_menu->addAction(m_deleteButton->defaultAction());
215 m_menu->insertSeparator(m_deleteButton->defaultAction());
219 QByteArray ProjectList::headerInfo() const
221 return m_listView->header()->saveState();
224 void ProjectList::setHeaderInfo(const QByteArray &state)
226 m_listView->header()->restoreState(state);
229 void ProjectList::updateProjectFormat(Timecode t)
234 void ProjectList::slotEditClip()
236 QList<QTreeWidgetItem *> list = m_listView->selectedItems();
237 if (list.count() > 1) {
238 editClipSelection(list);
242 if (!m_listView->currentItem() || m_listView->currentItem()->type() == PROJECTFOLDERTYPE)
244 if (m_listView->currentItem()->type() == PROJECTSUBCLIPTYPE)
245 item = static_cast <ProjectItem*>(m_listView->currentItem()->parent());
247 item = static_cast <ProjectItem*>(m_listView->currentItem());
248 if (item && (item->flags() & Qt::ItemIsDragEnabled)) {
249 emit clipSelected(item->referencedClip());
250 emit showClipProperties(item->referencedClip());
254 void ProjectList::editClipSelection(QList<QTreeWidgetItem *> list)
256 // Gather all common properties
257 QMap <QString, QString> commonproperties;
258 QList <DocClipBase *> clipList;
259 commonproperties.insert("force_aspect_num", "-");
260 commonproperties.insert("force_aspect_den", "-");
261 commonproperties.insert("force_fps", "-");
262 commonproperties.insert("force_progressive", "-");
263 commonproperties.insert("force_tff", "-");
264 commonproperties.insert("threads", "-");
265 commonproperties.insert("video_index", "-");
266 commonproperties.insert("audio_index", "-");
267 commonproperties.insert("force_colorspace", "-");
268 commonproperties.insert("full_luma", "-");
270 bool allowDurationChange = true;
271 int commonDuration = -1;
273 for (int i = 0; i < list.count(); i++) {
275 if (list.at(i)->type() == PROJECTFOLDERTYPE)
277 if (list.at(i)->type() == PROJECTSUBCLIPTYPE)
278 item = static_cast <ProjectItem*>(list.at(i)->parent());
280 item = static_cast <ProjectItem*>(list.at(i));
281 if (!(item->flags() & Qt::ItemIsDragEnabled))
285 DocClipBase *clip = item->referencedClip();
286 if (clipList.contains(clip)) continue;
287 if (clip->clipType() != COLOR && clip->clipType() != IMAGE && clip->clipType() != TEXT)
288 allowDurationChange = false;
289 if (allowDurationChange && commonDuration != 0) {
290 if (commonDuration == -1)
291 commonDuration = clip->duration().frames(m_fps);
292 else if (commonDuration != clip->duration().frames(m_fps))
295 clipList.append(clip);
296 QMap <QString, QString> clipprops = clip->properties();
297 QMapIterator<QString, QString> p(commonproperties);
298 while (p.hasNext()) {
300 if (p.value().isEmpty()) continue;
301 if (clipprops.contains(p.key())) {
302 if (p.value() == "-")
303 commonproperties.insert(p.key(), clipprops.value(p.key()));
304 else if (p.value() != clipprops.value(p.key()))
305 commonproperties.insert(p.key(), QString());
307 commonproperties.insert(p.key(), QString());
312 if (allowDurationChange)
313 commonproperties.insert("out", QString::number(commonDuration));
314 QMapIterator<QString, QString> p(commonproperties);
315 while (p.hasNext()) {
317 kDebug() << "Result: " << p.key() << " = " << p.value();
319 emit showClipProperties(clipList, commonproperties);
322 void ProjectList::slotOpenClip()
325 if (!m_listView->currentItem() || m_listView->currentItem()->type() == PROJECTFOLDERTYPE)
327 if (m_listView->currentItem()->type() == QTreeWidgetItem::UserType + 1)
328 item = static_cast <ProjectItem*>(m_listView->currentItem()->parent());
330 item = static_cast <ProjectItem*>(m_listView->currentItem());
332 if (item->clipType() == IMAGE) {
333 if (KdenliveSettings::defaultimageapp().isEmpty())
334 KMessageBox::sorry(kapp->activeWindow(), i18n("Please set a default application to open images in the Settings dialog"));
336 QProcess::startDetached(KdenliveSettings::defaultimageapp(), QStringList() << item->clipUrl().path());
338 if (item->clipType() == AUDIO) {
339 if (KdenliveSettings::defaultaudioapp().isEmpty())
340 KMessageBox::sorry(kapp->activeWindow(), i18n("Please set a default application to open audio files in the Settings dialog"));
342 QProcess::startDetached(KdenliveSettings::defaultaudioapp(), QStringList() << item->clipUrl().path());
347 void ProjectList::cleanup()
349 m_listView->clearSelection();
350 QTreeWidgetItemIterator it(m_listView);
353 if ((*it)->type() != PROJECTCLIPTYPE) {
357 item = static_cast <ProjectItem *>(*it);
358 if (item->numReferences() == 0)
359 item->setSelected(true);
365 void ProjectList::trashUnusedClips()
367 QTreeWidgetItemIterator it(m_listView);
372 if ((*it)->type() != PROJECTCLIPTYPE) {
376 item = static_cast <ProjectItem *>(*it);
377 if (item->numReferences() == 0) {
378 ids << item->clipId();
379 KUrl url = item->clipUrl();
380 if (!url.isEmpty() && !urls.contains(url.path()))
386 // Check that we don't use the URL in another clip
387 QTreeWidgetItemIterator it2(m_listView);
389 if ((*it2)->type() != PROJECTCLIPTYPE) {
393 item = static_cast <ProjectItem *>(*it2);
394 if (item->numReferences() > 0) {
395 KUrl url = item->clipUrl();
396 if (!url.isEmpty() && urls.contains(url.path())) urls.removeAll(url.path());
401 emit deleteProjectClips(ids, QMap <QString, QString>());
402 for (int i = 0; i < urls.count(); i++)
403 KIO::NetAccess::del(KUrl(urls.at(i)), this);
406 void ProjectList::slotReloadClip(const QString &id)
408 QList<QTreeWidgetItem *> selected;
410 selected = m_listView->selectedItems();
412 selected.append(getItemById(id));
414 for (int i = 0; i < selected.count(); i++) {
415 if (selected.at(i)->type() != PROJECTCLIPTYPE) {
416 if (selected.at(i)->type() == PROJECTFOLDERTYPE) {
417 for (int j = 0; j < selected.at(i)->childCount(); j++)
418 selected.append(selected.at(i)->child(j));
422 item = static_cast <ProjectItem *>(selected.at(i));
424 CLIPTYPE t = item->clipType();
426 if (!item->referencedClip()->getProperty("xmltemplate").isEmpty())
427 regenerateTemplate(item);
428 } else if (t != COLOR && t != SLIDESHOW && item->referencedClip() && item->referencedClip()->checkHash() == false) {
429 item->referencedClip()->setPlaceHolder(true);
430 item->setProperty("file_hash", QString());
431 } else if (t == IMAGE) {
432 item->referencedClip()->producer()->set("force_reload", 1);
435 QDomElement e = item->toXml();
436 // Make sure we get the correct producer length if it was adjusted in timeline
437 if (t == COLOR || t == IMAGE || t == SLIDESHOW || t == TEXT) {
438 int length = QString(item->referencedClip()->producerProperty("length")).toInt();
439 if (length > 0 && !e.hasAttribute("length")) {
440 e.setAttribute("length", length);
441 e.setAttribute("out", length - 1);
445 emit getFileProperties(e, item->clipId(), m_listView->iconSize().height(), true);
450 void ProjectList::slotModifiedClip(const QString &id)
452 ProjectItem *item = getItemById(id);
454 QPixmap pixmap = qVariantValue<QPixmap>(item->data(0, Qt::DecorationRole));
455 if (!pixmap.isNull()) {
457 p.fillRect(0, 0, pixmap.width(), pixmap.height(), QColor(255, 255, 255, 200));
458 p.drawPixmap(0, 0, KIcon("view-refresh").pixmap(m_listView->iconSize()));
461 pixmap = KIcon("view-refresh").pixmap(m_listView->iconSize());
463 item->setData(0, Qt::DecorationRole, pixmap);
467 void ProjectList::slotMissingClip(const QString &id)
469 ProjectItem *item = getItemById(id);
471 item->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled | Qt::ItemIsDropEnabled);
472 if (item->referencedClip()) {
473 item->referencedClip()->setPlaceHolder(true);
474 if (m_render == NULL) kDebug() << "********* ERROR, NULL RENDR";
475 item->referencedClip()->setProducer(m_render->invalidProducer(id), true);
476 item->slotSetToolTip();
477 emit clipNeedsReload(id, true);
481 emit displayMessage(i18n("Check missing clips"), -2);
482 emit updateRenderStatus();
485 void ProjectList::slotAvailableClip(const QString &id)
487 ProjectItem *item = getItemById(id);
490 item->setFlags(Qt::ItemIsSelectable | Qt::ItemIsDragEnabled | Qt::ItemIsEnabled | Qt::ItemIsEditable | Qt::ItemIsDropEnabled);
491 if (item->referencedClip()) { // && item->referencedClip()->checkHash() == false) {
492 item->setProperty("file_hash", QString());
496 item->referencedClip()->setValid();
497 item->slotSetToolTip();
500 emit updateRenderStatus();
503 bool ProjectList::hasMissingClips()
505 bool missing = false;
506 QTreeWidgetItemIterator it(m_listView);
508 if ((*it)->type() == PROJECTCLIPTYPE && !((*it)->flags() & Qt::ItemIsDragEnabled)) {
517 void ProjectList::setRenderer(Render *projectRender)
519 m_render = projectRender;
520 m_listView->setIconSize(QSize((ProjectItem::itemDefaultHeight() - 2) * m_render->dar(), ProjectItem::itemDefaultHeight() - 2));
523 void ProjectList::slotClipSelected()
525 if (!m_listView->isEnabled()) return;
526 if (m_listView->currentItem()) {
527 if (m_listView->currentItem()->type() == PROJECTFOLDERTYPE) {
528 emit clipSelected(NULL);
529 m_editButton->defaultAction()->setEnabled(false);
530 m_deleteButton->defaultAction()->setEnabled(true);
531 m_openAction->setEnabled(false);
532 m_reloadAction->setEnabled(false);
533 m_transcodeAction->setEnabled(false);
534 m_proxyAction->setEnabled(false);
537 if (m_listView->currentItem()->type() == PROJECTSUBCLIPTYPE) {
538 // this is a sub item, use base clip
539 m_deleteButton->defaultAction()->setEnabled(true);
540 clip = static_cast <ProjectItem*>(m_listView->currentItem()->parent());
541 if (clip == NULL) kDebug() << "-----------ERROR";
542 SubProjectItem *sub = static_cast <SubProjectItem*>(m_listView->currentItem());
543 emit clipSelected(clip->referencedClip(), sub->zone());
544 m_transcodeAction->setEnabled(false);
547 clip = static_cast <ProjectItem*>(m_listView->currentItem());
549 emit clipSelected(clip->referencedClip());
550 m_editButton->defaultAction()->setEnabled(true);
551 m_deleteButton->defaultAction()->setEnabled(true);
552 m_reloadAction->setEnabled(true);
553 m_transcodeAction->setEnabled(true);
554 if (clip && clip->clipType() == IMAGE && !KdenliveSettings::defaultimageapp().isEmpty()) {
555 m_openAction->setIcon(KIcon(KdenliveSettings::defaultimageapp()));
556 m_openAction->setEnabled(true);
557 } else if (clip && clip->clipType() == AUDIO && !KdenliveSettings::defaultaudioapp().isEmpty()) {
558 m_openAction->setIcon(KIcon(KdenliveSettings::defaultaudioapp()));
559 m_openAction->setEnabled(true);
561 m_openAction->setEnabled(false);
563 // Display relevant transcoding actions only
564 adjustTranscodeActions(clip);
565 // Display uses in timeline
566 emit findInTimeline(clip->clipId());
569 emit clipSelected(NULL);
570 m_editButton->defaultAction()->setEnabled(false);
571 m_deleteButton->defaultAction()->setEnabled(false);
572 m_openAction->setEnabled(false);
573 m_reloadAction->setEnabled(false);
574 m_transcodeAction->setEnabled(false);
578 void ProjectList::adjustProxyActions(ProjectItem *clip) const
580 if (clip == NULL || clip->type() != PROJECTCLIPTYPE || clip->clipType() == COLOR || clip->clipType() == TEXT || clip->clipType() == PLAYLIST || clip->clipType() == SLIDESHOW || clip->clipType() == AUDIO) {
581 m_proxyAction->setEnabled(false);
584 m_proxyAction->setEnabled(true);
585 m_proxyAction->setChecked(clip->hasProxy());
588 void ProjectList::adjustTranscodeActions(ProjectItem *clip) const
590 if (clip == NULL || clip->type() != PROJECTCLIPTYPE || clip->clipType() == COLOR || clip->clipType() == TEXT || clip->clipType() == PLAYLIST || clip->clipType() == SLIDESHOW) {
591 m_transcodeAction->setEnabled(false);
594 m_transcodeAction->setEnabled(true);
595 QList<QAction *> transcodeActions = m_transcodeAction->actions();
598 for (int i = 0; i < transcodeActions.count(); i++) {
599 data = transcodeActions.at(i)->data().toStringList();
600 if (data.count() > 2) {
601 condition = data.at(2);
602 if (condition.startsWith("vcodec"))
603 transcodeActions.at(i)->setEnabled(clip->referencedClip()->hasVideoCodec(condition.section('=', 1, 1)));
604 else if (condition.startsWith("acodec"))
605 transcodeActions.at(i)->setEnabled(clip->referencedClip()->hasVideoCodec(condition.section('=', 1, 1)));
611 void ProjectList::slotPauseMonitor()
617 void ProjectList::slotUpdateClipProperties(const QString &id, QMap <QString, QString> properties)
619 ProjectItem *item = getItemById(id);
621 slotUpdateClipProperties(item, properties);
622 if (properties.contains("out") || properties.contains("force_fps") || properties.contains("resource")) {
624 } else if (properties.contains("colour") ||
625 properties.contains("xmldata") ||
626 properties.contains("force_aspect_num") ||
627 properties.contains("force_aspect_den") ||
628 properties.contains("templatetext")) {
629 slotRefreshClipThumbnail(item);
631 } else if (properties.contains("full_luma") || properties.contains("force_colorspace")) {
637 void ProjectList::slotUpdateClipProperties(ProjectItem *clip, QMap <QString, QString> properties)
641 clip->setProperties(properties);
642 if (properties.contains("name")) {
643 m_listView->blockSignals(true);
644 clip->setText(0, properties.value("name"));
645 m_listView->blockSignals(false);
646 emit clipNameChanged(clip->clipId(), properties.value("name"));
648 if (properties.contains("description")) {
649 CLIPTYPE type = clip->clipType();
650 m_listView->blockSignals(true);
651 clip->setText(1, properties.value("description"));
652 m_listView->blockSignals(false);
654 if (KdenliveSettings::activate_nepomuk() && (type == AUDIO || type == VIDEO || type == AV || type == IMAGE || type == PLAYLIST)) {
655 // Use Nepomuk system to store clip description
656 Nepomuk::Resource f(clip->clipUrl().path());
657 f.setDescription(properties.value("description"));
660 emit projectModified();
664 void ProjectList::slotItemEdited(QTreeWidgetItem *item, int column)
666 if (item->type() == PROJECTSUBCLIPTYPE) {
667 // this is a sub-item
669 // user edited description
670 SubProjectItem *sub = static_cast <SubProjectItem*>(item);
671 ProjectItem *item = static_cast <ProjectItem *>(sub->parent());
672 EditClipCutCommand *command = new EditClipCutCommand(this, item->clipId(), sub->zone(), sub->zone(), sub->description(), sub->text(1), true);
673 m_commandStack->push(command);
674 //slotUpdateCutClipProperties(sub->clipId(), sub->zone(), sub->text(1), sub->text(1));
678 if (item->type() == PROJECTFOLDERTYPE) {
680 FolderProjectItem *folder = static_cast <FolderProjectItem*>(item);
681 editFolder(item->text(0), folder->groupName(), folder->clipId());
682 folder->setGroupName(item->text(0));
683 m_doc->clipManager()->addFolder(folder->clipId(), item->text(0));
684 const int children = item->childCount();
685 for (int i = 0; i < children; i++) {
686 ProjectItem *child = static_cast <ProjectItem *>(item->child(i));
687 child->setProperty("groupname", item->text(0));
693 ProjectItem *clip = static_cast <ProjectItem*>(item);
695 if (clip->referencedClip()) {
696 QMap <QString, QString> oldprops;
697 QMap <QString, QString> newprops;
698 oldprops["description"] = clip->referencedClip()->getProperty("description");
699 newprops["description"] = item->text(1);
701 if (clip->clipType() == TEXT) {
702 // This is a text template clip, update the image
703 /*oldprops.insert("xmldata", clip->referencedClip()->getProperty("xmldata"));
704 newprops.insert("xmldata", generateTemplateXml(clip->referencedClip()->getProperty("xmltemplate"), item->text(2)).toString());*/
705 oldprops.insert("templatetext", clip->referencedClip()->getProperty("templatetext"));
706 newprops.insert("templatetext", item->text(1));
708 slotUpdateClipProperties(clip->clipId(), newprops);
709 EditClipCommand *command = new EditClipCommand(this, clip->clipId(), oldprops, newprops, false);
710 m_commandStack->push(command);
712 } else if (column == 0) {
713 if (clip->referencedClip()) {
714 QMap <QString, QString> oldprops;
715 QMap <QString, QString> newprops;
716 oldprops["name"] = clip->referencedClip()->getProperty("name");
717 newprops["name"] = item->text(0);
718 slotUpdateClipProperties(clip, newprops);
719 emit projectModified();
720 EditClipCommand *command = new EditClipCommand(this, clip->clipId(), oldprops, newprops, false);
721 m_commandStack->push(command);
726 void ProjectList::slotContextMenu(const QPoint &pos, QTreeWidgetItem *item)
728 bool enable = item ? true : false;
729 m_editButton->defaultAction()->setEnabled(enable);
730 m_deleteButton->defaultAction()->setEnabled(enable);
731 m_reloadAction->setEnabled(enable);
732 m_transcodeAction->setEnabled(enable);
734 ProjectItem *clip = NULL;
735 if (m_listView->currentItem()->type() == PROJECTSUBCLIPTYPE) {
736 clip = static_cast <ProjectItem*>(item->parent());
737 m_transcodeAction->setEnabled(false);
738 } else if (m_listView->currentItem()->type() == PROJECTCLIPTYPE) {
739 clip = static_cast <ProjectItem*>(item);
740 // Display relevant transcoding actions only
741 adjustTranscodeActions(clip);
742 adjustProxyActions(clip);
743 // Display uses in timeline
744 emit findInTimeline(clip->clipId());
746 m_transcodeAction->setEnabled(false);
748 if (clip && clip->clipType() == IMAGE && !KdenliveSettings::defaultimageapp().isEmpty()) {
749 m_openAction->setIcon(KIcon(KdenliveSettings::defaultimageapp()));
750 m_openAction->setEnabled(true);
751 } else if (clip && clip->clipType() == AUDIO && !KdenliveSettings::defaultaudioapp().isEmpty()) {
752 m_openAction->setIcon(KIcon(KdenliveSettings::defaultaudioapp()));
753 m_openAction->setEnabled(true);
755 m_openAction->setEnabled(false);
759 m_openAction->setEnabled(false);
764 void ProjectList::slotRemoveClip()
766 if (!m_listView->currentItem())
769 QMap <QString, QString> folderids;
770 QList<QTreeWidgetItem *> selected = m_listView->selectedItems();
772 QUndoCommand *delCommand = new QUndoCommand();
773 delCommand->setText(i18n("Delete Clip Zone"));
774 for (int i = 0; i < selected.count(); i++) {
775 if (selected.at(i)->type() == PROJECTSUBCLIPTYPE) {
777 SubProjectItem *sub = static_cast <SubProjectItem *>(selected.at(i));
778 ProjectItem *item = static_cast <ProjectItem *>(sub->parent());
779 new AddClipCutCommand(this, item->clipId(), sub->zone().x(), sub->zone().y(), sub->description(), false, true, delCommand);
780 } else if (selected.at(i)->type() == PROJECTFOLDERTYPE) {
782 FolderProjectItem *folder = static_cast <FolderProjectItem *>(selected.at(i));
783 folderids[folder->groupName()] = folder->clipId();
784 int children = folder->childCount();
786 if (children > 0 && KMessageBox::questionYesNo(kapp->activeWindow(), i18np("Delete folder <b>%2</b>?<br />This will also remove the clip in that folder", "Delete folder <b>%2</b>?<br />This will also remove the %1 clips in that folder", children, folder->text(1)), i18n("Delete Folder")) != KMessageBox::Yes)
788 for (int i = 0; i < children; ++i) {
789 ProjectItem *child = static_cast <ProjectItem *>(folder->child(i));
790 ids << child->clipId();
793 ProjectItem *item = static_cast <ProjectItem *>(selected.at(i));
794 ids << item->clipId();
795 if (item->numReferences() > 0 && KMessageBox::questionYesNo(kapp->activeWindow(), 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"), KStandardGuiItem::yes(), KStandardGuiItem::no(), "DeleteAll") == KMessageBox::No) {
796 KMessageBox::enableMessage("DeleteAll");
801 KMessageBox::enableMessage("DeleteAll");
802 if (delCommand->childCount() == 0)
805 m_commandStack->push(delCommand);
806 emit deleteProjectClips(ids, folderids);
809 void ProjectList::updateButtons() const
811 if (m_listView->topLevelItemCount() == 0) {
812 m_deleteButton->defaultAction()->setEnabled(false);
814 m_deleteButton->defaultAction()->setEnabled(true);
815 if (!m_listView->currentItem())
816 m_listView->setCurrentItem(m_listView->topLevelItem(0));
817 QTreeWidgetItem *item = m_listView->currentItem();
818 if (item && item->type() == PROJECTCLIPTYPE) {
819 m_editButton->defaultAction()->setEnabled(true);
820 m_openAction->setEnabled(true);
821 m_reloadAction->setEnabled(true);
822 m_transcodeAction->setEnabled(true);
827 m_editButton->defaultAction()->setEnabled(false);
828 m_openAction->setEnabled(false);
829 m_reloadAction->setEnabled(false);
830 m_transcodeAction->setEnabled(false);
833 void ProjectList::selectItemById(const QString &clipId)
835 ProjectItem *item = getItemById(clipId);
837 m_listView->setCurrentItem(item);
841 void ProjectList::slotDeleteClip(const QString &clipId)
843 ProjectItem *item = getItemById(clipId);
845 kDebug() << "/// Cannot find clip to delete";
848 m_listView->blockSignals(true);
849 QTreeWidgetItem *newSelectedItem = m_listView->itemAbove(item);
850 if (!newSelectedItem)
851 newSelectedItem = m_listView->itemBelow(item);
853 m_doc->clipManager()->deleteClip(clipId);
854 m_listView->blockSignals(false);
855 if (newSelectedItem) {
856 m_listView->setCurrentItem(newSelectedItem);
859 emit clipSelected(NULL);
864 void ProjectList::editFolder(const QString folderName, const QString oldfolderName, const QString &clipId)
866 EditFolderCommand *command = new EditFolderCommand(this, folderName, oldfolderName, clipId, false);
867 m_commandStack->push(command);
868 m_doc->setModified(true);
871 void ProjectList::slotAddFolder()
873 AddFolderCommand *command = new AddFolderCommand(this, i18n("Folder"), QString::number(m_doc->clipManager()->getFreeFolderId()), true);
874 m_commandStack->push(command);
877 void ProjectList::slotAddFolder(const QString foldername, const QString &clipId, bool remove, bool edit)
880 FolderProjectItem *item = getFolderItemById(clipId);
882 m_doc->clipManager()->deleteFolder(clipId);
883 QTreeWidgetItem *newSelectedItem = m_listView->itemAbove(item);
884 if (!newSelectedItem)
885 newSelectedItem = m_listView->itemBelow(item);
888 m_listView->setCurrentItem(newSelectedItem);
894 FolderProjectItem *item = getFolderItemById(clipId);
896 m_listView->blockSignals(true);
897 item->setGroupName(foldername);
898 m_listView->blockSignals(false);
899 m_doc->clipManager()->addFolder(clipId, foldername);
900 const int children = item->childCount();
901 for (int i = 0; i < children; i++) {
902 ProjectItem *child = static_cast <ProjectItem *>(item->child(i));
903 child->setProperty("groupname", foldername);
907 m_listView->blockSignals(true);
908 m_listView->setCurrentItem(new FolderProjectItem(m_listView, QStringList() << foldername, clipId));
909 m_doc->clipManager()->addFolder(clipId, foldername);
910 m_listView->blockSignals(false);
911 m_listView->editItem(m_listView->currentItem(), 0);
915 m_doc->setModified(true);
920 void ProjectList::deleteProjectFolder(QMap <QString, QString> map)
922 QMapIterator<QString, QString> i(map);
923 QUndoCommand *delCommand = new QUndoCommand();
924 delCommand->setText(i18n("Delete Folder"));
925 while (i.hasNext()) {
927 new AddFolderCommand(this, i.key(), i.value(), false, delCommand);
929 m_commandStack->push(delCommand);
932 void ProjectList::slotAddClip(DocClipBase *clip, bool getProperties)
934 m_listView->setEnabled(false);
935 if (getProperties) m_listView->blockSignals(true);
936 const QString parent = clip->getProperty("groupid");
937 ProjectItem *item = NULL;
938 if (!parent.isEmpty()) {
939 FolderProjectItem *parentitem = getFolderItemById(parent);
942 QString groupName = clip->getProperty("groupname");
943 //kDebug() << "Adding clip to new group: " << groupName;
944 if (groupName.isEmpty()) groupName = i18n("Folder");
946 parentitem = new FolderProjectItem(m_listView, text, parent);
950 item = new ProjectItem(parentitem, clip);
953 item = new ProjectItem(m_listView, clip);
954 if (item->data(0, DurationRole).isNull()) item->setData(0, DurationRole, i18n("Loading"));
956 m_listView->blockSignals(true);
960 CLIPTYPE t = clip->clipType();
961 if ((t == VIDEO || t == AV || t == UNKNOWN) && KdenliveSettings::enableproxy()) {
962 if (clip->getProperty("proxy").isEmpty()) {
963 connect(clip, SIGNAL(proxyReady(const QString, bool)), this, SLOT(slotGotProxy(const QString, bool)));
964 item->setProxyStatus(1);
965 clip->generateProxy(m_doc->projectFolder());
968 // Proxy clip already created
969 item->setProxyStatus(2);
970 QDomElement e = clip->toXML().cloneNode().toElement();
971 e.removeAttribute("file_hash");
972 m_infoQueue.insert(clip->getId(), e);
977 // We don't use proxies
978 // remove file_hash so that we load all properties for the clip
979 QDomElement e = clip->toXML().cloneNode().toElement();
980 e.removeAttribute("file_hash");
981 m_infoQueue.insert(clip->getId(), e);
983 //m_render->getFileProperties(clip->toXML(), clip->getId(), true);
985 clip->askForAudioThumbs();
987 KUrl url = clip->fileURL();
988 if (getProperties == false && !clip->getClipHash().isEmpty()) {
989 QString cachedPixmap = m_doc->projectFolder().path(KUrl::AddTrailingSlash) + "thumbs/" + clip->getClipHash() + ".png";
990 if (QFile::exists(cachedPixmap)) {
991 QPixmap pix(cachedPixmap);
993 KIO::NetAccess::del(KUrl(cachedPixmap), this);
994 item->setData(0, Qt::DecorationRole, pix);
998 if (!url.isEmpty() && KdenliveSettings::activate_nepomuk()) {
999 // if file has Nepomuk comment, use it
1000 Nepomuk::Resource f(url.path());
1001 QString annotation = f.description();
1002 if (!annotation.isEmpty()) item->setText(1, annotation);
1003 item->setText(2, QString::number(f.rating()));
1007 QList <CutZoneInfo> cuts = clip->cutZones();
1008 if (!cuts.isEmpty()) {
1009 for (int i = 0; i < cuts.count(); i++) {
1010 SubProjectItem *sub = new SubProjectItem(item, cuts.at(i).zone.x(), cuts.at(i).zone.y(), cuts.at(i).description);
1011 if (!clip->getClipHash().isEmpty()) {
1012 QString cachedPixmap = m_doc->projectFolder().path(KUrl::AddTrailingSlash) + "thumbs/" + clip->getClipHash() + '#' + QString::number(cuts.at(i).zone.x()) + ".png";
1013 if (QFile::exists(cachedPixmap)) {
1014 QPixmap pix(cachedPixmap);
1016 KIO::NetAccess::del(KUrl(cachedPixmap), this);
1017 sub->setData(0, Qt::DecorationRole, pix);
1022 if (m_listView->isEnabled()) {
1025 m_listView->blockSignals(false);
1028 if (getProperties && !m_queueTimer.isActive())
1029 slotProcessNextClipInQueue();
1032 void ProjectList::slotGotProxy(const QString id, bool success)
1034 ProjectItem *item = getItemById(id);
1036 disconnect(m_listView, SIGNAL(itemChanged(QTreeWidgetItem *, int)), this, SLOT(slotItemEdited(QTreeWidgetItem *, int)));
1038 // Proxy clip successfully created
1039 item->setProxyStatus(2);
1040 QDomElement e = item->referencedClip()->toXML().cloneNode().toElement();
1041 e.removeAttribute("file_hash");
1042 e.setAttribute("replace", 1);
1043 m_infoQueue.insert(id, e);
1044 if (!m_queueTimer.isActive()) slotProcessNextClipInQueue();
1046 else item->setProxyStatus(0);
1047 connect(m_listView, SIGNAL(itemChanged(QTreeWidgetItem *, int)), this, SLOT(slotItemEdited(QTreeWidgetItem *, int)));
1052 void ProjectList::slotResetProjectList()
1054 m_listView->clear();
1055 emit clipSelected(NULL);
1056 m_thumbnailQueue.clear();
1057 m_infoQueue.clear();
1058 m_refreshed = false;
1061 void ProjectList::requestClipInfo(const QDomElement xml, const QString id)
1063 m_refreshed = false;
1064 m_infoQueue.insert(id, xml);
1065 //if (m_infoQueue.count() == 1 || ) QTimer::singleShot(300, this, SLOT(slotProcessNextClipInQueue()));
1068 void ProjectList::slotProcessNextClipInQueue()
1070 if (m_infoQueue.isEmpty()) {
1071 slotProcessNextThumbnail();
1075 QMap<QString, QDomElement>::const_iterator j = m_infoQueue.constBegin();
1076 if (j != m_infoQueue.constEnd()) {
1077 QDomElement dom = j.value();
1078 const QString id = j.key();
1079 m_infoQueue.remove(j.key());
1081 if (dom.hasAttribute("replace")) {
1082 dom.removeAttribute("replace");
1085 else replace = false;
1086 emit getFileProperties(dom, id, m_listView->iconSize().height(), replace);
1088 if (!m_infoQueue.isEmpty()) m_queueTimer.start();
1091 void ProjectList::slotUpdateClip(const QString &id)
1093 ProjectItem *item = getItemById(id);
1094 m_listView->blockSignals(true);
1095 if (item) item->setData(0, UsageRole, QString::number(item->numReferences()));
1096 m_listView->blockSignals(false);
1099 void ProjectList::updateAllClips()
1101 m_listView->setSortingEnabled(false);
1102 kDebug() << "// UPDATE ALL CLPY";
1104 QTreeWidgetItemIterator it(m_listView);
1107 m_listView->blockSignals(true);
1109 if ((*it)->type() == PROJECTSUBCLIPTYPE) {
1111 SubProjectItem *sub = static_cast <SubProjectItem *>(*it);
1112 if (sub->data(0, Qt::DecorationRole).isNull()) {
1113 item = static_cast <ProjectItem *>((*it)->parent());
1114 requestClipThumbnail(item->clipId() + '#' + QString::number(sub->zone().x()));
1118 } else if ((*it)->type() == PROJECTFOLDERTYPE) {
1123 item = static_cast <ProjectItem *>(*it);
1124 clip = item->referencedClip();
1125 if (item->referencedClip()->producer() == NULL) {
1126 if (clip->isPlaceHolder() == false)
1127 requestClipInfo(clip->toXML(), clip->getId());
1128 else if (!clip->isPlaceHolder())
1129 item->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled | Qt::ItemIsDropEnabled);
1131 if (item->data(0, Qt::DecorationRole).isNull())
1132 requestClipThumbnail(clip->getId());
1133 if (item->data(0, DurationRole).toString().isEmpty())
1134 item->changeDuration(item->referencedClip()->producer()->get_playtime());
1136 item->setData(0, UsageRole, QString::number(item->numReferences()));
1138 //qApp->processEvents();
1141 if (!m_queueTimer.isActive())
1142 m_queueTimer.start();
1143 if (m_listView->isEnabled())
1144 m_listView->blockSignals(false);
1145 m_listView->setSortingEnabled(true);
1146 if (m_infoQueue.isEmpty())
1147 slotProcessNextThumbnail();
1151 QString ProjectList::getExtensions()
1153 // Build list of mime types
1154 QStringList mimeTypes = QStringList() << "application/x-kdenlive" << "application/x-kdenlivetitle" << "video/mlt-playlist" << "text/plain"
1155 << "video/x-flv" << "application/vnd.rn-realmedia" << "video/x-dv" << "video/dv" << "video/x-msvideo" << "video/x-matroska" << "video/mpeg" << "video/ogg" << "video/x-ms-wmv" << "video/mp4" << "video/quicktime" << "video/webm"
1156 << "audio/x-flac" << "audio/x-matroska" << "audio/mp4" << "audio/mpeg" << "audio/x-mp3" << "audio/ogg" << "audio/x-wav" << "application/ogg" << "application/mxf" << "application/x-shockwave-flash"
1157 << "image/gif" << "image/jpeg" << "image/png" << "image/x-tga" << "image/x-bmp" << "image/svg+xml" << "image/tiff" << "image/x-xcf" << "image/x-xcf-gimp" << "image/x-vnd.adobe.photoshop" << "image/x-pcx" << "image/x-exr";
1159 QString allExtensions;
1160 foreach(const QString & mimeType, mimeTypes) {
1161 KMimeType::Ptr mime(KMimeType::mimeType(mimeType));
1163 allExtensions.append(mime->patterns().join(" "));
1164 allExtensions.append(' ');
1167 return allExtensions.simplified();
1170 void ProjectList::slotAddClip(const QList <QUrl> givenList, const QString &groupName, const QString &groupId)
1172 if (!m_commandStack)
1173 kDebug() << "!!!!!!!!!!!!!!!! NO CMD STK";
1176 if (givenList.isEmpty()) {
1177 QString allExtensions = getExtensions();
1178 const QString dialogFilter = allExtensions + ' ' + QLatin1Char('|') + i18n("All Supported Files") + "\n* " + QLatin1Char('|') + i18n("All Files");
1179 QCheckBox *b = new QCheckBox(i18n("Import image sequence"));
1180 b->setChecked(KdenliveSettings::autoimagesequence());
1181 KFileDialog *d = new KFileDialog(KUrl("kfiledialog:///clipfolder"), dialogFilter, kapp->activeWindow(), b);
1182 d->setOperationMode(KFileDialog::Opening);
1183 d->setMode(KFile::Files);
1185 list = d->selectedUrls();
1186 if (b->isChecked() && list.count() == 1) {
1187 // Check for image sequence
1188 KUrl url = list.at(0);
1189 QString fileName = url.fileName().section('.', 0, -2);
1190 if (fileName.at(fileName.size() - 1).isDigit()) {
1191 KFileItem item(KFileItem::Unknown, KFileItem::Unknown, url);
1192 if (item.mimetype().startsWith("image")) {
1193 // import as sequence if we found more than one image in the sequence
1195 QString pattern = SlideshowClip::selectedPath(url.path(), false, QString(), &list);
1196 int count = list.count();
1199 QStringList groupInfo = getGroup();
1201 // get image sequence base name
1202 while (fileName.at(fileName.size() - 1).isDigit()) {
1206 m_doc->slotCreateSlideshowClipFile(fileName, pattern, count, m_timecode.reformatSeparators(KdenliveSettings::sequence_duration()),
1207 false, false, false,
1208 m_timecode.getTimecodeFromFrames(int(ceil(m_timecode.fps()))), QString(), 0,
1209 QString(), groupInfo.at(0), groupInfo.at(1));
1217 for (int i = 0; i < givenList.count(); i++)
1218 list << givenList.at(i);
1221 foreach(const KUrl & file, list) {
1222 // Check there is no folder here
1223 KMimeType::Ptr type = KMimeType::findByUrl(file);
1224 if (type->is("inode/directory")) {
1225 // user dropped a folder
1226 list.removeAll(file);
1233 if (givenList.isEmpty()) {
1234 QStringList groupInfo = getGroup();
1235 m_doc->slotAddClipList(list, groupInfo.at(0), groupInfo.at(1));
1237 m_doc->slotAddClipList(list, groupName, groupId);
1241 void ProjectList::slotRemoveInvalidClip(const QString &id, bool replace)
1243 ProjectItem *item = getItemById(id);
1244 QTimer::singleShot(300, this, SLOT(slotProcessNextClipInQueue()));
1246 const QString path = item->referencedClip()->fileURL().path();
1247 if (item->referencedClip()->isPlaceHolder()) replace = false;
1248 if (!path.isEmpty()) {
1250 KMessageBox::sorry(kapp->activeWindow(), i18n("Clip <b>%1</b><br />is invalid, will be removed from project.", path));
1251 else if (KMessageBox::questionYesNo(kapp->activeWindow(), i18n("Clip <b>%1</b><br />is missing or invalid. Remove it from project?", path), i18n("Invalid clip")) == KMessageBox::Yes)
1255 emit deleteProjectClips(QStringList() << id, QMap <QString, QString>());
1259 void ProjectList::slotAddColorClip()
1261 if (!m_commandStack)
1262 kDebug() << "!!!!!!!!!!!!!!!! NO CMD STK";
1264 QDialog *dia = new QDialog(this);
1265 Ui::ColorClip_UI dia_ui;
1266 dia_ui.setupUi(dia);
1267 dia->setWindowTitle(i18n("Color Clip"));
1268 dia_ui.clip_name->setText(i18n("Color Clip"));
1270 TimecodeDisplay *t = new TimecodeDisplay(m_timecode);
1271 t->setValue(KdenliveSettings::color_duration());
1272 t->setTimeCodeFormat(false);
1273 dia_ui.clip_durationBox->addWidget(t);
1274 dia_ui.clip_color->setColor(KdenliveSettings::colorclipcolor());
1276 if (dia->exec() == QDialog::Accepted) {
1277 QString color = dia_ui.clip_color->color().name();
1278 KdenliveSettings::setColorclipcolor(color);
1279 color = color.replace(0, 1, "0x") + "ff";
1280 QStringList groupInfo = getGroup();
1281 m_doc->slotCreateColorClip(dia_ui.clip_name->text(), color, m_timecode.getTimecode(t->gentime()), groupInfo.at(0), groupInfo.at(1));
1288 void ProjectList::slotAddSlideshowClip()
1290 if (!m_commandStack)
1291 kDebug() << "!!!!!!!!!!!!!!!! NO CMD STK";
1293 SlideshowClip *dia = new SlideshowClip(m_timecode, this);
1295 if (dia->exec() == QDialog::Accepted) {
1296 QStringList groupInfo = getGroup();
1297 m_doc->slotCreateSlideshowClipFile(dia->clipName(), dia->selectedPath(), dia->imageCount(), dia->clipDuration(),
1298 dia->loop(), dia->crop(), dia->fade(),
1299 dia->lumaDuration(), dia->lumaFile(), dia->softness(),
1300 dia->animation(), groupInfo.at(0), groupInfo.at(1));
1305 void ProjectList::slotAddTitleClip()
1307 QStringList groupInfo = getGroup();
1308 m_doc->slotCreateTextClip(groupInfo.at(0), groupInfo.at(1));
1311 void ProjectList::slotAddTitleTemplateClip()
1313 if (!m_commandStack)
1314 kDebug() << "!!!!!!!!!!!!!!!! NO CMD STK";
1316 QStringList groupInfo = getGroup();
1318 // Get the list of existing templates
1320 filter << "*.kdenlivetitle";
1321 const QString path = m_doc->projectFolder().path(KUrl::AddTrailingSlash) + "titles/";
1322 QStringList templateFiles = QDir(path).entryList(filter, QDir::Files);
1324 QDialog *dia = new QDialog(this);
1325 Ui::TemplateClip_UI dia_ui;
1326 dia_ui.setupUi(dia);
1327 for (int i = 0; i < templateFiles.size(); ++i)
1328 dia_ui.template_list->comboBox()->addItem(templateFiles.at(i), path + templateFiles.at(i));
1330 if (!templateFiles.isEmpty())
1331 dia_ui.buttonBox->button(QDialogButtonBox::Ok)->setFocus();
1332 dia_ui.template_list->fileDialog()->setFilter("application/x-kdenlivetitle");
1333 //warning: setting base directory doesn't work??
1334 KUrl startDir(path);
1335 dia_ui.template_list->fileDialog()->setUrl(startDir);
1336 dia_ui.text_box->setHidden(true);
1337 if (dia->exec() == QDialog::Accepted) {
1338 QString textTemplate = dia_ui.template_list->comboBox()->itemData(dia_ui.template_list->comboBox()->currentIndex()).toString();
1339 if (textTemplate.isEmpty()) textTemplate = dia_ui.template_list->comboBox()->currentText();
1340 // Create a cloned template clip
1341 m_doc->slotCreateTextTemplateClip(groupInfo.at(0), groupInfo.at(1), KUrl(textTemplate));
1346 QStringList ProjectList::getGroup() const
1349 QTreeWidgetItem *item = m_listView->currentItem();
1350 while (item && item->type() != PROJECTFOLDERTYPE)
1351 item = item->parent();
1354 FolderProjectItem *folder = static_cast <FolderProjectItem *>(item);
1355 result << folder->groupName() << folder->clipId();
1357 result << QString() << QString();
1362 void ProjectList::setDocument(KdenliveDoc *doc)
1364 m_listView->blockSignals(true);
1365 m_listView->clear();
1366 m_listView->setSortingEnabled(false);
1367 emit clipSelected(NULL);
1368 m_thumbnailQueue.clear();
1369 m_infoQueue.clear();
1370 m_refreshed = false;
1372 m_timecode = doc->timecode();
1373 m_commandStack = doc->commandStack();
1376 QMap <QString, QString> flist = doc->clipManager()->documentFolderList();
1377 QMapIterator<QString, QString> f(flist);
1378 while (f.hasNext()) {
1380 (void) new FolderProjectItem(m_listView, QStringList() << f.value(), f.key());
1383 QList <DocClipBase*> list = doc->clipManager()->documentClipList();
1384 for (int i = 0; i < list.count(); i++)
1385 slotAddClip(list.at(i), false);
1387 m_listView->blockSignals(false);
1388 connect(m_doc->clipManager(), SIGNAL(reloadClip(const QString &)), this, SLOT(slotReloadClip(const QString &)));
1389 connect(m_doc->clipManager(), SIGNAL(modifiedClip(const QString &)), this, SLOT(slotModifiedClip(const QString &)));
1390 connect(m_doc->clipManager(), SIGNAL(missingClip(const QString &)), this, SLOT(slotMissingClip(const QString &)));
1391 connect(m_doc->clipManager(), SIGNAL(availableClip(const QString &)), this, SLOT(slotAvailableClip(const QString &)));
1392 connect(m_doc->clipManager(), SIGNAL(checkAllClips()), this, SLOT(updateAllClips()));
1395 QList <DocClipBase*> ProjectList::documentClipList() const
1398 return QList <DocClipBase*> ();
1400 return m_doc->clipManager()->documentClipList();
1403 QDomElement ProjectList::producersList()
1406 QDomElement prods = doc.createElement("producerlist");
1407 doc.appendChild(prods);
1408 kDebug() << "//////////// PRO LIST BUILD PRDSLIST ";
1409 QTreeWidgetItemIterator it(m_listView);
1411 if ((*it)->type() != PROJECTCLIPTYPE) {
1416 prods.appendChild(doc.importNode(((ProjectItem *)(*it))->toXml(), true));
1422 void ProjectList::slotCheckForEmptyQueue()
1424 if (!m_refreshed && m_thumbnailQueue.isEmpty() && m_infoQueue.isEmpty()) {
1426 emit loadingIsOver();
1427 emit displayMessage(QString(), -1);
1428 m_listView->blockSignals(false);
1429 m_listView->setEnabled(true);
1431 } else if (!m_refreshed) {
1432 QTimer::singleShot(300, this, SLOT(slotCheckForEmptyQueue()));
1436 void ProjectList::reloadClipThumbnails()
1438 m_thumbnailQueue.clear();
1439 QTreeWidgetItemIterator it(m_listView);
1441 if ((*it)->type() != PROJECTCLIPTYPE) {
1446 m_thumbnailQueue << ((ProjectItem *)(*it))->clipId();
1449 QTimer::singleShot(300, this, SLOT(slotProcessNextThumbnail()));
1452 void ProjectList::requestClipThumbnail(const QString id)
1454 if (!m_thumbnailQueue.contains(id)) m_thumbnailQueue.append(id);
1457 void ProjectList::slotProcessNextThumbnail()
1459 if (m_thumbnailQueue.isEmpty() && m_infoQueue.isEmpty()) {
1460 slotCheckForEmptyQueue();
1463 if (!m_infoQueue.isEmpty()) {
1464 //QTimer::singleShot(300, this, SLOT(slotProcessNextThumbnail()));
1467 if (m_thumbnailQueue.count() > 1) {
1468 int max = m_doc->clipManager()->clipsCount();
1469 emit displayMessage(i18n("Loading thumbnails"), (int)(100 *(max - m_thumbnailQueue.count()) / max));
1471 slotRefreshClipThumbnail(m_thumbnailQueue.takeFirst(), false);
1474 void ProjectList::slotRefreshClipThumbnail(const QString &clipId, bool update)
1476 QTreeWidgetItem *item = getAnyItemById(clipId);
1478 slotRefreshClipThumbnail(item, update);
1480 slotProcessNextThumbnail();
1483 void ProjectList::slotRefreshClipThumbnail(QTreeWidgetItem *it, bool update)
1485 if (it == NULL) return;
1486 ProjectItem *item = NULL;
1487 bool isSubItem = false;
1489 if (it->type() == PROJECTFOLDERTYPE) return;
1490 if (it->type() == PROJECTSUBCLIPTYPE) {
1491 item = static_cast <ProjectItem *>(it->parent());
1492 frame = static_cast <SubProjectItem *>(it)->zone().x();
1495 item = static_cast <ProjectItem *>(it);
1496 frame = item->referencedClip()->getClipThumbFrame();
1500 DocClipBase *clip = item->referencedClip();
1502 slotProcessNextThumbnail();
1506 int height = m_listView->iconSize().height();
1507 int width = (int)(height * m_render->dar());
1508 if (clip->clipType() == AUDIO)
1509 pix = KIcon("audio-x-generic").pixmap(QSize(width, height));
1510 else if (clip->clipType() == IMAGE)
1511 pix = QPixmap::fromImage(KThumb::getFrame(item->referencedClip()->producer(), 0, width, height));
1513 pix = item->referencedClip()->thumbProducer()->extractImage(frame, width, height);
1515 if (!pix.isNull()) {
1516 m_listView->blockSignals(true);
1517 it->setData(0, Qt::DecorationRole, pix);
1518 if (m_listView->isEnabled())
1519 m_listView->blockSignals(false);
1521 m_doc->cachePixmap(item->getClipHash(), pix);
1523 m_doc->cachePixmap(item->getClipHash() + '#' + QString::number(frame), pix);
1526 emit projectModified();
1528 slotProcessNextThumbnail();
1532 void ProjectList::slotReplyGetFileProperties(const QString &clipId, Mlt::Producer *producer, const QMap < QString, QString > &properties, const QMap < QString, QString > &metadata, bool replace)
1535 ProjectItem *item = getItemById(clipId);
1536 if (item && producer) {
1537 m_listView->blockSignals(true);
1538 item->setProperties(properties, metadata);
1539 if (item->referencedClip()->isPlaceHolder() && producer->is_valid()) {
1540 item->referencedClip()->setValid();
1541 item->setFlags(Qt::ItemIsSelectable | Qt::ItemIsDragEnabled | Qt::ItemIsEnabled | Qt::ItemIsEditable | Qt::ItemIsDropEnabled);
1544 if (item->referencedClip()->getProperty("proxy").isEmpty()) item->setProxyStatus(0);
1545 item->referencedClip()->setProducer(producer, replace);
1546 item->referencedClip()->askForAudioThumbs();
1547 if (!replace && item->data(0, Qt::DecorationRole).isNull())
1548 requestClipThumbnail(clipId);
1549 if (!toReload.isEmpty())
1550 item->slotSetToolTip();
1552 if (m_listView->isEnabled() && replace) {
1553 // update clip in clip monitor
1554 emit clipSelected(NULL);
1555 emit clipSelected(item->referencedClip());
1556 //TODO: Make sure the line below has no side effect
1560 // Check if duration changed.
1561 emit receivedClipDuration(clipId);
1564 if (m_listView->isEnabled())
1565 m_listView->blockSignals(false);
1566 /*if (item->icon(0).isNull()) {
1567 requestClipThumbnail(clipId);
1569 } else kDebug() << "//////// COULD NOT FIND CLIP TO UPDATE PRPS...";
1570 if (item && m_infoQueue.isEmpty() && m_thumbnailQueue.isEmpty()) {
1571 m_listView->setCurrentItem(item);
1572 bool updatedProfile = false;
1573 if (item->parent()) {
1574 if (item->parent()->type() == PROJECTFOLDERTYPE)
1575 static_cast <FolderProjectItem *>(item->parent())->switchIcon();
1576 } else if (KdenliveSettings::checkfirstprojectclip() && m_listView->topLevelItemCount() == 1) {
1577 // this is the first clip loaded in project, check if we want to adjust project settings to the clip
1578 updatedProfile = adjustProjectProfileToItem(item);
1580 if (updatedProfile == false) emit clipSelected(item->referencedClip());
1582 int max = m_doc->clipManager()->clipsCount();
1583 emit displayMessage(i18n("Loading clips"), (int)(100 *(max - m_infoQueue.count()) / max));
1585 if (!toReload.isEmpty())
1586 emit clipNeedsReload(toReload, true);
1588 qApp->processEvents();
1589 slotProcessNextClipInQueue();
1592 bool ProjectList::adjustProjectProfileToItem(ProjectItem *item)
1595 if (m_listView->currentItem() && m_listView->currentItem()->type() != PROJECTFOLDERTYPE)
1596 item = static_cast <ProjectItem*>(m_listView->currentItem());
1598 if (item == NULL || item->referencedClip() == NULL) {
1599 KMessageBox::information(kapp->activeWindow(), i18n("Cannot find profile from current clip"));
1602 bool profileUpdated = false;
1603 QString size = item->referencedClip()->getProperty("frame_size");
1604 int width = size.section('x', 0, 0).toInt();
1605 int height = size.section('x', -1).toInt();
1606 double fps = item->referencedClip()->getProperty("fps").toDouble();
1607 double par = item->referencedClip()->getProperty("aspect_ratio").toDouble();
1608 if (item->clipType() == IMAGE || item->clipType() == AV || item->clipType() == VIDEO) {
1609 if (ProfilesDialog::matchProfile(width, height, fps, par, item->clipType() == IMAGE, m_doc->mltProfile()) == false) {
1610 // get a list of compatible profiles
1611 QMap <QString, QString> suggestedProfiles = ProfilesDialog::getProfilesFromProperties(width, height, fps, par, item->clipType() == IMAGE);
1612 if (!suggestedProfiles.isEmpty()) {
1613 KDialog *dialog = new KDialog(this);
1614 dialog->setCaption(i18n("Change project profile"));
1615 dialog->setButtons(KDialog::Ok | KDialog::Cancel);
1618 QVBoxLayout *l = new QVBoxLayout;
1619 QLabel *label = new QLabel(i18n("Your clip does not match current project's profile.\nDo you want to change the project profile?\n\nThe following profiles match the clip (size: %1, fps: %2)", size, fps));
1620 l->addWidget(label);
1621 QListWidget *list = new QListWidget;
1622 list->setAlternatingRowColors(true);
1623 QMapIterator<QString, QString> i(suggestedProfiles);
1624 while (i.hasNext()) {
1626 QListWidgetItem *item = new QListWidgetItem(i.value(), list);
1627 item->setData(Qt::UserRole, i.key());
1628 item->setToolTip(i.key());
1630 list->setCurrentRow(0);
1632 container.setLayout(l);
1633 dialog->setButtonText(KDialog::Ok, i18n("Update profile"));
1634 dialog->setMainWidget(&container);
1635 if (dialog->exec() == QDialog::Accepted) {
1636 //Change project profile
1637 profileUpdated = true;
1638 if (list->currentItem())
1639 emit updateProfile(list->currentItem()->data(Qt::UserRole).toString());
1643 } else if (fps > 0) {
1644 KMessageBox::information(kapp->activeWindow(), i18n("Your clip does not match current project's profile.\nNo existing profile found to match the clip's properties.\nClip size: %1\nFps: %2\n", size, fps));
1648 return profileUpdated;
1651 void ProjectList::slotReplyGetImage(const QString &clipId, const QPixmap &pix)
1653 ProjectItem *item = getItemById(clipId);
1654 if (item && !pix.isNull()) {
1655 m_listView->blockSignals(true);
1656 item->setData(0, Qt::DecorationRole, pix);
1657 m_doc->cachePixmap(item->getClipHash(), pix);
1658 if (m_listView->isEnabled())
1659 m_listView->blockSignals(false);
1663 QTreeWidgetItem *ProjectList::getAnyItemById(const QString &id)
1665 QTreeWidgetItemIterator it(m_listView);
1666 QString lookId = id;
1667 if (id.contains('#'))
1668 lookId = id.section('#', 0, 0);
1670 ProjectItem *result = NULL;
1672 if ((*it)->type() != PROJECTCLIPTYPE) {
1677 ProjectItem *item = static_cast<ProjectItem *>(*it);
1678 if (item->clipId() == lookId) {
1684 if (result == NULL || !id.contains('#')) {
1687 for (int i = 0; i < result->childCount(); i++) {
1688 SubProjectItem *sub = static_cast <SubProjectItem *>(result->child(i));
1689 if (sub && sub->zone().x() == id.section('#', 1, 1).toInt())
1698 ProjectItem *ProjectList::getItemById(const QString &id)
1701 QTreeWidgetItemIterator it(m_listView);
1703 if ((*it)->type() != PROJECTCLIPTYPE) {
1708 item = static_cast<ProjectItem *>(*it);
1709 if (item->clipId() == id)
1716 FolderProjectItem *ProjectList::getFolderItemById(const QString &id)
1718 FolderProjectItem *item;
1719 QTreeWidgetItemIterator it(m_listView);
1721 if ((*it)->type() == PROJECTFOLDERTYPE) {
1722 item = static_cast<FolderProjectItem *>(*it);
1723 if (item->clipId() == id)
1731 void ProjectList::slotSelectClip(const QString &ix)
1733 ProjectItem *clip = getItemById(ix);
1735 m_listView->setCurrentItem(clip);
1736 m_listView->scrollToItem(clip);
1737 m_editButton->defaultAction()->setEnabled(true);
1738 m_deleteButton->defaultAction()->setEnabled(true);
1739 m_reloadAction->setEnabled(true);
1740 m_transcodeAction->setEnabled(true);
1741 if (clip->clipType() == IMAGE && !KdenliveSettings::defaultimageapp().isEmpty()) {
1742 m_openAction->setIcon(KIcon(KdenliveSettings::defaultimageapp()));
1743 m_openAction->setEnabled(true);
1744 } else if (clip->clipType() == AUDIO && !KdenliveSettings::defaultaudioapp().isEmpty()) {
1745 m_openAction->setIcon(KIcon(KdenliveSettings::defaultaudioapp()));
1746 m_openAction->setEnabled(true);
1748 m_openAction->setEnabled(false);
1753 QString ProjectList::currentClipUrl() const
1756 if (!m_listView->currentItem() || m_listView->currentItem()->type() == PROJECTFOLDERTYPE) return QString();
1757 if (m_listView->currentItem()->type() == PROJECTSUBCLIPTYPE) {
1759 item = static_cast <ProjectItem*>(m_listView->currentItem()->parent());
1761 item = static_cast <ProjectItem*>(m_listView->currentItem());
1765 return item->clipUrl().path();
1768 KUrl::List ProjectList::getConditionalUrls(const QString &condition) const
1772 QList<QTreeWidgetItem *> list = m_listView->selectedItems();
1773 for (int i = 0; i < list.count(); i++) {
1774 if (list.at(i)->type() == PROJECTFOLDERTYPE)
1776 if (list.at(i)->type() == PROJECTSUBCLIPTYPE) {
1778 item = static_cast <ProjectItem*>(list.at(i)->parent());
1780 item = static_cast <ProjectItem*>(list.at(i));
1782 if (item == NULL || item->type() == COLOR || item->type() == SLIDESHOW || item->type() == TEXT)
1784 DocClipBase *clip = item->referencedClip();
1785 if (!condition.isEmpty()) {
1786 if (condition.startsWith("vcodec") && !clip->hasVideoCodec(condition.section('=', 1, 1)))
1788 else if (condition.startsWith("acodec") && !clip->hasAudioCodec(condition.section('=', 1, 1)))
1791 result.append(item->clipUrl());
1796 void ProjectList::regenerateTemplate(const QString &id)
1798 ProjectItem *clip = getItemById(id);
1800 regenerateTemplate(clip);
1803 void ProjectList::regenerateTemplate(ProjectItem *clip)
1805 //TODO: remove this unused method, only force_reload is necessary
1806 clip->referencedClip()->producer()->set("force_reload", 1);
1809 QDomDocument ProjectList::generateTemplateXml(QString path, const QString &replaceString)
1813 if (!file.open(QIODevice::ReadOnly)) {
1814 kWarning() << "ERROR, CANNOT READ: " << path;
1817 if (!doc.setContent(&file)) {
1818 kWarning() << "ERROR, CANNOT READ: " << path;
1823 QDomNodeList texts = doc.elementsByTagName("content");
1824 for (int i = 0; i < texts.count(); i++) {
1825 QString data = texts.item(i).firstChild().nodeValue();
1826 data.replace("%s", replaceString);
1827 texts.item(i).firstChild().setNodeValue(data);
1833 void ProjectList::slotAddClipCut(const QString &id, int in, int out)
1835 ProjectItem *clip = getItemById(id);
1836 if (clip == NULL || clip->referencedClip()->hasCutZone(QPoint(in, out)))
1838 AddClipCutCommand *command = new AddClipCutCommand(this, id, in, out, QString(), true, false);
1839 m_commandStack->push(command);
1842 void ProjectList::addClipCut(const QString &id, int in, int out, const QString desc, bool newItem)
1844 ProjectItem *clip = getItemById(id);
1846 DocClipBase *base = clip->referencedClip();
1847 base->addCutZone(in, out);
1848 m_listView->blockSignals(true);
1849 SubProjectItem *sub = new SubProjectItem(clip, in, out, desc);
1850 if (newItem && desc.isEmpty() && !m_listView->isColumnHidden(1)) {
1851 if (!clip->isExpanded())
1852 clip->setExpanded(true);
1853 m_listView->scrollToItem(sub);
1854 m_listView->editItem(sub, 1);
1856 QPixmap p = clip->referencedClip()->thumbProducer()->extractImage(in, (int)(sub->sizeHint(0).height() * m_render->dar()), sub->sizeHint(0).height() - 2);
1857 sub->setData(0, Qt::DecorationRole, p);
1858 m_doc->cachePixmap(clip->getClipHash() + '#' + QString::number(in), p);
1859 m_listView->blockSignals(false);
1861 emit projectModified();
1864 void ProjectList::removeClipCut(const QString &id, int in, int out)
1866 ProjectItem *clip = getItemById(id);
1868 DocClipBase *base = clip->referencedClip();
1869 base->removeCutZone(in, out);
1870 SubProjectItem *sub = getSubItem(clip, QPoint(in, out));
1872 m_listView->blockSignals(true);
1874 m_listView->blockSignals(false);
1877 emit projectModified();
1880 SubProjectItem *ProjectList::getSubItem(ProjectItem *clip, QPoint zone)
1882 SubProjectItem *sub = NULL;
1884 for (int i = 0; i < clip->childCount(); i++) {
1885 QTreeWidgetItem *it = clip->child(i);
1886 if (it->type() == PROJECTSUBCLIPTYPE) {
1887 sub = static_cast <SubProjectItem*>(it);
1888 if (sub->zone() == zone)
1898 void ProjectList::slotUpdateClipCut(QPoint p)
1900 if (!m_listView->currentItem() || m_listView->currentItem()->type() != PROJECTSUBCLIPTYPE)
1902 SubProjectItem *sub = static_cast <SubProjectItem*>(m_listView->currentItem());
1903 ProjectItem *item = static_cast <ProjectItem *>(sub->parent());
1904 EditClipCutCommand *command = new EditClipCutCommand(this, item->clipId(), sub->zone(), p, sub->text(1), sub->text(1), true);
1905 m_commandStack->push(command);
1908 void ProjectList::doUpdateClipCut(const QString &id, const QPoint oldzone, const QPoint zone, const QString &comment)
1910 ProjectItem *clip = getItemById(id);
1911 SubProjectItem *sub = getSubItem(clip, oldzone);
1912 if (sub == NULL || clip == NULL)
1914 DocClipBase *base = clip->referencedClip();
1915 base->updateCutZone(oldzone.x(), oldzone.y(), zone.x(), zone.y(), comment);
1916 m_listView->blockSignals(true);
1918 sub->setDescription(comment);
1919 m_listView->blockSignals(false);
1920 emit projectModified();
1923 void ProjectList::slotForceProcessing(const QString &id)
1925 while (m_infoQueue.contains(id)) {
1926 slotProcessNextClipInQueue();
1930 void ProjectList::slotAddOrUpdateSequence(const QString frameName)
1932 QString fileName = KUrl(frameName).fileName().section('_', 0, -2);
1934 QString pattern = SlideshowClip::selectedPath(frameName, false, QString(), &list);
1935 int count = list.count();
1937 const QList <DocClipBase *> existing = m_doc->clipManager()->getClipByResource(pattern);
1938 if (!existing.isEmpty()) {
1939 // Sequence already exists, update
1940 QString id = existing.at(0)->getId();
1941 //ProjectItem *item = getItemById(id);
1942 QMap <QString, QString> oldprops;
1943 QMap <QString, QString> newprops;
1944 int ttl = existing.at(0)->getProperty("ttl").toInt();
1945 oldprops["out"] = existing.at(0)->getProperty("out");
1946 newprops["out"] = QString::number(ttl * count - 1);
1947 slotUpdateClipProperties(id, newprops);
1948 EditClipCommand *command = new EditClipCommand(this, id, oldprops, newprops, false);
1949 m_commandStack->push(command);
1952 QStringList groupInfo = getGroup();
1953 m_doc->slotCreateSlideshowClipFile(fileName, pattern, count, m_timecode.reformatSeparators(KdenliveSettings::sequence_duration()),
1954 false, false, false,
1955 m_timecode.getTimecodeFromFrames(int(ceil(m_timecode.fps()))), QString(), 0,
1956 QString(), groupInfo.at(0), groupInfo.at(1));
1958 } else emit displayMessage(i18n("Sequence not found"), -2);
1961 QMap <QString, QString> ProjectList::getProxies()
1963 QMap <QString, QString> list;
1965 QTreeWidgetItemIterator it(m_listView);
1967 if ((*it)->type() != PROJECTCLIPTYPE) {
1971 item = static_cast<ProjectItem *>(*it);
1972 if (item && item->referencedClip() != NULL) {
1973 QString proxy = item->referencedClip()->getProperty("proxy");
1974 if (!proxy.isEmpty()) list.insert(proxy, item->clipUrl().path());
1981 void ProjectList::updateProxyConfig()
1984 QTreeWidgetItemIterator it(m_listView);
1986 if ((*it)->type() != PROJECTCLIPTYPE) {
1990 item = static_cast<ProjectItem *>(*it);
1991 if (item && item->referencedClip() != NULL) {
1992 if (KdenliveSettings::enableproxy()) {
1993 DocClipBase *clip = item->referencedClip();
1994 connect(clip, SIGNAL(proxyReady(const QString, bool)), this, SLOT(slotGotProxy(const QString, bool)));
1995 item->setProxyStatus(1);
1996 clip->generateProxy(m_doc->projectFolder());
1998 else if (!item->referencedClip()->getProperty("proxy").isEmpty()) {
2000 item->referencedClip()->clearProperty("proxy");
2001 QDomElement e = item->toXml().cloneNode().toElement();
2002 e.removeAttribute("file_hash");
2003 e.setAttribute("replace", 1);
2004 m_infoQueue.insert(item->clipId(), e);
2009 if (!m_infoQueue.isEmpty() && !m_queueTimer.isActive()) m_queueTimer.start();
2013 void ProjectList::slotProxyCurrentItem(bool doProxy)
2015 if (m_listView->currentItem()->type() == PROJECTCLIPTYPE) {
2016 ProjectItem *item = static_cast <ProjectItem*>(m_listView->currentItem());
2017 if (item->referencedClip()) {
2019 DocClipBase *clip = item->referencedClip();
2020 connect(clip, SIGNAL(proxyReady(const QString, bool)), this, SLOT(slotGotProxy(const QString, bool)));
2021 item->setProxyStatus(1);
2022 clip->generateProxy(m_doc->projectFolder());
2024 else if (!item->referencedClip()->getProperty("proxy").isEmpty()) {
2026 item->referencedClip()->clearProperty("proxy");
2027 QDomElement e = item->toXml().cloneNode().toElement();
2028 e.removeAttribute("file_hash");
2029 e.setAttribute("replace", 1);
2030 m_infoQueue.insert(item->clipId(), e);
2033 if (!m_infoQueue.isEmpty() && !m_queueTimer.isActive()) m_queueTimer.start();
2037 #include "projectlist.moc"