m_proxyAction->setEnabled(false);
return;
}
- m_proxyAction->setEnabled(true);
+ m_proxyAction->setEnabled(useProxy());
m_proxyAction->blockSignals(true);
m_proxyAction->setChecked(clip->hasProxy());
m_proxyAction->blockSignals(false);
m_openAction->setEnabled(true);
m_reloadAction->setEnabled(true);
m_transcodeAction->setEnabled(true);
- m_proxyAction->setEnabled(true);
+ m_proxyAction->setEnabled(useProxy());
return;
}
else if (item && item->type() == PROJECTFOLDERTYPE && item->childCount() > 0) {
if (parentitem)
item = new ProjectItem(parentitem, clip);
}
- if (item == NULL)
+ 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->processLayout();
m_refreshed = false;
// Proxy clips
CLIPTYPE t = clip->clipType();
- if ((t == VIDEO || t == AV || t == UNKNOWN) && KdenliveSettings::enableproxy()) {
+ if ((t == VIDEO || t == AV || t == UNKNOWN) && useProxy()) {
if (clip->getProperty("proxy").isEmpty()) {
- connect(clip, SIGNAL(proxyReady(const QString, bool)), this, SLOT(slotGotProxy(const QString, bool)));
- setProxyStatus(item, 1);
- clip->generateProxy(m_doc->projectFolder());
+
+ //connect(clip, SIGNAL(proxyReady(const QString&, bool)), this, SLOT(slotGotProxy(const QString&, bool)));
+ //setProxyStatus(item, 1);
+ //clip->generateProxy(m_doc->projectFolder(), proxyParams());
}
else {
// Proxy clip already created
m_infoQueue.insert(clip->getId(), e);
}
}
- else {
+ //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);
}
else if (!clip->getProperty("proxy").isEmpty()) {
- connect(clip, SIGNAL(proxyReady(const QString, bool)), this, SLOT(slotGotProxy(const QString, bool)));
+ connect(clip, SIGNAL(proxyReady(const QString&, bool)), this, SLOT(slotGotProxy(const QString&, bool)));
setProxyStatus(item, 1);
- clip->generateProxy(m_doc->projectFolder());
+ clip->generateProxy(m_doc->projectFolder(), proxyParams());
}
clip->askForAudioThumbs();
m_queueRunner = QtConcurrent::run(this, &ProjectList::slotProcessNextClipInQueue);
}
-void ProjectList::slotGotProxy(const QString id, bool success)
+void ProjectList::slotGotProxy(const QString &id, bool success)
{
ProjectItem *item = getItemById(id);
if (item) {
// 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" << "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"
+ << "audio/x-flac" << "audio/x-matroska" << "audio/mp4" << "audio/mpeg" << "audio/x-mp3" << "audio/ogg" << "audio/x-wav" << "audio/x-aiff" << "audio/aiff" << "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;
item->setFlags(Qt::ItemIsSelectable | Qt::ItemIsDragEnabled | Qt::ItemIsEnabled | Qt::ItemIsEditable | Qt::ItemIsDropEnabled);
toReload = clipId;
}
- if (item->referencedClip()->getProperty("proxy").isEmpty()) setProxyStatus(item, 0);
- item->referencedClip()->setProducer(producer, replace);
- item->referencedClip()->askForAudioThumbs();
+ if (!useProxy() && item->referencedClip()->getProperty("proxy").isEmpty()) setProxyStatus(item, 0);
+ QString type = properties.value("type");
+ QString size = properties.value("frame_size");
+ DocClipBase *clip = item->referencedClip();
+ if (useProxy() && (type == "video" || type == "av") && generateProxy() && size.section('x', 0, 0).toInt() > proxyMinSize()) {
+ if (clip->getProperty("proxy").isEmpty()) {
+ connect(clip, SIGNAL(proxyReady(const QString&, bool)), this, SLOT(slotGotProxy(const QString&, bool)));
+ setProxyStatus(item, 1);
+ clip->generateProxy(m_doc->projectFolder(), proxyParams());
+
+ }
+ }
+ clip->setProducer(producer, replace);
+ clip->askForAudioThumbs();
if (!replace && item->data(0, Qt::DecorationRole).isNull())
requestClipThumbnail(clipId);
if (!toReload.isEmpty())
if (m_listView->isEnabled() && replace) {
// update clip in clip monitor
emit clipSelected(NULL);
- emit clipSelected(item->referencedClip());
+ emit clipSelected(clip);
//TODO: Make sure the line below has no side effect
toReload = clipId;
}
return profileUpdated;
}
+bool ProjectList::useProxy() const
+{
+ return m_doc->getDocumentProperty("enableproxy").toInt();
+}
+
+bool ProjectList::generateProxy() const
+{
+ return m_doc->getDocumentProperty("generateproxy").toInt();
+}
+
+int ProjectList::proxyMinSize() const
+{
+ return m_doc->getDocumentProperty("proxyminsize").toInt();
+}
+
+QString ProjectList::proxyParams() const
+{
+ return m_doc->getDocumentProperty("proxyparams").simplified();
+}
+
void ProjectList::slotReplyGetImage(const QString &clipId, const QPixmap &pix)
{
ProjectItem *item = getItemById(clipId);
QTreeWidgetItemIterator it(m_listView);
while (*it) {
if ((*it)->type() != PROJECTCLIPTYPE) {
- // subitem
+ // subitem or folder
++it;
continue;
}
m_deleteButton->defaultAction()->setEnabled(true);
m_reloadAction->setEnabled(true);
m_transcodeAction->setEnabled(true);
- m_proxyAction->setEnabled(true);
+ m_proxyAction->setEnabled(useProxy());
if (clip->clipType() == IMAGE && !KdenliveSettings::defaultimageapp().isEmpty()) {
m_openAction->setIcon(KIcon(KdenliveSettings::defaultimageapp()));
m_openAction->setEnabled(true);
continue;
}
item = static_cast<ProjectItem *>(*it);
- if (item && item->referencedClip() != NULL) {
- if (KdenliveSettings::enableproxy()) {
+ if (item == NULL) {
+ ++it;
+ continue;
+ }
+ CLIPTYPE t = item->clipType();
+ if ((t == VIDEO || t == AV || t == UNKNOWN) && item->referencedClip() != NULL) {
+ if (generateProxy() && useProxy()) {
DocClipBase *clip = item->referencedClip();
- connect(clip, SIGNAL(proxyReady(const QString, bool)), this, SLOT(slotGotProxy(const QString, bool)));
- setProxyStatus(item, 1);
- clip->generateProxy(m_doc->projectFolder());
+ if (clip->getProperty("frame_size").section('x', 0, 0).toInt() > proxyMinSize()) {
+ connect(clip, SIGNAL(proxyReady(const QString &, bool)), this, SLOT(slotGotProxy(const QString &, bool)));
+ setProxyStatus(item, 1);
+ clip->generateProxy(m_doc->projectFolder(), proxyParams());
+ }
}
else if (!item->referencedClip()->getProperty("proxy").isEmpty()) {
// remove proxy
}
if (listItem->type() == PROJECTCLIPTYPE) {
ProjectItem *item = static_cast <ProjectItem*>(listItem);
- if (item->referencedClip()) {
+ CLIPTYPE t = item->clipType();
+ if ((t == VIDEO || t == AV || t == UNKNOWN) && item->referencedClip()) {
if (doProxy) {
DocClipBase *clip = item->referencedClip();
- connect(clip, SIGNAL(proxyReady(const QString, bool)), this, SLOT(slotGotProxy(const QString, bool)));
+ connect(clip, SIGNAL(proxyReady(const QString&, bool)), this, SLOT(slotGotProxy(const QString&, bool)));
setProxyStatus(item, 1);
- clip->generateProxy(m_doc->projectFolder());
+ clip->generateProxy(m_doc->projectFolder(), proxyParams());
}
else if (!item->referencedClip()->getProperty("proxy").isEmpty()) {
// remove proxy