if a download finishes downloading and finishes seeding at the same time, do all the "finished download" activities (dock badging, growl notification, sound); if one sound is playing for finished downloading/seeding, don't play another one
This commit is contained in:
parent
6ca3f6516b
commit
afb5738b98
|
@ -115,6 +115,8 @@ typedef enum
|
|||
NSMutableDictionary * fPendingTorrentDownloads;
|
||||
NSMutableArray * fTempTorrentFiles;
|
||||
|
||||
BOOL fSoundPlaying;
|
||||
|
||||
BOOL fRemoteQuit;
|
||||
}
|
||||
|
||||
|
|
|
@ -221,6 +221,8 @@ void sleepCallBack(void * controller, io_service_t y, natural_t messageType, voi
|
|||
|
||||
fBadger = [[Badger alloc] initWithLib: fLib];
|
||||
|
||||
fSoundPlaying = NO;
|
||||
|
||||
fIPCController = [[IPCController alloc] init];
|
||||
[fIPCController setDelegate: self];
|
||||
[fIPCController setPrefsController: fPrefsController];
|
||||
|
@ -1593,14 +1595,17 @@ void sleepCallBack(void * controller, io_service_t y, natural_t messageType, voi
|
|||
- (void) torrentFinishedDownloading: (NSNotification *) notification
|
||||
{
|
||||
Torrent * torrent = [notification object];
|
||||
if ([torrent isActive])
|
||||
{
|
||||
if ([fDefaults boolForKey: @"PlayDownloadSound"])
|
||||
|
||||
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];
|
||||
|
@ -1611,6 +1616,8 @@ void sleepCallBack(void * controller, io_service_t y, natural_t messageType, voi
|
|||
if (![fWindow isMainWindow])
|
||||
[fBadger incrementCompleted];
|
||||
|
||||
if ([torrent isActive])
|
||||
{
|
||||
if ([fDefaults boolForKey: @"QueueSeed"] && [self numToStartFromQueue: NO] <= 0)
|
||||
{
|
||||
[torrent stopTransfer];
|
||||
|
@ -2341,12 +2348,16 @@ void sleepCallBack(void * controller, io_service_t y, natural_t messageType, voi
|
|||
[fInfoController updateInfoStats];
|
||||
[fInfoController updateOptions];
|
||||
|
||||
if ([fDefaults boolForKey: @"PlaySeedingSound"])
|
||||
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];
|
||||
|
@ -2355,6 +2366,11 @@ void sleepCallBack(void * controller, io_service_t y, natural_t messageType, voi
|
|||
iconData: nil priority: 0 isSticky: NO clickContext: clickContext];
|
||||
}
|
||||
|
||||
- (void) sound: (NSSound *) sound didFinishPlaying: (BOOL) finishedPlaying
|
||||
{
|
||||
fSoundPlaying = NO;
|
||||
}
|
||||
|
||||
-(void) watcher: (id<UKFileWatcher>) watcher receivedNotification: (NSString *) notification forPath: (NSString *) path
|
||||
{
|
||||
if ([notification isEqualToString: UKFileWatcherWriteNotification])
|
||||
|
|
Loading…
Reference in New Issue