Changeset 515
- Timestamp:
- Jul 4, 2006, 5:26:18 PM (16 years ago)
- Location:
- trunk/macosx
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/macosx/Controller.m
r514 r515 481 481 482 482 [self updateUI: nil]; 483 [ self reloadInspector: nil];483 [fInfoController updateInfoSettings]; 484 484 [self updateTorrentHistory]; 485 485 } … … 511 511 512 512 [self updateUI: nil]; 513 [ self reloadInspector: nil];513 [fInfoController updateInfoSettings]; 514 514 [self updateTorrentHistory]; 515 515 } … … 1031 1031 1032 1032 [self updateUI: nil]; 1033 [ self reloadInspector: nil];1033 [fInfoController updateInfoSettings]; 1034 1034 [self updateTorrentHistory]; 1035 1035 } … … 1041 1041 1042 1042 [self updateUI: nil]; 1043 [ self reloadInspector: nil];1043 [fInfoController updateInfoSettings]; 1044 1044 [self updateTorrentHistory]; 1045 1045 } … … 1050 1050 1051 1051 [self updateUI: nil]; 1052 [ self reloadInspector: nil];1052 [fInfoController updateInfoSettings]; 1053 1053 [self updateTorrentHistory]; 1054 1054 } -
trunk/macosx/InfoWindowController.h
r451 r515 57 57 - (void) updateInfoForTorrents: (NSArray *) torrents; 58 58 - (void) updateInfoStats; 59 - (void) updateInfoSettings; 59 60 60 61 - (void) setNextTab; -
trunk/macosx/InfoWindowController.m
r497 r515 179 179 } 180 180 [self updateInfoStats]; 181 [self updateInfoSettings]; 181 182 182 183 //set file table … … 190 191 [fFileTable deselectAll: nil]; 191 192 [fFileTable reloadData]; 192 193 //set wait to start194 BOOL waiting = NO, notWaiting = NO, canEnableWaiting = numberSelected > 0,195 waitingSettingOn = [[[NSUserDefaults standardUserDefaults] stringForKey: @"StartSetting"]196 isEqualToString: @"Wait"];197 198 enumerator = [fTorrents objectEnumerator];199 while ((torrent = [enumerator nextObject]))200 {201 if ([torrent waitingToStart])202 waiting = YES;203 else204 notWaiting = YES;205 206 if (canEnableWaiting && !(![torrent isActive] && [torrent progress] < 1.0 && waitingSettingOn))207 canEnableWaiting = NO;208 }209 210 [fWaitToStartButton setState: waiting && notWaiting ? NSMixedState : (waiting ? NSOnState : NSOffState)];211 [fWaitToStartButton setEnabled: canEnableWaiting];212 213 //set ratio settings214 if (numberSelected > 0)215 {216 enumerator = [fTorrents objectEnumerator];217 torrent = [enumerator nextObject]; //first torrent218 const int INVALID = -99;219 int ratioSetting = [torrent stopRatioSetting];220 float ratioLimit = [torrent ratioLimit];221 222 while ((ratioSetting != INVALID || ratioLimit != INVALID)223 && (torrent = [enumerator nextObject]))224 {225 if (ratioSetting != INVALID && ratioSetting != [torrent stopRatioSetting])226 ratioSetting = INVALID;227 228 if (ratioLimit != INVALID && ratioLimit != [torrent ratioLimit])229 ratioLimit = INVALID;230 }231 232 [fRatioMatrix setEnabled: YES];233 234 if (ratioSetting == RATIO_CHECK)235 {236 [fRatioMatrix selectCellWithTag: RATIO_CHECK_TAG];237 [fRatioLimitField setEnabled: YES];238 }239 else240 {241 if (ratioSetting == RATIO_NO_CHECK)242 [fRatioMatrix selectCellWithTag: RATIO_NO_CHECK_TAG];243 else if (ratioSetting == RATIO_GLOBAL)244 [fRatioMatrix selectCellWithTag: RATIO_GLOBAL_TAG];245 else246 [fRatioMatrix deselectAllCells];247 248 [fRatioLimitField setEnabled: NO];249 }250 251 if (ratioLimit != INVALID)252 [fRatioLimitField setFloatValue: ratioLimit];253 else254 [fRatioLimitField setStringValue: @""];255 }256 else257 {258 [fRatioMatrix deselectAllCells];259 [fRatioMatrix setEnabled: NO];260 261 [fRatioLimitField setEnabled: NO];262 [fRatioLimitField setStringValue: @""];263 }264 193 } 265 194 … … 320 249 } 321 250 251 - (void) updateInfoSettings 252 { 253 int numberSelected = [fTorrents count]; 254 255 //set wait to start 256 BOOL waiting = NO, notWaiting = NO, canEnableWaiting = numberSelected > 0, 257 waitingSettingOn = [[[NSUserDefaults standardUserDefaults] stringForKey: @"StartSetting"] 258 isEqualToString: @"Wait"]; 259 260 NSEnumerator * enumerator = [fTorrents objectEnumerator]; 261 Torrent * torrent; 262 while ((torrent = [enumerator nextObject])) 263 { 264 if ([torrent waitingToStart]) 265 waiting = YES; 266 else 267 notWaiting = YES; 268 269 if (canEnableWaiting && !(![torrent isActive] && [torrent progress] < 1.0 && waitingSettingOn)) 270 canEnableWaiting = NO; 271 } 272 273 [fWaitToStartButton setState: waiting && notWaiting ? NSMixedState : (waiting ? NSOnState : NSOffState)]; 274 [fWaitToStartButton setEnabled: canEnableWaiting]; 275 276 //set ratio settings 277 if (numberSelected > 0) 278 { 279 enumerator = [fTorrents objectEnumerator]; 280 torrent = [enumerator nextObject]; //first torrent 281 const int INVALID = -99; 282 int ratioSetting = [torrent stopRatioSetting]; 283 float ratioLimit = [torrent ratioLimit]; 284 285 while ((ratioSetting != INVALID || ratioLimit != INVALID) 286 && (torrent = [enumerator nextObject])) 287 { 288 if (ratioSetting != INVALID && ratioSetting != [torrent stopRatioSetting]) 289 ratioSetting = INVALID; 290 291 if (ratioLimit != INVALID && ratioLimit != [torrent ratioLimit]) 292 ratioLimit = INVALID; 293 } 294 295 [fRatioMatrix setEnabled: YES]; 296 297 if (ratioSetting == RATIO_CHECK) 298 { 299 [fRatioMatrix selectCellWithTag: RATIO_CHECK_TAG]; 300 [fRatioLimitField setEnabled: YES]; 301 } 302 else 303 { 304 if (ratioSetting == RATIO_NO_CHECK) 305 [fRatioMatrix selectCellWithTag: RATIO_NO_CHECK_TAG]; 306 else if (ratioSetting == RATIO_GLOBAL) 307 [fRatioMatrix selectCellWithTag: RATIO_GLOBAL_TAG]; 308 else 309 [fRatioMatrix deselectAllCells]; 310 311 [fRatioLimitField setEnabled: NO]; 312 } 313 314 if (ratioLimit != INVALID) 315 [fRatioLimitField setFloatValue: ratioLimit]; 316 else 317 [fRatioLimitField setStringValue: @""]; 318 } 319 else 320 { 321 [fRatioMatrix deselectAllCells]; 322 [fRatioMatrix setEnabled: NO]; 323 324 [fRatioLimitField setEnabled: NO]; 325 [fRatioLimitField setStringValue: @""]; 326 } 327 } 328 322 329 - (BOOL) validateMenuItem: (NSMenuItem *) menuItem 323 330 { … … 380 387 - (void) setNextTab 381 388 { 382 if ([fTabView indexOfTabViewItem: [fTabView selectedTabViewItem]] 383 == [fTabView numberOfTabViewItems] - 1) 389 if ([fTabView indexOfTabViewItem: [fTabView selectedTabViewItem]] == [fTabView numberOfTabViewItems] - 1) 384 390 [fTabView selectFirstTabViewItem: nil]; 385 391 else
Note: See TracChangeset
for help on using the changeset viewer.