Add option to keep images at original size when added to project by adding resize filter.

Related to #538
parent 5d12bf5c
Pipeline #15671 passed with stage
in 19 minutes and 21 seconds
......@@ -31,7 +31,10 @@
#include "macros.hpp"
#include "profiles/profilemodel.hpp"
#include "project/dialogs/slideshowclip.h"
#include "effects/effectsrepository.hpp"
#include "effects/effectstack/model/effectstackmodel.hpp"
#include "monitor/monitor.h"
#include "xml/xml.hpp"
#include <KMessageWidget>
#include <QMimeDatabase>
......@@ -79,7 +82,6 @@ ClipType::ProducerType getTypeForService(const QString &id, const QString &path)
if (id == QLatin1String("qml")) {
return ClipType::Qml;
}
return ClipType::Unknown;
}
......@@ -665,6 +667,29 @@ bool LoadJob::commitResult(Fun &undo, Fun &redo)
};
bool ok = operation();
if (ok) {
if (KdenliveSettings::disableimagescaling() && m_binClip->clipType() == ClipType::Image && !m_binClip->hasEffects()) {
// Add effect to have image at source size
QSize size = m_binClip->getFrameSize();
if (size.isValid() && !size.isNull() && size != pCore->getCurrentFrameSize()) {
// Image has a different size than project profile, create effect
QDomDocument doc("effects");
QDomElement root = doc.createElement("effects");
doc.appendChild(root);
QDomElement main = doc.createElement("effect");
QMap<QString, QString> properties;
if (EffectsRepository::get()->exists(QStringLiteral("pan_zoom"))) {
main.setAttribute(QStringLiteral("id"), QStringLiteral("pan_zoom"));
properties.insert(QStringLiteral("transition.geometry"), QString("0=\"0 0 %1 %2\"").arg(size.width()).arg(size.height()));
} else {
main.setAttribute(QStringLiteral("id"), QStringLiteral("qtblend"));
properties.insert(QStringLiteral("rect"), QString("0=\"0 0 %1 %2 1\"").arg(size.width()).arg(size.height()));
}
root.appendChild(main);
Xml::addXmlProperties(main, properties);
m_binClip->getEffectStack()->fromXml(doc.documentElement(), undo, redo);
qDebug()<<"== DOC2: "<< doc.toString();
}
}
m_readyCallBack();
if (pCore->projectItemModel()->clipsCount() == 1) {
// Always select first added clip
......
......@@ -77,6 +77,10 @@
<label>Automatically import image sequences.</label>
<default>false</default>
</entry>
<entry name="disableimagescaling" type="Bool">
<label>Add a filter to disable default image scaling.</label>
<default>false</default>
</entry>
<entry name="automultistreams" type="Bool">
<label>Automatically import all streams in multi streams clips.</label>
......
......@@ -11,10 +11,10 @@
</rect>
</property>
<layout class="QGridLayout" name="gridLayout_2">
<item row="7" column="0" colspan="3">
<widget class="QCheckBox" name="kcfg_use_exiftool">
<item row="1" column="0">
<widget class="QCheckBox" name="kcfg_crashrecovery">
<property name="text">
<string>Get clip metadata with exiftool</string>
<string>Activate crash recovery (auto save)</string>
</property>
</widget>
</item>
......@@ -32,6 +32,20 @@
</property>
</widget>
</item>
<item row="3" column="0" colspan="3">
<widget class="QCheckBox" name="kcfg_usekuiserver">
<property name="text">
<string>Use KDE job tracking for render jobs</string>
</property>
</widget>
</item>
<item row="7" column="0" colspan="3">
<widget class="QCheckBox" name="kcfg_use_exiftool">
<property name="text">
<string>Get clip metadata with exiftool</string>
</property>
</widget>
</item>
<item row="4" column="0" colspan="3">
<widget class="QCheckBox" name="kcfg_disable_effect_parameters">
<property name="text">
......@@ -39,6 +53,64 @@
</property>
</widget>
</item>
<item row="2" column="0" colspan="3">
<widget class="QCheckBox" name="kcfg_checkfirstprojectclip">
<property name="text">
<string>Check if first added clip matches project profile</string>
</property>
</widget>
</item>
<item row="9" column="1">
<widget class="QComboBox" name="kcfg_tabposition">
<item>
<property name="text">
<string>Top</string>
</property>
</item>
<item>
<property name="text">
<string>Bottom</string>
</property>
</item>
<item>
<property name="text">
<string>Left</string>
</property>
</item>
<item>
<property name="text">
<string>Right</string>
</property>
</item>
</widget>
</item>
<item row="9" column="0">
<widget class="QLabel" name="label_4">
<property name="text">
<string>Tab position</string>
</property>
</widget>
</item>
<item row="9" column="2">
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="0" column="0" colspan="3">
<widget class="QCheckBox" name="kcfg_openlastproject">
<property name="text">
<string>Open last project on startup</string>
</property>
</widget>
</item>
<item row="10" column="0" colspan="3">
<widget class="QGroupBox" name="groupBox">
<property name="title">
......@@ -108,37 +180,6 @@
</layout>
</widget>
</item>
<item row="9" column="0">
<widget class="QLabel" name="label_4">
<property name="text">
<string>Tab position</string>
</property>
</widget>
</item>
<item row="9" column="1">
<widget class="QComboBox" name="kcfg_tabposition">
<item>
<property name="text">
<string>Top</string>
</property>
</item>
<item>
<property name="text">
<string>Bottom</string>
</property>
</item>
<item>
<property name="text">
<string>Left</string>
</property>
</item>
<item>
<property name="text">
<string>Right</string>
</property>
</item>
</widget>
</item>
<item row="11" column="0" colspan="3">
<widget class="QCheckBox" name="kcfg_autoimagesequence">
<property name="text">
......@@ -146,19 +187,6 @@
</property>
</widget>
</item>
<item row="9" column="2">
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="6" column="0" colspan="3">
<widget class="QCheckBox" name="kcfg_bypasscodeccheck">
<property name="text">
......@@ -166,7 +194,7 @@
</property>
</widget>
</item>
<item row="12" column="1">
<item row="13" column="0">
<spacer>
<property name="orientation">
<enum>Qt::Vertical</enum>
......@@ -179,31 +207,10 @@
</property>
</spacer>
</item>
<item row="1" column="0">
<widget class="QCheckBox" name="kcfg_crashrecovery">
<property name="text">
<string>Activate crash recovery (auto save)</string>
</property>
</widget>
</item>
<item row="2" column="0" colspan="3">
<widget class="QCheckBox" name="kcfg_checkfirstprojectclip">
<property name="text">
<string>Check if first added clip matches project profile</string>
</property>
</widget>
</item>
<item row="3" column="0" colspan="3">
<widget class="QCheckBox" name="kcfg_usekuiserver">
<property name="text">
<string>Use KDE job tracking for render jobs</string>
</property>
</widget>
</item>
<item row="0" column="0" colspan="3">
<widget class="QCheckBox" name="kcfg_openlastproject">
<item row="12" column="0" colspan="3">
<widget class="QCheckBox" name="kcfg_disableimagescaling">
<property name="text">
<string>Open last project on startup</string>
<string>Keep images at original size</string>
</property>
</widget>
</item>
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment