summaryrefslogtreecommitdiffstats
path: root/profile-widget/divecartesianaxis.cpp
diff options
context:
space:
mode:
authorGravatar Berthold Stoeger <bstoeger@mail.tuwien.ac.at>2019-07-10 22:40:06 +0200
committerGravatar Robert C. Helling <helling@atdotde.de>2019-07-12 09:59:28 +0200
commitf93e0aafd52be47b99132a0d38629e1dffaaaa9e (patch)
treeca567559dedee56903a901569df4246ea43d195d /profile-widget/divecartesianaxis.cpp
parent2d9dc40171c261fc6c907badb871d6735d59787a (diff)
downloadsubsurface-f93e0aafd52be47b99132a0d38629e1dffaaaa9e.tar.gz
Profile: store animation speed in profile object
When exporting dive pictures we don't want animations. Therefore, store the animation speed in the profile object to avoid nasty hacks with the preferences. This actually removes such a hack. Pictures and tooltips for now still use the values stored in the preferences, because their animations happen only on user-interactions. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Diffstat (limited to 'profile-widget/divecartesianaxis.cpp')
-rw-r--r--profile-widget/divecartesianaxis.cpp25
1 files changed, 12 insertions, 13 deletions
diff --git a/profile-widget/divecartesianaxis.cpp b/profile-widget/divecartesianaxis.cpp
index c4beb4036..72d1081a6 100644
--- a/profile-widget/divecartesianaxis.cpp
+++ b/profile-widget/divecartesianaxis.cpp
@@ -10,7 +10,6 @@
#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()
{
@@ -127,11 +126,11 @@ void DiveCartesianAxis::setLinesVisible(bool arg1)
}
template <typename T>
-void emptyList(QList<T *> &list, int steps)
+void emptyList(QList<T *> &list, int steps, int speed)
{
while (list.size() > steps) {
T *removedItem = list.takeLast();
- Animations::animDelete(removedItem, qPrefDisplay::animation_speed());
+ Animations::animDelete(removedItem, speed);
}
}
@@ -150,8 +149,8 @@ void DiveCartesianAxis::updateTicks(color_index_t color)
if (steps < 1)
return;
- emptyList(labels, steps);
- emptyList(lines, steps);
+ emptyList(labels, steps, profileWidget->animSpeed);
+ emptyList(lines, steps, profileWidget->animSpeed);
// Move the remaining ticks / text to their correct positions
// regarding the possible new values for the axis
@@ -178,9 +177,9 @@ void DiveCartesianAxis::updateTicks(color_index_t color)
labels[i]->setText(textForValue(currValueText));
if (orientation == LeftToRight || orientation == RightToLeft) {
- Animations::moveTo(labels[i], qPrefDisplay::animation_speed(), childPos, m.y1() + tick_size);
+ Animations::moveTo(labels[i], profileWidget->animSpeed, childPos, m.y1() + tick_size);
} else {
- Animations::moveTo(labels[i], qPrefDisplay::animation_speed() ,m.x1() - tick_size, childPos);
+ Animations::moveTo(labels[i], profileWidget->animSpeed ,m.x1() - tick_size, childPos);
}
}
@@ -190,9 +189,9 @@ void DiveCartesianAxis::updateTicks(color_index_t color)
begin - i * stepSize;
if (orientation == LeftToRight || orientation == RightToLeft) {
- Animations::moveTo(lines[i], qPrefDisplay::animation_speed(), childPos, m.y1());
+ Animations::moveTo(lines[i], profileWidget->animSpeed, childPos, m.y1());
} else {
- Animations::moveTo(lines[i], qPrefDisplay::animation_speed(), m.x1(), childPos);
+ Animations::moveTo(lines[i], profileWidget->animSpeed, m.x1(), childPos);
}
}
@@ -213,11 +212,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, qPrefDisplay::animation_speed(),childPos , m.y1() + tick_size);
+ Animations::moveTo(label, profileWidget->animSpeed,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, qPrefDisplay::animation_speed(), m.x1() - tick_size, childPos);
+ Animations::moveTo(label, profileWidget->animSpeed, m.x1() - tick_size, childPos);
}
}
@@ -238,13 +237,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, qPrefDisplay::animation_speed(), childPos, m.y1());
+ Animations::moveTo(line, profileWidget->animSpeed, 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, qPrefDisplay::animation_speed(), m.x1(), childPos);
+ Animations::moveTo(line, profileWidget->animSpeed, m.x1(), childPos);
}
}