Fix missing luma error on project opening with AppImage

parent 0c728715
Pipeline #4709 passed with stage
in 21 minutes and 31 seconds
......@@ -101,7 +101,13 @@ void ListParamWidget::slotRefresh()
// Create thumbnails
if (pCore->getCurrentFrameSize().width() > 1000) {
// HD project
values = MainWindow::m_lumaFiles.value(QStringLiteral("HD"));
values = MainWindow::m_lumaFiles.value(QStringLiteral("16_9"));
} else if (pCore->getCurrentFrameSize().height() > 1000) {
values = MainWindow::m_lumaFiles.value(QStringLiteral("9_16"));
} else if (pCore->getCurrentFrameSize().height() == pCore->getCurrentFrameSize().width()) {
values = MainWindow::m_lumaFiles.value(QStringLiteral("square"));
} else if (pCore->getCurrentFrameSize().height() == 480) {
values = MainWindow::m_lumaFiles.value(QStringLiteral("NTSC"));
} else {
values = MainWindow::m_lumaFiles.value(QStringLiteral("PAL"));
}
......
......@@ -298,6 +298,7 @@ bool DocumentChecker::hasErrorInClips()
QMap<QString, QString> autoFixLuma;
QString lumaPath;
QString lumaMltPath;
// Check existence of luma files
for (const QString &lumafile : filesToCheck) {
filePath = lumafile;
......@@ -315,18 +316,31 @@ bool DocumentChecker::hasErrorInClips()
autoFixLuma.insert(filePath, fixedLuma);
continue;
}
// Check MLT folder
// Check Kdenlive folder
if (lumaPath.isEmpty()) {
QDir dir(QCoreApplication::applicationDirPath());
dir.cdUp();
dir.cd(QStringLiteral("share/kdenlive/lumas/"));
lumaPath = dir.absolutePath();
lumaPath = dir.absolutePath() + QStringLiteral("/");
}
lumaName = filePath.section(QLatin1Char('/'), -2);
lumaName.prepend(lumaPath);
if (QFile::exists(lumaName)) {
autoFixLuma.insert(filePath, lumaName);
continue;
}
// Check MLT folder
if (lumaMltPath.isEmpty()) {
QDir dir(KdenliveSettings::mltpath());
dir.cd(QStringLiteral("../lumas/"));
lumaMltPath = dir.absolutePath() + QStringLiteral("/");
}
lumaName = filePath.section(QLatin1Char('/'), -2);
lumaName.prepend(lumaMltPath);
if (QFile::exists(lumaName)) {
autoFixLuma.insert(filePath, lumaName);
continue;
}
if (filePath.endsWith(QLatin1String(".pgm"))) {
fixedLuma = filePath.section(QLatin1Char('.'), 0, -2) + QStringLiteral(".png");
......
......@@ -176,7 +176,6 @@ std::unique_ptr<Mlt::Repository> &MltConnection::getMltRepository()
void MltConnection::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");
......@@ -187,9 +186,10 @@ void MltConnection::refreshLumas()
QStringList folders = topDir.entryList(QDir::AllDirs | QDir::NoDotAndDotDot);
QString format;
for (const QString &f : folders) {
QStringList imagefiles;
QDir dir(topDir.absoluteFilePath(f));
if (f == QLatin1String("16_9")) {
format = QStringLiteral("HD");
if (f == QLatin1String("HD")) {
format = QStringLiteral("16_9");
} else {
format = f;
}
......
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