Changeset 11047
- Timestamp:
- Jul 24, 2010, 4:14:43 AM (13 years ago)
- Location:
- trunk/qt
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/qt/details.cc
r11044 r11047 647 647 myPeerLimitSpin->setValue( tor->peerLimit() ); 648 648 myPeerLimitSpin->blockSignals( false ); 649 650 // ratio radios 649 } 650 651 { 652 const Torrent * tor; 653 654 // ratio 655 bool uniform = true; 656 int baselineInt = torrents[0]->seedRatioMode( ); 657 foreach( tor, torrents ) if( baselineInt != tor->seedRatioMode( ) ) { uniform = false; break; } 658 659 myRatioCombo->blockSignals( true ); 660 myRatioCombo->setCurrentIndex( uniform ? myRatioCombo->findData( baselineInt ) : -1 ); 661 myRatioSpin->setVisible( uniform && ( baselineInt == TR_RATIOLIMIT_SINGLE ) ); 662 myRatioCombo->blockSignals( false ); 663 664 myRatioSpin->blockSignals( true ); 665 myRatioSpin->setValue( tor->seedRatioLimit( ) ); 666 myRatioSpin->blockSignals( false ); 667 668 // idle 651 669 uniform = true; 652 baselineInt = tor->seedRatioMode( ); 653 foreach( tor, torrents ) if( baselineInt != tor->seedRatioMode( ) ) { uniform = false; break; } 654 if( !uniform ) { 655 mySeedGlobalRadio->setChecked( false ); 656 mySeedCustomRadio->setChecked( false ); 657 mySeedForeverRadio->setChecked( false ); 658 } else { 659 QRadioButton * rb; 660 switch( baselineInt ) { 661 case TR_RATIOLIMIT_GLOBAL: rb = mySeedGlobalRadio; break; 662 case TR_RATIOLIMIT_SINGLE: rb = mySeedCustomRadio; break; 663 case TR_RATIOLIMIT_UNLIMITED: rb = mySeedForeverRadio; break; 664 } 665 rb->setChecked( true ); 666 } 667 668 mySeedCustomSpin->blockSignals( true ); 669 mySeedCustomSpin->setValue( tor->seedRatioLimit( ) ); 670 mySeedCustomSpin->blockSignals( false ); 670 baselineInt = torrents[0]->seedIdleMode( ); 671 foreach( tor, torrents ) if( baselineInt != tor->seedIdleMode( ) ) { uniform = false; break; } 672 673 myIdleCombo->blockSignals( true ); 674 myIdleCombo->setCurrentIndex( uniform ? myIdleCombo->findData( baselineInt ) : -1 ); 675 myIdleSpin->setVisible( uniform && ( baselineInt == TR_RATIOLIMIT_SINGLE ) ); 676 myIdleCombo->blockSignals( false ); 677 678 myIdleSpin->blockSignals( true ); 679 myIdleSpin->setValue( tor->seedIdleLimit( ) ); 680 myIdleSpin->blockSignals( false ); 671 681 } 672 682 … … 1027 1037 } 1028 1038 1029 #define RATIO_KEY "seedRatioMode" 1030 1031 void 1032 Details :: onSeedUntilChanged( bool b ) 1033 { 1034 if( b ) 1035 mySession.torrentSet( myIds, RATIO_KEY, sender()->property(RATIO_KEY).toInt() ); 1036 } 1037 1038 void 1039 Details :: onSeedRatioLimitChanged( double val ) 1040 { 1041 QSet<int> ids; 1042 1043 foreach( int id, myIds ) { 1044 const Torrent * tor = myModel.getTorrentFromId( id ); 1045 if( tor && tor->seedRatioLimit( ) ) 1046 ids.insert( id ); 1047 } 1048 1049 if( !ids.empty( ) ) 1050 mySession.torrentSet( ids, "seedRatioLimit", val ); 1039 void 1040 Details :: onIdleModeChanged( int index ) 1041 { 1042 const int val = myIdleCombo->itemData( index ).toInt( ); 1043 mySession.torrentSet( myIds, "seedIdleMode", val ); 1044 } 1045 1046 void 1047 Details :: onIdleLimitChanged( int val ) 1048 { 1049 mySession.torrentSet( myIds, "seedIdleLimit", val ); 1050 } 1051 1052 void 1053 Details :: onRatioModeChanged( int index ) 1054 { 1055 const int val = myRatioCombo->itemData( index ).toInt( ); 1056 mySession.torrentSet( myIds, "seedRatioMode", val ); 1057 } 1058 1059 void 1060 Details :: onRatioLimitChanged( double val ) 1061 { 1062 mySession.torrentSet( myIds, "seedRatioLimit", val ); 1051 1063 } 1052 1064 … … 1184 1196 Details :: createOptionsTab( ) 1185 1197 { 1186 //QWidget * l;1187 1198 QSpinBox * s; 1188 1199 QCheckBox * c; 1189 1200 QComboBox * m; 1190 1201 QHBoxLayout * h; 1191 QRadioButton * r;1192 1202 QDoubleSpinBox * ds; 1193 1203 const QString speed_K_str = Formatter::unitStr( Formatter::SPEED, Formatter::KB ); … … 1232 1242 hig->addSectionTitle( tr( "Seeding Limits" ) ); 1233 1243 1234 r = new QRadioButton( tr( "Use &global settings" ) );1235 r->setProperty( RATIO_KEY, TR_RATIOLIMIT_GLOBAL );1236 connect( r, SIGNAL(clicked(bool)), this, SLOT(onSeedUntilChanged(bool)));1237 mySeedGlobalRadio = r;1238 hig->addWideControl( r );1239 1240 r = new QRadioButton( tr( "Seed ®ardless of ratio" ) );1241 r->setProperty( RATIO_KEY, TR_RATIOLIMIT_UNLIMITED );1242 connect( r, SIGNAL(clicked(bool)), this, SLOT(onSeedUntilChanged(bool)));1243 mySeedForeverRadio = r;1244 hig->addWideControl( r );1245 1246 1244 h = new QHBoxLayout( ); 1247 1245 h->setSpacing( HIG :: PAD ); 1248 r = new QRadioButton( tr( "&Seed torrent until its ratio reaches:" ) ); 1249 r->setProperty( RATIO_KEY, TR_RATIOLIMIT_SINGLE ); 1250 connect( r, SIGNAL(clicked(bool)), this, SLOT(onSeedUntilChanged(bool))); 1251 mySeedCustomRadio = r; 1252 h->addWidget( r ); 1246 m = new QComboBox; 1247 m->addItem( tr( "Use Global Settings" ), TR_RATIOLIMIT_GLOBAL ); 1248 m->addItem( tr( "Seed regardless of ratio" ), TR_RATIOLIMIT_UNLIMITED ); 1249 m->addItem( tr( "Stop seeding at ratio:" ), TR_RATIOLIMIT_SINGLE ); 1250 connect( m, SIGNAL(currentIndexChanged(int)), this, SLOT(onRatioModeChanged(int))); 1251 h->addWidget( myRatioCombo = m ); 1253 1252 ds = new QDoubleSpinBox( ); 1254 1253 ds->setRange( 0.5, INT_MAX ); 1255 connect( ds, SIGNAL(valueChanged(double)), this, SLOT(onSeedRatioLimitChanged(double))); 1256 mySeedCustomSpin = ds; 1257 h->addWidget( ds ); 1258 hig->addWideControl( h ); 1254 connect( ds, SIGNAL(valueChanged(double)), this, SLOT(onRatioLimitChanged(double))); 1255 h->addWidget( myRatioSpin = ds ); 1256 hig->addRow( tr( "&Ratio:" ), h, m ); 1257 1258 h = new QHBoxLayout( ); 1259 h->setSpacing( HIG :: PAD ); 1260 m = new QComboBox; 1261 m->addItem( tr( "Use Global Settings" ), TR_IDLELIMIT_GLOBAL ); 1262 m->addItem( tr( "Seed regardless of activity" ), TR_IDLELIMIT_UNLIMITED ); 1263 m->addItem( tr( "Stop seeding if idle for N minutes:" ), TR_IDLELIMIT_SINGLE ); 1264 connect( m, SIGNAL(currentIndexChanged(int)), this, SLOT(onIdleModeChanged(int))); 1265 h->addWidget( myIdleCombo = m ); 1266 s = new QSpinBox( ); 1267 s->setRange( 1, 9999 ); 1268 connect( s, SIGNAL(valueChanged(int)), this, SLOT(onIdleLimitChanged(int))); 1269 h->addWidget( myIdleSpin = s ); 1270 hig->addRow( tr( "&Idle:" ), h, m ); 1271 1259 1272 1260 1273 hig->addSectionDivider( ); -
trunk/qt/details.h
r10908 r11047 104 104 QSpinBox * mySingleDownSpin; 105 105 QSpinBox * mySingleUpSpin; 106 Q RadioButton * mySeedGlobalRadio;107 Q RadioButton * mySeedForeverRadio;108 Q RadioButton * mySeedCustomRadio;109 Q DoubleSpinBox * mySeedCustomSpin;106 QComboBox * myRatioCombo; 107 QDoubleSpinBox * myRatioSpin; 108 QComboBox * myIdleCombo; 109 QSpinBox * myIdleSpin; 110 110 QSpinBox * myPeerLimitSpin; 111 111 QComboBox * myBandwidthPriorityCombo; … … 145 145 void onUploadLimitedToggled( bool ); 146 146 void onUploadLimitChanged( int ); 147 void onSeedUntilChanged( bool ); 148 void onSeedRatioLimitChanged( double ); 147 void onRatioModeChanged( int ); 148 void onRatioLimitChanged( double ); 149 void onIdleModeChanged( int ); 150 void onIdleLimitChanged( int ); 149 151 void onShowTrackerScrapesToggled( bool ); 150 152 void onTrackerSelectionChanged( ); -
trunk/qt/torrent.cc
r10937 r11047 90 90 { SEED_RATIO_LIMIT, "seedRatioLimit", QVariant::Double, STAT }, 91 91 { SEED_RATIO_MODE, "seedRatioMode", QVariant::Int, STAT }, 92 { SEED_IDLE_LIMIT, "seedIdleLimit", QVariant::Int, STAT_EXTRA }, 93 { SEED_IDLE_MODE, "seedIdleMode", QVariant::Int, STAT_EXTRA }, 92 94 { DOWN_LIMIT, "downloadLimit", QVariant::Int, STAT_EXTRA }, /* KB/s */ 93 95 { DOWN_LIMITED, "downloadLimited", QVariant::Bool, STAT_EXTRA }, -
trunk/qt/torrent.h
r10937 r11047 154 154 SEED_RATIO_LIMIT, 155 155 SEED_RATIO_MODE, 156 SEED_IDLE_LIMIT, 157 SEED_IDLE_MODE, 156 158 DOWN_LIMIT, 157 159 DOWN_LIMITED, … … 293 295 double seedRatioLimit( ) const { return getDouble( SEED_RATIO_LIMIT ); } 294 296 tr_ratiolimit seedRatioMode( ) const { return (tr_ratiolimit) getInt( SEED_RATIO_MODE ); } 297 int seedIdleLimit( ) const { return getInt( SEED_IDLE_LIMIT ); } 298 tr_idlelimit seedIdleMode( ) const { return (tr_idlelimit) getInt( SEED_IDLE_MODE ); } 295 299 TrackerStatsList trackerStats( ) const{ return myValues[TRACKERSTATS].value<TrackerStatsList>(); } 296 300 PeerList peers( ) const{ return myValues[PEERS].value<PeerList>(); }
Note: See TracChangeset
for help on using the changeset viewer.