]> granicus.if.org Git - transmission/commitdiff
(trunk qt) #2050 "properties dialog changes seem to undo themselves" -- better fix
authorCharles Kerr <charles@transmissionbt.com>
Mon, 2 Aug 2010 16:30:24 +0000 (16:30 +0000)
committerCharles Kerr <charles@transmissionbt.com>
Mon, 2 Aug 2010 16:30:24 +0000 (16:30 +0000)
qt/my-valgrind.sh
qt/prefs-dialog.cc
qt/prefs-dialog.h

index d7d45db3d4d7ae0c797dcfbe5bf2e7988bf21b33..c75201238920bac49a69e9f1d3aa089b9457c314 100755 (executable)
@@ -2,4 +2,4 @@
 export G_SLICE=always-malloc
 export G_DEBUG=gc-friendly
 export GLIBCXX_FORCE_NEW=1
-valgrind --tool=memcheck --leak-check=full --leak-resolution=high --num-callers=64 --log-file=x-valgrind --show-reachable=yes ./qtr 
+valgrind --tool=memcheck --leak-check=full --leak-resolution=high --num-callers=32 --log-file=x-valgrind --show-reachable=yes ./transmission-qt
index b715626fedac6ee040c630a6b3395c791f7b1bac..6d5b09cf130a3912e99c3cd8fbead0cc6710d2d3 100644 (file)
@@ -57,7 +57,7 @@ void
 PrefsDialog :: checkBoxToggled( bool checked )
 {
     const int key( sender( )->property( PREF_KEY ).toInt( ) );
-    myPrefs.set( key, checked );
+    setPref( key, checked );
 }
 
 QCheckBox *
@@ -86,9 +86,9 @@ PrefsDialog :: spinBoxChangedIdle( )
 
     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
@@ -152,7 +152,7 @@ PrefsDialog :: timeChanged( const QTime& time )
 {
     const int key( sender()->property( PREF_KEY ).toInt( ) );
     const int seconds( QTime().secsTo( time ) );
-    myPrefs.set( key, seconds / 60 );
+    setPref( key, seconds / 60 );
 }
 
 QTimeEdit*
@@ -172,7 +172,7 @@ void
 PrefsDialog :: textChanged( const QString& text )
 {
     const int key( sender()->property( PREF_KEY ).toInt( ) );
-    myPrefs.set( key, text );
+    setPref( key, text );
 }
 
 QLineEdit*
@@ -255,7 +255,7 @@ void
 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 );
 }
 
 
@@ -458,7 +458,7 @@ void
 PrefsDialog :: encryptionEdited( int i )
 {
     const int value( qobject_cast<QComboBox*>(sender())->itemData(i).toInt( ) );
-    myPrefs.set( Prefs::ENCRYPTION, value );
+    setPref( Prefs::ENCRYPTION, value );
 }
 
 QWidget *
@@ -552,8 +552,7 @@ PrefsDialog :: onDestinationClicked( void )
 void
 PrefsDialog :: onLocationSelected( const QString& path, int key )
 {
-    myPrefs.set( key, path );
-    updatePref( key );
+    setPref( key, path );
 }
 
 QWidget *
@@ -668,7 +667,7 @@ PrefsDialog :: PrefsDialog( Session& session, Prefs& prefs, QWidget * parent ):
          << 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
@@ -684,6 +683,13 @@ PrefsDialog :: ~PrefsDialog( )
 {
 }
 
+void
+PrefsDialog :: setPref( int key, const QVariant& v )
+{
+    myPrefs.set( key, v );
+    refreshPref( key );
+}
+
 /***
 ****
 ***/
@@ -706,7 +712,7 @@ PrefsDialog :: updateBlocklistCheckBox( )
 }
 
 void
-PrefsDialog :: updatePref( int key )
+PrefsDialog :: refreshPref( int key )
 {
     switch( key )
     {
index 394b47cbc4dedb8c8473a239d1cbeadb315b39d0..2dc212f6125952d14d7f39e1b630a7d8522a827c 100644 (file)
@@ -46,7 +46,7 @@ class PrefsDialog: public QDialog
         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( );
@@ -77,6 +77,7 @@ class PrefsDialog: public QDialog
         ~PrefsDialog( );
 
     private:
+        void setPref( int key, const QVariant& v );
         bool isAllowed( int key ) const;
         QWidget * createTorrentsTab( );
         QWidget * createSpeedTab( );