return desired;
}
+#warning migrate to Torrent.m
- (void) torrentFinishedDownloading: (NSNotification *) notification
{
Torrent * torrent = [notification object];
- if (!fSoundPlaying && [fDefaults boolForKey: @"PlayDownloadSound"])
+ if ([torrent isActive])
{
- NSSound * sound;
- if ((sound = [NSSound soundNamed: [fDefaults stringForKey: @"DownloadSound"]]))
+ if (!fSoundPlaying && [fDefaults boolForKey: @"PlayDownloadSound"])
{
- [sound setDelegate: self];
- fSoundPlaying = YES;
- [sound play];
+ NSSound * sound;
+ if ((sound = [NSSound soundNamed: [fDefaults stringForKey: @"DownloadSound"]]))
+ {
+ [sound setDelegate: self];
+ fSoundPlaying = YES;
+ [sound play];
+ }
}
- }
-
- NSDictionary * clickContext = [NSDictionary dictionaryWithObjectsAndKeys: GROWL_DOWNLOAD_COMPLETE, @"Type",
- [torrent dataLocation] , @"Location", nil];
- [GrowlApplicationBridge notifyWithTitle: NSLocalizedString(@"Download Complete", "Growl notification title")
- description: [torrent name] notificationName: GROWL_DOWNLOAD_COMPLETE
- iconData: nil priority: 0 isSticky: NO clickContext: clickContext];
-
- if (![fWindow isMainWindow])
- [fBadger incrementCompleted];
-
- if ([torrent isActive])
- {
+
+ NSDictionary * clickContext = [NSDictionary dictionaryWithObjectsAndKeys: GROWL_DOWNLOAD_COMPLETE, @"Type",
+ [torrent dataLocation] , @"Location", nil];
+ [GrowlApplicationBridge notifyWithTitle: NSLocalizedString(@"Download Complete", "Growl notification title")
+ description: [torrent name] notificationName: GROWL_DOWNLOAD_COMPLETE
+ iconData: nil priority: 0 isSticky: NO clickContext: clickContext];
+
+ if (![fWindow isMainWindow])
+ [fBadger incrementCompleted];
+
if ([fDefaults boolForKey: @"QueueSeed"] && [self numToStartFromQueue: NO] <= 0)
{
[torrent stopTransfer];
[self updateTorrentsInQueue];
}
+- (void) torrentStoppedForRatio: (NSNotification *) notification
+{
+ Torrent * torrent = [notification object];
+
+ [self updateTorrentsInQueue];
+ [fInfoController updateInfoStats];
+ [fInfoController updateOptions];
+
+ if (!fSoundPlaying && [fDefaults boolForKey: @"PlaySeedingSound"])
+ {
+ NSSound * sound;
+ if ((sound = [NSSound soundNamed: [fDefaults stringForKey: @"SeedingSound"]]))
+ {
+ [sound setDelegate: self];
+ fSoundPlaying = YES;
+ [sound play];
+ }
+ }
+
+ NSDictionary * clickContext = [NSDictionary dictionaryWithObjectsAndKeys: GROWL_SEEDING_COMPLETE, @"Type",
+ [torrent dataLocation], @"Location", nil];
+ [GrowlApplicationBridge notifyWithTitle: NSLocalizedString(@"Seeding Complete", "Growl notification title")
+ description: [torrent name] notificationName: GROWL_SEEDING_COMPLETE
+ iconData: nil priority: 0 isSticky: NO clickContext: clickContext];
+}
+
- (void) updateTorrentHistory
{
NSMutableArray * history = [NSMutableArray arrayWithCapacity: [fTorrents count]];
[fPrefsController updateRatioStopField];
}
-- (void) torrentStoppedForRatio: (NSNotification *) notification
-{
- Torrent * torrent = [notification object];
-
- [self updateTorrentsInQueue];
- [fInfoController updateInfoStats];
- [fInfoController updateOptions];
-
- if (!fSoundPlaying && [fDefaults boolForKey: @"PlaySeedingSound"])
- {
- NSSound * sound;
- if ((sound = [NSSound soundNamed: [fDefaults stringForKey: @"SeedingSound"]]))
- {
- [sound setDelegate: self];
- fSoundPlaying = YES;
- [sound play];
- }
- }
-
- NSDictionary * clickContext = [NSDictionary dictionaryWithObjectsAndKeys: GROWL_SEEDING_COMPLETE, @"Type",
- [torrent dataLocation], @"Location", nil];
- [GrowlApplicationBridge notifyWithTitle: NSLocalizedString(@"Seeding Complete", "Growl notification title")
- description: [torrent name] notificationName: GROWL_SEEDING_COMPLETE
- iconData: nil priority: 0 isSticky: NO clickContext: clickContext];
-}
-
- (void) sound: (NSSound *) sound didFinishPlaying: (BOOL) finishedPlaying
{
fSoundPlaying = NO;