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
36729b22
Commit
36729b22
authored
Jun 16, 2020
by
Simon Eugster
Browse files
Decimal point: Treat all parameter types
Related:
#713
parent
010a531e
Pipeline
#23916
passed with stage
in 14 minutes and 18 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
src/assets/model/assetparametermodel.cpp
View file @
36729b22
...
...
@@ -80,7 +80,8 @@ AssetParameterModel::AssetParameterModel(std::unique_ptr<Mlt::Properties> asset,
assetXml
.
save
(
stream
,
1
);
qDebug
()
<<
"XML to parse: "
<<
str
;
}
if
(
!
originalDecimalPoint
.
isEmpty
())
{
bool
fixDecimalPoint
=
!
originalDecimalPoint
.
isEmpty
();
if
(
fixDecimalPoint
)
{
qDebug
()
<<
"Original decimal point was different:"
<<
originalDecimalPoint
<<
"Values will be converted if required."
;
}
for
(
int
i
=
0
;
i
<
parameterNodes
.
count
();
++
i
)
{
...
...
@@ -113,6 +114,9 @@ AssetParameterModel::AssetParameterModel(std::unique_ptr<Mlt::Properties> asset,
QVariant
defaultValue
=
parseAttribute
(
m_ownerId
,
QStringLiteral
(
"default"
),
currentParameter
);
value
=
defaultValue
.
type
()
==
QVariant
::
Double
?
locale
.
toString
(
defaultValue
.
toDouble
())
:
defaultValue
.
toString
();
}
if
(
name
==
"variance"
)
{
qDebug
()
<<
"Hey"
;
}
bool
isFixed
=
(
type
==
QLatin1String
(
"fixed"
));
if
(
isFixed
)
{
m_fixedParams
[
name
]
=
value
;
...
...
@@ -128,33 +132,68 @@ AssetParameterModel::AssetParameterModel(std::unique_ptr<Mlt::Properties> asset,
if
(
!
value
.
contains
(
QLatin1Char
(
'='
)))
{
value
.
prepend
(
QStringLiteral
(
"%1="
).
arg
(
pCore
->
getItemIn
(
m_ownerId
)));
}
if
(
!
originalDecimalPoint
.
isEmpty
())
{
if
(
currentRow
.
type
==
ParamType
::
KeyframeParam
)
{
}
if
(
fixDecimalPoint
)
{
bool
converted
=
true
;
switch
(
currentRow
.
type
)
{
case
ParamType
::
KeyframeParam
:
case
ParamType
::
Position
:
// Fix values like <position>=1,5
value
.
replace
(
QRegExp
(
R"((=\d+),(\d+))"
),
"
\\
1.
\\
2"
);
}
else
{
break
;
case
ParamType
::
AnimatedRect
:
// Fix values like <position>=50 20 1920 1080 0,75
value
.
replace
(
QRegExp
(
R"((=\d+ \d+ \d+ \d+ \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
.
replace
(
originalDecimalPoint
,
"."
);
qDebug
()
<<
"Decial point conversion: "
<<
name
<<
"="
<<
value
;
break
;
case
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.
// Fall-through, treat like Double
case
ParamType
::
Double
:
case
ParamType
::
Hidden
:
case
ParamType
::
Bezier_spline
:
value
.
replace
(
originalDecimalPoint
,
"."
);
break
;
case
ParamType
::
Bool
:
case
ParamType
::
Color
:
case
ParamType
::
Fontfamily
:
case
ParamType
::
Keywords
:
case
ParamType
::
Readonly
:
case
ParamType
::
RestrictedAnim
:
// Fine because unsupported
case
ParamType
::
Animated
:
// Fine because unsupported
case
ParamType
::
Addedgeometry
:
// Fine because unsupported
case
ParamType
::
Url
:
// All fine
converted
=
false
;
break
;
case
ParamType
::
ColorWheel
:
case
ParamType
::
Curve
:
case
ParamType
::
Geometry
:
case
ParamType
::
Switch
:
case
ParamType
::
Wipe
:
// Pretty sure that those are fine
converted
=
false
;
break
;
case
ParamType
::
Roto_spline
:
// Not sure because cannot test
case
ParamType
::
Filterjob
:
// Not sure if fine
converted
=
false
;
break
;
}
}
else
if
(
currentRow
.
type
==
ParamType
::
Animated
)
{
if
(
!
originalDecimalPoint
.
isEmpty
())
{
qDebug
()
<<
"PROBABLY ISSUE "
<<
name
<<
value
;
if
(
converted
)
{
qDebug
()
<<
"Decimal point conversion: "
<<
name
<<
"="
<<
value
;
}
else
{
qDebug
()
<<
"No fixing needed for"
<<
name
<<
"="
<<
value
;
}
}
if
(
!
name
.
isEmpty
())
{
internalSetParameter
(
name
,
value
);
// Keep track of param order
m_paramOrder
.
push_back
(
name
);
}
if
(
isFixed
)
{
// fixed parameters are not displayed so we don't store them.
continue
;
...
...
@@ -173,6 +212,7 @@ AssetParameterModel::AssetParameterModel(std::unique_ptr<Mlt::Properties> asset,
}
m_asset
->
set
(
"effect"
,
effectParam
.
join
(
QLatin1Char
(
' '
)).
toUtf8
().
constData
());
}
qDebug
()
<<
"END parsing of "
<<
assetId
<<
". Number of found parameters"
<<
m_rows
.
size
();
emit
modelChanged
();
}
...
...
src/doc/documentvalidator.cpp
View file @
36729b22
...
...
@@ -1821,9 +1821,6 @@ auto DocumentValidator::upgradeTo100(const QLocale &documentLocale) -> QString {
}
auto
fixAttribute
=
[
fixTimecode
](
QDomElement
&
el
,
const
QString
&
attributeName
)
{
if
(
el
.
nodeName
()
==
"blank"
)
{
qDebug
()
<<
"This is a blank!"
;
}
if
(
el
.
hasAttribute
(
attributeName
))
{
QString
oldValue
=
el
.
attribute
(
attributeName
,
""
);
QString
newValue
(
oldValue
);
...
...
@@ -1839,6 +1836,9 @@ auto DocumentValidator::upgradeTo100(const QLocale &documentLocale) -> QString {
QList
<
QString
>
tagsToFix
=
{
"producer"
,
"filter"
,
"tractor"
,
"entry"
,
"transition"
,
"blank"
};
for
(
const
QString
&
tag
:
tagsToFix
)
{
QDomNodeList
elements
=
m_doc
.
elementsByTagName
(
tag
);
if
(
tag
==
"producer"
)
{
qDebug
()
<<
"Fixing producers .."
;
}
for
(
int
i
=
0
;
i
<
elements
.
count
();
i
++
)
{
QDomElement
el
=
elements
.
at
(
i
).
toElement
();
fixAttribute
(
el
,
"in"
);
...
...
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