commonproperties.insert("audio_index", "-");
commonproperties.insert("force_colorspace", "-");
commonproperties.insert("full_luma", "-");
+ QString transparency = "-";
bool allowDurationChange = true;
int commonDuration = -1;
+ bool hasImages = false;;
ProjectItem *item;
for (int i = 0; i < list.count(); i++) {
item = NULL;
// check properties
DocClipBase *clip = item->referencedClip();
if (clipList.contains(clip)) continue;
+ if (clip->clipType() == IMAGE) {
+ hasImages = true;
+ if (clip->getProperty("transparency").isEmpty() || clip->getProperty("transparency").toInt() == 0) {
+ if (transparency == "-") {
+ // first non transparent image
+ transparency = "0";
+ }
+ else if (transparency == "1") {
+ // we have transparent and non transparent clips
+ transparency = "-1";
+ }
+ }
+ else {
+ if (transparency == "-") {
+ // first transparent image
+ transparency = "1";
+ }
+ else if (transparency == "0") {
+ // we have transparent and non transparent clips
+ transparency = "-1";
+ }
+ }
+ }
if (clip->clipType() != COLOR && clip->clipType() != IMAGE && clip->clipType() != TEXT)
allowDurationChange = false;
if (allowDurationChange && commonDuration != 0) {
}
if (allowDurationChange)
commonproperties.insert("out", QString::number(commonDuration));
+ if (hasImages)
+ commonproperties.insert("transparency", transparency);
/*QMapIterator<QString, QString> p(commonproperties);
while (p.hasNext()) {
p.next();
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, false);
}
}
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) {
- qApp->processEvents();
+ m_listView->processLayout();
m_refreshed = false;
// Proxy clips
CLIPTYPE t = clip->clipType();
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(), proxyParams());
+
+ //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()) {
//qApp->processEvents();
++it;
}
- /*if (!m_queueTimer.isActive())
- m_queueTimer.start();*/
+
if (!m_queueRunner.isRunning() && m_processingClips.isEmpty()) m_queueRunner = QtConcurrent::run(this, &ProjectList::slotProcessNextClipInQueue);
if (m_listView->isEnabled())
monitorItemEditing(true);
const QString dialogFilter = allExtensions + ' ' + QLatin1Char('|') + i18n("All Supported Files") + "\n* " + QLatin1Char('|') + i18n("All Files");
QCheckBox *b = new QCheckBox(i18n("Import image sequence"));
b->setChecked(KdenliveSettings::autoimagesequence());
- KFileDialog *d = new KFileDialog(KUrl("kfiledialog:///clipfolder"), dialogFilter, kapp->activeWindow(), b);
+ QCheckBox *c = new QCheckBox(i18n("Transparent background for images"));
+ c->setChecked(KdenliveSettings::autoimagetransparency());
+ QFrame *f = new QFrame;
+ f->setFrameShape(QFrame::NoFrame);
+ QHBoxLayout *l = new QHBoxLayout;
+ l->addWidget(b);
+ l->addWidget(c);
+ l->addStretch(5);
+ f->setLayout(l);
+ KFileDialog *d = new KFileDialog(KUrl("kfiledialog:///clipfolder"), dialogFilter, kapp->activeWindow(), f);
d->setOperationMode(KFileDialog::Opening);
d->setMode(KFile::Files);
- d->exec();
+ if (d->exec() == QDialog::Accepted) {
+ KdenliveSettings::setAutoimagetransparency(c->isChecked());
+ }
list = d->selectedUrls();
if (b->isChecked() && list.count() == 1) {
// Check for image sequence
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 size = properties.value("frame_size");
+ DocClipBase *clip = item->referencedClip();
+ if (useProxy() && (item->clipType() == AV || item->clipType() == VIDEO) && 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 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();
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);
}
CLIPTYPE t = item->clipType();
if ((t == VIDEO || t == AV || t == UNKNOWN) && item->referencedClip() != NULL) {
- if (useProxy()) {
+ 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(), proxyParams());
+ 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