From 612e7221a9354c55d604c98d1686ea6be76ccbe4 Mon Sep 17 00:00:00 2001 From: Mitchell Livingston Date: Mon, 14 Apr 2008 00:05:16 +0000 Subject: [PATCH] when unchecking all files in the add dialog window, don't do finished events --- macosx/Controller.h | 3 +- macosx/Controller.m | 93 +++++++++++++++++++++++---------------------- 2 files changed, 48 insertions(+), 48 deletions(-) diff --git a/macosx/Controller.h b/macosx/Controller.h index e695196e1..5ef6d304d 100644 --- a/macosx/Controller.h +++ b/macosx/Controller.h @@ -194,6 +194,7 @@ typedef enum - (void) torrentFinishedDownloading: (NSNotification *) notification; - (void) torrentRestartedDownloading: (NSNotification *) notification; +- (void) torrentStoppedForRatio: (NSNotification *) notification; - (void) updateTorrentHistory; @@ -227,8 +228,6 @@ typedef enum - (void) setRatioGlobalEnabled: (id) sender; - (void) setQuickRatioGlobal: (id) sender; -- (void) torrentStoppedForRatio: (NSNotification *) notification; - - (void) changeAutoImport; - (void) checkAutoImportDirectory; diff --git a/macosx/Controller.m b/macosx/Controller.m index 90706ab5b..64fe51741 100644 --- a/macosx/Controller.m +++ b/macosx/Controller.m @@ -1593,32 +1593,33 @@ void sleepCallBack(void * controller, io_service_t y, natural_t messageType, voi return desired; } +#warning migrate to Torrent.m - (void) torrentFinishedDownloading: (NSNotification *) notification { Torrent * torrent = [notification object]; - if (!fSoundPlaying && [fDefaults boolForKey: @"PlayDownloadSound"]) - { - 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]) { + if (!fSoundPlaying && [fDefaults boolForKey: @"PlayDownloadSound"]) + { + 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 ([fDefaults boolForKey: @"QueueSeed"] && [self numToStartFromQueue: NO] <= 0) { [torrent stopTransfer]; @@ -1644,6 +1645,32 @@ void sleepCallBack(void * controller, io_service_t y, natural_t messageType, voi [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]]; @@ -2341,32 +2368,6 @@ void sleepCallBack(void * controller, io_service_t y, natural_t messageType, voi [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;