Commit 03c01121 authored by Julius Künzel's avatar Julius Künzel
Browse files

Archive LUT files too

parent 8734dfa0
......@@ -1321,6 +1321,20 @@ const QString EffectStackModel::effectNames() const
return effects.join(QLatin1Char('/'));
}
QStringList EffectStackModel::externalFiles() const
{
QStringList urls;
for (int i = 0; i < rootItem->childCount(); ++i) {
auto filter = std::static_pointer_cast<EffectItemModel>(rootItem->child(i))->filter();
QString url = filter.get("av.file");
if(!url.isEmpty()) {
urls << url;
}
urls << url;
}
return urls;
}
bool EffectStackModel::isStackEnabled() const
{
return m_effectStackEnabled;
......
......@@ -128,6 +128,9 @@ public:
/** @brief Returns a comma separated list of effect names */
const QString effectNames() const;
/** @brief Returns a list of external file urls used by the effects (e.g. LUTs) */
QStringList externalFiles() const;
bool isStackEnabled() const;
/** @brief Returns an XML representation of the effect stack with all parameters */
......
......@@ -3792,7 +3792,7 @@ void MainWindow::slotArchiveProject()
KMessageBox::error(this, i18n("Project file could not be saved for archiving."));
return;
}
QPointer<ArchiveWidget> d(new ArchiveWidget(doc->url().fileName(), sceneData, getMainTimeline()->controller()->extractCompositionLumas(), this));
QPointer<ArchiveWidget> d(new ArchiveWidget(doc->url().fileName(), sceneData, getMainTimeline()->controller()->extractCompositionLumas(), getMainTimeline()->controller()->extractExternalEffectFiles(), this));
if (d->exec() != 0) {
m_messageLabel->setMessage(i18n("Archiving project"), OperationCompletedMessage);
}
......
......@@ -868,6 +868,11 @@ int ClipController::effectsCount()
return count;
}
QStringList ClipController::filesUsedByEffects()
{
return m_effectStack->externalFiles();
}
bool ClipController::hasEffects() const
{
return m_effectStack->rowCount() > 0;
......
......@@ -197,6 +197,8 @@ public:
void setBinEffectsEnabled(bool enabled);
/** @brief Returns the number of Kdenlive added effects for this bin clip */
int effectsCount();
/** @brief Returns all urls of external files used by effects on this bin clip (e.g. LUTs)*/
QStringList filesUsedByEffects();
/** @brief Save an xml playlist of current clip with in/out points as zone.x()/y() */
void saveZone(QPoint zone, const QDir &dir);
......
......@@ -42,7 +42,7 @@
#include <QtConcurrent>
#include <memory>
#include <utility>
ArchiveWidget::ArchiveWidget(const QString &projectName, const QString xmlData, const QStringList &luma_list, QWidget *parent)
ArchiveWidget::ArchiveWidget(const QString &projectName, const QString xmlData, const QStringList &luma_list, const QStringList &other_list, QWidget *parent)
: QDialog(parent)
, m_requestedSize(0)
, m_copyJob(nullptr)
......@@ -110,6 +110,7 @@ ArchiveWidget::ArchiveWidget(const QString &projectName, const QString xmlData,
QStringList allFonts;
QStringList extraImageUrls;
QStringList otherUrls;
otherUrls << other_list;
generateItems(lumas, luma_list);
QMap<QString, QString> slideUrls;
......@@ -153,6 +154,7 @@ ArchiveWidget::ArchiveWidget(const QString &projectName, const QString xmlData,
}
}
}
otherUrls << clip->filesUsedByEffects();
}
generateItems(images, extraImageUrls);
......@@ -161,6 +163,7 @@ ArchiveWidget::ArchiveWidget(const QString &projectName, const QString xmlData,
generateItems(images, imageUrls);
generateItems(slideshows, slideUrls);
generateItems(playlists, playlistUrls);
otherUrls.removeDuplicates();
generateItems(others, otherUrls);
generateItems(proxies, proxyUrls);
......@@ -880,6 +883,31 @@ bool ArchiveWidget::processProjectFile()
}
}
// process mlt filters
prods = mlt.elementsByTagName(QStringLiteral("filter"));
for (int i = 0; i < prods.count(); ++i) {
QDomElement e = prods.item(i).toElement();
if (e.isNull()) {
continue;
}
attribute = QStringLiteral("filename");
QString src = Xml::getXmlProperty(e, attribute);
if (src.isEmpty()) {
attribute = QStringLiteral("av.file");
}
src = Xml::getXmlProperty(e, attribute);
if (!src.isEmpty()) {
if (QFileInfo(src).isRelative()) {
src.prepend(root);
}
QUrl srcUrl = QUrl::fromLocalFile(src);
QUrl dest = m_replacementList.value(srcUrl);
if (!dest.isEmpty()) {
Xml::setXmlProperty(e, attribute, dest.toLocalFile());
}
}
}
QString playList = m_doc.toString();
if (isArchive) {
QString startString(QStringLiteral("\""));
......
......@@ -47,7 +47,7 @@ class ArchiveWidget : public QDialog, public Ui::ArchiveWidget_UI
Q_OBJECT
public:
ArchiveWidget(const QString &projectName, const QString xmlData, const QStringList &luma_list, QWidget *parent = nullptr);
ArchiveWidget(const QString &projectName, const QString xmlData, const QStringList &luma_list, const QStringList &other_list, QWidget *parent = nullptr);
// Constructor for extracting widget
explicit ArchiveWidget(QUrl url, QWidget *parent = nullptr);
~ArchiveWidget() override;
......
......@@ -806,6 +806,12 @@ const QString ClipModel::effectNames() const
return m_effectStack->effectNames();
}
const QStringList ClipModel::externalFiles() const
{
READ_LOCK();
return m_effectStack->externalFiles();
}
int ClipModel::getFakeTrackId() const
{
return m_fakeTrack;
......
......@@ -88,6 +88,9 @@ public:
/** @brief Returns a comma separated list of effect names */
const QString effectNames() const;
/** @brief Returns a list of external files (e.g. LUTs) used by the effects of the clip */
const QStringList externalFiles() const;
/** @brief Returns the timeline clip status (video / audio only) */
PlaylistState::ClipState clipState() const;
/** @brief Returns the bin clip type (image, color, AV, ...) */
......
......@@ -4669,6 +4669,15 @@ QStringList TimelineModel::extractCompositionLumas() const
return urls;
}
QStringList TimelineModel::extractExternalEffectFiles() const
{
QStringList urls;
for (const auto &clip : m_allClips) {
urls << clip.second->externalFiles();
}
return urls;
}
void TimelineModel::adjustAssetRange(int clipId, int in, int out)
{
Q_UNUSED(clipId)
......
......@@ -662,6 +662,9 @@ public:
/** @brief Returns a list of all luma files used in the project
*/
QStringList extractCompositionLumas() const;
/** @brief Returns a list of all external files used by effects in the timeline
*/
QStringList extractExternalEffectFiles() const;
/** @brief Inform asset view of duration change
*/
virtual void adjustAssetRange(int clipId, int in, int out);
......
......@@ -1721,6 +1721,11 @@ QStringList TimelineController::extractCompositionLumas() const
return m_model->extractCompositionLumas();
}
QStringList TimelineController::extractExternalEffectFiles() const
{
return m_model->extractExternalEffectFiles();
}
void TimelineController::addEffectToCurrentClip(const QStringList &effectData)
{
QList<int> activeClips;
......
......@@ -486,6 +486,9 @@ public:
/** @brief Returns a list of all luma files used in the project
*/
QStringList extractCompositionLumas() const;
/** @brief Returns a list of all external files used by effects in the timeline
*/
QStringList extractExternalEffectFiles() const;
/** @brief Get the frame where mouse is positioned
*/
int getMousePos();
......
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