Changeset 940 for trunk/macosx/Torrent.m
- Timestamp:
- Sep 28, 2006, 12:32:26 AM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/macosx/Torrent.m
r933 r940 318 318 - (void) startTransfer 319 319 { 320 if (![self isActive]) 321 { 320 fWaitToStart = NO; 321 fFinishedSeeding = NO; 322 323 if (![self isActive] && [self remainingDiskSpaceForTorrent]) 322 324 tr_torrentStart(fHandle); 323 324 fFinishedSeeding = NO;325 fWaitToStart = NO;326 }327 325 } 328 326 … … 415 413 if (fPublicTorrent) 416 414 [self trashFile: [self publicTorrentLocation]]; 415 } 416 417 - (BOOL) remainingDiskSpaceForTorrent 418 { 419 if ([self progress] >= 1.0) 420 return YES; 421 422 NSDictionary * fsAttributes = [[NSFileManager defaultManager] fileSystemAttributesAtPath: [self dataLocation]]; 423 float remainingSpace = [[fsAttributes objectForKey: NSFileSystemFreeSize] floatValue], 424 torrentRemaining = (float)[self size] * (1.0 - [self progress]); 425 426 NSLog(@"Remaining disk space: %f", remainingSpace); 427 NSLog(@"Torrent remaining size: %f", torrentRemaining); 428 429 if (remainingSpace - torrentRemaining <= 10240.0) 430 { 431 NSAlert * alert = [[NSAlert alloc] init]; 432 [alert setMessageText: [NSString stringWithFormat: @"Not enough remaining disk space to download \"%@\" completely.", 433 [self name]]]; 434 [alert setInformativeText: @"The transfer has been paused. Clear up space on your disk to continue."]; 435 436 [alert runModal]; 437 438 return NO; 439 } 440 441 return YES; 417 442 } 418 443
Note: See TracChangeset
for help on using the changeset viewer.