Changeset 11492


Ignore:
Timestamp:
Dec 8, 2010, 4:23:21 PM (11 years ago)
Author:
charles
Message:

(trunk qt) #2050 "properties dialog changes seem to undo themselves" -- fixed.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/qt/details.cc

    r11491 r11492  
    297297}
    298298
     299namespace
     300{
     301    void setIfIdle( QComboBox * box, int i )
     302    {
     303        if( !box->hasFocus( ) )
     304        {
     305            box->blockSignals( true );
     306            box->setCurrentIndex( i );
     307            box->blockSignals( false );
     308        }
     309    }
     310
     311    void setIfIdle( QDoubleSpinBox * spin, double value )
     312    {
     313        if( !spin->hasFocus( ) )
     314        {
     315            spin->blockSignals( true );
     316            spin->setValue( value );
     317            spin->blockSignals( false );
     318        }
     319    }
     320
     321    void setIfIdle( QSpinBox * spin, int value )
     322    {
     323        if( !spin->hasFocus( ) )
     324        {
     325            spin->blockSignals( true );
     326            spin->setValue( value );
     327            spin->blockSignals( false );
     328        }
     329    }
     330}
    299331
    300332void
     
    681713        else
    682714            i = -1;
    683         myBandwidthPriorityCombo->blockSignals( true );
    684         myBandwidthPriorityCombo->setCurrentIndex( i );
    685         myBandwidthPriorityCombo->blockSignals( false );
    686 
    687         mySingleDownSpin->blockSignals( true );
    688         mySingleDownSpin->setValue( (int)tor->downloadLimit().KBps() );
    689         mySingleDownSpin->blockSignals( false );
    690 
    691         mySingleUpSpin->blockSignals( true );
    692         mySingleUpSpin->setValue( (int)tor->uploadLimit().KBps() );
    693         mySingleUpSpin->blockSignals( false );
    694 
    695         myPeerLimitSpin->blockSignals( true );
    696         myPeerLimitSpin->setValue( tor->peerLimit() );
    697         myPeerLimitSpin->blockSignals( false );
     715        setIfIdle( myBandwidthPriorityCombo, i );
     716
     717        setIfIdle( mySingleDownSpin, int(tor->downloadLimit().KBps()) );
     718        setIfIdle( mySingleUpSpin, int(tor->uploadLimit().KBps()) );
     719        setIfIdle( myPeerLimitSpin, tor->peerLimit() );
    698720    }
    699721
     
    707729        foreach( tor, torrents ) if( baselineInt != tor->seedRatioMode( ) ) { uniform = false; break; }
    708730
    709         myRatioCombo->blockSignals( true );
    710         myRatioCombo->setCurrentIndex( uniform ? myRatioCombo->findData( baselineInt ) : -1 );
     731        setIfIdle( myRatioCombo, uniform ? myRatioCombo->findData( baselineInt ) : -1 );
    711732        myRatioSpin->setVisible( uniform && ( baselineInt == TR_RATIOLIMIT_SINGLE ) );
    712         myRatioCombo->blockSignals( false );
    713 
    714         myRatioSpin->blockSignals( true );
    715         myRatioSpin->setValue( tor->seedRatioLimit( ) );
    716         myRatioSpin->blockSignals( false );
     733
     734        setIfIdle( myRatioSpin, tor->seedRatioLimit( ) );
    717735
    718736        // idle
     
    721739        foreach( tor, torrents ) if( baselineInt != tor->seedIdleMode( ) ) { uniform = false; break; }
    722740
    723         myIdleCombo->blockSignals( true );
    724         myIdleCombo->setCurrentIndex( uniform ? myIdleCombo->findData( baselineInt ) : -1 );
     741        setIfIdle( myIdleCombo, uniform ? myIdleCombo->findData( baselineInt ) : -1 );
    725742        myIdleSpin->setVisible( uniform && ( baselineInt == TR_RATIOLIMIT_SINGLE ) );
    726         myIdleCombo->blockSignals( false );
    727 
    728         myIdleSpin->blockSignals( true );
    729         myIdleSpin->setValue( tor->seedIdleLimit( ) );
    730         myIdleSpin->blockSignals( false );
     743
     744        setIfIdle( myIdleSpin, tor->seedIdleLimit( ) );
    731745    }
    732746
Note: See TracChangeset for help on using the changeset viewer.