Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
Multimedia
Kdenlive
Commits
d961c39b
Commit
d961c39b
authored
Mar 24, 2017
by
Jean-Baptiste Mardelle
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix archived project wrong path and missing images/slideshows
CCBUG: 377999 CCBUG: 378000
parent
f99275fa
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
46 additions
and
21 deletions
+46
-21
src/doc/documentvalidator.cpp
src/doc/documentvalidator.cpp
+3
-1
src/project/dialogs/archivewidget.cpp
src/project/dialogs/archivewidget.cpp
+41
-18
src/timeline/customtrackview.h
src/timeline/customtrackview.h
+2
-2
No files found.
src/doc/documentvalidator.cpp
View file @
d961c39b
...
...
@@ -63,10 +63,12 @@ bool DocumentValidator::validate(const double currentVersion)
if
(
rootDir
==
QLatin1String
(
"$CURRENTPATH"
))
{
// The document was extracted from a Kdenlive archived project, fix root directory
QString
playlist
=
m_doc
.
toString
();
playlist
.
replace
(
QLatin1String
(
"$CURRENTPATH"
),
m_url
.
adjusted
(
QUrl
::
RemoveFilename
).
toLocalFile
());
playlist
.
replace
(
QLatin1String
(
"$CURRENTPATH"
),
m_url
.
adjusted
(
QUrl
::
RemoveFilename
|
QUrl
::
StripTrailingSlash
).
toLocalFile
());
m_doc
.
setContent
(
playlist
);
mlt
=
m_doc
.
firstChildElement
(
QStringLiteral
(
"mlt"
));
kdenliveDoc
=
mlt
.
firstChildElement
(
QStringLiteral
(
"kdenlivedoc"
));
}
else
if
(
rootDir
.
isEmpty
())
{
mlt
.
setAttribute
(
QStringLiteral
(
"root"
),
m_url
.
adjusted
(
QUrl
::
RemoveFilename
|
QUrl
::
StripTrailingSlash
).
toLocalFile
());
}
// Previous MLT / Kdenlive versions used C locale by default
...
...
src/project/dialogs/archivewidget.cpp
View file @
d961c39b
...
...
@@ -125,7 +125,7 @@ ArchiveWidget::ArchiveWidget(const QString &projectName, const QDomDocument &doc
else
if
(
t
==
QText
)
{
allFonts
<<
clip
->
property
(
QStringLiteral
(
"family"
));
}
else
if
(
t
==
Text
)
{
else
if
(
t
==
Text
||
t
==
TextTemplate
)
{
QStringList
imagefiles
=
TitleWidget
::
extractImageList
(
clip
->
property
(
QStringLiteral
(
"xmldata"
)));
QStringList
fonts
=
TitleWidget
::
extractFontList
(
clip
->
property
(
QStringLiteral
(
"xmldata"
)));
extraImageUrls
<<
imagefiles
;
...
...
@@ -444,20 +444,16 @@ void ArchiveWidget::generateItems(QTreeWidgetItem *parentItem, const QMap<QStrin
// pattern url (like clip%.3d.png)
QStringList
result
=
dir
.
entryList
(
QDir
::
Files
);
QString
filter
=
slideUrl
.
fileName
();
QString
ext
=
filter
.
section
(
QLatin1Char
(
'.'
),
-
1
);
QString
ext
=
filter
.
section
(
QLatin1Char
(
'.'
),
-
1
)
.
section
(
QLatin1Char
(
'?'
),
0
,
0
)
;
filter
=
filter
.
section
(
QLatin1Char
(
'%'
),
0
,
-
2
);
QString
regexp
=
QLatin1Char
(
'^'
)
+
filter
+
QStringLiteral
(
"
\\
d+
\\
."
)
+
ext
+
QLatin1Char
(
'$'
);
QRegExp
rx
(
regexp
);
QStringList
slideImages
;
qint64
totalSize
=
0
;
QString
directory
=
dir
.
absolutePath
();
if
(
!
directory
.
endsWith
(
QLatin1Char
(
'/'
)))
{
directory
.
append
(
QLatin1Char
(
'/'
));
}
foreach
(
const
QString
&
path
,
result
)
{
if
(
rx
.
exactMatch
(
path
))
{
totalSize
+=
QFileInfo
(
dir
ectory
+
path
).
size
();
slideImages
<<
dir
ectory
+
path
;
totalSize
+=
QFileInfo
(
dir
.
absoluteFilePath
(
path
)
)
.
size
();
slideImages
<<
dir
.
absoluteFilePath
(
path
)
;
}
}
item
->
setData
(
0
,
Qt
::
UserRole
+
1
,
slideImages
);
...
...
@@ -699,18 +695,18 @@ bool ArchiveWidget::processProjectFile()
for
(
int
i
=
0
;
i
<
files_list
->
topLevelItemCount
();
++
i
)
{
QTreeWidgetItem
*
parentItem
=
files_list
->
topLevelItem
(
i
);
if
(
parentItem
->
childCount
()
>
0
)
{
destUrl
=
QUrl
::
fromLocalFile
(
archive_url
->
url
().
toLocalFile
()
+
QDir
::
separator
()
+
parentItem
->
data
(
0
,
Qt
::
UserRole
).
toString
());
QDir
destFolder
(
archive_url
->
url
().
toLocalFile
()
+
QDir
::
separator
()
+
parentItem
->
data
(
0
,
Qt
::
UserRole
).
toString
());
bool
isSlideshow
=
parentItem
->
data
(
0
,
Qt
::
UserRole
).
toString
()
==
QLatin1String
(
"slideshows"
);
for
(
int
j
=
0
;
j
<
parentItem
->
childCount
();
++
j
)
{
item
=
parentItem
->
child
(
j
);
QUrl
src
=
QUrl
::
fromLocalFile
(
item
->
text
(
0
));
QUrl
dest
=
destUrl
;
QUrl
dest
=
QUrl
::
fromLocalFile
(
destFolder
.
absolutePath
())
;
if
(
isSlideshow
)
{
dest
=
QUrl
::
fromLocalFile
(
destUrl
.
toLocalFile
()
+
QDir
::
separator
(
)
+
item
->
data
(
0
,
Qt
::
UserRole
).
toString
()
+
QLatin1Char
(
'/'
)
+
src
.
fileName
());
dest
=
QUrl
::
fromLocalFile
(
parentItem
->
data
(
0
,
Qt
::
UserRole
).
toString
()
+
QLatin1Char
(
'/'
)
+
item
->
data
(
0
,
Qt
::
UserRole
).
toString
()
+
QLatin1Char
(
'/'
)
+
src
.
fileName
());
}
else
if
(
item
->
data
(
0
,
Qt
::
UserRole
).
isNull
())
{
dest
=
QUrl
::
fromLocalFile
(
destUrl
.
toLocalFile
()
+
QDir
::
separator
(
)
+
src
.
fileName
());
dest
=
QUrl
::
fromLocalFile
(
parentItem
->
data
(
0
,
Qt
::
UserRole
).
toString
()
+
QLatin1Char
(
'/'
)
+
src
.
fileName
());
}
else
{
dest
=
QUrl
::
fromLocalFile
(
destUrl
.
toLocalFile
()
+
QLatin1Char
(
'/'
)
+
item
->
data
(
0
,
Qt
::
UserRole
).
toString
());
dest
=
QUrl
::
fromLocalFile
(
parentItem
->
data
(
0
,
Qt
::
UserRole
).
toString
()
+
QLatin1Char
(
'/'
)
+
item
->
data
(
0
,
Qt
::
UserRole
).
toString
());
}
m_replacementList
.
insert
(
src
,
dest
);
}
...
...
@@ -728,11 +724,10 @@ bool ArchiveWidget::processProjectFile()
if
(
isArchive
)
{
basePath
=
QStringLiteral
(
"$CURRENTPATH"
);
}
else
{
basePath
=
archive_url
->
url
().
adjusted
(
QUrl
::
StripTrailingSlash
).
toLocalFile
();
basePath
=
archive_url
->
url
().
adjusted
(
QUrl
::
StripTrailingSlash
|
QUrl
::
StripTrailingSlash
).
toLocalFile
();
}
mlt
.
setAttribute
(
QStringLiteral
(
"root"
),
basePath
);
QDomElement
project
=
mlt
.
firstChildElement
(
QStringLiteral
(
"kdenlivedoc"
));
project
.
setAttribute
(
QStringLiteral
(
"projectfolder"
),
basePath
);
// Switch to relative path
mlt
.
removeAttribute
(
QStringLiteral
(
"root"
));
// process kdenlive producers
QDomNodeList
prods
=
mlt
.
elementsByTagName
(
QStringLiteral
(
"kdenlive_producer"
));
...
...
@@ -775,6 +770,30 @@ bool ArchiveWidget::processProjectFile()
EffectsList
::
setProperty
(
e
,
QStringLiteral
(
"resource"
),
dest
.
toLocalFile
());
}
}
src
=
EffectsList
::
property
(
e
,
QStringLiteral
(
"xmldata"
));
bool
found
=
false
;
if
(
!
src
.
isEmpty
()
&&
(
src
.
contains
(
QLatin1String
(
"QGraphicsPixmapItem"
))
||
src
.
contains
(
QLatin1String
(
"QGraphicsSvgItem"
))))
{
// Title with images, replace paths
QDomDocument
titleXML
;
titleXML
.
setContent
(
src
);
QDomNodeList
images
=
titleXML
.
documentElement
().
elementsByTagName
(
QLatin1String
(
"item"
));
for
(
int
i
=
0
;
i
<
images
.
count
();
i
++
)
{
QDomNode
n
=
images
.
at
(
i
);
QDomElement
url
=
n
.
firstChildElement
(
QLatin1String
(
"content"
));
if
(
!
url
.
isNull
()
&&
url
.
hasAttribute
(
QLatin1String
(
"url"
)))
{
QUrl
srcUrl
=
QUrl
::
fromLocalFile
(
url
.
attribute
(
QLatin1String
(
"url"
)));
QUrl
dest
=
m_replacementList
.
value
(
srcUrl
);
if
(
dest
.
isValid
())
{
url
.
setAttribute
(
QLatin1String
(
"url"
),
dest
.
toLocalFile
());
found
=
true
;
}
}
}
if
(
found
)
{
// replace content
EffectsList
::
setProperty
(
e
,
QStringLiteral
(
"xmldata"
),
titleXML
.
toString
());
}
}
}
// process mlt transitions (for luma files)
...
...
@@ -849,10 +868,14 @@ bool ArchiveWidget::processProjectFile()
void
ArchiveWidget
::
createArchive
()
{
QString
archiveName
(
archive_url
->
url
().
toLocalFile
()
+
QDir
::
separator
()
+
m_name
+
QStringLiteral
(
".tar.gz"
));
if
(
QFile
::
exists
(
archiveName
)
&&
KMessageBox
::
questionYesNo
(
this
,
i18n
(
"File %1 already exists.
\n
Do you want to overwrite it?"
,
archiveName
))
==
KMessageBox
::
No
)
{
return
;
}
QFileInfo
dirInfo
(
archive_url
->
url
().
toLocalFile
());
QString
user
=
dirInfo
.
owner
();
QString
group
=
dirInfo
.
group
();
KTar
archive
(
archive
_url
->
url
().
toLocalFile
()
+
QDir
::
separator
()
+
m_name
+
QStringLiteral
(
".tar.gz"
)
,
QStringLiteral
(
"application/x-gzip"
));
KTar
archive
(
archive
Name
,
QStringLiteral
(
"application/x-gzip"
));
archive
.
open
(
QIODevice
::
WriteOnly
);
// Create folders
...
...
src/timeline/customtrackview.h
View file @
d961c39b
...
...
@@ -214,8 +214,6 @@ public:
/** @brief Returns last requested seeking pos, or current cursor position. */
int
seekPosition
()
const
;
/** @brief Trigger a monitor refresh. */
void
monitorRefresh
(
const
QList
<
ItemInfo
>
&
range
,
bool
invalidateRange
=
false
);
void
monitorRefresh
(
bool
invalidateRange
=
false
);
/** @brief Trigger a monitor refresh if timeline cursor is inside range. */
void
monitorRefresh
(
const
ItemInfo
&
range
,
bool
invalidateRange
=
false
);
...
...
@@ -365,6 +363,8 @@ public slots:
void
slotUpdateAllThumbs
();
void
slotCheckPositionScrolling
();
void
slotInsertTrack
(
int
ix
);
/** @brief Trigger a monitor refresh. */
void
monitorRefresh
(
const
QList
<
ItemInfo
>
&
range
,
bool
invalidateRange
=
false
);
/** @brief Shows a dialog for selecting a track to delete.
* @param ix Number of the track, which should be pre-selected in the dialog */
...
...
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