6 #include <QDomDocument>
12 int zoomedWidth =
static_cast<int>(
static_cast<float>(size.width()) *
m_hzoom);
13 int zoomedHeight =
static_cast<int>(
static_cast<float>(size.height()) *
m_vzoom);
20 y = -zoomedHeight / 2;
break;
24 y = -size.height() / 2;
break;
28 y = size.height() - zoomedHeight / 2;
break;
36 x = -zoomedWidth / 2;
break;
40 x = -size.width() / 2;
break;
44 x = size.width() - zoomedWidth / 2;
break;
47 return {x, y, zoomedWidth, zoomedHeight};
52 if (
GetMythDB()->GetBoolSetting(
"SmoothTransitions",
true))
91 setStartValue(animation->startValue());
92 setEndValue(animation->endValue());
93 setEasingCurve(animation->easingCurve());
94 setDuration(animation->duration());
108 int offset = (direction() == Forward) ? interval.count() : -interval.count();
109 setCurrentTime(currentTime() + offset);
111 if (endValue() == currentValue())
113 if (direction() == Forward)
116 setDirection(Backward);
121 else if (startValue() == currentValue())
123 if (direction() == Backward)
126 setDirection(Forward);
135 if (curve ==
"Linear") setEasingCurve(QEasingCurve::Linear);
136 else if (curve ==
"InQuad") setEasingCurve(QEasingCurve::InQuad);
137 else if (curve ==
"OutQuad") setEasingCurve(QEasingCurve::OutQuad);
138 else if (curve ==
"InOutQuad") setEasingCurve(QEasingCurve::InOutQuad);
139 else if (curve ==
"OutInQuad") setEasingCurve(QEasingCurve::OutInQuad);
140 else if (curve ==
"InCubic") setEasingCurve(QEasingCurve::InCubic);
141 else if (curve ==
"OutCubic") setEasingCurve(QEasingCurve::OutCubic);
142 else if (curve ==
"InOutCubic") setEasingCurve(QEasingCurve::InOutCubic);
143 else if (curve ==
"OutInCubic") setEasingCurve(QEasingCurve::OutInCubic);
144 else if (curve ==
"InQuart") setEasingCurve(QEasingCurve::InQuart);
145 else if (curve ==
"OutQuart") setEasingCurve(QEasingCurve::OutQuart);
146 else if (curve ==
"InOutQuart") setEasingCurve(QEasingCurve::InOutQuart);
147 else if (curve ==
"OutInQuart") setEasingCurve(QEasingCurve::OutInQuart);
148 else if (curve ==
"InQuint") setEasingCurve(QEasingCurve::InQuint);
149 else if (curve ==
"OutQuint") setEasingCurve(QEasingCurve::OutQuint);
150 else if (curve ==
"InOutQuint") setEasingCurve(QEasingCurve::InOutQuint);
151 else if (curve ==
"OutInQuint") setEasingCurve(QEasingCurve::OutInQuint);
152 else if (curve ==
"InSine") setEasingCurve(QEasingCurve::InSine);
153 else if (curve ==
"OutSine") setEasingCurve(QEasingCurve::OutSine);
154 else if (curve ==
"InOutSine") setEasingCurve(QEasingCurve::InOutSine);
155 else if (curve ==
"OutInSine") setEasingCurve(QEasingCurve::OutInSine);
156 else if (curve ==
"InExpo") setEasingCurve(QEasingCurve::InExpo);
157 else if (curve ==
"OutExpo") setEasingCurve(QEasingCurve::OutExpo);
158 else if (curve ==
"InOutExpo") setEasingCurve(QEasingCurve::InOutExpo);
159 else if (curve ==
"OutInExpo") setEasingCurve(QEasingCurve::OutInExpo);
160 else if (curve ==
"InCirc") setEasingCurve(QEasingCurve::InCirc);
161 else if (curve ==
"OutCirc") setEasingCurve(QEasingCurve::OutCirc);
162 else if (curve ==
"InOutCirc") setEasingCurve(QEasingCurve::InOutCirc);
163 else if (curve ==
"OutInCirc") setEasingCurve(QEasingCurve::OutInCirc);
164 else if (curve ==
"InElastic") setEasingCurve(QEasingCurve::InElastic);
165 else if (curve ==
"OutElastic") setEasingCurve(QEasingCurve::OutElastic);
166 else if (curve ==
"InOutElastic") setEasingCurve(QEasingCurve::InOutElastic);
167 else if (curve ==
"OutInElastic") setEasingCurve(QEasingCurve::OutInElastic);
168 else if (curve ==
"InBack") setEasingCurve(QEasingCurve::InBack);
169 else if (curve ==
"OutBack") setEasingCurve(QEasingCurve::OutBack);
170 else if (curve ==
"InOutBack") setEasingCurve(QEasingCurve::InOutBack);
171 else if (curve ==
"OutInBack") setEasingCurve(QEasingCurve::OutInBack);
172 else if (curve ==
"InBounce") setEasingCurve(QEasingCurve::InBounce);
173 else if (curve ==
"OutBounce") setEasingCurve(QEasingCurve::OutBounce);
174 else if (curve ==
"InOutBounce") setEasingCurve(QEasingCurve::InOutBounce);
175 else if (curve ==
"OutInBounce") setEasingCurve(QEasingCurve::OutInBounce);
176 else if (curve ==
"InCurve") setEasingCurve(QEasingCurve::InCurve);
177 else if (curve ==
"OutCurve") setEasingCurve(QEasingCurve::OutCurve);
178 else if (curve ==
"SineCurve") setEasingCurve(QEasingCurve::SineCurve);
179 else if (curve ==
"CosineCurve") setEasingCurve(QEasingCurve::CosineCurve);
198 QString
t = element.attribute(
"trigger",
"AboutToShow");
200 if (
"AboutToHide" ==
t)
203 for (QDomNode child = element.firstChild(); !child.isNull();
204 child = child.nextSibling())
206 QDomElement section = child.toElement();
207 if (section.isNull())
209 if (section.tagName() ==
"section")
217 int duration = element.attribute(
"duration",
"500").toInt();
218 QString centre = element.attribute(
"centre",
"Middle");
219 for (QDomNode child = element.firstChild(); !child.isNull();
220 child = child.nextSibling())
222 QDomElement effect = child.toElement();
227 int effectduration = duration;
229 QString effect_duration = effect.attribute(
"duration",
"");
230 if (!effect_duration.isEmpty())
231 effectduration = effect_duration.toInt();
233 bool looped =
parseBool(effect.attribute(
"looped",
"false"));
234 bool reversible =
parseBool(effect.attribute(
"reversible",
"false"));
235 QString easingcurve = effect.attribute(
"easingcurve",
"Linear");
239 QString fxtype = effect.tagName();
240 if (fxtype ==
"alpha")
245 else if (fxtype ==
"position")
250 else if (fxtype ==
"angle")
255 else if (fxtype ==
"zoom")
260 else if (fxtype ==
"horizontalzoom")
265 else if (fxtype ==
"verticalzoom")
276 a->setStartValue(start);
278 a->setDuration(effectduration);
279 a->SetEasingCurve(easingcurve);
280 a->SetCentre(centre);
281 a->SetLooped(looped);
282 a->SetReversible(reversible);
290 QVariant& startValue, QVariant& endValue)
292 startValue = element.attribute(
"start",
"0").toInt();
293 endValue = element.attribute(
"end",
"0").toInt();
297 QVariant& startValue, QVariant& endValue,
325 QVariant& startValue, QVariant& endValue)
327 startValue = element.attribute(
"start",
"0").toFloat() / 100.0F;
328 endValue = element.attribute(
"end",
"0").toFloat() /100.0F;
332 QVariant& startValue, QVariant& endValue)
334 startValue = element.attribute(
"start",
"0").toFloat();
335 endValue = element.attribute(
"end",
"0").toFloat();