diff options
author | Gehad elrobey <gehadelrobey@gmail.com> | 2014-04-08 13:45:23 +0200 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2014-04-11 07:21:15 -0700 |
commit | cdf83f5ef6415eb44cc95e993ab38b4b44f03427 (patch) | |
tree | 262c135a0c141eb7f20cc14b6580219f26be9e86 | |
parent | 6a8d929876f5a8d0279d2a83248a5d7b59e0ae39 (diff) | |
download | subsurface-cdf83f5ef6415eb44cc95e993ab38b4b44f03427.tar.gz |
Change some references of QSettings to the pref struct.
After adding the animation member in the preference struct, it is
very resonable to change these references of QSettings to the
preference structure instead.
Signed-off-by: Gehad elrobey <gehadelrobey@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
-rw-r--r-- | qt-ui/profile/animationfunctions.cpp | 10 | ||||
-rw-r--r-- | qt-ui/profile/profilewidget2.cpp | 12 | ||||
-rw-r--r-- | subsurfacestartup.c | 1 |
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, |