From 751c76a5787c4072da836c27f1af913dc671a52e Mon Sep 17 00:00:00 2001 From: Tomaz Canabrava Date: Tue, 11 Mar 2014 17:36:49 -0300 Subject: Support save / load for the Animation Speed on the Preferences User can now fine-tune the animation speed on the preferences, a value of zero disables it completely. Signed-off-by: Tomaz Canabrava Signed-off-by: Dirk Hohndel --- qt-ui/preferences.cpp | 11 +++ qt-ui/preferences.ui | 167 ++++++++++++++++++++++++----------- qt-ui/profile/animationfunctions.cpp | 1 + 3 files changed, 128 insertions(+), 51 deletions(-) (limited to 'qt-ui') diff --git a/qt-ui/preferences.cpp b/qt-ui/preferences.cpp index 03123858b..e2473d66b 100644 --- a/qt-ui/preferences.cpp +++ b/qt-ui/preferences.cpp @@ -105,6 +105,11 @@ void PreferencesDialog::setUiFromPrefs() QModelIndexList languages = m->match(m->index(0, 0), Qt::UserRole, s.value("UiLanguage").toString()); if (languages.count()) ui.languageView->setCurrentIndex(languages.first()); + + s.endGroup(); + s.beginGroup("Animations"); + int animVelocity = s.value("animation_speed",500).toInt(); + ui.velocitySlider->setValue(animVelocity); } void PreferencesDialog::restorePrefs() @@ -218,6 +223,8 @@ void PreferencesDialog::syncSettings() s.setValue("UiLanguage", ui.languageView->currentIndex().data(Qt::UserRole)); s.endGroup(); + s.beginGroup("Animations"); + s.setValue("animation_speed",ui.velocitySlider->value()); loadSettings(); emit settingsChanged(); } @@ -289,6 +296,10 @@ void PreferencesDialog::loadSettings() prefs.font_size = defaultFont.pointSizeF(); GET_INT("displayinvalid", display_invalid_dives); s.endGroup(); + + s.beginGroup("Animations"); + int animVelocity = s.value("animation_speed",500).toInt(); + ui.velocitySlider->setValue(animVelocity); } void PreferencesDialog::buttonClicked(QAbstractButton *button) diff --git a/qt-ui/preferences.ui b/qt-ui/preferences.ui index 115e93526..e0bd4c27d 100644 --- a/qt-ui/preferences.ui +++ b/qt-ui/preferences.ui @@ -231,6 +231,39 @@ + + + + Animations + + + + + + Speed + + + + + + + 500 + + + Qt::Horizontal + + + + + + + 500 + + + + + + @@ -746,8 +779,8 @@ accept() - 235 - 511 + 247 + 635 157 @@ -762,8 +795,8 @@ reject() - 303 - 511 + 315 + 635 286 @@ -794,12 +827,12 @@ setEnabled(bool) - 195 - 39 + 845 + 51 - 195 - 39 + 308 + 100 @@ -842,12 +875,12 @@ setChecked(bool) - 20 - 20 + 504 + 46 - 20 - 20 + 623 + 119 @@ -858,12 +891,12 @@ setChecked(bool) - 20 - 20 + 319 + 46 - 20 - 20 + 385 + 119 @@ -874,12 +907,12 @@ setChecked(bool) - 20 - 20 + 504 + 46 - 20 - 20 + 623 + 153 @@ -890,12 +923,12 @@ setChecked(bool) - 20 - 20 + 319 + 46 - 20 - 20 + 385 + 153 @@ -906,12 +939,12 @@ setChecked(bool) - 20 - 20 + 504 + 46 - 20 - 20 + 623 + 187 @@ -922,12 +955,12 @@ setChecked(bool) - 20 - 20 + 319 + 46 - 20 - 20 + 385 + 187 @@ -938,12 +971,12 @@ setChecked(bool) - 20 - 20 + 504 + 46 - 20 - 20 + 623 + 221 @@ -954,12 +987,12 @@ setChecked(bool) - 20 - 20 + 319 + 46 - 20 - 20 + 385 + 221 @@ -970,12 +1003,12 @@ setChecked(bool) - 20 - 20 + 504 + 46 - 20 - 20 + 623 + 255 @@ -986,23 +1019,55 @@ setChecked(bool) - 20 - 20 + 319 + 46 - 20 - 20 + 385 + 255 + + + + + velocitySlider + valueChanged(int) + velocitySpinBox + setValue(int) + + + 718 + 415 + + + 823 + 414 + + + + + velocitySpinBox + valueChanged(int) + velocitySlider + setValue(int) + + + 790 + 400 + + + 580 + 417 + + + - - - diff --git a/qt-ui/profile/animationfunctions.cpp b/qt-ui/profile/animationfunctions.cpp index 608c4c000..81fbf5eee 100644 --- a/qt-ui/profile/animationfunctions.cpp +++ b/qt-ui/profile/animationfunctions.cpp @@ -26,6 +26,7 @@ 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){ QPropertyAnimation *animation = new QPropertyAnimation(obj, "pos"); -- cgit v1.2.3-70-g09d2