This patch changes some references of QSettings to the preference struct.
-- Regards, Gehad Elrobey
>From c04fb42212a7db076aea832dac60e9031a3cbfde Mon Sep 17 00:00:00 2001 From: Gehad elrobey <[email protected]> Date: Tue, 8 Apr 2014 13:45:23 +0200 Subject: [PATCH] Changing 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 <[email protected]> --- qt-ui/profile/animationfunctions.cpp | 10 ++++------ qt-ui/profile/profilewidget2.cpp | 12 +++++------- 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 81fbf5e..96e6a1e 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 047634e..9ff409c 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> @@ -334,10 +336,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; } @@ -463,9 +463,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 63ecaa1..aa2b019 100644 --- a/subsurfacestartup.c +++ b/subsurfacestartup.c @@ -25,6 +25,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, -- 1.8.3.2
_______________________________________________ subsurface mailing list [email protected] http://lists.hohndel.org/cgi-bin/mailman/listinfo/subsurface
