Commit 35353442 authored by Hugo Beauzée-Luyssen's avatar Hugo Beauzée-Luyssen

Settings: Discard changes when clicking cancel

parent 2269cfc9
......@@ -54,7 +54,7 @@ class ISettingsCategoryWidget : public QWidget
protected:
SettingValue *m_setting;
protected slots:
public slots:
virtual void changed( const QVariant& ) = 0;
};
......
......@@ -116,6 +116,13 @@ PreferenceWidget::reset()
save();
}
void
PreferenceWidget::discard()
{
foreach ( ISettingsCategoryWidget* w, m_settings )
w->changed( w->setting()->get() );
}
const char*
PreferenceWidget::category() const
{
......
......@@ -46,6 +46,7 @@ class PreferenceWidget : public QScrollArea
virtual bool save();
virtual void reset();
void discard();
const char *category() const;
protected:
void changeEvent( QEvent *e );
......
......@@ -133,6 +133,11 @@ Settings::buttonClicked( QAbstractButton *button )
if ( m_type == SettingsManager::Vlmc )
SettingsManager::getInstance()->save();
}
case QDialogButtonBox::Cancel:
{
for ( int i = 0; i < m_stackedLayout->count(); ++i )
qobject_cast<PreferenceWidget*>( m_stackedLayout->widget( i ) )->discard();
}
default:
break ;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment