Summary: | [PATCH]amarok keeps equalizer settings even when you click cancel | ||
---|---|---|---|
Product: | [Applications] amarok | Reporter: | Richard Hartmann <richih-kde> |
Component: | Tools/Equalizer | Assignee: | Amarok Developers <amarok-bugs-dist> |
Status: | RESOLVED FIXED | ||
Severity: | normal | ||
Priority: | NOR | ||
Version: | 2.3.1 | ||
Target Milestone: | --- | ||
Platform: | Unlisted Binaries | ||
OS: | Linux | ||
Latest Commit: | Version Fixed In: | ||
Sentry Crash Report: | |||
Attachments: | possible solution |
Description
Richard Hartmann
2010-06-24 23:03:02 UTC
Which exact Amarok version is this about? 2.3.1-1 in Debian unstable. http://packages.debian.org/sid/amarok http://packages.qa.debian.org/a/amarok/news/20100530T214835Z.html Thank you for the fast feedback. Thanks for triaging :) Created attachment 49083 [details]
possible solution
commit d6b28871ca608aa1416e8ca49b5b6771c2d57ce5 Author: Mark Kretschmann <kretschmann@kde.org> Date: Sat Sep 4 16:23:16 2010 +0200 Bugfix: The equalizer dialog did not discard changes when clicking "Cancel". Many thanks to Anton Gritsay <anton@angri.ru> for the patch. BUG: 242730 diff --git a/ChangeLog b/ChangeLog index 39f132d..4225d83 100644 --- a/ChangeLog +++ b/ChangeLog @@ -12,6 +12,8 @@ VERSION 2.3.2 * Use system date/time format for default name when saving user playlists. BUGFIXES: + * The equalizer dialog did not discard changes when clicking "Cancel". + Patch by Anton Gritsay <anton@angri.ru>. (BR 242730) * The Last.fm service did not work without KWallet. (BR 235861) * Show actual KDE version in the "About Amarok" dialog, instead of the version used at compile time. diff --git a/src/dialogs/EqualizerDialog.cpp b/src/dialogs/EqualizerDialog.cpp index 8e200f8..2efd2d2 100644 --- a/src/dialogs/EqualizerDialog.cpp +++ b/src/dialogs/EqualizerDialog.cpp @@ -62,6 +62,28 @@ void EqualizerDialog::showOnce() instance()->activateWindow(); instance()->show(); instance()->raise(); + instance()->eqRememberOriginalSettings(); +} + +void +EqualizerDialog::eqRememberOriginalSettings() +{ + mOriginalPreset = eqPresets->itemText(AmarokConfig::equalizerMode()); + mOriginalGains = AmarokConfig::equalizerGains(); +} + +void +EqualizerDialog::eqRestoreOriginalSettings() +{ + int originalPresetIndex = eqPresets->findText( mOriginalPreset ); + if( originalPresetIndex == -1 ) { + // original preset seems to be deleted. will set eq to Off + originalPresetIndex = 0; + } + AmarokConfig::setEqualizerMode( originalPresetIndex ); + AmarokConfig::setEqualizerGains( mOriginalGains ); + eqUpdateUI( originalPresetIndex ); + The::engineController()->eqUpdate(); } void @@ -82,6 +104,8 @@ EqualizerDialog::eqSetupUI() return; } + connect(this, SIGNAL( cancelClicked() ), this, SLOT( eqRestoreOriginalSettings() )); + // Assign slider items to vectors mBands.append( eqPreampSlider ); mBands.append( eqBand0Slider ); diff --git a/src/dialogs/EqualizerDialog.h b/src/dialogs/EqualizerDialog.h index b1472a4..cd1917a 100644 --- a/src/dialogs/EqualizerDialog.h +++ b/src/dialogs/EqualizerDialog.h @@ -46,6 +46,7 @@ class EqualizerDialog : public KDialog, public Ui_EqualizerDialog void eqSavePreset(); void eqDeletePreset(); void eqRestorePreset(); + void eqRestoreOriginalSettings(); private: EqualizerDialog(); @@ -53,6 +54,8 @@ class EqualizerDialog : public KDialog, public Ui_EqualizerDialog QVector<QSlider*> mBands; QVector<QLabel*> mBandsValues; QVector<QLabel*> mBandsLabels; + QList<int> mOriginalGains; + QString mOriginalPreset; void eqSetupUI(); void eqUpdateToolTips(); @@ -60,6 +63,7 @@ class EqualizerDialog : public KDialog, public Ui_EqualizerDialog bool eqCfgDeletePreset( QString & mPresetName ); bool eqCfgRestorePreset( QString mPresetName ); void eqCfgSetPresetVal( QString & mPresetName, QList<int> & mPresetValues); + void eqRememberOriginalSettings(); QList<int> eqCfgGetPresetVal ( QString mPresetName ); QStringList eqGlobalList(); |