layout->addWidget(m_toolbar);
layout->addWidget(m_listView);
setLayout(layout);
-
+
connect(m_listView, SIGNAL(itemSelectionChanged()), this, SLOT(slotClipSelected()));
m_menu->addActions(addMenu->actions());
}
-void ProjectList::setupGeneratorMenu(QMenu *addMenu)
+void ProjectList::setupGeneratorMenu(QMenu *addMenu, QMenu *transcodeMenu)
{
if (!addMenu) return;
QMenu *menu = m_addButton->menu();
m_menu->addMenu(addMenu);
if (addMenu->isEmpty()) addMenu->setEnabled(false);
+ m_menu->addMenu(transcodeMenu);
+ if (transcodeMenu->isEmpty()) transcodeMenu->setEnabled(false);
m_menu->addAction(m_reloadAction);
m_menu->addAction(m_editAction);
m_menu->addAction(m_openAction);
}
-QByteArray ProjectList::headerInfo()
+QByteArray ProjectList::headerInfo() const
{
return m_listView->header()->saveState();
}
if (item->clipType() == IMAGE) {
item->referencedClip()->producer()->set("force_reload", 1);
}
- emit getFileProperties(item->toXml(), item->clipId(), false);
+ emit getFileProperties(item->toXml(), item->clipId(), true);
}
}
ProjectItem *item = getItemById(id);
if (item) {
slotUpdateClipProperties(item, properties);
- if (properties.contains("colour") || properties.contains("resource") || properties.contains("xmldata")) slotRefreshClipThumbnail(item);
+ if (properties.contains("colour") || properties.contains("resource") || properties.contains("xmldata") || properties.contains("force_aspect_ratio")) slotRefreshClipThumbnail(item);
if (properties.contains("out")) item->changeDuration(properties.value("out").toInt());
}
}
if (item->isGroup()) folderids[item->groupName()] = item->clipId();
else ids << item->clipId();
if (item->numReferences() > 0) {
- 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;
+ 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;
} else if (item->isGroup() && item->childCount() > 0) {
int children = item->childCount();
- 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;
+ 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;
for (int i = 0; i < children; ++i) {
ProjectItem *child = static_cast <ProjectItem *>(item->child(i));
ids << child->clipId();
const QDomElement dom = i.value();
const QString id = i.key();
m_infoQueue.remove(i.key());
- emit getFileProperties(dom, id, true);
+ emit getFileProperties(dom, id, false);
}
if (m_infoQueue.isEmpty()) m_listView->setEnabled(true);
}
KUrl::List list;
if (givenList.isEmpty()) {
// Build list of mime types
- QStringList mimeTypes = QStringList() << "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-tga" << "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" << "video/x-matroska" << "audio/x-matroska";
+ QStringList mimeTypes = QStringList() << "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-tga" << "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" << "video/x-matroska" << "audio/x-matroska" << "video/ogg" << "audio/ogg";
QString allExtensions;
foreach(const QString& mimeType, mimeTypes) {
m_doc->slotAddClipList(list, group, groupId);
}
-void ProjectList::slotRemoveInvalidClip(const QString &id)
+void ProjectList::slotRemoveInvalidClip(const QString &id, bool replace)
{
ProjectItem *item = getItemById(id);
if (item) {
const QString path = item->referencedClip()->fileURL().path();
- if (!path.isEmpty()) KMessageBox::sorry(this, i18n("Clip <b>%1</b><br>is invalid, will be removed from project.", path));
+ if (!path.isEmpty()) {
+ if (replace) KMessageBox::sorry(this, i18n("Clip <b>%1</b><br>is invalid, will be removed from project.", path));
+ else {
+ if (KMessageBox::questionYesNo(this, i18n("Clip <b>%1</b><br>is missing or invalid. Remove it from project?", path), i18n("Invalid clip")) == KMessageBox::Yes) replace = true;
+ }
+ }
QList <QString> ids;
ids << id;
- m_doc->deleteProjectClip(ids);
+ if (replace) m_doc->deleteProjectClip(ids);
}
if (!m_infoQueue.isEmpty()) QTimer::singleShot(300, this, SLOT(slotProcessNextClipInQueue()));
else m_listView->setEnabled(true);
void ProjectList::slotAddSlideshowClip()
{
if (!m_commandStack) kDebug() << "!!!!!!!!!!!!!!!! NO CMD STK";
- SlideshowClip *dia = new SlideshowClip(this);
+ SlideshowClip *dia = new SlideshowClip(m_timecode, this);
if (dia->exec() == QDialog::Accepted) {
} else QTimer::singleShot(500, this, SLOT(slotCheckForEmptyQueue()));
}
+void ProjectList::reloadClipThumbnails()
+{
+ m_thumbnailQueue.clear();
+ QTreeWidgetItemIterator it(m_listView);
+ while (*it) {
+ if (!((ProjectItem *)(*it))->isGroup())
+ m_thumbnailQueue << ((ProjectItem *)(*it))->clipId();
+ ++it;
+ }
+ QTimer::singleShot(300, this, SLOT(slotProcessNextThumbnail()));
+}
+
void ProjectList::requestClipThumbnail(const QString &id)
{
m_thumbnailQueue.append(id);
m_listView->blockSignals(true);
item->setProperties(properties, metadata);
Q_ASSERT_X(item->referencedClip(), "void ProjectList::slotReplyGetFileProperties", QString("Item with groupName %1 does not have a clip associated").arg(item->groupName()).toLatin1());
- if (replace) item->referencedClip()->setProducer(producer);
- else {
+ item->referencedClip()->setProducer(producer, replace);
+ emit receivedClipDuration(clipId);
+ if (replace) {
+ // update clip in clip monitor
+ emit clipSelected(NULL);
+ emit clipSelected(item->referencedClip());
+ }
+ /*else {
// Check if duration changed.
emit receivedClipDuration(clipId);
delete producer;
- }
+ }*/
m_listView->blockSignals(false);
} else kDebug() << "//////// COULD NOT FIND CLIP TO UPDATE PRPS...";
if (!m_infoQueue.isEmpty()) QTimer::singleShot(300, this, SLOT(slotProcessNextClipInQueue()));
}
}
+QString ProjectList::currentClipUrl() const
+{
+ ProjectItem *item = static_cast <ProjectItem*>(m_listView->currentItem());
+ if (item == NULL) return QString();
+ return item->clipUrl().path();
+}
+
#include "projectlist.moc"