Commit 0be77192 authored by Jean-Baptiste Mardelle's avatar Jean-Baptiste Mardelle

Merge branch '1912'

parents ffbcb8db 1b5680af
Pipeline #11436 passed with stage
in 13 minutes and 41 seconds
......@@ -117,11 +117,9 @@ void ListParamWidget::slotRefresh()
const QString &entry = values.at(j);
m_list->addItem(values.at(j).section(QLatin1Char('/'), -1), entry);
if (!entry.isEmpty() && (entry.endsWith(QLatin1String(".png")) || entry.endsWith(QLatin1String(".pgm")))) {
if (!MainWindow::m_lumacache.contains(entry)) {
QImage pix(entry);
MainWindow::m_lumacache.insert(entry, pix.scaled(50, 30, Qt::KeepAspectRatio, Qt::SmoothTransformation));
if (MainWindow::m_lumacache.contains(entry)) {
m_list->setItemIcon(j + 1, QPixmap::fromImage(MainWindow::m_lumacache.value(entry)));
}
m_list->setItemIcon(j + 1, QPixmap::fromImage(MainWindow::m_lumacache.value(entry)));
}
}
if (!value.isEmpty() && values.contains(value)) {
......
......@@ -82,6 +82,7 @@ public slots:
/** @brief refresh the properties to reflect changes in the model
*/
void slotRefresh() override;
};
#endif
......@@ -201,6 +201,19 @@ void Core::initGUI(const QUrl &Url)
QThreadPool::globalInstance()->setMaxThreadCount(qMin(4, QThreadPool::globalInstance()->maxThreadCount()));
}
void Core::buildLumaThumbs(const QStringList &values)
{
for (auto &entry : values) {
if (MainWindow::m_lumacache.contains(entry)) {
continue;
}
QImage pix(entry);
if (!pix.isNull()) {
MainWindow::m_lumacache.insert(entry, pix.scaled(50, 30, Qt::KeepAspectRatio, Qt::SmoothTransformation));
}
}
}
std::unique_ptr<Core> &Core::self()
{
if (!m_self) {
......
......@@ -233,6 +233,8 @@ public slots:
/** @brief display a user info/warning message in the project bin */
void displayBinMessage(const QString &text, int type, const QList<QAction *> &actions = QList<QAction *>());
void displayBinLogMessage(const QString &text, int type, const QString &logInfo);
/** @brief Create small thumbnails for luma used in compositions */
void buildLumaThumbs(const QStringList &values);
signals:
void coreIsReady();
......
......@@ -17,6 +17,7 @@ the Free Software Foundation, either version 3 of the License, or
#include <KUrlRequesterDialog>
#include <config-kdenlive.h>
#include <klocalizedstring.h>
#include <QtConcurrent>
#include "kdenlive_debug.h"
#include <QFile>
......@@ -181,6 +182,7 @@ void MltConnection::refreshLumas()
fileFilters << QStringLiteral("*.png") << QStringLiteral("*.pgm");
QStringList customLumas = QStandardPaths::locateAll(QStandardPaths::AppDataLocation, QStringLiteral("lumas"), QStandardPaths::LocateDirectory);
customLumas.append(QString(mlt_environment("MLT_DATA")) + QStringLiteral("/lumas"));
QStringList allImagefiles;
for (const QString &folder : customLumas) {
QDir topDir(folder);
QStringList folders = topDir.entryList(QDir::AllDirs | QDir::NoDotAndDotDot);
......@@ -201,6 +203,9 @@ void MltConnection::refreshLumas()
imagefiles.append(dir.absoluteFilePath(fname));
}
MainWindow::m_lumaFiles.insert(format, imagefiles);
allImagefiles << imagefiles;
}
}
allImagefiles.removeDuplicates();
QtConcurrent::run(pCore.get(), &Core::buildLumaThumbs, allImagefiles);
}
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