if (type->name().startsWith("image/")) {
prod.setAttribute("type", (int) IMAGE);
prod.setAttribute("in", 0);
- prod.setAttribute("out", m_doc->getFramePos(KdenliveSettings::image_duration()) - 1);
+ prod.setAttribute("out", m_doc->getFramePos(KdenliveSettings::image_duration()));
if (KdenliveSettings::autoimagetransparency()) prod.setAttribute("transparency", 1);
// Read EXIF metadata for JPEG
if (type->is("image/jpeg")) {
if (out > 0)
prod.setAttribute("out", out);
else
- prod.setAttribute("out", m_doc->getFramePos(KdenliveSettings::title_duration()) - 1);
+ prod.setAttribute("out", m_doc->getFramePos(KdenliveSettings::title_duration()));
} else
txtfile.close();
}
uint id = m_clipIdCounter++;
prod.setAttribute("id", QString::number(id));
prod.setAttribute("in", "0");
- prod.setAttribute("out", m_doc->getFramePos(duration) - 1);
+ prod.setAttribute("out", m_doc->getFramePos(duration));
prod.setAttribute("name", name);
if (!group.isEmpty()) {
prod.setAttribute("groupname", group);
uint id = m_clipIdCounter++;
prod.setAttribute("id", QString::number(id));
prod.setAttribute("in", "0");
- prod.setAttribute("out", m_doc->getFramePos(duration) * count - 1);
+ prod.setAttribute("out", m_doc->getFramePos(duration) * count);
prod.setAttribute("ttl", m_doc->getFramePos(duration));
prod.setAttribute("luma_duration", m_doc->getFramePos(luma_duration));
prod.setAttribute("name", name);
out = titledoc.documentElement().attribute("out").toInt();
} else txtfile.close();
- if (out == 0) out = m_doc->getFramePos(KdenliveSettings::image_duration()) - 1;
+ if (out == 0) out = m_doc->getFramePos(KdenliveSettings::image_duration());
prod.setAttribute("out", out);
AddClipCommand *command = new AddClipCommand(m_doc, doc.documentElement(), QString::number(id), true);
setAttribute(Qt::WA_DeleteOnClose, true);
setFont(KGlobalSettings::toolBarFont());
m_view.setupUi(this);
+
+ // force transparency is only for group properties, so hide it
+ m_view.clip_force_transparency->setHidden(true);
+ m_view.clip_transparency->setHidden(true);
+
KUrl url = m_clip->fileURL();
m_view.clip_path->setText(url.path());
m_view.clip_description->setText(m_clip->description());
m_view.clip_duration->setValidator(tc.validator());
m_view.clip_duration->setText(tc.getTimecode(m_clip->duration()));
if (t != IMAGE && t != COLOR && t != TEXT) m_view.clip_duration->setReadOnly(true);
- else connect(m_view.clip_duration, SIGNAL(editingFinished()), this, SLOT(slotCheckMaxLength()));
+ else {
+ connect(m_view.clip_duration, SIGNAL(editingFinished()), this, SLOT(slotCheckMaxLength()));
+ connect(m_view.clip_duration, SIGNAL(textChanged(QString)), this, SLOT(slotModified()));
+ }
// markers
m_view.marker_new->setIcon(KIcon("document-new"));
setFont(KGlobalSettings::toolBarFont());
m_view.setupUi(this);
QString title = windowTitle();
- title.append(" " + i18np("(%1 clip)", "(%1 clips)", cliplist.count()).arg(cliplist.count()));
+ title.append(" " + i18np("(%1 clip)", "(%1 clips)", cliplist.count()));
setWindowTitle(title);
QMap <QString, QString> props = cliplist.at(0)->properties();
m_old_props = commonproperties;
if (commonproperties.contains("full_luma") && !commonproperties.value("full_luma").isEmpty()) {
m_view.clip_full_luma->setChecked(true);
}
+
+ if (commonproperties.contains("transparency")) {
+ // image transparency checkbox
+ int transparency = commonproperties.value("transparency").toInt();
+ if (transparency == 0) {
+ m_view.clip_force_transparency->setChecked(true);
+ }
+ else if (transparency == 1) {
+ m_view.clip_force_transparency->setChecked(true);
+ m_view.clip_transparency->setCurrentIndex(1);
+ }
+ }
+ else {
+ m_view.clip_force_transparency->setHidden(true);
+ m_view.clip_transparency->setHidden(true);
+ }
+
+ connect(m_view.clip_force_transparency, SIGNAL(toggled(bool)), m_view.clip_transparency, SLOT(setEnabled(bool)));
connect(m_view.clip_force_ar, SIGNAL(toggled(bool)), m_view.clip_ar_num, SLOT(setEnabled(bool)));
connect(m_view.clip_force_ar, SIGNAL(toggled(bool)), m_view.clip_ar_den, SLOT(setEnabled(bool)));
connect(m_view.clip_force_progressive, SIGNAL(toggled(bool)), m_view.clip_progressive, SLOT(setEnabled(bool)));
m_clipNeedsRefresh = true;
}
} else {
- if (m_old_props.contains("force_aspect_num")) {
+ if (m_old_props.contains("force_aspect_num") && !m_old_props.value("force_aspect_num").isEmpty()) {
props["force_aspect_num"].clear();
m_clipNeedsRefresh = true;
}
- if (m_old_props.contains("force_aspect_den")) {
+ if (m_old_props.contains("force_aspect_den") && !m_old_props.value("force_aspect_den").isEmpty()) {
props["force_aspect_den"].clear();
m_clipNeedsRefresh = true;
}
props["force_fps"] = QString::number(fps);
m_clipNeedsRefresh = true;
}
- } else if (m_old_props.contains("force_fps")) {
+ } else if (m_old_props.contains("force_fps") && !m_old_props.value("force_fps").isEmpty()) {
props["force_fps"].clear();
m_clipNeedsRefresh = true;
}
if (progressive != m_old_props.value("force_progressive").toInt()) {
props["force_progressive"] = QString::number(progressive);
}
- } else if (m_old_props.contains("force_progressive")) {
+ } else if (m_old_props.contains("force_progressive") && !m_old_props.value("force_progressive").isEmpty()) {
props["force_progressive"].clear();
}
if (fieldOrder != m_old_props.value("force_tff").toInt()) {
props["force_tff"] = QString::number(fieldOrder);
}
- } else if (m_old_props.contains("force_tff")) {
+ } else if (m_old_props.contains("force_tff") && !m_old_props.value("force_tff").isEmpty()) {
props["force_tff"].clear();
}
if (threads != m_old_props.value("threads").toInt()) {
props["threads"] = QString::number(threads);
}
- } else if (m_old_props.contains("threads")) {
+ } else if (m_old_props.contains("threads") && !m_old_props.value("threads").isEmpty()) {
props["threads"].clear();
}
if (vindex != m_old_props.value("video_index").toInt()) {
props["video_index"] = QString::number(vindex);
}
- } else if (m_old_props.contains("video_index")) {
+ } else if (m_old_props.contains("video_index") && !m_old_props.value("video_index").isEmpty()) {
props["video_index"].clear();
}
if (aindex != m_old_props.value("audio_index").toInt()) {
props["audio_index"] = QString::number(aindex);
}
- } else if (m_old_props.contains("audio_index")) {
+ } else if (m_old_props.contains("audio_index") && !m_old_props.value("audio_index").isEmpty()) {
props["audio_index"].clear();
}
props["force_colorspace"] = QString::number(colorspace);
m_clipNeedsRefresh = true;
}
- } else if (m_old_props.contains("force_colorspace")) {
+ } else if (m_old_props.contains("force_colorspace") && !m_old_props.value("force_colorspace").isEmpty()) {
props["force_colorspace"].clear();
m_clipNeedsRefresh = true;
}
if (m_view.clip_full_luma->isChecked()) {
props["full_luma"] = QString::number(1);
m_clipNeedsRefresh = true;
- } else if (m_old_props.contains("full_luma")) {
+ } else if (m_old_props.contains("full_luma") && !m_old_props.value("full_luma").isEmpty()) {
props["full_luma"].clear();
m_clipNeedsRefresh = true;
}
+
+ if (m_view.clip_force_transparency->isChecked()) {
+ QString transp = QString::number(m_view.clip_transparency->currentIndex());
+ if (transp != m_old_props.value("transparency")) props["transparency"] = transp;
+ }
// If we adjust several clips, return now
if (m_clip == NULL) {
#include "clipproperties.moc"
+
void DocClipBase::slotRefreshProducer()
{
if (m_baseTrackProducers.count() == 0) return;
- kDebug() << "//////////// REFRESH CLIP !!!!!!!!!!!!!!!!";
if (m_clipType == SLIDESHOW) {
/*Mlt::Producer producer(*(m_clipProducer->profile()), getProperty("resource").toUtf8().data());
delete m_clipProducer;
ClipProperties dia(cliplist, m_activeDocument->timecode(), commonproperties, this);
if (dia.exec() == QDialog::Accepted) {
QUndoCommand *command = new QUndoCommand();
+ QMap <QString, QString> newImageProps = dia.properties();
+ // Transparency setting applies only for images
+ QMap <QString, QString> newProps = newImageProps;
+ newProps.remove("transparency");
command->setText(i18n("Edit clips"));
for (int i = 0; i < cliplist.count(); i++) {
DocClipBase *clip = cliplist.at(i);
- new EditClipCommand(m_projectList, clip->getId(), clip->properties(), dia.properties(), true, command);
+ if (clip->clipType() == IMAGE)
+ new EditClipCommand(m_projectList, clip->getId(), clip->properties(), newImageProps, true, command);
+ else
+ new EditClipCommand(m_projectList, clip->getId(), clip->properties(), newProps, true, command);
}
m_activeDocument->commandStack()->push(command);
for (int i = 0; i < cliplist.count(); i++)
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);
}
}
}
// setup length here as otherwise default length (currently 15000 frames in MLT) will be taken even if outpoint is larger
- if (type == COLOR || type == TEXT || type == IMAGE || type == SLIDESHOW)
- producer->set("length", xml.attribute("out").toInt() - xml.attribute("in").toInt() + 1);
+ if (type == COLOR || type == TEXT || type == IMAGE || type == SLIDESHOW) {
+ int length;
+ if (xml.hasAttribute("length")) length = xml.attribute("length").toInt();
+ else length = xml.attribute("out").toInt() - xml.attribute("in").toInt();
+ producer->set("length", length);
+ }
if (xml.hasAttribute("out"))
producer->set_in_and_out(xml.attribute("in").toInt(), xml.attribute("out").toInt());
delete fs;
}
if (!url.isEmpty()) {
- if (m_titledocument.saveDocument(url, m_startViewport, m_endViewport, m_tc.getFrameCount(title_duration->text()) - 1, embed_image) == false)
+ if (m_titledocument.saveDocument(url, m_startViewport, m_endViewport, m_tc.getFrameCount(title_duration->text()), embed_image) == false)
KMessageBox::error(this, i18n("Cannot write to file %1", url.path()));
}
}
QDomDocument TitleWidget::xml()
{
QDomDocument doc = m_titledocument.xml(m_startViewport, m_endViewport);
- doc.documentElement().setAttribute("out", m_tc.getFrameCount(title_duration->text()) - 1);
+ doc.documentElement().setAttribute("out", m_tc.getFrameCount(title_duration->text()));
return doc;
}
int TitleWidget::outPoint() const
{
- return m_tc.getFrameCount(title_duration->text()) - 1;
+ return m_tc.getFrameCount(title_duration->text());
}
void TitleWidget::setXml(QDomDocument doc)
int out;
m_count = m_titledocument.loadFromXml(doc, m_startViewport, m_endViewport, &out, m_projectTitlePath);
adjustFrameSize();
- title_duration->setText(m_tc.getTimecode(GenTime(out + 1, m_render->fps())));
+ title_duration->setText(m_tc.getTimecode(GenTime(out, m_render->fps())));
/*if (doc.documentElement().hasAttribute("out")) {
GenTime duration = GenTime(doc.documentElement().attribute("out").toDouble() / 1000.0);
title_duration->setText(m_tc.getTimecode(duration));
<rect>
<x>0</x>
<y>0</y>
- <width>308</width>
- <height>507</height>
+ <width>280</width>
+ <height>520</height>
</rect>
</property>
<property name="windowTitle">
<string>Advanced</string>
</attribute>
<layout class="QGridLayout" name="gridLayout_3">
- <item row="11" column="2">
+ <item row="12" column="2">
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
</widget>
</item>
- <item row="9" column="1">
+ <item row="9" column="1" colspan="2">
<widget class="QCheckBox" name="clip_full_luma">
<property name="text">
<string>Full luma range</string>
</property>
</widget>
</item>
+ <item row="10" column="1">
+ <widget class="QCheckBox" name="clip_force_transparency">
+ <property name="text">
+ <string>Image background</string>
+ </property>
+ </widget>
+ </item>
+ <item row="10" column="2">
+ <widget class="KComboBox" name="clip_transparency">
+ <item>
+ <property name="text">
+ <string>Normal</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Transparent</string>
+ </property>
+ </item>
+ </widget>
+ </item>
</layout>
</widget>
</widget>