summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--qt-ui/profile/animationfunctions.cpp10
-rw-r--r--qt-ui/profile/profilewidget2.cpp12
-rw-r--r--subsurfacestartup.c1
3 files changed, 10 insertions, 13 deletions
diff --git a/qt-ui/profile/animationfunctions.cpp b/qt-ui/profile/animationfunctions.cpp
index 81fbf5eee..05e437cf0 100644
--- a/qt-ui/profile/animationfunctions.cpp
+++ b/qt-ui/profile/animationfunctions.cpp
@@ -1,7 +1,8 @@
#include "animationfunctions.h"
+#include "dive.h"
+#include "pref.h"
#include <QPropertyAnimation>
#include <QPointF>
-#include <QSettings>
namespace Animations
{
@@ -25,12 +26,9 @@ namespace Animations
void moveTo(QObject *obj, qreal x, qreal y)
{
- QSettings s;
- s.beginGroup("Animations");
- int msecs = s.value("animation_speed", 500).toInt();
- if (msecs != 0){
+ if (prefs.animation != 0){
QPropertyAnimation *animation = new QPropertyAnimation(obj, "pos");
- animation->setDuration(msecs);
+ animation->setDuration(prefs.animation);
animation->setStartValue(obj->property("pos").toPointF());
animation->setEndValue(QPointF(x, y));
animation->start(QAbstractAnimation::DeleteWhenStopped);
diff --git a/qt-ui/profile/profilewidget2.cpp b/qt-ui/profile/profilewidget2.cpp
index 95f8f49ee..97511c785 100644
--- a/qt-ui/profile/profilewidget2.cpp
+++ b/qt-ui/profile/profilewidget2.cpp
@@ -13,6 +13,8 @@
#include "planner.h"
#include "device.h"
#include "ruleritem.h"
+#include "../../dive.h"
+#include "../../pref.h"
#include <libdivecomputer/parser.h>
#include <QSignalTransition>
#include <QPropertyAnimation>
@@ -336,10 +338,8 @@ void ProfileWidget2::plotDives(QList<dive *> dives)
int animSpeedBackup = -1;
if (firstCall && MainWindow::instance()->filesFromCommandLine()) {
- QSettings s;
- s.beginGroup("Animations");
- animSpeedBackup = s.value("animation_speed", 500).toInt();
- s.setValue("animation_speed", 0);
+ animSpeedBackup = prefs.animation;
+ prefs.animation = 0;
firstCall = false;
}
@@ -469,9 +469,7 @@ void ProfileWidget2::plotDives(QList<dive *> dives)
}
diveComputerText->setText(currentdc->model);
if (MainWindow::instance()->filesFromCommandLine() && animSpeedBackup != -1) {
- QSettings s;
- s.beginGroup("Animations");
- s.setValue("animation_speed", animSpeedBackup);
+ prefs.animation = animSpeedBackup;
}
}
diff --git a/subsurfacestartup.c b/subsurfacestartup.c
index 3bd2dc0f1..4e7550ce3 100644
--- a/subsurfacestartup.c
+++ b/subsurfacestartup.c
@@ -26,6 +26,7 @@ struct preferences default_prefs = {
.calc_ndl_tts = false,
.gflow = 30,
.gfhigh = 75,
+ .animation = 500,
.gf_low_at_maxdepth = false,
.font_size = -1,
.display_invalid_dives = false,