Fix MLT 16_9 lumas not found

parent ed184f5a
Pipeline #1559 passed with stage
in 14 minutes and 14 seconds
......@@ -3767,33 +3767,6 @@ void MainWindow::slotGrabItem()
getCurrentTimeline()->controller()->grabCurrent();
}
// static
void MainWindow::refreshLumas()
{
// Check for Kdenlive installed luma files, add empty string at start for no luma
QStringList imagefiles;
QStringList fileFilters;
MainWindow::m_lumaFiles.clear();
fileFilters << QStringLiteral("*.png") << QStringLiteral("*.pgm");
QStringList customLumas = QStandardPaths::locateAll(QStandardPaths::AppDataLocation, QStringLiteral("lumas"), QStandardPaths::LocateDirectory);
customLumas.append(QString(mlt_environment("MLT_DATA")) + QStringLiteral("/lumas"));
for (const QString &folder : customLumas) {
QDir topDir(folder);
QStringList folders = topDir.entryList(QDir::AllDirs | QDir::NoDotAndDotDot);
for (const QString &f : folders) {
QDir dir(topDir.absoluteFilePath(f));
QStringList filesnames = dir.entryList(fileFilters, QDir::Files);
if (MainWindow::m_lumaFiles.contains(f)) {
imagefiles = MainWindow::m_lumaFiles.value(f);
}
for (const QString &fname : filesnames) {
imagefiles.append(dir.absoluteFilePath(fname));
}
MainWindow::m_lumaFiles.insert(f, imagefiles);
}
}
}
#ifdef DEBUG_MAINW
#undef DEBUG_MAINW
#endif
......@@ -128,8 +128,6 @@ public:
/** @brief Returns a pointer to the current timeline */
TimelineWidget *getCurrentTimeline() const;
/** @brief Reload luma files */
static void refreshLumas();
protected:
/** @brief Closes the window.
......
......@@ -176,16 +176,22 @@ void MltConnection::refreshLumas()
for (const QString &folder : customLumas) {
QDir topDir(folder);
QStringList folders = topDir.entryList(QDir::AllDirs | QDir::NoDotAndDotDot);
QString format;
for (const QString &f : folders) {
QDir dir(topDir.absoluteFilePath(f));
if (f == QLatin1String("16_9")) {
format = QStringLiteral("HD");
} else {
format = f;
}
QStringList filesnames = dir.entryList(fileFilters, QDir::Files);
if (MainWindow::m_lumaFiles.contains(f)) {
imagefiles = MainWindow::m_lumaFiles.value(f);
if (MainWindow::m_lumaFiles.contains(format)) {
imagefiles = MainWindow::m_lumaFiles.value(format);
}
for (const QString &fname : filesnames) {
imagefiles.append(dir.absoluteFilePath(fname));
}
MainWindow::m_lumaFiles.insert(f, imagefiles);
MainWindow::m_lumaFiles.insert(format, imagefiles);
}
}
}
......@@ -38,6 +38,10 @@ public:
/* @brief Returns a pointer to the instance of the singleton */
static std::unique_ptr<MltConnection> &self();
/** @brief Updates the list of available Lumas
*/
static void refreshLumas();
protected:
/** @brief Open connection to the MLT framework
This constructor should be called only once
......@@ -52,10 +56,6 @@ protected:
* user. It doesn't fill any list of profiles, while its name suggests so. */
void locateMeltAndProfilesPath(const QString &mltPath = QString());
/** @brief Updates the list of available Lumas
*/
void refreshLumas();
static std::unique_ptr<MltConnection> m_self;
/** @brief The MLT repository, useful for filter/producer requests */
......
......@@ -24,6 +24,7 @@
#include "assets/assetlist/view/qmltypes/asseticonprovider.hpp"
#include "dialogs/profilesdialog.h"
#include "mainwindow.h"
#include "mltconnection.h"
#include "transitions/transitionlist/model/transitionfilter.hpp"
#include "transitions/transitionsrepository.hpp"
......@@ -99,7 +100,7 @@ int TransitionListWidget::getNewStuff(const QString &configFile)
void TransitionListWidget::downloadNewLumas()
{
if (getNewStuff(QStringLiteral(":data/kdenlive_wipes.knsrc")) > 0) {
MainWindow::refreshLumas();
MltConnection::refreshLumas();
// TODO: refresh currently displayd trans ?
}
}
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