Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Multimedia
Kdenlive
Commits
42bea5df
Commit
42bea5df
authored
Nov 15, 2022
by
Jean-Baptiste Mardelle
Browse files
Fix recovering luma file paths when opening an Appimage project or from another computer
parent
fe827478
Pipeline
#268444
failed with stage
in 18 minutes and 27 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
src/doc/documentchecker.cpp
View file @
42bea5df
...
...
@@ -197,28 +197,9 @@ bool DocumentChecker::hasErrorInClips()
continue
;
}
// Check Kdenlive folder
if
(
lumaPath
.
isEmpty
())
{
QDir
dir
(
QCoreApplication
::
applicationDirPath
());
dir
.
cdUp
();
dir
.
cd
(
QStringLiteral
(
"share/kdenlive/lumas/"
));
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
);
QString
res
=
fixLuma
(
filePath
);
if
(
!
res
.
isEmpty
()
&&
QFile
::
exists
(
res
))
{
autoFixLuma
.
insert
(
filePath
,
res
);
continue
;
}
...
...
@@ -1038,10 +1019,10 @@ void DocumentChecker::slotSearchClips(const QString &newpath)
m_checkRunning
=
false
;
}
QString
DocumentChecker
::
searchLuma
(
const
QDir
&
dir
,
const
QString
&
file
)
QString
DocumentChecker
::
fixLuma
(
const
QString
&
file
)
{
QDir
searchPath
(
KdenliveSettings
::
mltpath
());
QString
fname
=
Q
Url
::
fromLocal
File
(
file
).
fileName
();
QString
fname
=
QFile
Info
(
file
).
fileName
();
if
(
file
.
contains
(
QStringLiteral
(
"PAL"
)))
{
searchPath
.
cd
(
QStringLiteral
(
"../lumas/PAL"
));
}
else
{
...
...
@@ -1054,21 +1035,41 @@ QString DocumentChecker::searchLuma(const QDir &dir, const QString &file)
// try to find luma in application path
searchPath
.
setPath
(
QCoreApplication
::
applicationDirPath
());
#ifdef Q_OS_WIN
searchPath
.
cd
(
QStringLiteral
(
"data/
lumas
"
));
searchPath
.
cd
(
QStringLiteral
(
"data/"
));
#else
searchPath
.
cd
(
QStringLiteral
(
"../share/
apps/
kdenlive/
lumas
"
));
searchPath
.
cd
(
QStringLiteral
(
"../share/kdenlive/"
));
#endif
if
(
file
.
contains
(
QStringLiteral
(
"/PAL"
)))
{
searchPath
.
cd
(
QStringLiteral
(
"lumas/PAL/"
));
}
else
{
searchPath
.
cd
(
QStringLiteral
(
"lumas/HD/"
));
}
result
.
setFile
(
searchPath
,
fname
);
if
(
result
.
exists
())
{
return
result
.
filePath
();
}
// Try in Kdenlive's standard KDE path
QString
res
=
QStandardPaths
::
locate
(
QStandardPaths
::
AppDataLocation
,
QStringLiteral
(
"lumas/"
)
+
fname
);
QString
res
=
QStandardPaths
::
locate
(
QStandardPaths
::
AppDataLocation
,
"lumas"
,
QStandardPaths
::
LocateDirectory
);
if
(
!
res
.
isEmpty
())
{
return
res
;
searchPath
.
setPath
(
res
);
if
(
file
.
contains
(
QStringLiteral
(
"/PAL"
)))
{
searchPath
.
cd
(
QStringLiteral
(
"PAL"
));
}
else
{
searchPath
.
cd
(
QStringLiteral
(
"HD"
));
}
result
.
setFile
(
searchPath
,
fname
);
if
(
result
.
exists
())
{
return
result
.
filePath
();
}
}
return
QString
();
}
QString
DocumentChecker
::
searchLuma
(
const
QDir
&
dir
,
const
QString
&
file
)
{
// Try in user's chosen folder
return
searchPathRecursively
(
dir
,
fname
);
QString
result
=
fixLuma
(
file
);
return
result
.
isEmpty
()
?
searchPathRecursively
(
dir
,
QFileInfo
(
file
).
fileName
())
:
result
;
}
QString
DocumentChecker
::
searchPathRecursively
(
const
QDir
&
dir
,
const
QString
&
fileName
,
ClipType
::
ProducerType
type
)
...
...
src/doc/documentchecker.h
View file @
42bea5df
...
...
@@ -28,6 +28,7 @@ public:
* @return
*/
bool
hasErrorInClips
();
QString
fixLuma
(
const
QString
&
file
);
QString
searchLuma
(
const
QDir
&
dir
,
const
QString
&
file
);
private
slots
:
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment