Skip to content
GitLab
Menu
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
01f6e42d
Commit
01f6e42d
authored
Dec 02, 2020
by
Jean-Baptiste Mardelle
Browse files
Fix several slideshows incorrectly share same thumbnail if in same folder
parent
bfff60a1
Changes
3
Hide whitespace changes
Inline
Side-by-side
src/bin/projectclip.cpp
View file @
01f6e42d
...
...
@@ -986,9 +986,10 @@ const QString ProjectClip::hash()
return
getFileHash
();
}
const
QByteArray
ProjectClip
::
getFolderHash
(
QDir
dir
)
const
QByteArray
ProjectClip
::
getFolderHash
(
QDir
dir
,
QString
fileName
)
{
QByteArray
fileData
=
dir
.
entryList
(
QDir
::
Files
).
join
(
QLatin1Char
(
','
)).
toUtf8
();
fileName
.
append
(
dir
.
entryList
(
QDir
::
Files
).
join
(
QLatin1Char
(
','
)));
QByteArray
fileData
=
fileName
.
toUtf8
();
return
QCryptographicHash
::
hash
(
fileData
,
QCryptographicHash
::
Md5
);
}
...
...
@@ -998,7 +999,7 @@ const QString ProjectClip::getFileHash()
QByteArray
fileHash
;
switch
(
m_clipType
)
{
case
ClipType
::
SlideShow
:
fileHash
=
getFolderHash
(
QFileInfo
(
clipUrl
()).
absoluteDir
());
fileHash
=
getFolderHash
(
QFileInfo
(
clipUrl
()).
absoluteDir
()
,
QFileInfo
(
clipUrl
()).
fileName
()
);
break
;
case
ClipType
::
Text
:
fileData
=
getProducerProperty
(
QStringLiteral
(
"xmldata"
)).
toUtf8
();
...
...
src/bin/projectclip.h
View file @
01f6e42d
...
...
@@ -244,7 +244,7 @@ public:
/** @brief Get the list of audio stream effects for a defined stream. */
QStringList
getAudioStreamEffect
(
int
streamIndex
)
const
override
;
/** @brief Calculate the folder's hash (based on the files it contains). */
static
const
QByteArray
getFolderHash
(
QDir
dir
);
static
const
QByteArray
getFolderHash
(
QDir
dir
,
QString
fileName
);
/** @brief Check if the clip is included in timeline and reset its occurences on producer reload. */
void
updateTimelineOnReload
();
...
...
src/doc/documentchecker.cpp
View file @
01f6e42d
...
...
@@ -294,9 +294,11 @@ bool DocumentChecker::hasErrorInClips()
continue
;
}
// Check for slideshows
QString
slidePattern
;
bool
slideshow
=
resource
.
contains
(
QStringLiteral
(
"/.all."
))
||
resource
.
contains
(
QLatin1Char
(
'?'
))
||
resource
.
contains
(
QLatin1Char
(
'%'
));
if
(
slideshow
)
{
if
(
service
==
QLatin1String
(
"qimage"
)
||
service
==
QLatin1String
(
"pixbuf"
))
{
slidePattern
=
QFileInfo
(
resource
).
fileName
();
resource
=
QFileInfo
(
resource
).
absolutePath
();
}
else
if
(
service
.
startsWith
(
QLatin1String
(
"avformat"
))
&&
Xml
::
hasXmlProperty
(
e
,
QStringLiteral
(
"ttl"
)))
{
// Fix MLT 6.20 avformat slideshows
...
...
@@ -332,7 +334,7 @@ bool DocumentChecker::hasErrorInClips()
// Check if file changed
const
QByteArray
hash
=
Xml
::
getXmlProperty
(
e
,
"kdenlive:file_hash"
).
toLatin1
();
if
(
!
hash
.
isEmpty
())
{
const
QByteArray
fileData
=
slideshow
?
ProjectClip
::
getFolderHash
(
QDir
(
resource
)).
toHex
()
:
ProjectClip
::
calculateHash
(
resource
).
first
.
toHex
();
const
QByteArray
fileData
=
slideshow
?
ProjectClip
::
getFolderHash
(
QDir
(
resource
)
,
slidePattern
).
toHex
()
:
ProjectClip
::
calculateHash
(
resource
).
first
.
toHex
();
if
(
hash
!=
fileData
)
{
// For slideshow clips, silently upgrade hash
if
(
slideshow
)
{
...
...
@@ -1019,7 +1021,7 @@ QString DocumentChecker::searchDirRecursively(const QDir &dir, const QString &ma
QStringList
filesAndDirs
;
QString
fileName
=
QFileInfo
(
fullName
).
fileName
();
// Check main dir
QString
fileHash
=
ProjectClip
::
getFolderHash
(
dir
).
toHex
();
QString
fileHash
=
ProjectClip
::
getFolderHash
(
dir
,
fileName
).
toHex
();
if
(
fileHash
==
matchHash
)
{
return
dir
.
absoluteFilePath
(
fileName
);
}
...
...
@@ -1027,7 +1029,7 @@ QString DocumentChecker::searchDirRecursively(const QDir &dir, const QString &ma
const
QStringList
subDirs
=
dir
.
entryList
(
QDir
::
AllDirs
|
QDir
::
NoDot
|
QDir
::
NoDotDot
);
for
(
const
QString
&
sub
:
subDirs
)
{
QDir
subFolder
(
dir
.
absoluteFilePath
(
sub
));
fileHash
=
ProjectClip
::
getFolderHash
(
subFolder
).
toHex
();
fileHash
=
ProjectClip
::
getFolderHash
(
subFolder
,
fileName
).
toHex
();
if
(
fileHash
==
matchHash
)
{
return
subFolder
.
absoluteFilePath
(
fileName
);
}
...
...
Eugen Mohr
@emohr
mentioned in issue
#779 (closed)
·
Dec 03, 2020
mentioned in issue
#779 (closed)
mentioned in issue #779
Toggle commit list
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a 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