if a torrent switches from seeding to downloading still apply this to the queue

This commit is contained in:
Mitchell Livingston 2007-06-20 00:04:20 +00:00
parent 9f939256c6
commit 34b2b2e698
3 changed files with 23 additions and 1 deletions

View File

@ -169,6 +169,7 @@
- (void) updateTorrentsInQueue;
- (void) torrentFinishedDownloading: (NSNotification *) notification;
- (void) torrentRestartedDownloading: (NSNotification *) notification;
- (void) updateTorrentHistory;
- (void) sortTorrents;

View File

@ -385,6 +385,9 @@ static void sleepCallBack(void * controller, io_service_t y, natural_t messageTy
[nc addObserver: self selector: @selector(torrentFinishedDownloading:)
name: @"TorrentFinishedDownloading" object: nil];
[nc addObserver: self selector: @selector(torrentRestartedDownloading:)
name: @"TorrentRestartedDownloading" object: nil];
[nc addObserver: self selector: @selector(updateControlTint:)
name: NSControlTintDidChangeNotification object: nil];
@ -1464,6 +1467,7 @@ static void sleepCallBack(void * controller, io_service_t y, natural_t messageTy
if (![fWindow isKeyWindow])
[fBadger incrementCompleted];
#warning make better
if ([fDefaults boolForKey: @"QueueSeed"])
{
[torrent stopTransfer];
@ -1473,6 +1477,22 @@ static void sleepCallBack(void * controller, io_service_t y, natural_t messageTy
[self updateTorrentsInQueue];
}
- (void) torrentRestartedDownloading: (NSNotification *) notification
{
Torrent * torrent = [notification object];
[fInfoController updateInfoStats];
#warning make better
if ([fDefaults boolForKey: @"Queue"])
{
[torrent stopTransfer];
[torrent setWaitToStart: YES];
}
[self updateTorrentsInQueue];
}
- (void) updateTorrentHistory
{
NSMutableArray * history = [NSMutableArray arrayWithCapacity: [fTorrents count]];

View File

@ -345,7 +345,7 @@ static uint32_t kRed = BE(0xFF6450FF), //255, 100, 80
[[NSNotificationCenter defaultCenter] postNotificationName: @"TorrentFinishedDownloading" object: self];
}
else if (tr_getIncomplete(fHandle))
[[NSNotificationCenter defaultCenter] postNotificationName: @"UpdateQueue" object: self];
[[NSNotificationCenter defaultCenter] postNotificationName: @"TorrentRestartedDownloading" object: self];
else;
//check to stop for ratio
@ -1704,6 +1704,7 @@ static uint32_t kRed = BE(0xFF6450FF), //255, 100, 80
}
}
#warning move?
- (NSImage *) advancedBar
{
uint32_t * p;