Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
Multimedia
Kdenlive
Commits
91dafd60
Commit
91dafd60
authored
Jun 20, 2020
by
Simon Eugster
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
WIP: Remove QLocales
Related:
#713
parent
36729b22
Pipeline
#24486
passed with stage
in 14 minutes and 28 seconds
Changes
14
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
64 additions
and
98 deletions
+64
-98
src/assets/abstractassetsrepository.ipp
src/assets/abstractassetsrepository.ipp
+5
-7
src/assets/keyframes/model/keyframemodel.cpp
src/assets/keyframes/model/keyframemodel.cpp
+10
-11
src/assets/model/assetparametermodel.cpp
src/assets/model/assetparametermodel.cpp
+19
-27
src/assets/view/widgets/animationwidget.cpp
src/assets/view/widgets/animationwidget.cpp
+1
-3
src/assets/view/widgets/curves/bezier/cubicbezierspline.cpp
src/assets/view/widgets/curves/bezier/cubicbezierspline.cpp
+4
-4
src/assets/view/widgets/doubleparamwidget.cpp
src/assets/view/widgets/doubleparamwidget.cpp
+4
-8
src/assets/view/widgets/keyframeedit.cpp
src/assets/view/widgets/keyframeedit.cpp
+1
-11
src/assets/view/widgets/keyframewidget.cpp
src/assets/view/widgets/keyframewidget.cpp
+5
-8
src/assets/view/widgets/lumaliftgainparam.cpp
src/assets/view/widgets/lumaliftgainparam.cpp
+5
-6
src/assets/view/widgets/lumaliftgainparam.hpp
src/assets/view/widgets/lumaliftgainparam.hpp
+0
-1
src/bin/projectitemmodel.cpp
src/bin/projectitemmodel.cpp
+2
-1
src/doc/documentvalidator.cpp
src/doc/documentvalidator.cpp
+7
-6
src/doc/kdenlivedoc.cpp
src/doc/kdenlivedoc.cpp
+0
-2
src/widgets/geometrywidget.cpp
src/widgets/geometrywidget.cpp
+1
-3
No files found.
src/assets/abstractassetsrepository.ipp
View file @
91dafd60
...
...
@@ -142,8 +142,6 @@ template <typename AssetType> bool AbstractAssetsRepository<AssetType>::parseInf
QDomElement eff = doc.createElement(QStringLiteral("effect"));
eff.setAttribute(QStringLiteral("tag"), id);
eff.setAttribute(QStringLiteral("id"), id);
QLocale locale;
////qCDebug(KDENLIVE_LOG)<<"Effect: "<<id;
Mlt::Properties param_props((mlt_properties)metadata->get_data("parameters"));
for (int j = 0; param_props.is_valid() && j < param_props.count(); ++j) {
...
...
@@ -165,10 +163,10 @@ template <typename AssetType> bool AbstractAssetsRepository<AssetType>::parseInf
if (paramType == QLatin1String("float")) {
// Float must be converted using correct locale
if (paramdesc.get("maximum")) {
params.setAttribute(QStringLiteral("max"),
locale.toString
(paramdesc.get_double("maximum")));
params.setAttribute(QStringLiteral("max"),
QString::number
(paramdesc.get_double("maximum")
, 'f'
));
}
if (paramdesc.get("minimum")) {
params.setAttribute(QStringLiteral("min"),
locale.toString
(paramdesc.get_double("minimum")));
params.setAttribute(QStringLiteral("min"),
QString::number
(paramdesc.get_double("minimum")
, 'f'
));
}
} else {
if (paramdesc.get("maximum")) {
...
...
@@ -214,12 +212,12 @@ template <typename AssetType> bool AbstractAssetsRepository<AssetType>::parseInf
if (paramType == QLatin1String("float")) {
// floats have to be converted using correct locale
if (paramdesc.get("default")) {
params.setAttribute(QStringLiteral("default"),
locale.toString
(paramdesc.get_double("default")));
params.setAttribute(QStringLiteral("default"),
QString::number
(paramdesc.get_double("default")
, 'f'
));
}
if (paramdesc.get("value")) {
params.setAttribute(QStringLiteral("value"),
locale.toString
(paramdesc.get_double("value")));
params.setAttribute(QStringLiteral("value"),
QString::number
(paramdesc.get_double("value")
, 'f'
));
} else {
params.setAttribute(QStringLiteral("value"),
locale.toString
(paramdesc.get_double("default")));
params.setAttribute(QStringLiteral("value"),
QString::number
(paramdesc.get_double("default")
, 'f'
));
}
} else {
if (paramdesc.get("default")) {
...
...
src/assets/keyframes/model/keyframemodel.cpp
View file @
91dafd60
...
...
@@ -442,8 +442,12 @@ QVariant KeyframeModel::data(const QModelIndex &index, int role) const
case
NormalizedValueRole
:
{
if
(
m_paramType
==
ParamType
::
AnimatedRect
)
{
const
QString
&
data
=
it
->
second
.
second
.
toString
();
QLocale
locale
;
return
locale
.
toDouble
(
data
.
section
(
QLatin1Char
(
' '
),
-
1
));
bool
ok
;
double
converted
=
data
.
section
(
QLatin1Char
(
' '
),
-
1
).
toDouble
(
&
ok
);
if
(
!
ok
)
{
qDebug
()
<<
"QLocale: Could not convert animated rect opacity"
<<
data
;
}
return
converted
;
}
double
val
=
it
->
second
.
second
.
toDouble
();
if
(
auto
ptr
=
m_model
.
lock
())
{
...
...
@@ -713,7 +717,6 @@ void KeyframeModel::parseAnimProperty(const QString &prop)
{
Fun
undo
=
[]()
{
return
true
;
};
Fun
redo
=
[]()
{
return
true
;
};
QLocale
locale
;
disconnect
(
this
,
&
KeyframeModel
::
modelChanged
,
this
,
&
KeyframeModel
::
sendModification
);
removeAllKeyframes
(
undo
,
redo
);
int
in
=
0
;
...
...
@@ -749,7 +752,7 @@ void KeyframeModel::parseAnimProperty(const QString &prop)
case
ParamType
::
AnimatedRect
:
{
mlt_rect
rect
=
mlt_prop
.
anim_get_rect
(
"key"
,
frame
);
if
(
useOpacity
)
{
value
=
QVariant
(
QStringLiteral
(
"%1 %2 %3 %4 %5"
).
arg
(
rect
.
x
).
arg
(
rect
.
y
).
arg
(
rect
.
w
).
arg
(
rect
.
h
).
arg
(
locale
.
toString
(
rect
.
o
)
));
value
=
QVariant
(
QStringLiteral
(
"%1 %2 %3 %4 %5"
).
arg
(
rect
.
x
).
arg
(
rect
.
y
).
arg
(
rect
.
w
).
arg
(
rect
.
h
).
arg
(
rect
.
o
,
0
,
'f'
));
}
else
{
value
=
QVariant
(
QStringLiteral
(
"%1 %2 %3 %4"
).
arg
(
rect
.
x
).
arg
(
rect
.
y
).
arg
(
rect
.
w
).
arg
(
rect
.
h
));
}
...
...
@@ -782,7 +785,6 @@ void KeyframeModel::resetAnimProperty(const QString &prop)
removeAllKeyframes
(
undo
,
redo
);
Mlt
::
Properties
mlt_prop
;
QLocale
locale
;
int
in
=
0
;
bool
useOpacity
=
true
;
if
(
auto
ptr
=
m_model
.
lock
())
{
...
...
@@ -812,7 +814,7 @@ void KeyframeModel::resetAnimProperty(const QString &prop)
case
ParamType
::
AnimatedRect
:
{
mlt_rect
rect
=
mlt_prop
.
anim_get_rect
(
"key"
,
frame
);
if
(
useOpacity
)
{
value
=
QVariant
(
QStringLiteral
(
"%1 %2 %3 %4 %5"
).
arg
(
rect
.
x
).
arg
(
rect
.
y
).
arg
(
rect
.
w
).
arg
(
rect
.
h
).
arg
(
locale
.
toString
(
rect
.
o
)));
value
=
QVariant
(
QStringLiteral
(
"%1 %2 %3 %4 %5"
).
arg
(
rect
.
x
).
arg
(
rect
.
y
).
arg
(
rect
.
w
).
arg
(
rect
.
h
).
arg
(
QString
::
number
(
rect
.
o
,
'f'
)));
}
else
{
value
=
QVariant
(
QStringLiteral
(
"%1 %2 %3 %4"
).
arg
(
rect
.
x
).
arg
(
rect
.
y
).
arg
(
rect
.
w
).
arg
(
rect
.
h
));
}
...
...
@@ -877,10 +879,8 @@ QVariant KeyframeModel::getInterpolatedValue(int p) const
QVariant
KeyframeModel
::
updateInterpolated
(
const
QVariant
&
interpValue
,
double
val
)
{
QStringList
vals
=
interpValue
.
toString
().
split
(
QLatin1Char
(
' '
));
QLocale
locale
;
locale
.
setNumberOptions
(
QLocale
::
OmitGroupSeparator
);
if
(
!
vals
.
isEmpty
())
{
vals
[
vals
.
size
()
-
1
]
=
locale
.
toString
(
val
);
vals
[
vals
.
size
()
-
1
]
=
QString
::
number
(
val
,
'f'
);
}
return
vals
.
join
(
QLatin1Char
(
' '
));
}
...
...
@@ -938,14 +938,13 @@ QVariant KeyframeModel::getInterpolatedValue(const GenTime &pos) const
return
QVariant
();
}
else
if
(
m_paramType
==
ParamType
::
AnimatedRect
)
{
if
(
!
animData
.
isEmpty
())
{
QLocale
locale
;
mlt_prop
.
set
(
"key"
,
animData
.
toUtf8
().
constData
());
// This is a fake query to force the animation to be parsed
(
void
)
mlt_prop
.
anim_get_double
(
"key"
,
0
,
out
);
mlt_rect
rect
=
mlt_prop
.
anim_get_rect
(
"key"
,
pos
.
frames
(
pCore
->
getCurrentFps
()));
QString
res
=
QStringLiteral
(
"%1 %2 %3 %4"
).
arg
((
int
)
rect
.
x
).
arg
((
int
)
rect
.
y
).
arg
((
int
)
rect
.
w
).
arg
((
int
)
rect
.
h
);
if
(
useOpacity
)
{
res
.
append
(
QStringLiteral
(
" %1"
).
arg
(
locale
.
toString
(
rect
.
o
)));
res
.
append
(
QStringLiteral
(
" %1"
).
arg
(
QString
::
number
(
rect
.
o
,
'f'
)));
}
return
QVariant
(
res
);
}
...
...
src/assets/model/assetparametermodel.cpp
View file @
91dafd60
...
...
@@ -51,8 +51,6 @@ AssetParameterModel::AssetParameterModel(std::unique_ptr<Mlt::Properties> asset,
bool
needsLocaleConversion
=
false
;
QChar
separator
,
oldSeparator
;
// Check locale, default effects xml has no LC_NUMERIC defined and always uses the C locale
QLocale
locale
;
locale
.
setNumberOptions
(
QLocale
::
OmitGroupSeparator
);
if
(
assetXml
.
hasAttribute
(
QStringLiteral
(
"LC_NUMERIC"
)))
{
QLocale
effectLocale
=
QLocale
(
assetXml
.
attribute
(
QStringLiteral
(
"LC_NUMERIC"
)));
if
(
QLocale
::
c
().
decimalPoint
()
!=
effectLocale
.
decimalPoint
())
{
...
...
@@ -112,10 +110,8 @@ AssetParameterModel::AssetParameterModel(std::unique_ptr<Mlt::Properties> asset,
currentRow
.
xml
=
currentParameter
;
if
(
value
.
isEmpty
())
{
QVariant
defaultValue
=
parseAttribute
(
m_ownerId
,
QStringLiteral
(
"default"
),
currentParameter
);
value
=
defaultValue
.
type
()
==
QVariant
::
Double
?
locale
.
toString
(
defaultValue
.
toDouble
())
:
defaultValue
.
toString
();
}
if
(
name
==
"variance"
)
{
qDebug
()
<<
"Hey"
;
value
=
defaultValue
.
toString
();
qDebug
()
<<
"QLocale: Default value is"
<<
defaultValue
<<
"parsed:"
<<
value
;
}
bool
isFixed
=
(
type
==
QLatin1String
(
"fixed"
));
if
(
isFixed
)
{
...
...
@@ -136,6 +132,7 @@ AssetParameterModel::AssetParameterModel(std::unique_ptr<Mlt::Properties> asset,
if
(
fixDecimalPoint
)
{
bool
converted
=
true
;
QString
originalValue
(
value
);
switch
(
currentRow
.
type
)
{
case
ParamType
::
KeyframeParam
:
case
ParamType
::
Position
:
...
...
@@ -146,12 +143,14 @@ AssetParameterModel::AssetParameterModel(std::unique_ptr<Mlt::Properties> asset,
// Fix values like <position>=50 20 1920 1080 0,75
value
.
replace
(
QRegExp
(
R"((=\d+ \d+ \d+ \d+ \d+),(\d+))"
),
"
\\
1.
\\
2"
);
break
;
case
ParamType
::
ColorWheel
:
// Colour wheel has 3 separate properties: prop_r, prop_g and prop_b, always numbers
case
ParamType
::
Double
:
case
ParamType
::
Hidden
:
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
;
...
...
@@ -167,7 +166,6 @@ AssetParameterModel::AssetParameterModel(std::unique_ptr<Mlt::Properties> asset,
// All fine
converted
=
false
;
break
;
case
ParamType
::
ColorWheel
:
case
ParamType
::
Curve
:
case
ParamType
::
Geometry
:
case
ParamType
::
Switch
:
...
...
@@ -182,7 +180,11 @@ AssetParameterModel::AssetParameterModel(std::unique_ptr<Mlt::Properties> asset,
break
;
}
if
(
converted
)
{
qDebug
()
<<
"Decimal point conversion: "
<<
name
<<
"="
<<
value
;
if
(
value
!=
originalValue
)
{
qDebug
()
<<
"Decimal point conversion: "
<<
name
<<
"converted from"
<<
originalValue
<<
"to"
<<
value
;
}
else
{
qDebug
()
<<
"Decimal point conversion: "
<<
name
<<
" is already ok: "
<<
value
;
}
}
else
{
qDebug
()
<<
"No fixing needed for"
<<
name
<<
"="
<<
value
;
}
...
...
@@ -287,8 +289,6 @@ void AssetParameterModel::setParameter(const QString &name, int value, bool upda
void
AssetParameterModel
::
internalSetParameter
(
const
QString
&
name
,
const
QString
&
paramValue
,
const
QModelIndex
&
paramIndex
)
{
Q_ASSERT
(
m_asset
->
is_valid
());
QLocale
locale
;
locale
.
setNumberOptions
(
QLocale
::
OmitGroupSeparator
);
// TODO: this does not really belong here, but I don't see another way to do it so that undo works
if
(
data
(
paramIndex
,
AssetParameterModel
::
TypeRole
).
value
<
ParamType
>
()
==
ParamType
::
Curve
)
{
#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0)
...
...
@@ -316,13 +316,7 @@ void AssetParameterModel::internalSetParameter(const QString &name, const QStrin
}
}
bool
conversionSuccess
=
true
;
double
doubleValue
=
0
;
if
(
paramValue
.
simplified
().
contains
(
QLatin1Char
(
' '
)))
{
// Some locale interpret a space as thousands separator
conversionSuccess
=
false
;
}
else
{
doubleValue
=
locale
.
toDouble
(
paramValue
,
&
conversionSuccess
);
}
double
doubleValue
=
paramValue
.
toDouble
(
&
conversionSuccess
);
if
(
conversionSuccess
)
{
m_asset
->
set
(
name
.
toLatin1
().
constData
(),
doubleValue
);
if
(
m_fixedParams
.
count
(
name
)
==
0
)
{
...
...
@@ -640,9 +634,12 @@ QVariant AssetParameterModel::parseAttribute(const ObjectId &owner, const QStrin
if
(
attribute
==
QLatin1String
(
"default"
))
{
return
content
.
toDouble
();
}
QLocale
locale
;
locale
.
setNumberOptions
(
QLocale
::
OmitGroupSeparator
);
return
locale
.
toDouble
(
content
);
bool
ok
;
double
converted
=
content
.
toDouble
(
&
ok
);
if
(
!
ok
)
{
qDebug
()
<<
"QLocale: Could not load double parameter"
<<
content
;
}
return
converted
;
}
if
(
attribute
==
QLatin1String
(
"default"
))
{
if
(
type
==
ParamType
::
RestrictedAnim
)
{
...
...
@@ -656,11 +653,6 @@ QVariant AssetParameterModel::parseAttribute(const ObjectId &owner, const QStrin
return
res
;
}
return
defaultValue
.
isNull
()
?
content
:
defaultValue
;
}
else
if
(
type
==
ParamType
::
Bezier_spline
)
{
QLocale
locale
;
if
(
locale
.
decimalPoint
()
!=
QLocale
::
c
().
decimalPoint
())
{
return
content
.
replace
(
QLocale
::
c
().
decimalPoint
(),
locale
.
decimalPoint
());
}
}
}
return
content
;
...
...
src/assets/view/widgets/animationwidget.cpp
View file @
91dafd60
...
...
@@ -1070,8 +1070,6 @@ const QMap<QString, QString> AnimationWidget::getAnimation()
int
pos
;
mlt_keyframe_type
type
;
QString
key
;
QLocale
locale
;
locale
.
setNumberOptions
(
QLocale
::
OmitGroupSeparator
);
QStringList
result
;
int
duration
=
m_outPoint
;
for
(
int
j
=
0
;
j
<
m_animController
.
key_count
();
++
j
)
{
...
...
@@ -1092,7 +1090,7 @@ const QMap<QString, QString> AnimationWidget::getAnimation()
key
.
append
(
QStringLiteral
(
"="
));
break
;
}
key
.
append
(
locale
.
toString
(
val
));
key
.
append
(
QString
::
number
(
val
,
'f'
));
result
<<
key
;
}
animationResults
.
insert
(
i
.
key
(),
result
.
join
(
QLatin1Char
(
';'
)));
...
...
src/assets/view/widgets/curves/bezier/cubicbezierspline.cpp
View file @
91dafd60
...
...
@@ -44,7 +44,6 @@ CubicBezierSpline &CubicBezierSpline::operator=(const CubicBezierSpline &spline)
void
CubicBezierSpline
::
fromString
(
const
QString
&
spline
)
{
m_points
.
clear
();
QLocale
locale
;
const
QStringList
bpoints
=
spline
.
split
(
QLatin1Char
(
'|'
));
for
(
const
QString
&
bpoint
:
bpoints
)
{
const
QStringList
points
=
bpoint
.
split
(
QLatin1Char
(
'#'
));
...
...
@@ -52,7 +51,7 @@ void CubicBezierSpline::fromString(const QString &spline)
for
(
const
QString
&
point
:
points
)
{
const
QStringList
xy
=
point
.
split
(
QLatin1Char
(
';'
));
if
(
xy
.
count
()
==
2
)
{
values
.
append
(
QPointF
(
locale
.
toDouble
(
xy
.
at
(
0
)),
locale
.
toDouble
(
xy
.
at
(
1
)
)));
values
.
append
(
QPointF
(
xy
.
at
(
0
)
.
toDouble
(
),
xy
.
at
(
1
)
.
toDouble
()));
}
}
if
(
values
.
count
()
==
3
)
{
...
...
@@ -71,8 +70,9 @@ QString CubicBezierSpline::toString() const
locale
.
setNumberOptions
(
QLocale
::
OmitGroupSeparator
);
for
(
const
BPoint
&
p
:
m_points
)
{
spline
<<
QStringLiteral
(
"%1;%2#%3;%4#%5;%6"
)
.
arg
(
locale
.
toString
(
p
.
h1
.
x
()),
locale
.
toString
(
p
.
h1
.
y
()),
locale
.
toString
(
p
.
p
.
x
()),
locale
.
toString
(
p
.
p
.
y
()),
locale
.
toString
(
p
.
h2
.
x
()),
locale
.
toString
(
p
.
h2
.
y
()));
.
arg
(
QString
::
number
(
p
.
h1
.
x
(),
'f'
),
QString
::
number
(
p
.
h1
.
y
(),
'f'
),
QString
::
number
(
p
.
p
.
x
(),
'f'
),
QString
::
number
(
p
.
p
.
y
(),
'f'
),
QString
::
number
(
p
.
h2
.
x
(),
'f'
),
QString
::
number
(
p
.
h2
.
y
(),
'f'
));
}
return
spline
.
join
(
QLatin1Char
(
'|'
));
}
...
...
src/assets/view/widgets/doubleparamwidget.cpp
View file @
91dafd60
...
...
@@ -32,15 +32,13 @@ DoubleParamWidget::DoubleParamWidget(std::shared_ptr<AssetParameterModel> model,
m_lay
=
new
QVBoxLayout
(
this
);
m_lay
->
setContentsMargins
(
0
,
0
,
0
,
0
);
m_lay
->
setSpacing
(
0
);
QLocale
locale
;
locale
.
setNumberOptions
(
QLocale
::
OmitGroupSeparator
);
// Retrieve parameters from the model
QString
name
=
m_model
->
data
(
m_index
,
Qt
::
DisplayRole
).
toString
();
double
value
=
locale
.
toDouble
(
m_model
->
data
(
m_index
,
AssetParameterModel
::
ValueRole
).
to
String
()
);
double
value
=
m_model
->
data
(
m_index
,
AssetParameterModel
::
ValueRole
).
to
Double
(
);
double
min
=
m_model
->
data
(
m_index
,
AssetParameterModel
::
MinRole
).
toDouble
();
double
max
=
m_model
->
data
(
m_index
,
AssetParameterModel
::
MaxRole
).
toDouble
();
double
defaultValue
=
locale
.
toDouble
(
m_model
->
data
(
m_index
,
AssetParameterModel
::
DefaultRole
).
to
String
()
);
double
defaultValue
=
m_model
->
data
(
m_index
,
AssetParameterModel
::
DefaultRole
).
to
Double
(
);
QString
comment
=
m_model
->
data
(
m_index
,
AssetParameterModel
::
CommentRole
).
toString
();
QString
suffix
=
m_model
->
data
(
m_index
,
AssetParameterModel
::
SuffixRole
).
toString
();
int
decimals
=
m_model
->
data
(
m_index
,
AssetParameterModel
::
DecimalsRole
).
toInt
();
...
...
@@ -51,16 +49,14 @@ DoubleParamWidget::DoubleParamWidget(std::shared_ptr<AssetParameterModel> model,
setMinimumHeight
(
m_doubleWidget
->
height
());
// Connect signal
connect
(
m_doubleWidget
,
&
DoubleWidget
::
valueChanged
,
[
this
,
locale
](
double
val
)
{
emit
valueChanged
(
m_index
,
locale
.
toString
(
val
),
true
);
});
connect
(
m_doubleWidget
,
&
DoubleWidget
::
valueChanged
,
[
this
](
double
val
)
{
emit
valueChanged
(
m_index
,
QString
::
number
(
val
,
'f'
),
true
);
});
slotRefresh
();
}
void
DoubleParamWidget
::
slotRefresh
()
{
QSignalBlocker
bk
(
m_doubleWidget
);
QLocale
locale
;
locale
.
setNumberOptions
(
QLocale
::
OmitGroupSeparator
);
double
value
=
locale
.
toDouble
(
m_model
->
data
(
m_index
,
AssetParameterModel
::
ValueRole
).
toString
());
double
value
=
m_model
->
data
(
m_index
,
AssetParameterModel
::
ValueRole
).
toDouble
();
m_doubleWidget
->
setValue
(
value
);
}
...
...
src/assets/view/widgets/keyframeedit.cpp
View file @
91dafd60
...
...
@@ -113,13 +113,11 @@ void KeyframeEdit::addParameter(QModelIndex index, int activeKeyframe)
keyframe_list
->
blockSignals
(
true
);
// Retrieve parameters from the model
QLocale
locale
;
locale
.
setNumberOptions
(
QLocale
::
OmitGroupSeparator
);
QString
name
=
m_model
->
data
(
index
,
Qt
::
DisplayRole
).
toString
();
double
value
=
0
;
// locale.toDouble(m_model->data(index, AssetParameterModel::ValueRole).toString());
double
min
=
m_model
->
data
(
index
,
AssetParameterModel
::
MinRole
).
toDouble
();
double
max
=
m_model
->
data
(
index
,
AssetParameterModel
::
MaxRole
).
toDouble
();
double
defaultValue
=
locale
.
toDouble
(
m_model
->
data
(
index
,
AssetParameterModel
::
DefaultRole
).
to
String
()
);
double
defaultValue
=
m_model
->
data
(
index
,
AssetParameterModel
::
DefaultRole
).
to
Double
(
);
QString
comment
=
m_model
->
data
(
index
,
AssetParameterModel
::
CommentRole
).
toString
();
QString
suffix
=
m_model
->
data
(
index
,
AssetParameterModel
::
SuffixRole
).
toString
();
int
decimals
=
m_model
->
data
(
index
,
AssetParameterModel
::
DecimalsRole
).
toInt
();
...
...
@@ -131,14 +129,6 @@ void KeyframeEdit::addParameter(QModelIndex index, int activeKeyframe)
DoubleWidget
*
doubleparam
=
new
DoubleWidget
(
name
,
value
,
min
,
max
,
m_model
->
data
(
index
,
AssetParameterModel
::
FactorRole
).
toDouble
(),
defaultValue
,
comment
,
-
1
,
suffix
,
decimals
,
m_model
->
data
(
index
,
AssetParameterModel
::
OddRole
).
toBool
(),
this
);
/*DoubleParameterWidget *doubleparam = new DoubleParameterWidget(
paramName, 0, m_params.at(columnId).attribute(QStringLiteral("min")).toDouble(), m_params.at(columnId).attribute(QStringLiteral("max")).toDouble(),
m_params.at(columnId).attribute(QStringLiteral("default")).toDouble(), comment, columnId, m_params.at(columnId).attribute(QStringLiteral("suffix")),
m_params.at(columnId).attribute(QStringLiteral("decimals")).toInt(), false, this);*/
// Connect signal
// connect(doubleparam, &DoubleWidget::valueChanged, [this, locale, index](double value) { emit valueChanged(index, locale.toString(value)); });
connect
(
doubleparam
,
&
DoubleWidget
::
valueChanged
,
this
,
&
KeyframeEdit
::
slotAdjustKeyframeValue
);
connect
(
this
,
SIGNAL
(
showComments
(
bool
)),
doubleparam
,
SLOT
(
slotShowComment
(
bool
)));
// connect(doubleparam, SIGNAL(setInTimeline(int)), this, SLOT(slotUpdateVisibleParameter(int)));
...
...
src/assets/view/widgets/keyframewidget.cpp
View file @
91dafd60
...
...
@@ -237,8 +237,7 @@ void KeyframeWidget::slotRefreshParams()
if
(
vals
.
count
()
>=
4
)
{
rect
=
QRect
(
vals
.
at
(
0
).
toInt
(),
vals
.
at
(
1
).
toInt
(),
vals
.
at
(
2
).
toInt
(),
vals
.
at
(
3
).
toInt
());
if
(
vals
.
count
()
>
4
)
{
QLocale
locale
;
opacity
=
locale
.
toDouble
(
vals
.
at
(
4
));
opacity
=
vals
.
at
(
4
).
toDouble
();
}
}
((
GeometryWidget
*
)
w
.
second
)
->
setValue
(
rect
,
opacity
);
...
...
@@ -329,8 +328,6 @@ void KeyframeWidget::resetKeyframes()
void
KeyframeWidget
::
addParameter
(
const
QPersistentModelIndex
&
index
)
{
QLocale
locale
;
locale
.
setNumberOptions
(
QLocale
::
OmitGroupSeparator
);
// Retrieve parameters from the model
QString
name
=
m_model
->
data
(
index
,
Qt
::
DisplayRole
).
toString
();
QString
comment
=
m_model
->
data
(
index
,
AssetParameterModel
::
CommentRole
).
toString
();
...
...
@@ -351,7 +348,7 @@ void KeyframeWidget::addParameter(const QPersistentModelIndex &index)
if
(
vals
.
count
()
>
3
)
{
rect
=
QRect
(
vals
.
at
(
0
).
toInt
(),
vals
.
at
(
1
).
toInt
(),
vals
.
at
(
2
).
toInt
(),
vals
.
at
(
3
).
toInt
());
if
(
vals
.
count
()
>
4
)
{
opacity
=
locale
.
toDouble
(
vals
.
at
(
4
));
opacity
=
vals
.
at
(
4
)
.
toDouble
(
);
}
}
// qtblend uses an opacity value in the (0-1) range, while older geometry effects use (0-100)
...
...
@@ -385,11 +382,11 @@ void KeyframeWidget::addParameter(const QPersistentModelIndex &index)
}
}
double
value
=
m_keyframes
->
getInterpolatedValue
(
getPosition
(),
index
).
toDouble
();
double
min
=
locale
.
toDouble
(
m_model
->
data
(
index
,
AssetParameterModel
::
MinRole
).
to
String
()
);
double
max
=
locale
.
toDouble
(
m_model
->
data
(
index
,
AssetParameterModel
::
MaxRole
).
to
String
()
);
double
min
=
m_model
->
data
(
index
,
AssetParameterModel
::
MinRole
).
to
Double
(
);
double
max
=
m_model
->
data
(
index
,
AssetParameterModel
::
MaxRole
).
to
Double
(
);
double
defaultValue
=
m_model
->
data
(
index
,
AssetParameterModel
::
DefaultRole
).
toDouble
();
int
decimals
=
m_model
->
data
(
index
,
AssetParameterModel
::
DecimalsRole
).
toInt
();
double
factor
=
locale
.
toDouble
(
m_model
->
data
(
index
,
AssetParameterModel
::
FactorRole
).
to
String
()
);
double
factor
=
m_model
->
data
(
index
,
AssetParameterModel
::
FactorRole
).
to
Double
(
);
factor
=
qFuzzyIsNull
(
factor
)
?
1
:
factor
;
auto
doubleWidget
=
new
DoubleWidget
(
name
,
value
,
min
,
max
,
factor
,
defaultValue
,
comment
,
-
1
,
suffix
,
decimals
,
m_model
->
data
(
index
,
AssetParameterModel
::
OddRole
).
toBool
(),
this
);
connect
(
doubleWidget
,
&
DoubleWidget
::
valueChanged
,
...
...
src/assets/view/widgets/lumaliftgainparam.cpp
View file @
91dafd60
...
...
@@ -34,7 +34,6 @@ LumaLiftGainParam::LumaLiftGainParam(std::shared_ptr<AssetParameterModel> model,
{
m_flowLayout
=
new
FlowLayout
(
this
,
2
,
2
,
2
);
setSizePolicy
(
QSizePolicy
::
Preferred
,
QSizePolicy
::
Preferred
);
m_locale
.
setNumberOptions
(
QLocale
::
OmitGroupSeparator
);
m_lift
=
new
ColorWheel
(
QStringLiteral
(
"lift"
),
i18n
(
"Lift"
),
NegQColor
(),
this
);
m_lift
->
setFactorDefaultZero
(
LIFT_FACTOR
,
0
,
0.5
);
connect
(
m_lift
,
&
ColorWheel
::
colorChange
,
this
,
&
LumaLiftGainParam
::
liftChanged
);
...
...
@@ -60,19 +59,19 @@ LumaLiftGainParam::LumaLiftGainParam(std::shared_ptr<AssetParameterModel> model,
connect
(
this
,
&
LumaLiftGainParam
::
liftChanged
,
[
this
,
indexes
]()
{
NegQColor
liftColor
=
m_lift
->
color
();
QList
<
QModelIndex
>
ixes
{
indexes
.
value
(
QStringLiteral
(
"lift_r"
)),
indexes
.
value
(
QStringLiteral
(
"lift_g"
)),
indexes
.
value
(
QStringLiteral
(
"lift_b"
))};
QStringList
values
{
m_locale
.
toString
(
liftColor
.
redF
()),
m_locale
.
toString
(
liftColor
.
greenF
()),
m_locale
.
toString
(
liftColor
.
blueF
())};
QStringList
values
{
QString
::
number
(
liftColor
.
redF
(),
'f'
),
QString
::
number
(
liftColor
.
greenF
(),
'f'
),
QString
::
number
(
liftColor
.
blueF
()
,
'f'
)};
emit
valuesChanged
(
ixes
,
values
,
true
);
});
connect
(
this
,
&
LumaLiftGainParam
::
gammaChanged
,
[
this
,
indexes
]()
{
NegQColor
gammaColor
=
m_gamma
->
color
();
QList
<
QModelIndex
>
ixes
{
indexes
.
value
(
QStringLiteral
(
"gamma_r"
)),
indexes
.
value
(
QStringLiteral
(
"gamma_g"
)),
indexes
.
value
(
QStringLiteral
(
"gamma_b"
))};
QStringList
values
{
m_locale
.
toString
(
gammaColor
.
redF
()
*
GAMMA_FACTOR
),
m_locale
.
toString
(
gammaColor
.
greenF
()
*
GAMMA_FACTOR
),
m_locale
.
toString
(
gammaColor
.
blueF
()
*
GAMMA_FACTOR
)};
QStringList
values
{
QString
::
number
(
gammaColor
.
redF
()
*
GAMMA_FACTOR
,
'f'
),
QString
::
number
(
gammaColor
.
greenF
()
*
GAMMA_FACTOR
,
'f'
),
QString
::
number
(
gammaColor
.
blueF
()
*
GAMMA_FACTOR
,
'f'
)};
emit
valuesChanged
(
ixes
,
values
,
true
);
});
connect
(
this
,
&
LumaLiftGainParam
::
gainChanged
,
[
this
,
indexes
]()
{
NegQColor
gainColor
=
m_gain
->
color
();
QList
<
QModelIndex
>
ixes
{
indexes
.
value
(
QStringLiteral
(
"gain_r"
)),
indexes
.
value
(
QStringLiteral
(
"gain_g"
)),
indexes
.
value
(
QStringLiteral
(
"gain_b"
))};
QStringList
values
{
m_locale
.
toString
(
gainColor
.
redF
()
*
GAIN_FACTOR
),
m_locale
.
toString
(
gainColor
.
greenF
()
*
GAIN_FACTOR
),
m_locale
.
toString
(
gainColor
.
blueF
()
*
GAIN_FACTOR
)};
QStringList
values
{
QString
::
number
(
gainColor
.
redF
()
*
GAIN_FACTOR
,
'f'
),
QString
::
number
(
gainColor
.
greenF
()
*
GAIN_FACTOR
,
'f'
),
QString
::
number
(
gainColor
.
blueF
()
*
GAIN_FACTOR
,
'f'
)};
emit
valuesChanged
(
ixes
,
values
,
true
);
});
}
...
...
@@ -103,7 +102,7 @@ void LumaLiftGainParam::updateEffect(QDomElement &effect)
}
if
(
values
.
contains
(
pa
.
attribute
(
QStringLiteral
(
"name"
))))
{
pa
.
setAttribute
(
QStringLiteral
(
"value"
),
(
int
)(
values
.
value
(
pa
.
attribute
(
QStringLiteral
(
"name"
)))
*
m_locale
.
toDouble
(
pa
.
attribute
(
QStringLiteral
(
"factor"
),
QStringLiteral
(
"1"
)))));
pa
.
attribute
(
QStringLiteral
(
"factor"
),
QStringLiteral
(
"1"
))
.
toDouble
(
)));
}
}
}
...
...
@@ -124,7 +123,7 @@ void LumaLiftGainParam::slotRefresh()
for
(
int
i
=
0
;
i
<
m_model
->
rowCount
();
++
i
)
{
QModelIndex
local_index
=
m_model
->
index
(
i
,
0
);
QString
name
=
m_model
->
data
(
local_index
,
AssetParameterModel
::
NameRole
).
toString
();
double
val
=
m_locale
.
toDouble
(
m_model
->
data
(
local_index
,
AssetParameterModel
::
ValueRole
).
to
String
()
);
double
val
=
m_model
->
data
(
local_index
,
AssetParameterModel
::
ValueRole
).
to
Double
(
);
values
.
insert
(
name
,
val
);
}
m_lift
->
setColor
({
values
.
value
(
QStringLiteral
(
"lift_r"
)),
values
.
value
(
QStringLiteral
(
"lift_g"
)),
values
.
value
(
QStringLiteral
(
"lift_b"
))});
...
...
src/assets/view/widgets/lumaliftgainparam.hpp
View file @
91dafd60
...
...
@@ -46,7 +46,6 @@ public:
void
updateEffect
(
QDomElement
&
effect
);
private:
QLocale
m_locale
;
ColorWheel
*
m_lift
;
ColorWheel
*
m_gamma
;
ColorWheel
*
m_gain
;
...
...
src/bin/projectitemmodel.cpp
View file @
91dafd60
...
...
@@ -978,7 +978,8 @@ void ProjectItemModel::loadBinPlaylist(Mlt::Tractor *documentTractor, Mlt::Tract
pCore
->
loadingMessageUpdated
(
i18n
(
"Loading project clips..."
));
}
// Load bin clips
qDebug
()
<<
"init bin"
;
auto
currentLocale
=
strdup
(
setlocale
(
LC_ALL
,
nullptr
));
qDebug
()
<<
"Init bin; Current LC_ALL"
<<
currentLocale
;
// Load folders
Mlt
::
Properties
folderProperties
;
Mlt
::
Properties
playlistProps
(
playlist
.
get_properties
());
...
...
src/doc/documentvalidator.cpp
View file @
91dafd60
...
...
@@ -1739,7 +1739,8 @@ auto DocumentValidator::upgradeTo100(const QLocale &documentLocale) -> QString {
// List of properties which always need to be fixed
QList
<
QString
>
generalPropertiesToFix
=
{
"warp_speed"
,
"length"
};
// Example: <property name="aspect_ratio">1,00247</property>
QList
<
QString
>
generalPropertiesToFix
=
{
"warp_speed"
,
"length"
,
"aspect_ratio"
};
// Fix properties just by name, anywhere in the file
auto
props
=
m_doc
.
elementsByTagName
(
QStringLiteral
(
"property"
));
...
...
@@ -1751,7 +1752,9 @@ auto DocumentValidator::upgradeTo100(const QLocale &documentLocale) -> QString {
QDomText
text
=
element
.
firstChild
().
toText
();
if
(
!
text
.
isNull
())
{
bool
autoReplace
=
propName
.
endsWith
(
"frame_rate"
)
||
(
generalPropertiesToFix
.
indexOf
(
propName
)
>=
0
);
bool
autoReplace
=
propName
.
endsWith
(
"frame_rate"
)
||
propName
.
endsWith
(
"aspect_ratio"
)
||
(
generalPropertiesToFix
.
indexOf
(
propName
)
>=
0
);
QString
originalValue
=
text
.
nodeValue
();
QString
value
(
originalValue
);
...
...
@@ -1827,7 +1830,7 @@ auto DocumentValidator::upgradeTo100(const QLocale &documentLocale) -> QString {
fixTimecode
(
newValue
);
if
(
oldValue
!=
newValue
)
{
el
.
setAttribute
(
attributeName
,
newValue
);
qDebug
()
<<
"Decimal point: Converted"
<<
oldValu
e
<<
"
to
"
<<
new
Value
<<
"
in
"
<<
el
.
nodeName
()
<<
attributeNam
e
;
qDebug
()
<<
"Decimal point: Converted"
<<
el
.
nodeName
()
<<
attributeNam
e
<<
"
from
"
<<
old
Value
<<
"
to
"
<<
newValu
e
;
}
}
};
...
...
@@ -1836,9 +1839,6 @@ 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"
);
...
...
@@ -1848,6 +1848,7 @@ auto DocumentValidator::upgradeTo100(const QLocale &documentLocale) -> QString {
}
modified
=
true
;
qDebug
()
<<
"Decimal point: New XML: "
<<
m_doc
.
toString
(
-
1
);
}
else
{
qDebug
()
<<
"Decimal point is OK"
;
...
...
src/doc/kdenlivedoc.cpp
View file @
91dafd60
...
...
@@ -311,7 +311,6 @@ const QByteArray KdenliveDoc::getAndClearProjectXml()
const
QByteArray
result
=
m_document
.
toString
().
toUtf8
();
// We don't need the xml data anymore, throw away
m_document
.
clear
();
qDebug
()
<<
"Project XML: "
<<
result
;
return
result
;
}
...
...
@@ -621,7 +620,6 @@ bool KdenliveDoc::saveSceneList(const QString &path, const QString &scene)
QLocale
currentLocale
;
qDebug
()
<<
"Current locale is "
<<
currentLocale
;
QLocale
::
setDefault
(
QLocale
(
QLocale
::
Russian
,
QLocale
::
Russia
));
const
QByteArray
sceneData
=
sceneList
.
toString
().
toUtf8
();
QLocale
::
setDefault
(
currentLocale
);
...
...
src/widgets/geometrywidget.cpp
View file @
91dafd60
...
...
@@ -413,14 +413,12 @@ void GeometryWidget::setValue(const QRect r, double opacity)
const
QString
GeometryWidget
::
getValue
()
const
{
if
(
m_opacity
)
{
QLocale
locale
;
locale
.
setNumberOptions
(
QLocale
::
OmitGroupSeparator
);
return
QStringLiteral
(
"%1 %2 %3 %4 %5"
)
.
arg
(
m_spinX
->
value
())
.
arg
(
m_spinY
->
value
())
.
arg
(
m_spinWidth
->
value
())
.
arg
(
m_spinHeight
->
value
())
.
arg
(
locale
.
toString
(
m_opacity
->
value
()
/
m_opacityFactor
));
.
arg
(
QString
::
number
(
m_opacity
->
value
()
/
m_opacityFactor
,
'f'
));
}
return
QStringLiteral
(
"%1 %2 %3 %4"
).
arg
(
m_spinX
->
value
()).
arg
(
m_spinY
->
value
()).
arg
(
m_spinWidth
->
value
()).
arg
(
m_spinHeight
->
value
());
}
...
...
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