PrefsDialog :: checkBoxToggled( bool checked )
{
const int key( sender( )->property( PREF_KEY ).toInt( ) );
- myPrefs.set( key, checked );
+ setPref( key, checked );
}
QCheckBox *
const QDoubleSpinBox * d = qobject_cast<const QDoubleSpinBox*>( spin );
if( d != 0 )
- myPrefs.set( key, d->value( ) );
+ setPref( key, d->value( ) );
else
- myPrefs.set( key, qobject_cast<const QSpinBox*>(spin)->value( ) );
+ setPref( key, qobject_cast<const QSpinBox*>(spin)->value( ) );
}
void
{
const int key( sender()->property( PREF_KEY ).toInt( ) );
const int seconds( QTime().secsTo( time ) );
- myPrefs.set( key, seconds / 60 );
+ setPref( key, seconds / 60 );
}
QTimeEdit*
PrefsDialog :: textChanged( const QString& text )
{
const int key( sender()->property( PREF_KEY ).toInt( ) );
- myPrefs.set( key, text );
+ setPref( key, text );
}
QLineEdit*
PrefsDialog :: altSpeedDaysEdited( int i )
{
const int value = qobject_cast<QComboBox*>(sender())->itemData(i).toInt();
- myPrefs.set( Prefs::ALT_SPEED_LIMIT_TIME_DAY, value );
+ setPref( Prefs::ALT_SPEED_LIMIT_TIME_DAY, value );
}
PrefsDialog :: encryptionEdited( int i )
{
const int value( qobject_cast<QComboBox*>(sender())->itemData(i).toInt( ) );
- myPrefs.set( Prefs::ENCRYPTION, value );
+ setPref( Prefs::ENCRYPTION, value );
}
QWidget *
void
PrefsDialog :: onLocationSelected( const QString& path, int key )
{
- myPrefs.set( key, path );
- updatePref( key );
+ setPref( key, path );
}
QWidget *
<< Prefs :: INCOMPLETE_DIR
<< Prefs :: INCOMPLETE_DIR_ENABLED;
foreach( int key, keys )
- updatePref( key );
+ refreshPref( key );
// if it's a remote session, disable the preferences
// that don't work in remote sessions
{
}
+void
+PrefsDialog :: setPref( int key, const QVariant& v )
+{
+ myPrefs.set( key, v );
+ refreshPref( key );
+}
+
/***
****
***/
}
void
-PrefsDialog :: updatePref( int key )
+PrefsDialog :: refreshPref( int key )
{
switch( key )
{
void spinBoxChangedIdle( );
void timeChanged( const QTime& );
void textChanged( const QString& );
- void updatePref( int key );
+ void refreshPref( int key );
void encryptionEdited( int );
void altSpeedDaysEdited( int );
void sessionUpdated( );
~PrefsDialog( );
private:
+ void setPref( int key, const QVariant& v );
bool isAllowed( int key ) const;
QWidget * createTorrentsTab( );
QWidget * createSpeedTab( );