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
2445f6d1
Commit
2445f6d1
authored
Jun 08, 2020
by
Simon Eugster
Browse files
Replace decimal separator in keyframe parameters
Related:
#713
parent
4fecc521
Changes
10
Hide whitespace changes
Inline
Side-by-side
src/assets/model/assetparametermodel.cpp
View file @
2445f6d1
...
...
@@ -62,12 +62,6 @@ AssetParameterModel::AssetParameterModel(std::unique_ptr<Mlt::Properties> asset,
}
}
qDebug
()
<<
"Listing all effects in the repository:"
;
auto
allEffects
=
EffectsRepository
::
get
()
->
getNames
();
for
(
const
auto
&
effect
:
allEffects
)
{
qDebug
()
<<
"Asset ID "
<<
effect
.
first
<<
" with name "
<<
effect
.
second
;
}
if
(
EffectsRepository
::
get
()
->
exists
(
assetId
))
{
qDebug
()
<<
"Asset "
<<
assetId
<<
" found in the repository. Description: "
<<
EffectsRepository
::
get
()
->
getDescription
(
assetId
);
QString
str
;
...
...
@@ -134,13 +128,21 @@ AssetParameterModel::AssetParameterModel(std::unique_ptr<Mlt::Properties> asset,
if
(
!
value
.
contains
(
QLatin1Char
(
'='
)))
{
value
.
prepend
(
QStringLiteral
(
"%1="
).
arg
(
pCore
->
getItemIn
(
m_ownerId
)));
}
if
(
!
originalDecimalPoint
.
isEmpty
())
{
value
.
replace
(
QRegExp
(
"(=
\\
d+),(
\\
d+)"
),
"
\\
1.
\\
2"
);
qDebug
()
<<
"Decimal point conversion: "
<<
name
<<
"="
<<
value
;
}
}
else
if
(
currentRow
.
type
==
ParamType
::
List
)
{
// Despite its name, a list type parameter is a single value *chosen from* a list.
// If it contains a non-“.” decimal separator, it is very likely wrong.
if
(
!
originalDecimalPoint
.
isEmpty
())
{
value
=
value
.
replace
(
originalDecimalPoint
,
"."
);
value
.
replace
(
originalDecimalPoint
,
"."
);
qDebug
()
<<
"Decial point conversion: "
<<
name
<<
"="
<<
value
;
}
}
else
if
(
currentRow
.
type
==
ParamType
::
Animated
)
{
if
(
!
originalDecimalPoint
.
isEmpty
())
{
qDebug
()
<<
"PROBABLY ISSUE "
<<
name
<<
value
;
}
}
if
(
!
name
.
isEmpty
())
{
internalSetParameter
(
name
,
value
);
...
...
src/doc/documentvalidator.cpp
View file @
2445f6d1
...
...
@@ -1738,18 +1738,14 @@ auto DocumentValidator::upgradeTo100(const QLocale &documentLocale) -> QString {
if
(
!
text
.
isNull
())
{
QList
<
QString
>
propsToReplace
;
/*
propsToReplace
<< QStringLiteral("length")
<< QStringLiteral("kdenlive:duration")
<< QStringLiteral("kdenlive:original_length");
*/
<<
QStringLiteral
(
"warp_speed"
);
bool
doReplace
=
propName
.
endsWith
(
"frame_rate"
)
||
(
propsToReplace
.
indexOf
(
propName
)
>=
0
);
if
(
doReplace
)
{
QString
originalValue
=
text
.
nodeValue
();
QString
newValue
=
originalValue
.
replace
(
decimalPoint
,
'.'
);
QString
newValue
=
QString
(
originalValue
)
.
replace
(
decimalPoint
,
'.'
);
text
.
setNodeValue
(
newValue
);
qDebug
()
<<
"Decimal separator: Converted "
<<
propName
<<
" from "
<<
originalValue
<<
" to "
<<
newValue
;
...
...
src/doc/kdenlivedoc.cpp
View file @
2445f6d1
...
...
@@ -68,7 +68,7 @@
#include <xlocale.h>
#endif
const
double
DOCUMENTVERSION
=
0.99
;
const
double
DOCUMENTVERSION
=
1.00
;
KdenliveDoc
::
KdenliveDoc
(
const
QUrl
&
url
,
QString
projectFolder
,
QUndoGroup
*
undoGroup
,
const
QString
&
profileName
,
const
QMap
<
QString
,
QString
>
&
properties
,
const
QMap
<
QString
,
QString
>
&
metadata
,
const
QPair
<
int
,
int
>
&
tracks
,
int
audioChannels
,
bool
*
openBackup
,
MainWindow
*
parent
)
...
...
@@ -306,11 +306,10 @@ int KdenliveDoc::clipsCount() const
}
const
QByteArray
KdenliveDoc
::
getProjectXml
()
const
QByteArray
KdenliveDoc
::
get
AndClear
ProjectXml
()
{
const
QByteArray
result
=
m_document
.
toString
().
toUtf8
();
// We don't need the xml data anymore, throw away
// TODO This is a getter – should not have any side effects! Fix or rename!
m_document
.
clear
();
qDebug
()
<<
"Project XML: "
<<
result
;
return
result
;
...
...
@@ -1275,6 +1274,7 @@ QMap<QString, QString> KdenliveDoc::documentProperties()
}
m_documentProperties
.
insert
(
QStringLiteral
(
"profile"
),
pCore
->
getCurrentProfile
()
->
path
());
if
(
m_documentProperties
.
contains
(
QStringLiteral
(
"decimalPoint"
)))
{
// "kdenlive:docproperties.decimalPoint" was removed in document version 100
m_documentProperties
.
remove
(
QStringLiteral
(
"decimalPoint"
));
}
return
m_documentProperties
;
...
...
src/doc/kdenlivedoc.h
View file @
2445f6d1
...
...
@@ -62,7 +62,7 @@ public:
~
KdenliveDoc
()
override
;
friend
class
LoadJob
;
/** @brief Get current document's producer. */
const
QByteArray
getProjectXml
();
const
QByteArray
get
AndClear
ProjectXml
();
QString
getLcNumeric
();
double
fps
()
const
;
int
width
()
const
;
...
...
src/project/projectmanager.cpp
View file @
2445f6d1
...
...
@@ -883,7 +883,8 @@ bool ProjectManager::updateTimeline(int pos, int scrollPos)
}
}
QScopedPointer
<
Mlt
::
Producer
>
xmlProd
(
new
Mlt
::
Producer
(
pCore
->
getCurrentProfile
()
->
profile
(),
"xml-string"
,
m_project
->
getProjectXml
().
constData
()));
QScopedPointer
<
Mlt
::
Producer
>
xmlProd
(
new
Mlt
::
Producer
(
pCore
->
getCurrentProfile
()
->
profile
(),
"xml-string"
,
m_project
->
getAndClearProjectXml
().
constData
()));
Mlt
::
Service
s
(
*
xmlProd
);
Mlt
::
Tractor
tractor
(
s
);
...
...
src/timeline2/model/builders/meltBuilder.cpp
View file @
2445f6d1
...
...
@@ -172,7 +172,7 @@ bool constructTimelineFromMelt(const std::shared_ptr<TimelineItemModel> &timelin
}
}
auto
transProps
=
std
::
make_unique
<
Mlt
::
Properties
>
(
t
->
get_properties
());
compositionOk
=
timeline
->
requestCompositionInsertion
(
id
,
timeline
->
getTrackIndexFromPosition
(
t
->
get_b_track
()
-
1
),
t
->
get_a_track
(),
t
->
get_in
(),
t
->
get_length
(),
std
::
move
(
transProps
),
compoId
,
undo
,
redo
);
compositionOk
=
timeline
->
requestCompositionInsertion
(
id
,
timeline
->
getTrackIndexFromPosition
(
t
->
get_b_track
()
-
1
),
t
->
get_a_track
(),
t
->
get_in
(),
t
->
get_length
(),
std
::
move
(
transProps
),
compoId
,
undo
,
redo
,
false
,
originalDecimalPoint
);
if
(
!
compositionOk
)
{
qDebug
()
<<
"ERROR : failed to insert composition in track "
<<
t
->
get_b_track
()
<<
", position"
<<
t
->
get_in
()
<<
", ID: "
<<
id
<<
", MLT ID: "
<<
t
->
get
(
"id"
);
...
...
src/timeline2/model/compositionmodel.cpp
View file @
2445f6d1
...
...
@@ -29,16 +29,16 @@
#include <utility>
CompositionModel
::
CompositionModel
(
std
::
weak_ptr
<
TimelineModel
>
parent
,
std
::
unique_ptr
<
Mlt
::
Transition
>
transition
,
int
id
,
const
QDomElement
&
transitionXml
,
const
QString
&
transitionId
)
const
QString
&
transitionId
,
const
QString
&
originalDecimalPoint
)
:
MoveableItem
<
Mlt
::
Transition
>
(
std
::
move
(
parent
),
id
)
,
AssetParameterModel
(
std
::
move
(
transition
),
transitionXml
,
transitionId
,
{
ObjectType
::
TimelineComposition
,
m_id
})
,
AssetParameterModel
(
std
::
move
(
transition
),
transitionXml
,
transitionId
,
{
ObjectType
::
TimelineComposition
,
m_id
}
,
originalDecimalPoint
)
,
m_a_track
(
-
1
)
,
m_duration
(
0
)
{
m_compositionName
=
TransitionsRepository
::
get
()
->
getName
(
transitionId
);
}
int
CompositionModel
::
construct
(
const
std
::
weak_ptr
<
TimelineModel
>
&
parent
,
const
QString
&
transitionId
,
int
id
,
int
CompositionModel
::
construct
(
const
std
::
weak_ptr
<
TimelineModel
>
&
parent
,
const
QString
&
transitionId
,
const
QString
&
originalDecimalPoint
,
int
id
,
std
::
unique_ptr
<
Mlt
::
Properties
>
sourceProperties
)
{
std
::
unique_ptr
<
Mlt
::
Transition
>
transition
=
TransitionsRepository
::
get
()
->
getTransition
(
transitionId
);
...
...
@@ -64,7 +64,7 @@ int CompositionModel::construct(const std::weak_ptr<TimelineModel> &parent, cons
transition
->
set
(
"force_track"
,
sourceProperties
->
get_int
(
"force_track"
));
}
}
std
::
shared_ptr
<
CompositionModel
>
composition
(
new
CompositionModel
(
parent
,
std
::
move
(
transition
),
id
,
xml
,
transitionId
));
std
::
shared_ptr
<
CompositionModel
>
composition
(
new
CompositionModel
(
parent
,
std
::
move
(
transition
),
id
,
xml
,
transitionId
,
originalDecimalPoint
));
id
=
composition
->
m_id
;
if
(
auto
ptr
=
parent
.
lock
())
{
...
...
src/timeline2/model/compositionmodel.hpp
View file @
2445f6d1
...
...
@@ -45,7 +45,7 @@ class CompositionModel : public MoveableItem<Mlt::Transition>, public AssetParam
protected:
/* This constructor is not meant to be called, call the static construct instead */
CompositionModel
(
std
::
weak_ptr
<
TimelineModel
>
parent
,
std
::
unique_ptr
<
Mlt
::
Transition
>
transition
,
int
id
,
const
QDomElement
&
transitionXml
,
const
QString
&
transitionId
);
const
QString
&
transitionId
,
const
QString
&
originalDecimalPoint
);
public:
/* @brief Creates a composition, which then registers itself to the parent timeline
...
...
@@ -54,7 +54,7 @@ public:
@param transitionId is the id of the transition to be inserted
@param id Requested id of the clip. Automatic if -1
*/
static
int
construct
(
const
std
::
weak_ptr
<
TimelineModel
>
&
parent
,
const
QString
&
transitionId
,
int
id
=
-
1
,
static
int
construct
(
const
std
::
weak_ptr
<
TimelineModel
>
&
parent
,
const
QString
&
transitionId
,
const
QString
&
originalDecimalPoint
,
int
id
=
-
1
,
std
::
unique_ptr
<
Mlt
::
Properties
>
sourceProperties
=
nullptr
);
friend
class
TrackModel
;
...
...
src/timeline2/model/timelinemodel.cpp
View file @
2445f6d1
...
...
@@ -3038,13 +3038,13 @@ bool TimelineModel::requestCompositionInsertion(const QString &transitionId, int
}
bool
TimelineModel
::
requestCompositionInsertion
(
const
QString
&
transitionId
,
int
trackId
,
int
compositionTrack
,
int
position
,
int
length
,
std
::
unique_ptr
<
Mlt
::
Properties
>
transProps
,
int
&
id
,
Fun
&
undo
,
Fun
&
redo
,
bool
finalMove
)
std
::
unique_ptr
<
Mlt
::
Properties
>
transProps
,
int
&
id
,
Fun
&
undo
,
Fun
&
redo
,
bool
finalMove
,
QString
originalDecimalPoint
)
{
qDebug
()
<<
"Inserting compo track"
<<
trackId
<<
"pos"
<<
position
<<
"length"
<<
length
;
int
compositionId
=
TimelineModel
::
getNextId
();
id
=
compositionId
;
Fun
local_undo
=
deregisterComposition_lambda
(
compositionId
);
CompositionModel
::
construct
(
shared_from_this
(),
transitionId
,
compositionId
,
std
::
move
(
transProps
));
CompositionModel
::
construct
(
shared_from_this
(),
transitionId
,
originalDecimalPoint
,
compositionId
,
std
::
move
(
transProps
));
auto
composition
=
m_allCompositions
[
compositionId
];
Fun
local_redo
=
[
composition
,
this
]()
{
// We capture a shared_ptr to the composition, which means that as long as this undo object lives, the composition object is not deleted. To insert it
...
...
src/timeline2/model/timelinemodel.hpp
View file @
2445f6d1
...
...
@@ -598,7 +598,7 @@ public:
bool
logUndo
=
true
);
/* Same function, but accumulates undo and redo*/
bool
requestCompositionInsertion
(
const
QString
&
transitionId
,
int
trackId
,
int
compositionTrack
,
int
position
,
int
length
,
std
::
unique_ptr
<
Mlt
::
Properties
>
transProps
,
int
&
id
,
Fun
&
undo
,
Fun
&
redo
,
bool
finalMove
=
false
);
std
::
unique_ptr
<
Mlt
::
Properties
>
transProps
,
int
&
id
,
Fun
&
undo
,
Fun
&
redo
,
bool
finalMove
=
false
,
QString
originalDecimalPoint
=
QString
()
);
/* @brief This function change the global (timeline-wise) enabled state of the effects
It disables/enables track and clip effects (recursively)
...
...
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