Profile: add speed parameter to Animation::* functions

For now always use the preferences value, so that this is a
no-op. This is a preparation for storing the speed in the
profile widget.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
Berthold Stoeger 2019-07-10 22:23:25 +02:00 committed by Robert C. Helling
parent 74244b3cfe
commit 2d9dc40171
5 changed files with 34 additions and 33 deletions

View file

@ -10,6 +10,7 @@
#include "profile-widget/animationfunctions.h"
#include "profile-widget/divelineitem.h"
#include "profile-widget/profilewidget2.h"
#include "core/settings/qPrefDisplay.h" // TODO: Remove
QPen DiveCartesianAxis::gridPen()
{
@ -130,7 +131,7 @@ void emptyList(QList<T *> &list, int steps)
{
while (list.size() > steps) {
T *removedItem = list.takeLast();
Animations::animDelete(removedItem);
Animations::animDelete(removedItem, qPrefDisplay::animation_speed());
}
}
@ -177,9 +178,9 @@ void DiveCartesianAxis::updateTicks(color_index_t color)
labels[i]->setText(textForValue(currValueText));
if (orientation == LeftToRight || orientation == RightToLeft) {
Animations::moveTo(labels[i],childPos, m.y1() + tick_size);
Animations::moveTo(labels[i], qPrefDisplay::animation_speed(), childPos, m.y1() + tick_size);
} else {
Animations::moveTo(labels[i],m.x1() - tick_size, childPos);
Animations::moveTo(labels[i], qPrefDisplay::animation_speed() ,m.x1() - tick_size, childPos);
}
}
@ -189,9 +190,9 @@ void DiveCartesianAxis::updateTicks(color_index_t color)
begin - i * stepSize;
if (orientation == LeftToRight || orientation == RightToLeft) {
Animations::moveTo(lines[i],childPos, m.y1());
Animations::moveTo(lines[i], qPrefDisplay::animation_speed(), childPos, m.y1());
} else {
Animations::moveTo(lines[i],m.x1(), childPos);
Animations::moveTo(lines[i], qPrefDisplay::animation_speed(), m.x1(), childPos);
}
}
@ -212,11 +213,11 @@ void DiveCartesianAxis::updateTicks(color_index_t color)
if (orientation == RightToLeft || orientation == LeftToRight) {
label->setAlignment(Qt::AlignBottom | Qt::AlignHCenter);
label->setPos(scene()->sceneRect().width() + 10, m.y1() + tick_size); // position it outside of the scene);
Animations::moveTo(label,childPos, m.y1() + tick_size);
Animations::moveTo(label, qPrefDisplay::animation_speed(),childPos , m.y1() + tick_size);
} else {
label->setAlignment(Qt::AlignVCenter | Qt::AlignLeft);
label->setPos(m.x1() - tick_size, scene()->sceneRect().height() + 10);
Animations::moveTo(label,m.x1() - tick_size, childPos);
Animations::moveTo(label, qPrefDisplay::animation_speed(), m.x1() - tick_size, childPos);
}
}
@ -237,13 +238,13 @@ void DiveCartesianAxis::updateTicks(color_index_t color)
if (orientation == RightToLeft || orientation == LeftToRight) {
line->setLine(0, -line_size, 0, 0);
line->setPos(scene()->sceneRect().width() + 10, m.y1()); // position it outside of the scene);
Animations::moveTo(line,childPos, m.y1());
Animations::moveTo(line, qPrefDisplay::animation_speed(), childPos, m.y1());
} else {
QPointF p1 = mapFromScene(3, 0);
QPointF p2 = mapFromScene(line_size, 0);
line->setLine(p1.x(), 0, p2.x(), 0);
line->setPos(m.x1(), scene()->sceneRect().height() + 10);
Animations::moveTo(line,m.x1(), childPos);
Animations::moveTo(line, qPrefDisplay::animation_speed(), m.x1(), childPos);
}
}