Correctly disable all animations

This seems to be needed for the correct print of the profile,
What was happening on the print code was that the profile even in print
mode was doing animations, and we were getting a frame of it and trying to
print it.

Also, a bit of code cleanup.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Tomaz Canabrava 2014-07-11 18:55:33 -03:00 committed by Dirk Hohndel
parent 3fa908b242
commit 2171b981ac
6 changed files with 36 additions and 19 deletions

View file

@ -8,19 +8,27 @@ namespace Animations {
void hide(QObject *obj)
{
QPropertyAnimation *animation = new QPropertyAnimation(obj, "opacity");
animation->setStartValue(1);
animation->setEndValue(0);
animation->start(QAbstractAnimation::DeleteWhenStopped);
if (prefs.animation != 0) {
QPropertyAnimation *animation = new QPropertyAnimation(obj, "opacity");
animation->setStartValue(1);
animation->setEndValue(0);
animation->start(QAbstractAnimation::DeleteWhenStopped);
} else {
obj->setProperty("opacity", 0);
}
}
void animDelete(QObject *obj)
{
QPropertyAnimation *animation = new QPropertyAnimation(obj, "opacity");
obj->connect(animation, SIGNAL(finished()), SLOT(deleteLater()));
animation->setStartValue(1);
animation->setEndValue(0);
animation->start(QAbstractAnimation::DeleteWhenStopped);
if (prefs.animation != 0) {
QPropertyAnimation *animation = new QPropertyAnimation(obj, "opacity");
obj->connect(animation, SIGNAL(finished()), SLOT(deleteLater()));
animation->setStartValue(1);
animation->setEndValue(0);
animation->start(QAbstractAnimation::DeleteWhenStopped);
} else {
obj->setProperty("opacity", 0);
}
}
void moveTo(QObject *obj, qreal x, qreal y)
@ -38,12 +46,16 @@ namespace Animations {
void scaleTo(QObject *obj, qreal scale)
{
QPropertyAnimation *animation = new QPropertyAnimation(obj, "scale");
animation->setDuration(prefs.animation);
animation->setStartValue(obj->property("scale").toReal());
animation->setEndValue(QVariant::fromValue(scale));
animation->setEasingCurve(QEasingCurve::InCubic);
animation->start(QAbstractAnimation::DeleteWhenStopped);
if (prefs.animation != 0) {
QPropertyAnimation *animation = new QPropertyAnimation(obj, "scale");
animation->setDuration(prefs.animation);
animation->setStartValue(obj->property("scale").toReal());
animation->setEndValue(QVariant::fromValue(scale));
animation->setEasingCurve(QEasingCurve::InCubic);
animation->start(QAbstractAnimation::DeleteWhenStopped);
} else {
obj->setProperty("scale", QVariant::fromValue(scale));
}
}
void moveTo(QObject *obj, const QPointF &pos)

View file

@ -201,7 +201,6 @@ void DiveCartesianAxis::updateTicks(color_indice_t color)
}
DiveTextItem *label = new DiveTextItem(this);
label->setText(textForValue(currValueText));
label->setBrush(QBrush(textColor));
label->setBrush(colorForValue(currValueText));
label->setScale(fontLabelScale());
label->setZValue(1);

View file

@ -66,7 +66,7 @@ void DiveTextItem::updateText()
fnt.setPixelSize(size);
} else {
size = fnt.pointSizeF();
size *= scale * MainWindow::instance()->graphics()->getFontPrintScale();;
size *= scale * MainWindow::instance()->graphics()->getFontPrintScale();
fnt.setPointSizeF(size);
}
QFontMetrics fm(fnt);

View file

@ -382,7 +382,6 @@ void ProfileWidget2::plotDive(struct dive *d, bool force)
return;
}
}
//END
// special handling for the first time we display things
int animSpeedBackup = -1;