summaryrefslogtreecommitdiffstats
path: root/qt-ui
diff options
context:
space:
mode:
authorGravatar Tomaz Canabrava <tomaz.canabrava@intel.com>2014-03-11 17:36:49 -0300
committerGravatar Dirk Hohndel <dirk@hohndel.org>2014-03-11 17:41:41 -0700
commit751c76a5787c4072da836c27f1af913dc671a52e (patch)
tree28ec33a385c18f6c2ba16b935543498a53d06a82 /qt-ui
parent9f37bac07a06870bc3e5d1c150496ed347a4de99 (diff)
downloadsubsurface-751c76a5787c4072da836c27f1af913dc671a52e.tar.gz
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 <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'qt-ui')
-rw-r--r--qt-ui/preferences.cpp11
-rw-r--r--qt-ui/preferences.ui167
-rw-r--r--qt-ui/profile/animationfunctions.cpp1
3 files changed, 128 insertions, 51 deletions
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
@@ -232,6 +232,39 @@
</widget>
</item>
<item>
+ <widget class="QGroupBox" name="groupBox_7">
+ <property name="title">
+ <string>Animations</string>
+ </property>
+ <layout class="QHBoxLayout" name="horizontalLayout_7">
+ <item>
+ <widget class="QLabel" name="label_15">
+ <property name="text">
+ <string>Speed</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QSlider" name="velocitySlider">
+ <property name="maximum">
+ <number>500</number>
+ </property>
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QSpinBox" name="velocitySpinBox">
+ <property name="maximum">
+ <number>500</number>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ </item>
+ <item>
<spacer name="verticalSpacer_2">
<property name="orientation">
<enum>Qt::Vertical</enum>
@@ -746,8 +779,8 @@
<slot>accept()</slot>
<hints>
<hint type="sourcelabel">
- <x>235</x>
- <y>511</y>
+ <x>247</x>
+ <y>635</y>
</hint>
<hint type="destinationlabel">
<x>157</x>
@@ -762,8 +795,8 @@
<slot>reject()</slot>
<hints>
<hint type="sourcelabel">
- <x>303</x>
- <y>511</y>
+ <x>315</x>
+ <y>635</y>
</hint>
<hint type="destinationlabel">
<x>286</x>
@@ -794,12 +827,12 @@
<slot>setEnabled(bool)</slot>
<hints>
<hint type="sourcelabel">
- <x>195</x>
- <y>39</y>
+ <x>845</x>
+ <y>51</y>
</hint>
<hint type="destinationlabel">
- <x>195</x>
- <y>39</y>
+ <x>308</x>
+ <y>100</y>
</hint>
</hints>
</connection>
@@ -842,12 +875,12 @@
<slot>setChecked(bool)</slot>
<hints>
<hint type="sourcelabel">
- <x>20</x>
- <y>20</y>
+ <x>504</x>
+ <y>46</y>
</hint>
<hint type="destinationlabel">
- <x>20</x>
- <y>20</y>
+ <x>623</x>
+ <y>119</y>
</hint>
</hints>
</connection>
@@ -858,12 +891,12 @@
<slot>setChecked(bool)</slot>
<hints>
<hint type="sourcelabel">
- <x>20</x>
- <y>20</y>
+ <x>319</x>
+ <y>46</y>
</hint>
<hint type="destinationlabel">
- <x>20</x>
- <y>20</y>
+ <x>385</x>
+ <y>119</y>
</hint>
</hints>
</connection>
@@ -874,12 +907,12 @@
<slot>setChecked(bool)</slot>
<hints>
<hint type="sourcelabel">
- <x>20</x>
- <y>20</y>
+ <x>504</x>
+ <y>46</y>
</hint>
<hint type="destinationlabel">
- <x>20</x>
- <y>20</y>
+ <x>623</x>
+ <y>153</y>
</hint>
</hints>
</connection>
@@ -890,12 +923,12 @@
<slot>setChecked(bool)</slot>
<hints>
<hint type="sourcelabel">
- <x>20</x>
- <y>20</y>
+ <x>319</x>
+ <y>46</y>
</hint>
<hint type="destinationlabel">
- <x>20</x>
- <y>20</y>
+ <x>385</x>
+ <y>153</y>
</hint>
</hints>
</connection>
@@ -906,12 +939,12 @@
<slot>setChecked(bool)</slot>
<hints>
<hint type="sourcelabel">
- <x>20</x>
- <y>20</y>
+ <x>504</x>
+ <y>46</y>
</hint>
<hint type="destinationlabel">
- <x>20</x>
- <y>20</y>
+ <x>623</x>
+ <y>187</y>
</hint>
</hints>
</connection>
@@ -922,12 +955,12 @@
<slot>setChecked(bool)</slot>
<hints>
<hint type="sourcelabel">
- <x>20</x>
- <y>20</y>
+ <x>319</x>
+ <y>46</y>
</hint>
<hint type="destinationlabel">
- <x>20</x>
- <y>20</y>
+ <x>385</x>
+ <y>187</y>
</hint>
</hints>
</connection>
@@ -938,12 +971,12 @@
<slot>setChecked(bool)</slot>
<hints>
<hint type="sourcelabel">
- <x>20</x>
- <y>20</y>
+ <x>504</x>
+ <y>46</y>
</hint>
<hint type="destinationlabel">
- <x>20</x>
- <y>20</y>
+ <x>623</x>
+ <y>221</y>
</hint>
</hints>
</connection>
@@ -954,12 +987,12 @@
<slot>setChecked(bool)</slot>
<hints>
<hint type="sourcelabel">
- <x>20</x>
- <y>20</y>
+ <x>319</x>
+ <y>46</y>
</hint>
<hint type="destinationlabel">
- <x>20</x>
- <y>20</y>
+ <x>385</x>
+ <y>221</y>
</hint>
</hints>
</connection>
@@ -970,12 +1003,12 @@
<slot>setChecked(bool)</slot>
<hints>
<hint type="sourcelabel">
- <x>20</x>
- <y>20</y>
+ <x>504</x>
+ <y>46</y>
</hint>
<hint type="destinationlabel">
- <x>20</x>
- <y>20</y>
+ <x>623</x>
+ <y>255</y>
</hint>
</hints>
</connection>
@@ -986,23 +1019,55 @@
<slot>setChecked(bool)</slot>
<hints>
<hint type="sourcelabel">
- <x>20</x>
- <y>20</y>
+ <x>319</x>
+ <y>46</y>
</hint>
<hint type="destinationlabel">
- <x>20</x>
- <y>20</y>
+ <x>385</x>
+ <y>255</y>
+ </hint>
+ </hints>
+ </connection>
+ <connection>
+ <sender>velocitySlider</sender>
+ <signal>valueChanged(int)</signal>
+ <receiver>velocitySpinBox</receiver>
+ <slot>setValue(int)</slot>
+ <hints>
+ <hint type="sourcelabel">
+ <x>718</x>
+ <y>415</y>
+ </hint>
+ <hint type="destinationlabel">
+ <x>823</x>
+ <y>414</y>
+ </hint>
+ </hints>
+ </connection>
+ <connection>
+ <sender>velocitySpinBox</sender>
+ <signal>valueChanged(int)</signal>
+ <receiver>velocitySlider</receiver>
+ <slot>setValue(int)</slot>
+ <hints>
+ <hint type="sourcelabel">
+ <x>790</x>
+ <y>400</y>
+ </hint>
+ <hint type="destinationlabel">
+ <x>580</x>
+ <y>417</y>
</hint>
</hints>
</connection>
</connections>
<buttongroups>
+ <buttongroup name="buttonGroup_5"/>
+ <buttongroup name="buttonGroup_6"/>
+ <buttongroup name="buttonGroup"/>
<buttongroup name="verticalSpeed"/>
<buttongroup name="buttonGroup_2"/>
<buttongroup name="buttonGroup_3"/>
<buttongroup name="buttonGroup_4"/>
- <buttongroup name="buttonGroup_5"/>
- <buttongroup name="buttonGroup_6"/>
- <buttongroup name="buttonGroup"/>
</buttongroups>
</ui>
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");