// Gather all common properties
QMap <QString, QString> commonproperties;
QList <DocClipBase *> clipList;
- commonproperties.insert("force_aspect_ratio", "-");
+ commonproperties.insert("force_aspect_num", "-");
+ commonproperties.insert("force_aspect_den", "-");
commonproperties.insert("force_fps", "-");
commonproperties.insert("force_progressive", "-");
+ commonproperties.insert("force_tff", "-");
commonproperties.insert("threads", "-");
commonproperties.insert("video_index", "-");
commonproperties.insert("audio_index", "-");
+ commonproperties.insert("force_colorspace", "-");
+ commonproperties.insert("full_luma", "-");
bool allowDurationChange = true;
int commonDuration = -1;
}
item = static_cast <ProjectItem *>(selected.at(i));
if (item) {
- if (item->clipType() == TEXT) {
+ CLIPTYPE t = item->clipType();
+ if (t == TEXT) {
if (!item->referencedClip()->getProperty("xmltemplate").isEmpty())
regenerateTemplate(item);
- } else if (item->clipType() != COLOR && item->clipType() != SLIDESHOW && item->referencedClip() && item->referencedClip()->checkHash() == false) {
+ } else if (t != COLOR && t != SLIDESHOW && item->referencedClip() && item->referencedClip()->checkHash() == false) {
item->referencedClip()->setPlaceHolder(true);
item->setProperty("file_hash", QString());
- } else if (item->clipType() == IMAGE) {
+ } else if (t == IMAGE) {
item->referencedClip()->producer()->set("force_reload", 1);
}
- //requestClipInfo(item->toXml(), item->clipId(), true);
- // Clear the file_hash value, which will cause a complete reload of the clip
- emit getFileProperties(item->toXml(), item->clipId(), m_listView->iconSize().height(), true);
+
+ QDomElement e = item->toXml();
+ // Make sure we get the correct producer length if it was adjusted in timeline
+ if (t == COLOR || t == IMAGE || t == SLIDESHOW || t == TEXT) {
+ int length = QString(item->referencedClip()->producerProperty("length")).toInt();
+ if (length > 0 && !e.hasAttribute("length")) {
+ e.setAttribute("length", length);
+ e.setAttribute("out", length - 1);
+ }
+ }
+
+ emit getFileProperties(e, item->clipId(), m_listView->iconSize().height(), true);
}
}
}
slotUpdateClipProperties(item, properties);
if (properties.contains("out") || properties.contains("force_fps") || properties.contains("resource")) {
slotReloadClip(id);
- } else if (properties.contains("colour") || properties.contains("xmldata") || properties.contains("force_aspect_ratio") || properties.contains("templatetext")) {
+ } else if (properties.contains("colour") ||
+ properties.contains("xmldata") ||
+ properties.contains("force_aspect_num") ||
+ properties.contains("force_aspect_den") ||
+ properties.contains("templatetext")) {
slotRefreshClipThumbnail(item);
emit refreshClip();
+ } else if (properties.contains("full_luma") || properties.contains("force_colorspace")) {
+ emit refreshClip();
}
}
}
QUndoCommand *delCommand = new QUndoCommand();
delCommand->setText(i18n("Delete Clip Zone"));
-
for (int i = 0; i < selected.count(); i++) {
if (selected.at(i)->type() == PROJECTSUBCLIPTYPE) {
// subitem
} else {
ProjectItem *item = static_cast <ProjectItem *>(selected.at(i));
ids << item->clipId();
- 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")) != KMessageBox::Yes)
+ 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) {
+ KMessageBox::enableMessage("DeleteAll");
return;
+ }
}
}
-
+ KMessageBox::enableMessage("DeleteAll");
if (delCommand->childCount() == 0)
delete delCommand;
else
void ProjectList::slotAddClip(DocClipBase *clip, bool getProperties)
{
m_listView->setEnabled(false);
- if (getProperties) {
- m_listView->blockSignals(true);
- m_refreshed = false;
- // remove file_hash so that we load all properties for the clip
- QDomElement e = clip->toXML().cloneNode().toElement();
- e.removeAttribute("file_hash");
- m_infoQueue.insert(clip->getId(), e);
- //m_render->getFileProperties(clip->toXML(), clip->getId(), true);
- }
- clip->askForAudioThumbs();
+ if (getProperties) m_listView->blockSignals(true);
const QString parent = clip->getProperty("groupid");
ProjectItem *item = NULL;
if (!parent.isEmpty()) {
}
if (item == NULL)
item = new ProjectItem(m_listView, clip);
+ if (item->data(0, DurationRole).isNull()) item->setData(0, DurationRole, i18n("Loading"));
+ if (getProperties) {
+ m_listView->blockSignals(true);
+ m_refreshed = false;
+
+ // Proxy clips
+ CLIPTYPE t = clip->clipType();
+ if ((t == VIDEO || t == AV || t == UNKNOWN) && KdenliveSettings::enableproxy()) {
+ if (clip->getProperty("proxy").isEmpty()) {
+ connect(clip, SIGNAL(proxyReady(const QString, bool)), this, SLOT(slotGotProxy(const QString, bool)));
+ item->setProxyStatus(1);
+ clip->generateProxy(m_doc->projectFolder());
+ }
+ else {
+ // Proxy clip already created
+ item->setProxyStatus(2);
+ QDomElement e = clip->toXML().cloneNode().toElement();
+ e.removeAttribute("file_hash");
+ m_infoQueue.insert(clip->getId(), e);
+
+ }
+ }
+ else {
+ // We don't use proxies
+ // remove file_hash so that we load all properties for the clip
+ QDomElement e = clip->toXML().cloneNode().toElement();
+ e.removeAttribute("file_hash");
+ m_infoQueue.insert(clip->getId(), e);
+ }
+ //m_render->getFileProperties(clip->toXML(), clip->getId(), true);
+ }
+ clip->askForAudioThumbs();
+
KUrl url = clip->fileURL();
-
if (getProperties == false && !clip->getClipHash().isEmpty()) {
QString cachedPixmap = m_doc->projectFolder().path(KUrl::AddTrailingSlash) + "thumbs/" + clip->getClipHash() + ".png";
if (QFile::exists(cachedPixmap)) {
if (getProperties)
m_listView->blockSignals(false);
}
+
if (getProperties && !m_queueTimer.isActive())
slotProcessNextClipInQueue();
}
+void ProjectList::slotGotProxy(const QString id, bool success)
+{
+ ProjectItem *item = getItemById(id);
+ if (item) {
+ disconnect(m_listView, SIGNAL(itemChanged(QTreeWidgetItem *, int)), this, SLOT(slotItemEdited(QTreeWidgetItem *, int)));
+ if (success) {
+ // Proxy clip successfully created
+ item->setProxyStatus(2);
+ QDomElement e = item->referencedClip()->toXML().cloneNode().toElement();
+ e.removeAttribute("file_hash");
+ e.setAttribute("replace", 1);
+ m_infoQueue.insert(id, e);
+ if (!m_queueTimer.isActive()) slotProcessNextClipInQueue();
+ }
+ else item->setProxyStatus(0);
+ connect(m_listView, SIGNAL(itemChanged(QTreeWidgetItem *, int)), this, SLOT(slotItemEdited(QTreeWidgetItem *, int)));
+ update();
+ }
+}
+
void ProjectList::slotResetProjectList()
{
m_listView->clear();
QMap<QString, QDomElement>::const_iterator j = m_infoQueue.constBegin();
if (j != m_infoQueue.constEnd()) {
- const QDomElement dom = j.value();
+ QDomElement dom = j.value();
const QString id = j.key();
m_infoQueue.remove(j.key());
- emit getFileProperties(dom, id, m_listView->iconSize().height(), false);
+ bool replace;
+ if (dom.hasAttribute("replace")) {
+ dom.removeAttribute("replace");
+ replace = true;
+ }
+ else replace = false;
+ emit getFileProperties(dom, id, m_listView->iconSize().height(), replace);
}
if (!m_infoQueue.isEmpty()) m_queueTimer.start();
}
{
// Build list of mime types
QStringList mimeTypes = QStringList() << "application/x-kdenlive" << "application/x-kdenlivetitle" << "video/mlt-playlist" << "text/plain"
- << "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"
- << "audio/x-flac" << "audio/x-matroska" << "audio/mp4" << "audio/mpeg" << "audio/x-mp3" << "audio/ogg" << "audio/x-wav" << "application/ogg" << "application/mxf"
+ << "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"
+ << "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"
<< "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";
QString allExtensions;
if (fileName.at(fileName.size() - 1).isDigit()) {
KFileItem item(KFileItem::Unknown, KFileItem::Unknown, url);
if (item.mimetype().startsWith("image")) {
- int count = 0;
// import as sequence if we found more than one image in the sequence
- QString pattern = SlideshowClip::selectedPath(url.path(), false, QString(), &count);
+ QStringList list;
+ QString pattern = SlideshowClip::selectedPath(url.path(), false, QString(), &list);
+ int count = list.count();
if (count > 1) {
delete d;
QStringList groupInfo = getGroup();
void ProjectList::reloadClipThumbnails()
{
- kDebug() << "////////////// RELOAD CLIPS THUMBNAILS!!!";
m_thumbnailQueue.clear();
QTreeWidgetItemIterator it(m_listView);
while (*it) {
}
if (update)
emit projectModified();
- QTimer::singleShot(30, this, SLOT(slotProcessNextThumbnail()));
+
+ slotProcessNextThumbnail();
}
}
item->setFlags(Qt::ItemIsSelectable | Qt::ItemIsDragEnabled | Qt::ItemIsEnabled | Qt::ItemIsEditable | Qt::ItemIsDropEnabled);
toReload = clipId;
}
- //Q_ASSERT_X(item->referencedClip(), "void ProjectList::slotReplyGetFileProperties", QString("Item with groupName %1 does not have a clip associated").arg(item->groupName()).toLatin1());
+ if (item->referencedClip()->getProperty("proxy").isEmpty()) item->setProxyStatus(0);
item->referencedClip()->setProducer(producer, replace);
item->referencedClip()->askForAudioThumbs();
if (!replace && item->data(0, Qt::DecorationRole).isNull())
if (!toReload.isEmpty())
item->slotSetToolTip();
- //emit receivedClipDuration(clipId);
if (m_listView->isEnabled() && replace) {
// update clip in clip monitor
emit clipSelected(NULL);
requestClipThumbnail(clipId);
}*/
} else kDebug() << "//////// COULD NOT FIND CLIP TO UPDATE PRPS...";
- int max = m_doc->clipManager()->clipsCount();
if (item && m_infoQueue.isEmpty() && m_thumbnailQueue.isEmpty()) {
m_listView->setCurrentItem(item);
bool updatedProfile = false;
}
if (updatedProfile == false) emit clipSelected(item->referencedClip());
} else {
+ int max = m_doc->clipManager()->clipsCount();
emit displayMessage(i18n("Loading clips"), (int)(100 *(max - m_infoQueue.count()) / max));
}
if (!toReload.isEmpty())
emit clipNeedsReload(toReload, true);
- // small delay so that the app can display the progress info
- QTimer::singleShot(30, this, SLOT(slotProcessNextClipInQueue()));
+
+ qApp->processEvents();
+ slotProcessNextClipInQueue();
}
bool ProjectList::adjustProjectProfileToItem(ProjectItem *item)
}
delete list;
delete label;
- } else 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));
+ } else if (fps > 0) {
+ 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));
+ }
}
}
return profileUpdated;
void ProjectList::slotAddOrUpdateSequence(const QString frameName)
{
QString fileName = KUrl(frameName).fileName().section('_', 0, -2);
- int count;
- QString pattern = SlideshowClip::selectedPath(frameName, false, QString(), &count);
+ QStringList list;
+ QString pattern = SlideshowClip::selectedPath(frameName, false, QString(), &list);
+ int count = list.count();
if (count > 1) {
- const QList <DocClipBase *> existing = m_doc->clipManager()->getClipByResource(pattern);
- if (!existing.isEmpty()) {
- // Sequence already exists, update
- QString id = existing.at(0)->getId();
- //ProjectItem *item = getItemById(id);
+ const QList <DocClipBase *> existing = m_doc->clipManager()->getClipByResource(pattern);
+ if (!existing.isEmpty()) {
+ // Sequence already exists, update
+ QString id = existing.at(0)->getId();
+ //ProjectItem *item = getItemById(id);
QMap <QString, QString> oldprops;
QMap <QString, QString> newprops;
- int ttl = existing.at(0)->getProperty("ttl").toInt();
+ int ttl = existing.at(0)->getProperty("ttl").toInt();
oldprops["out"] = existing.at(0)->getProperty("out");
newprops["out"] = QString::number(ttl * count - 1);
- slotUpdateClipProperties(id, newprops);
+ slotUpdateClipProperties(id, newprops);
EditClipCommand *command = new EditClipCommand(this, id, oldprops, newprops, false);
m_commandStack->push(command);
- }
- else {
- // Create sequence
- QStringList groupInfo = getGroup();
- m_doc->slotCreateSlideshowClipFile(fileName, pattern, count, m_timecode.reformatSeparators(KdenliveSettings::sequence_duration()),
- false, false, false,
- m_timecode.getTimecodeFromFrames(int(ceil(m_timecode.fps()))), QString(), 0,
- QString(), groupInfo.at(0), groupInfo.at(1));
- }
+ } else {
+ // Create sequence
+ QStringList groupInfo = getGroup();
+ m_doc->slotCreateSlideshowClipFile(fileName, pattern, count, m_timecode.reformatSeparators(KdenliveSettings::sequence_duration()),
+ false, false, false,
+ m_timecode.getTimecodeFromFrames(int(ceil(m_timecode.fps()))), QString(), 0,
+ QString(), groupInfo.at(0), groupInfo.at(1));
+ }
+ } else emit displayMessage(i18n("Sequence not found"), -2);
+}
+
+QMap <QString, QString> ProjectList::getProxies()
+{
+ QMap <QString, QString> list;
+ ProjectItem *item;
+ QTreeWidgetItemIterator it(m_listView);
+ while (*it) {
+ if ((*it)->type() != PROJECTCLIPTYPE) {
+ ++it;
+ continue;
+ }
+ item = static_cast<ProjectItem *>(*it);
+ if (item && item->referencedClip() != NULL) {
+ QString proxy = item->referencedClip()->getProperty("proxy");
+ if (!proxy.isEmpty()) list.insert(proxy, item->clipUrl().path());
+ }
+ ++it;
+ }
+ return list;
+}
+
+void ProjectList::updateProxyConfig()
+{
+ ProjectItem *item;
+ QTreeWidgetItemIterator it(m_listView);
+ while (*it) {
+ if ((*it)->type() != PROJECTCLIPTYPE) {
+ ++it;
+ continue;
+ }
+ item = static_cast<ProjectItem *>(*it);
+ if (item && item->referencedClip() != NULL) {
+ if (KdenliveSettings::enableproxy()) {
+ DocClipBase *clip = item->referencedClip();
+ connect(clip, SIGNAL(proxyReady(const QString, bool)), this, SLOT(slotGotProxy(const QString, bool)));
+ item->setProxyStatus(1);
+ clip->generateProxy(m_doc->projectFolder());
+ }
+ else if (!item->referencedClip()->getProperty("proxy").isEmpty()) {
+ // remove proxy
+ item->referencedClip()->clearProperty("proxy");
+ QDomElement e = item->toXml().cloneNode().toElement();
+ e.removeAttribute("file_hash");
+ e.setAttribute("replace", 1);
+ m_infoQueue.insert(item->clipId(), e);
+ }
+ }
+ ++it;
}
- else emit displayMessage(i18n("Sequence not found"), -2);
+ if (!m_infoQueue.isEmpty() && !m_queueTimer.isActive()) m_queueTimer.start();
+
}
#include "projectlist.moc"