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
ad382e0c
Commit
ad382e0c
authored
Jul 07, 2019
by
Jean-Baptiste Mardelle
Browse files
Fix reloading of title clips and others.
BUG: 409569
parent
59fc6051
Pipeline
#5025
passed with stage
in 26 minutes and 3 seconds
Changes
7
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
src/bin/bin.cpp
View file @
ad382e0c
...
...
@@ -2670,6 +2670,7 @@ void Bin::showTitleWidget(const std::shared_ptr<ProjectClip> &clip)
KGuiItem
(
i18n
(
"Save in project only"
)))
==
KMessageBox
::
Yes
)
{
// save to external file
dia_ui
.
saveTitle
(
QUrl
::
fromLocalFile
(
path
));
return
;
}
else
{
newprops
.
insert
(
QStringLiteral
(
"resource"
),
QString
());
}
...
...
src/bin/clipcreator.cpp
View file @
ad382e0c
...
...
@@ -116,18 +116,7 @@ QString ClipCreator::createClipFromFile(const QString &path, const QString &pare
}
}
}
prod
.
setAttribute
(
QStringLiteral
(
"in"
),
0
);
int
duration
=
0
;
if
(
txtdoc
.
documentElement
().
hasAttribute
(
QStringLiteral
(
"duration"
)))
{
duration
=
txtdoc
.
documentElement
().
attribute
(
QStringLiteral
(
"duration"
)).
toInt
();
}
else
if
(
txtdoc
.
documentElement
().
hasAttribute
(
QStringLiteral
(
"out"
)))
{
duration
=
txtdoc
.
documentElement
().
attribute
(
QStringLiteral
(
"out"
)).
toInt
();
}
if
(
duration
<=
0
)
{
duration
=
pCore
->
currentDoc
()
->
getFramePos
(
KdenliveSettings
::
title_duration
())
-
1
;
}
prod
=
createProducer
(
xml
,
ClipType
::
Text
,
path
,
QString
(),
duration
,
QString
());
txtdoc
.
documentElement
().
setAttribute
(
QStringLiteral
(
"kdenlive:duration"
),
duration
);
prod
=
createProducer
(
xml
,
ClipType
::
Text
,
path
,
QString
(),
-
1
,
QString
());
QString
titleData
=
txtdoc
.
toString
();
prod
.
setAttribute
(
QStringLiteral
(
"xmldata"
),
titleData
);
}
else
{
...
...
src/bin/filewatcher.cpp
View file @
ad382e0c
...
...
@@ -32,6 +32,7 @@ FileWatcher::FileWatcher(QObject *parent)
m_modifiedTimer
.
setInterval
(
1500
);
connect
(
m_fileWatcher
.
get
(),
&
KDirWatch
::
dirty
,
this
,
&
FileWatcher
::
slotUrlModified
);
connect
(
m_fileWatcher
.
get
(),
&
KDirWatch
::
deleted
,
this
,
&
FileWatcher
::
slotUrlMissing
);
connect
(
m_fileWatcher
.
get
(),
&
KDirWatch
::
created
,
this
,
&
FileWatcher
::
slotUrlAdded
);
connect
(
&
m_modifiedTimer
,
&
QTimer
::
timeout
,
this
,
&
FileWatcher
::
slotProcessModifiedUrls
);
}
...
...
@@ -79,9 +80,15 @@ void FileWatcher::slotUrlModified(const QString &path)
}
}
void
FileWatcher
::
slotUrlAdded
(
const
QString
&
path
)
{
for
(
const
QString
&
id
:
m_occurences
[
path
])
{
emit
binClipModified
(
id
);
}
}
void
FileWatcher
::
slotUrlMissing
(
const
QString
&
path
)
{
// TODO handle missing clips by replacing producer with an invalid producer
for
(
const
QString
&
id
:
m_occurences
[
path
])
{
emit
binClipMissing
(
id
);
}
...
...
src/bin/filewatcher.hpp
View file @
ad382e0c
...
...
@@ -57,6 +57,7 @@ signals:
private
slots
:
void
slotUrlModified
(
const
QString
&
path
);
void
slotUrlMissing
(
const
QString
&
path
);
void
slotUrlAdded
(
const
QString
&
path
);
void
slotProcessModifiedUrls
();
private:
...
...
src/bin/projectclip.cpp
View file @
ad382e0c
...
...
@@ -324,7 +324,10 @@ void ProjectClip::reloadProducer(bool refreshOnly, bool audioStreamChanged)
if
(
!
xml
.
isNull
())
{
pCore
->
jobManager
()
->
discardJobs
(
clipId
(),
AbstractClipJob
::
THUMBJOB
);
m_thumbsProducer
.
reset
();
xml
.
removeAttribute
(
"out"
);
ClipType
::
ProducerType
type
=
clipType
();
if
(
type
!=
ClipType
::
Color
&&
type
!=
ClipType
::
Image
)
{
xml
.
removeAttribute
(
"out"
);
}
ThumbnailCache
::
get
()
->
invalidateThumbsForClip
(
clipId
());
int
loadJob
=
pCore
->
jobManager
()
->
startJob
<
LoadJob
>
({
clipId
()},
loadjobId
,
QString
(),
xml
);
pCore
->
jobManager
()
->
startJob
<
ThumbJob
>
({
clipId
()},
loadJob
,
QString
(),
150
,
-
1
,
true
,
true
);
...
...
src/jobs/loadjob.cpp
View file @
ad382e0c
...
...
@@ -253,6 +253,7 @@ bool LoadJob::startJob()
}
pCore
->
getMonitor
(
Kdenlive
::
ClipMonitor
)
->
resetPlayOrLoopZone
(
m_clipId
);
m_resource
=
Xml
::
getXmlProperty
(
m_xml
,
QStringLiteral
(
"resource"
));
int
duration
=
0
;
ClipType
::
ProducerType
type
=
static_cast
<
ClipType
::
ProducerType
>
(
m_xml
.
attribute
(
QStringLiteral
(
"type"
)).
toInt
());
QString
service
=
Xml
::
getXmlProperty
(
m_xml
,
QStringLiteral
(
"mlt_service"
));
if
(
type
==
ClipType
::
Unknown
)
{
...
...
@@ -263,8 +264,25 @@ bool LoadJob::startJob()
m_producer
=
loadResource
(
m_resource
,
QStringLiteral
(
"color:"
));
break
;
case
ClipType
::
Text
:
case
ClipType
::
TextTemplate
:
m_producer
=
loadResource
(
m_resource
,
QStringLiteral
(
"kdenlivetitle:"
));
case
ClipType
::
TextTemplate
:
{
QFile
txtfile
(
m_resource
);
QDomDocument
txtdoc
(
QStringLiteral
(
"titledocument"
));
if
(
txtfile
.
open
(
QIODevice
::
ReadOnly
)
&&
txtdoc
.
setContent
(
&
txtfile
))
{
txtfile
.
close
();
if
(
txtdoc
.
documentElement
().
hasAttribute
(
QStringLiteral
(
"duration"
)))
{
duration
=
txtdoc
.
documentElement
().
attribute
(
QStringLiteral
(
"duration"
)).
toInt
();
}
else
if
(
txtdoc
.
documentElement
().
hasAttribute
(
QStringLiteral
(
"out"
)))
{
duration
=
txtdoc
.
documentElement
().
attribute
(
QStringLiteral
(
"out"
)).
toInt
();
}
}
m_producer
=
loadResource
(
m_resource
,
QStringLiteral
(
"kdenlivetitle:"
));
if
(
duration
<=
0
)
{
duration
=
pCore
->
currentDoc
()
->
getFramePos
(
KdenliveSettings
::
title_duration
())
-
1
;
}
m_producer
->
set
(
"length"
,
duration
);
m_producer
->
set
(
"kdenlive:duration"
,
duration
);
m_producer
->
set
(
"out"
,
duration
-
1
);
}
break
;
case
ClipType
::
QText
:
m_producer
=
loadResource
(
m_resource
,
QStringLiteral
(
"qtext:"
));
...
...
@@ -337,13 +355,13 @@ bool LoadJob::startJob()
if
(
!
groupId
.
isEmpty
())
{
m_producer
->
set
(
"kdenlive:folderid"
,
groupId
.
toUtf8
().
constData
());
}
int
clipOut
=
0
,
duration
=
0
;
int
clipOut
=
0
;
if
(
m_xml
.
hasAttribute
(
QStringLiteral
(
"out"
)))
{
clipOut
=
m_xml
.
attribute
(
QStringLiteral
(
"out"
)).
toInt
();
}
// setup length here as otherwise default length (currently 15000 frames in MLT) will be taken even if outpoint is larger
if
(
type
==
ClipType
::
Color
||
type
==
ClipType
::
Text
||
type
==
ClipType
::
TextTemplate
||
type
==
ClipType
::
QText
||
type
==
ClipType
::
Image
||
type
==
ClipType
::
SlideShow
)
{
if
(
duration
==
0
&&
(
type
==
ClipType
::
Color
||
type
==
ClipType
::
Text
||
type
==
ClipType
::
TextTemplate
||
type
==
ClipType
::
QText
||
type
==
ClipType
::
Image
||
type
==
ClipType
::
SlideShow
)
)
{
int
length
;
if
(
m_xml
.
hasAttribute
(
QStringLiteral
(
"length"
)))
{
length
=
m_xml
.
attribute
(
QStringLiteral
(
"length"
)).
toInt
();
...
...
@@ -383,7 +401,6 @@ bool LoadJob::startJob()
if
(
m_xml
.
hasAttribute
(
QStringLiteral
(
"templatetext"
)))
{
m_producer
->
set
(
"templatetext"
,
m_xml
.
attribute
(
QStringLiteral
(
"templatetext"
)).
toUtf8
().
constData
());
}
duration
=
duration
>
0
?
duration
:
m_producer
->
get_playtime
();
if
(
type
==
ClipType
::
SlideShow
)
{
processSlideShow
();
}
...
...
src/titler/titledocument.cpp
View file @
ad382e0c
...
...
@@ -360,7 +360,9 @@ bool TitleDocument::saveDocument(const QUrl &url, QGraphicsRectItem *startv, QGr
}
xmlf
.
close
();
KIO
::
FileCopyJob
*
copyjob
=
KIO
::
file_copy
(
QUrl
::
fromLocalFile
(
tmpfile
.
fileName
()),
url
,
-
1
,
KIO
::
Overwrite
);
return
copyjob
->
exec
();
bool
result
=
copyjob
->
exec
();
delete
copyjob
;
return
result
;
}
int
TitleDocument
::
loadFromXml
(
const
QDomDocument
&
doc
,
QGraphicsRectItem
*
startv
,
QGraphicsRectItem
*
endv
,
int
*
duration
,
const
QString
&
projectpath
)
...
...
Write
Preview
Supports
Markdown
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