summaryrefslogtreecommitdiffstats
path: root/profile-widget
diff options
context:
space:
mode:
Diffstat (limited to 'profile-widget')
-rw-r--r--profile-widget/divecartesianaxis.cpp25
-rw-r--r--profile-widget/profilewidget2.cpp8
-rw-r--r--profile-widget/profilewidget2.h1
3 files changed, 15 insertions, 19 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);
}
}
diff --git a/profile-widget/profilewidget2.cpp b/profile-widget/profilewidget2.cpp
index 9eefb0fc1..c2514e59e 100644
--- a/profile-widget/profilewidget2.cpp
+++ b/profile-widget/profilewidget2.cpp
@@ -594,10 +594,9 @@ void ProfileWidget2::plotDive(const struct dive *d, bool force, bool doClearPict
}
// special handling for the first time we display things
- int animSpeedBackup = 0;
+ animSpeed = qPrefDisplay::animation_speed();
if (firstCall && haveFilesOnCommandLine()) {
- animSpeedBackup = qPrefDisplay::animation_speed();
- qPrefDisplay::set_animation_speed(0);
+ animSpeed = 0;
firstCall = false;
}
@@ -814,9 +813,6 @@ void ProfileWidget2::plotDive(const struct dive *d, bool force, bool doClearPict
dcText += tr(" (#%1 of %2)").arg(dc_number + 1).arg(nr);
#endif
diveComputerText->setText(dcText);
- if (haveFilesOnCommandLine() && animSpeedBackup != 0) {
- qPrefDisplay::set_animation_speed(animSpeedBackup);
- }
#ifndef SUBSURFACE_MOBILE
if (currentState == ADD || currentState == PLAN) { // TODO: figure a way to move this from here.
diff --git a/profile-widget/profilewidget2.h b/profile-widget/profilewidget2.h
index fbc43c623..fa3f7f95d 100644
--- a/profile-widget/profilewidget2.h
+++ b/profile-widget/profilewidget2.h
@@ -90,6 +90,7 @@ public:
void recalcCeiling();
void setToolTipVisibile(bool visible);
State currentState;
+ int animSpeed;
signals:
void fontPrintScaleChanged(double scale);