Added an option to only show the remove/quit warning if transfers are downloading (not seeding). Also change the word "torrent" to "transfer" in the prefs window.

This commit is contained in:
Mitchell Livingston
2006-06-26 05:52:51 +00:00
parent 5046cc4752
commit 72eecfa7d4
7 changed files with 54 additions and 17 deletions

View File

@@ -258,14 +258,19 @@ static void sleepCallBack(void * controller, io_service_t y,
{
if (!fUpdateInProgress && [fDefaults boolForKey: @"CheckQuit"])
{
int active = 0;
int active = 0, downloading = 0;
Torrent * torrent;
NSEnumerator * enumerator = [fTorrents objectEnumerator];
while ((torrent = [enumerator nextObject]))
if ([torrent isActive])
{
active++;
if (![torrent isSeeding])
downloading++;
}
if (active > 0)
BOOL shouldAsk = [fDefaults boolForKey: @"CheckRemoveDownloading"] ? downloading > 0 : active > 0;
if (shouldAsk)
{
NSString * message = active == 1
? @"There is an active transfer. Do you really want to quit?"
@@ -516,15 +521,23 @@ static void sleepCallBack(void * controller, io_service_t y,
deleteData: (BOOL) deleteData deleteTorrent: (BOOL) deleteTorrent
{
NSArray * torrents = [[self torrentsAtIndexes: indexSet] retain];
int active = 0;
int active = 0, downloading = 0;
Torrent * torrent;
NSEnumerator * enumerator = [torrents objectEnumerator];
while ((torrent = [enumerator nextObject]))
if ([torrent isActive])
active++;
if ([fDefaults boolForKey: @"CheckRemove"])
{
Torrent * torrent;
NSEnumerator * enumerator = [torrents objectEnumerator];
while ((torrent = [enumerator nextObject]))
if ([torrent isActive])
{
active++;
if (![torrent isSeeding])
downloading++;
}
}
if (active > 0 && [fDefaults boolForKey: @"CheckRemove"])
BOOL shouldAsk = [fDefaults boolForKey: @"CheckRemoveDownloading"] ? downloading > 0 : active > 0;
if (shouldAsk)
{
NSDictionary * dict = [[NSDictionary alloc] initWithObjectsAndKeys:
torrents, @"Torrents",