Commit 020bb22a authored by Jean-Baptiste Mardelle's avatar Jean-Baptiste Mardelle
Browse files

Merge branch 'master' of invent.kde.org:multimedia/kdenlive

parents 9080a829 66b91728
Pipeline #89277 passed with stage
in 8 minutes and 44 seconds
......@@ -4600,18 +4600,23 @@ bool Bin::addProjectClipInFolder(const QString &path, const QString &parentFolde
if (!baseFolder) {
baseFolder = m_itemModel->getRootFolder();
}
for (int i = 0; i < baseFolder->childCount(); ++i) {
auto currentItem = std::static_pointer_cast<AbstractProjectItem>(baseFolder->child(i));
if (currentItem->itemType() == AbstractProjectItem::FolderItem && currentItem->name() == folderName) {
found = true;
folderId = currentItem->clipId();
break;
if (folderName.isEmpty()) {
// Put clip in parentFolder
folderId = baseFolder->clipId();
} else {
for (int i = 0; i < baseFolder->childCount(); ++i) {
auto currentItem = std::static_pointer_cast<AbstractProjectItem>(baseFolder->child(i));
if (currentItem->itemType() == AbstractProjectItem::FolderItem && currentItem->name() == folderName) {
found = true;
folderId = currentItem->clipId();
break;
}
}
}
if (!found) {
// if it was not found, create folder
m_itemModel->requestAddFolder(folderId, folderName, parentFolder, undo, redo);
if (!found) {
// if it was not found, create folder
m_itemModel->requestAddFolder(folderId, folderName, parentFolder, undo, redo);
}
}
auto id = ClipCreator::createClipFromFile(path, folderId, m_itemModel, undo, redo);
bool ok = (id != QStringLiteral("-1"));
......
......@@ -587,6 +587,9 @@ bool ProjectClip::setProducer(std::shared_ptr<Mlt::Producer> producer)
if (!skipProducer && getProducerIntProperty(QStringLiteral("meta.media.width")) >= KdenliveSettings::proxyminsize()) {
clipList << std::static_pointer_cast<ProjectClip>(shared_from_this());
}
} else if (m_clipType == ClipType::Playlist && pCore->getCurrentFrameDisplaySize().width() >= KdenliveSettings::proxyminsize() &&
getProducerProperty(QStringLiteral("kdenlive:proxy")) == QLatin1String()) {
clipList << std::static_pointer_cast<ProjectClip>(shared_from_this());
}
if (!clipList.isEmpty()) {
generateProxy = true;
......
......@@ -2218,10 +2218,10 @@ bool DocumentValidator::checkMovit()
bool hasWB = EffectsRepository::get()->exists(QStringLiteral("frei0r.colgate"));
bool hasBlur = EffectsRepository::get()->exists(QStringLiteral("frei0r.IIRblur"));
QString compositeTrans;
if (TransitionsRepository::get()->exists(QStringLiteral("qtblend"))) {
compositeTrans = QStringLiteral("qtblend");
} else if (TransitionsRepository::get()->exists(QStringLiteral("frei0r.cairoblend"))) {
if (TransitionsRepository::get()->exists(QStringLiteral("frei0r.cairoblend"))) {
compositeTrans = QStringLiteral("frei0r.cairoblend");
} else if (TransitionsRepository::get()->exists(QStringLiteral("qtblend"))) {
compositeTrans = QStringLiteral("qtblend");
}
// Parse all effects in document
......
......@@ -77,12 +77,17 @@ void SpeedTask::start(QObject* object, bool force)
l->addWidget(&lab);
l->addWidget(&speedInput);
l->addWidget(&cb);
QCheckBox cb2(i18n("Add clip to \"Speed Change\" folder"), &d);
cb2.setChecked(KdenliveSettings::add_new_clip_to_folder());
l->addWidget(&cb2);
l->addWidget(&buttonBox);
d.connect(&buttonBox, &QDialogButtonBox::rejected, &d, &QDialog::reject);
d.connect(&buttonBox, &QDialogButtonBox::accepted, &d, &QDialog::accept);
if (d.exec() != QDialog::Accepted) {
return;
}
bool addToFolder = cb2.isChecked();
KdenliveSettings::setAdd_new_clip_to_folder(addToFolder);
double speed = speedInput.value();
bool warp_pitch = cb.isChecked();
std::unordered_map<QString, QString> destinations; // keys are binIds, values are path to target files
......@@ -144,6 +149,7 @@ void SpeedTask::start(QObject* object, bool force)
if (task) {
// Otherwise, start a filter thread.
task->m_isForce = force;
task->m_addToFolder = addToFolder;
pCore->taskManager.startTask(owner.second, task);
}
}
......@@ -231,7 +237,7 @@ void SpeedTask::run()
return;
}
QMetaObject::invokeMethod(pCore->bin(), "addProjectClipInFolder", Qt::QueuedConnection, Q_ARG(const QString&,m_destination), Q_ARG(const QString&,binClip->parent()->clipId()), Q_ARG(const QString&,i18n("Speed Change")));
QMetaObject::invokeMethod(pCore->bin(), "addProjectClipInFolder", Qt::QueuedConnection, Q_ARG(const QString&,m_destination), Q_ARG(const QString&,binClip->parent()->clipId()), Q_ARG(const QString&,m_addToFolder ? i18n("Speed Change") : QString()));
return;
}
......
......@@ -39,6 +39,7 @@ private:
QStringList m_consumerArgs;
QString m_errorMessage;
QString m_logDetails;
bool m_addToFolder;
std::unique_ptr<QProcess> m_jobProcess;
};
......
......@@ -24,7 +24,7 @@ SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
#include <klocalizedstring.h>
StabilizeTask::StabilizeTask(const ObjectId &owner, const QString &binId, const QString &destination, int in, int out, bool autoAddClip, std::unordered_map<QString, QVariant> filterParams, QObject* object)
StabilizeTask::StabilizeTask(const ObjectId &owner, const QString &binId, const QString &destination, int in, int out, std::pair<bool,bool> autoAddClip, std::unordered_map<QString, QVariant> filterParams, QObject* object)
: AbstractTask(owner, AbstractTask::STABILIZEJOB, object)
, m_binId(binId)
, m_inPoint(in)
......@@ -57,6 +57,8 @@ void StabilizeTask::start(QObject* object, bool force)
}
// Now we have to create the jobs objects. This is trickier than usual, since the parameters are different for each job (each clip has its own
// destination). We have to construct a lambda that does that.
bool autoAdd = d->autoAddClip();
bool addToFolder = d->addClipInFolder();
for (auto & id : binIds) {
StabilizeTask* task = nullptr;
ObjectId owner;
......@@ -70,14 +72,14 @@ void StabilizeTask::start(QObject* object, bool force)
owner = ObjectId(ObjectType::BinClip, binData.first().toInt());
auto binClip = pCore->projectItemModel()->getClipByBinID(binData.first());
if (binClip) {
task = new StabilizeTask(owner, binData.first(), destinations.at(id), binData.at(1).toInt(), binData.at(2).toInt(), d->autoAddClip(), filterParams, binClip.get());
task = new StabilizeTask(owner, binData.first(), destinations.at(id), binData.at(1).toInt(), binData.at(2).toInt(), {autoAdd,addToFolder}, filterParams, binClip.get());
}
} else {
// Process full clip
owner = ObjectId(ObjectType::BinClip, id.toInt());
auto binClip = pCore->projectItemModel()->getClipByBinID(id);
if (binClip) {
task = new StabilizeTask(owner, id, destinations.at(id), -1, -1, d->autoAddClip(), filterParams, binClip.get());
task = new StabilizeTask(owner, id, destinations.at(id), -1, -1, {autoAdd,addToFolder}, filterParams, binClip.get());
}
}
if (task) {
......@@ -180,8 +182,8 @@ void StabilizeTask::run()
}
return;
}
if (m_addToProject) {
QMetaObject::invokeMethod(pCore->bin(), "addProjectClipInFolder", Qt::QueuedConnection, Q_ARG(const QString&,m_destination), Q_ARG(const QString&,binClip->parent()->clipId()), Q_ARG(const QString&,i18n("Stabilized")));
if (m_addToProject.first) {
QMetaObject::invokeMethod(pCore->bin(), "addProjectClipInFolder", Qt::QueuedConnection, Q_ARG(const QString&,m_destination), Q_ARG(const QString&,binClip->parent()->clipId()), Q_ARG(const QString&,m_addToProject.second ? i18n("Stabilized") : QString()));
}
}
......
......@@ -17,7 +17,7 @@ class QProcess;
class StabilizeTask : public AbstractTask
{
public:
StabilizeTask(const ObjectId &owner, const QString &binId, const QString &destination, int in, int out, bool autoAddClip, std::unordered_map<QString, QVariant> filterParams, QObject* object);
StabilizeTask(const ObjectId &owner, const QString &binId, const QString &destination, int in, int out, std::pair<bool,bool> autoAddClip, std::unordered_map<QString, QVariant> filterParams, QObject* object);
static void start(QObject* object, bool force = false);
int length;
......@@ -37,7 +37,7 @@ private:
QString m_errorMessage;
QString m_logDetails;
std::unique_ptr<QProcess> m_jobProcess;
bool m_addToProject;
std::pair<bool,bool> m_addToProject;
};
......
......@@ -1120,7 +1120,12 @@
</entry>
<entry name="add_new_clip" type="Bool">
<label>Add cut clips to project after transcoding.</label>
<label>Add task clips to project after processing.</label>
<default>true</default>
</entry>
<entry name="add_new_clip_to_folder" type="Bool">
<label>Add task clips in a specific folder after processing.</label>
<default>true</default>
</entry>
......
......@@ -34,6 +34,7 @@ ClipStabilize::ClipStabilize(const std::vector<QString> &binIds, QString filterN
setWindowTitle(i18n("Stabilize Clip"));
auto_add->setText(i18ncp("@action", "Add clip to project", "Add clips to project", m_binIds.size()));
auto_add->setChecked(KdenliveSettings::add_new_clip());
auto_folder->setChecked(KdenliveSettings::add_new_clip_to_folder());
// QString stylesheet = EffectStackView2::getStyleSheet();
// setStyleSheet(stylesheet);
......@@ -83,6 +84,7 @@ ClipStabilize::~ClipStabilize()
m_stabilizeProcess.close();
}*/
KdenliveSettings::setAdd_new_clip(auto_add->isChecked());
KdenliveSettings::setAdd_new_clip_to_folder(auto_folder->isChecked());
}
std::unordered_map<QString, QVariant> ClipStabilize::filterParams() const
......@@ -120,6 +122,11 @@ bool ClipStabilize::autoAddClip() const
return auto_add->isChecked();
}
bool ClipStabilize::addClipInFolder() const
{
return auto_folder->isChecked();
}
void ClipStabilize::slotValidate()
{
if (m_binIds.size() == 1) {
......
......@@ -26,6 +26,8 @@ public:
~ClipStabilize() override;
/** @brief Should the generated clip be added to current project. */
bool autoAddClip() const;
/** @brief Should the generated clip be moved in a specific folder. */
bool addClipInFolder() const;
/** @brief Return the filter parameters, filter name as value of "filter" entry. */
std::unordered_map<QString, QVariant> filterParams() const;
/** @brief Return the destination file or folder. */
......
......@@ -359,7 +359,7 @@ bool constructTrackFromMelt(const std::shared_ptr<TimelineItemModel> &timeline,
m_notesLog << i18n("%1 Timeline clip (%2) with incorrect bin reference found and recovered.", tcInfo, clip->parent().get("id"));
m_errorMessage << i18n("Invalid clip %1 (%2) not found in project bin, recovered.", clip->parent().get("id"), clipId);
} else {
m_notesLog << i18n("%1 Timeline clip (%2) without bin refrence found and removed.", tcInfo, clip->parent().get("id"));
m_notesLog << i18n("%1 Timeline clip (%2) without bin reference found and removed.", tcInfo, clip->parent().get("id"));
m_errorMessage << i18n("Project corrupted. Clip %1 (%2) not found in project bin.", clip->parent().get("id"), clipId);
// Do not try to insert clip
continue;
......
......@@ -158,12 +158,12 @@ const QString TransitionsRepository::getCompositingTransition()
if (KdenliveSettings::gpu_accel()) {
return QStringLiteral("movit.overlay");
}
if (exists(QStringLiteral("qtblend"))) {
return QStringLiteral("qtblend");
}
if (exists(QStringLiteral("frei0r.cairoblend"))) {
return QStringLiteral("frei0r.cairoblend");
}
if (exists(QStringLiteral("qtblend"))) {
return QStringLiteral("qtblend");
}
if (exists(QStringLiteral("composite"))) {
return QStringLiteral("composite");
}
......
......@@ -6,18 +6,31 @@
<rect>
<x>0</x>
<y>0</y>
<width>349</width>
<height>160</height>
<width>324</width>
<height>198</height>
</rect>
</property>
<property name="windowTitle">
<string>Dialog</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="1" column="0" colspan="4">
<widget class="QLabel" name="label_3">
<item row="6" column="1" colspan="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="4" column="0" colspan="4">
<widget class="QCheckBox" name="auto_add">
<property name="text">
<string>Options</string>
<string>Add clip to project</string>
</property>
</widget>
</item>
......@@ -28,13 +41,26 @@
</property>
</widget>
</item>
<item row="4" column="0" colspan="4">
<widget class="QCheckBox" name="auto_add">
<item row="1" column="0" colspan="4">
<widget class="QLabel" name="label_3">
<property name="text">
<string>Add clip to project</string>
<string>Options</string>
</property>
</widget>
</item>
<item row="6" column="3">
<widget class="QDialogButtonBox" name="buttonBox">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="standardButtons">
<set>QDialogButtonBox::Abort|QDialogButtonBox::Ok</set>
</property>
</widget>
</item>
<item row="0" column="1" colspan="3">
<widget class="KUrlRequester" name="dest_url"/>
</item>
<item row="3" column="0">
<spacer name="verticalSpacer">
<property name="orientation">
......@@ -48,19 +74,6 @@
</property>
</spacer>
</item>
<item row="0" column="2" colspan="2">
<widget class="KUrlRequester" name="dest_url"/>
</item>
<item row="5" column="3">
<widget class="QDialogButtonBox" name="buttonBox">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="standardButtons">
<set>QDialogButtonBox::Abort|QDialogButtonBox::Ok</set>
</property>
</widget>
</item>
<item row="2" column="0" colspan="4">
<widget class="QWidget" name="optionsbox" native="true">
<property name="sizePolicy">
......@@ -71,7 +84,7 @@
</property>
</widget>
</item>
<item row="5" column="0">
<item row="6" column="0">
<widget class="QToolButton" name="preset_button">
<property name="text">
<string>...</string>
......@@ -81,25 +94,22 @@
</property>
</widget>
</item>
<item row="5" column="1" colspan="2">
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
<item row="5" column="0" colspan="4">
<widget class="QCheckBox" name="auto_folder">
<property name="enabled">
<bool>false</bool>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
<property name="text">
<string>Put clip in &quot;Stabilized&quot; folder</string>
</property>
</spacer>
</widget>
</item>
</layout>
</widget>
<customwidgets>
<customwidget>
<class>KUrlRequester</class>
<extends>QFrame</extends>
<extends>QWidget</extends>
<header>kurlrequester.h</header>
<container>1</container>
</customwidget>
......@@ -122,5 +132,21 @@
</hint>
</hints>
</connection>
<connection>
<sender>auto_add</sender>
<signal>toggled(bool)</signal>
<receiver>auto_folder</receiver>
<slot>setEnabled(bool)</slot>
<hints>
<hint type="sourcelabel">
<x>161</x>
<y>109</y>
</hint>
<hint type="destinationlabel">
<x>161</x>
<y>143</y>
</hint>
</hints>
</connection>
</connections>
</ui>
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