mirror of https://github.com/procxx/kepka.git
QtLottie: Use QStringLiteral instead of QLatin1String.
This commit is contained in:
parent
21eaa35d8c
commit
0e7cefb69c
|
@ -1 +1 @@
|
||||||
Subproject commit 18b8ae7d9980f7e46980abfb275439782fc4c239
|
Subproject commit 4ca937ed0f7158b5510c54429cc5e57adcf85f10
|
|
@ -87,13 +87,13 @@ public:
|
||||||
|
|
||||||
virtual void construct(const QJsonObject &definition)
|
virtual void construct(const QJsonObject &definition)
|
||||||
{
|
{
|
||||||
if (definition.value(QLatin1String("s")).toVariant().toInt())
|
if (definition.value(QStringLiteral("s")).toVariant().toInt())
|
||||||
qCWarning(lcLottieQtBodymovinParser)
|
qCWarning(lcLottieQtBodymovinParser)
|
||||||
<< "Property is split into separate x and y but it is not supported";
|
<< "Property is split into separate x and y but it is not supported";
|
||||||
|
|
||||||
m_animated = definition.value(QLatin1String("a")).toDouble() > 0;
|
m_animated = definition.value(QStringLiteral("a")).toDouble() > 0;
|
||||||
if (m_animated) {
|
if (m_animated) {
|
||||||
QJsonArray keyframes = definition.value(QLatin1String("k")).toArray();
|
QJsonArray keyframes = definition.value(QStringLiteral("k")).toArray();
|
||||||
QJsonArray::const_iterator it = keyframes.constBegin();
|
QJsonArray::const_iterator it = keyframes.constBegin();
|
||||||
QJsonArray::const_iterator previous;
|
QJsonArray::const_iterator previous;
|
||||||
while (it != keyframes.constEnd()) {
|
while (it != keyframes.constEnd()) {
|
||||||
|
@ -120,7 +120,7 @@ public:
|
||||||
}
|
}
|
||||||
m_value = T();
|
m_value = T();
|
||||||
} else
|
} else
|
||||||
m_value = getValue(definition.value(QLatin1String("k")));
|
m_value = getValue(definition.value(QStringLiteral("k")));
|
||||||
}
|
}
|
||||||
|
|
||||||
void setValue(const T& value)
|
void setValue(const T& value)
|
||||||
|
@ -214,12 +214,12 @@ protected:
|
||||||
{
|
{
|
||||||
EasingSegment<T> easing;
|
EasingSegment<T> easing;
|
||||||
|
|
||||||
int startTime = keyframe.value(QLatin1String("t")).toVariant().toInt();
|
int startTime = keyframe.value(QStringLiteral("t")).toVariant().toInt();
|
||||||
|
|
||||||
// AE exported Bodymovin file includes the last
|
// AE exported Bodymovin file includes the last
|
||||||
// key frame but no other properties.
|
// key frame but no other properties.
|
||||||
// No need to process in that case
|
// No need to process in that case
|
||||||
if (!keyframe.contains(QLatin1String("s")) && !keyframe.contains(QLatin1String("e"))) {
|
if (!keyframe.contains(QStringLiteral("s")) && !keyframe.contains(QStringLiteral("e"))) {
|
||||||
// In this case start time is the last frame for the property
|
// In this case start time is the last frame for the property
|
||||||
this->m_endFrame = startTime;
|
this->m_endFrame = startTime;
|
||||||
easing.startFrame = startTime;
|
easing.startFrame = startTime;
|
||||||
|
@ -242,20 +242,20 @@ protected:
|
||||||
m_startFrame = startTime;
|
m_startFrame = startTime;
|
||||||
|
|
||||||
easing.startFrame = startTime;
|
easing.startFrame = startTime;
|
||||||
easing.startValue = getValue(keyframe.value(QLatin1String("s")).toArray());
|
easing.startValue = getValue(keyframe.value(QStringLiteral("s")).toArray());
|
||||||
if (keyframe.contains(QLatin1String("e"))) {
|
if (keyframe.contains(QStringLiteral("e"))) {
|
||||||
easing.endValue = getValue(keyframe.value(QLatin1String("e")).toArray());
|
easing.endValue = getValue(keyframe.value(QStringLiteral("e")).toArray());
|
||||||
easing.state = EasingSegmentState::Complete;
|
easing.state = EasingSegmentState::Complete;
|
||||||
}
|
}
|
||||||
|
|
||||||
QJsonObject easingIn = keyframe.value(QLatin1String("i")).toObject();
|
QJsonObject easingIn = keyframe.value(QStringLiteral("i")).toObject();
|
||||||
QJsonObject easingOut = keyframe.value(QLatin1String("o")).toObject();
|
QJsonObject easingOut = keyframe.value(QStringLiteral("o")).toObject();
|
||||||
|
|
||||||
qreal eix = easingIn.value(QLatin1String("x")).toArray().at(0).toDouble();
|
qreal eix = easingIn.value(QStringLiteral("x")).toArray().at(0).toDouble();
|
||||||
qreal eiy = easingIn.value(QLatin1String("y")).toArray().at(0).toDouble();
|
qreal eiy = easingIn.value(QStringLiteral("y")).toArray().at(0).toDouble();
|
||||||
|
|
||||||
qreal eox = easingOut.value(QLatin1String("x")).toArray().at(0).toDouble();
|
qreal eox = easingOut.value(QStringLiteral("x")).toArray().at(0).toDouble();
|
||||||
qreal eoy = easingOut.value(QLatin1String("y")).toArray().at(0).toDouble();
|
qreal eoy = easingOut.value(QStringLiteral("y")).toArray().at(0).toDouble();
|
||||||
|
|
||||||
QPointF c1 = QPointF(eox, eoy);
|
QPointF c1 = QPointF(eox, eoy);
|
||||||
QPointF c2 = QPointF(eix, eiy);
|
QPointF c2 = QPointF(eix, eiy);
|
||||||
|
@ -321,9 +321,9 @@ protected:
|
||||||
|
|
||||||
EasingSegment<T> parseKeyframe(const QJsonObject keyframe) override
|
EasingSegment<T> parseKeyframe(const QJsonObject keyframe) override
|
||||||
{
|
{
|
||||||
QJsonArray startValues = keyframe.value(QLatin1String("s")).toArray();
|
QJsonArray startValues = keyframe.value(QStringLiteral("s")).toArray();
|
||||||
QJsonArray endValues = keyframe.value(QLatin1String("e")).toArray();
|
QJsonArray endValues = keyframe.value(QStringLiteral("e")).toArray();
|
||||||
int startTime = keyframe.value(QLatin1String("t")).toVariant().toInt();
|
int startTime = keyframe.value(QStringLiteral("t")).toVariant().toInt();
|
||||||
|
|
||||||
EasingSegment<T> easingCurve;
|
EasingSegment<T> easingCurve;
|
||||||
easingCurve.startFrame = startTime;
|
easingCurve.startFrame = startTime;
|
||||||
|
@ -358,8 +358,8 @@ protected:
|
||||||
ys = startValues.at(1).toDouble();
|
ys = startValues.at(1).toDouble();
|
||||||
T s(xs, ys);
|
T s(xs, ys);
|
||||||
|
|
||||||
QJsonObject easingIn = keyframe.value(QLatin1String("i")).toObject();
|
QJsonObject easingIn = keyframe.value(QStringLiteral("i")).toObject();
|
||||||
QJsonObject easingOut = keyframe.value(QLatin1String("o")).toObject();
|
QJsonObject easingOut = keyframe.value(QStringLiteral("o")).toObject();
|
||||||
|
|
||||||
easingCurve.startFrame = startTime;
|
easingCurve.startFrame = startTime;
|
||||||
easingCurve.startValue = s;
|
easingCurve.startValue = s;
|
||||||
|
@ -372,12 +372,12 @@ protected:
|
||||||
easingCurve.state = EasingSegmentState::Complete;
|
easingCurve.state = EasingSegmentState::Complete;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (easingIn.value(QLatin1String("x")).isArray()) {
|
if (easingIn.value(QStringLiteral("x")).isArray()) {
|
||||||
QJsonArray eixArr = easingIn.value(QLatin1String("x")).toArray();
|
QJsonArray eixArr = easingIn.value(QStringLiteral("x")).toArray();
|
||||||
QJsonArray eiyArr = easingIn.value(QLatin1String("y")).toArray();
|
QJsonArray eiyArr = easingIn.value(QStringLiteral("y")).toArray();
|
||||||
|
|
||||||
QJsonArray eoxArr = easingOut.value(QLatin1String("x")).toArray();
|
QJsonArray eoxArr = easingOut.value(QStringLiteral("x")).toArray();
|
||||||
QJsonArray eoyArr = easingOut.value(QLatin1String("y")).toArray();
|
QJsonArray eoyArr = easingOut.value(QStringLiteral("y")).toArray();
|
||||||
|
|
||||||
if (!eixArr.isEmpty() && !eiyArr.isEmpty()) {
|
if (!eixArr.isEmpty() && !eiyArr.isEmpty()) {
|
||||||
qreal eix = eixArr.takeAt(0).toDouble();
|
qreal eix = eixArr.takeAt(0).toDouble();
|
||||||
|
@ -393,11 +393,11 @@ protected:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
qreal eix = easingIn.value(QLatin1String("x")).toDouble();
|
qreal eix = easingIn.value(QStringLiteral("x")).toDouble();
|
||||||
qreal eiy = easingIn.value(QLatin1String("y")).toDouble();
|
qreal eiy = easingIn.value(QStringLiteral("y")).toDouble();
|
||||||
|
|
||||||
qreal eox = easingOut.value(QLatin1String("x")).toDouble();
|
qreal eox = easingOut.value(QStringLiteral("x")).toDouble();
|
||||||
qreal eoy = easingOut.value(QLatin1String("y")).toDouble();
|
qreal eoy = easingOut.value(QStringLiteral("y")).toDouble();
|
||||||
|
|
||||||
QPointF c1 = QPointF(eox, eoy);
|
QPointF c1 = QPointF(eox, eoy);
|
||||||
QPointF c2 = QPointF(eix, eiy);
|
QPointF c2 = QPointF(eix, eiy);
|
||||||
|
|
|
@ -66,8 +66,8 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
qreal tix = 0, tiy = 0, tox = 0, toy = 0;
|
qreal tix = 0, tiy = 0, tox = 0, toy = 0;
|
||||||
QJsonArray tiArr = keyframe.value(QLatin1String("ti")).toArray();
|
QJsonArray tiArr = keyframe.value(QStringLiteral("ti")).toArray();
|
||||||
QJsonArray toArr = keyframe.value(QLatin1String("to")).toArray();
|
QJsonArray toArr = keyframe.value(QStringLiteral("to")).toArray();
|
||||||
|
|
||||||
if (tiArr.count() && toArr.count()) {
|
if (tiArr.count() && toArr.count()) {
|
||||||
tix = tiArr.at(0).toDouble();
|
tix = tiArr.at(0).toDouble();
|
||||||
|
|
Loading…
Reference in New Issue