aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJean-Baptiste Mardelle <[email protected]>2015-07-17 00:58:45 +0200
committerJean-Baptiste Mardelle <[email protected]>2015-07-17 00:58:45 +0200
commite097fdb6a095bc909b9e7a1c3f203a3b5f4e743a (patch)
tree2d56772abd2763a9aa463e85f6188e01df3e2a93
parent3ff3f2b410fe623174421e82cc22c47881f9182b (diff)
Restore auto add transition for titles and transparent images
-rw-r--r--src/bin/projectclip.cpp7
-rw-r--r--src/bin/projectclip.h5
-rw-r--r--src/dialogs/clipcreationdialog.cpp5
-rw-r--r--src/mltcontroller/clippropertiescontroller.cpp21
-rw-r--r--src/timeline/customtrackview.cpp5
5 files changed, 33 insertions, 10 deletions
diff --git a/src/bin/projectclip.cpp b/src/bin/projectclip.cpp
index 036ba51..12cec02 100644
--- a/src/bin/projectclip.cpp
+++ b/src/bin/projectclip.cpp
@@ -874,3 +874,10 @@ void ProjectClip::slotCreateAudioThumbs()
}
m_abortAudioThumb = false;
}
+
+bool ProjectClip::isTransparent() const
+{
+ if (m_type == Text) return true;
+ if (m_type == Image && m_controller->int_property("kdenlive:transparency") == 1) return true;
+ return false;
+}
diff --git a/src/bin/projectclip.h b/src/bin/projectclip.h
index 39b3f38..38ceeb3 100644
--- a/src/bin/projectclip.h
+++ b/src/bin/projectclip.h
@@ -85,10 +85,11 @@ public:
ClipType clipType() const;
ClipPropertiesController *buildProperties(QWidget *parent);
QPoint zone() const;
- //TODO
void addMarker(int position);
- //TODO
void removeMarker(int position);
+
+ /** @brief Returns true if we want to add an affine transition in timeline when dropping this clip. */
+ bool isTransparent() const;
/** @brief Returns whether this clip has a url (=describes a file) or not. */
bool hasUrl() const;
diff --git a/src/dialogs/clipcreationdialog.cpp b/src/dialogs/clipcreationdialog.cpp
index 5751b93..417cc05 100644
--- a/src/dialogs/clipcreationdialog.cpp
+++ b/src/dialogs/clipcreationdialog.cpp
@@ -353,7 +353,6 @@ void ClipCreationDialog::createClipsCommand(KdenliveDoc *doc, const QList<QUrl>
i.next();
properties.insert(i.key(), i.value());
}
- addXmlProperties(prod, properties);
//prod.setAttribute("resource", file.path());
uint id = bin->getFreeClipId();
prod.setAttribute("id", QString::number(id));
@@ -363,7 +362,7 @@ void ClipCreationDialog::createClipsCommand(KdenliveDoc *doc, const QList<QUrl>
prod.setAttribute("type", (int) Image);
prod.setAttribute("in", 0);
prod.setAttribute("out", doc->getFramePos(KdenliveSettings::image_duration()) - 1);
- if (KdenliveSettings::autoimagetransparency()) prod.setAttribute("transparency", 1);
+ if (KdenliveSettings::autoimagetransparency()) properties.insert("kdenlive:transparency", "1");
// Read EXIF metadata for JPEG
if (type.inherits("image/jpeg")) {
//TODO KF5 how to read metadata?
@@ -399,7 +398,6 @@ void ClipCreationDialog::createClipsCommand(KdenliveDoc *doc, const QList<QUrl>
}
}
}
- prod.setAttribute("transparency", 1);
prod.setAttribute("in", 0);
int duration = 0;
if (txtdoc.documentElement().hasAttribute("duration")) {
@@ -419,6 +417,7 @@ void ClipCreationDialog::createClipsCommand(KdenliveDoc *doc, const QList<QUrl>
txtfile.close();
}
}
+ addXmlProperties(prod, properties);
new AddClipCommand(doc, xml.documentElement(), QString::number(id), true, addClips);
}
if (addClips->childCount() > 0) {
diff --git a/src/mltcontroller/clippropertiescontroller.cpp b/src/mltcontroller/clippropertiescontroller.cpp
index 58c7cf8..f3c4887 100644
--- a/src/mltcontroller/clippropertiescontroller.cpp
+++ b/src/mltcontroller/clippropertiescontroller.cpp
@@ -79,6 +79,17 @@ ClipPropertiesController::ClipPropertiesController(Timecode tc, ClipController *
connect(choosecolor, SIGNAL(modified(QColor)), this, SLOT(slotColorModified(QColor)));
connect(this, SIGNAL(modified(QColor)), choosecolor, SLOT(slotColorModified(QColor)));
}
+ if (m_type == Image) {
+ int transparency = m_properties.get_int("kdenlive:transparency");
+ m_originalProperties.insert("kdenlive:transparency", QString::number(transparency));
+ QHBoxLayout *hlay = new QHBoxLayout;
+ QCheckBox *box = new QCheckBox(i18n("Transparent"), this);
+ box->setObjectName("kdenlive:transparency");
+ box->setChecked(transparency == 1);
+ connect(box, SIGNAL(stateChanged(int)), this, SLOT(slotEnableForce(int)));
+ hlay->addWidget(box);
+ vbox->addLayout(hlay);
+ }
if (m_type == AV || m_type == Video) {
QLocale locale;
QString force_fps = m_properties.get("force_fps");
@@ -195,6 +206,9 @@ void ClipPropertiesController::slotEnableForce(int state)
m_properties.set("kdenlive:original_length", (char *) NULL);
return;
}
+ else if (param == "kdenlive:transparency") {
+ properties.insert(param, QString());
+ }
else {
properties.insert(param, "-");
}
@@ -206,16 +220,19 @@ void ClipPropertiesController::slotEnableForce(int state)
m_properties.set("kdenlive:original_length", m_properties.get_int("length"));
}
}
- if (param == "force_fps") {
+ else if (param == "force_fps") {
QDoubleSpinBox *spin = findChild<QDoubleSpinBox *>(param + "_value");
if (!spin) return;
properties.insert(param, locale.toString(spin->value()));
}
- if (param == "force_colorspace") {
+ else if (param == "force_colorspace") {
QComboBox *combo = findChild<QComboBox *>(param + "_value");
if (!combo) return;
properties.insert(param, QString::number(combo->currentData().toInt()));
}
+ else if (param == "kdenlive:transparency") {
+ properties.insert(param, "1");
+ }
}
if (properties.isEmpty()) return;
emit updateClipProperties(m_id, m_originalProperties, properties);
diff --git a/src/timeline/customtrackview.cpp b/src/timeline/customtrackview.cpp
index d034426..ae1cd29 100644
--- a/src/timeline/customtrackview.cpp
+++ b/src/timeline/customtrackview.cpp
@@ -2792,14 +2792,13 @@ void CustomTrackView::dropEvent(QDropEvent * event)
new AddTimelineClipCommand(this, clipBinId, item->info(), item->effectList(), item->clipState(), m_scene->editMode() == OverwriteEdit, m_scene->editMode() == InsertEdit, false, false, addCommand);
updateTrackDuration(info.track, addCommand);
- //TODO
- /*if (false && item->baseClip()->isTransparent() && getTransitionItemAtStart(info.startPos, info.track) == NULL) {
+ if (item->binClip()->isTransparent() && getTransitionItemAtStart(info.startPos, info.track) == NULL) {
// add transparency transition if space is available
if (canBePastedTo(info, TransitionWidget)) {
QDomElement trans = MainWindow::transitions.getEffectByTag("affine", QString()).cloneNode().toElement();
new AddTransitionCommand(this, info, getPreviousVideoTrack(info.track), trans, false, true, addCommand);
}
- }*/
+ }
item->setSelected(true);
}
// Add refresh command for redo