mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Fix incorrect behavior in preference window
When doing some changes in the preference window and clicking "Apply", the 'Close without saving' button is supposed to restore the previous values. However some fields were not restored correctly. - The Animations Slider was never restored to its initial value. (A new member in the pref struct was added - pref.animation) - The 'Font' and 'Font size' were restored correctly to the previous values but their effects weren't restored to the UI and that required to open the prefrences window again and press ok. Fixes #481 Signed-off-by: Gehad elrobey <gehadelrobey@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
0bf79e216f
commit
3125e0e695
2 changed files with 4 additions and 5 deletions
|
@ -90,6 +90,7 @@ void PreferencesDialog::setUiFromPrefs()
|
|||
ui.show_average_depth->setChecked(prefs.show_average_depth);
|
||||
ui.vertical_speed_minutes->setChecked(prefs.units.vertical_speed_time == units::MINUTES);
|
||||
ui.vertical_speed_seconds->setChecked(prefs.units.vertical_speed_time == units::SECONDS);
|
||||
ui.velocitySlider->setValue(prefs.animation);
|
||||
|
||||
QSortFilterProxyModel *filterModel = new QSortFilterProxyModel();
|
||||
filterModel->setSourceModel(LanguageModel::instance());
|
||||
|
@ -107,9 +108,6 @@ void PreferencesDialog::setUiFromPrefs()
|
|||
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()
|
||||
|
@ -298,8 +296,7 @@ void PreferencesDialog::loadSettings()
|
|||
s.endGroup();
|
||||
|
||||
s.beginGroup("Animations");
|
||||
int animVelocity = s.value("animation_speed",500).toInt();
|
||||
ui.velocitySlider->setValue(animVelocity);
|
||||
GET_INT("animation_speed", animation);
|
||||
}
|
||||
|
||||
void PreferencesDialog::buttonClicked(QAbstractButton *button)
|
||||
|
@ -307,6 +304,7 @@ void PreferencesDialog::buttonClicked(QAbstractButton *button)
|
|||
switch (ui.buttonBox->standardButton(button)) {
|
||||
case QDialogButtonBox::Discard:
|
||||
restorePrefs();
|
||||
syncSettings();
|
||||
close();
|
||||
break;
|
||||
case QDialogButtonBox::Apply:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue