mirror of
https://github.com/transmission/transmission
synced 2025-02-20 13:16:53 +00:00
simplify the download finished/restarting code
This commit is contained in:
parent
6c093a322a
commit
42e150a786
3 changed files with 38 additions and 44 deletions
|
@ -1507,10 +1507,9 @@
|
|||
i386,
|
||||
);
|
||||
CONFIGURATION_BUILD_DIR = "$(SRCROOT)/build/Debug";
|
||||
LIBRARY_SEARCH_PATHS = "\"$(SRCROOT)/build/Debug\"";
|
||||
OTHER_CFLAGS = (
|
||||
);
|
||||
HEADER_SEARCH_PATHS = "\"$(SRCROOT)\"";
|
||||
LIBRARY_SEARCH_PATHS = "\"$(SRCROOT)/build/Debug\"";
|
||||
OTHER_CFLAGS = "";
|
||||
PRODUCT_NAME = transmissioncli;
|
||||
};
|
||||
name = Debug;
|
||||
|
@ -1585,6 +1584,7 @@
|
|||
GCC_GENERATE_DEBUGGING_SYMBOLS = YES;
|
||||
GCC_MODEL_TUNING = G5;
|
||||
GCC_OPTIMIZATION_LEVEL = 3;
|
||||
HEADER_SEARCH_PATHS = "\"$(SRCROOT)\"";
|
||||
INSTALL_PATH = "$(HOME)/bin";
|
||||
LIBRARY_SEARCH_PATHS = (
|
||||
"$(LIBRARY_SEARCH_PATHS_QUOTED_1)",
|
||||
|
@ -1592,9 +1592,7 @@
|
|||
);
|
||||
LIBRARY_SEARCH_PATHS_QUOTED_1 = "\"$(SRCROOT)/build/Debug\"";
|
||||
LIBRARY_SEARCH_PATHS_QUOTED_2 = "\"$(SRCROOT)/libevent\"";
|
||||
OTHER_CFLAGS = (
|
||||
);
|
||||
HEADER_SEARCH_PATHS = "\"$(SRCROOT)\"";
|
||||
OTHER_CFLAGS = "";
|
||||
PREBINDING = NO;
|
||||
PRODUCT_NAME = "transmission-daemon";
|
||||
ZERO_LINK = NO;
|
||||
|
@ -1615,6 +1613,7 @@
|
|||
GCC_GENERATE_DEBUGGING_SYMBOLS = YES;
|
||||
GCC_MODEL_TUNING = G5;
|
||||
GCC_OPTIMIZATION_LEVEL = 3;
|
||||
HEADER_SEARCH_PATHS = "\"$(SRCROOT)\"";
|
||||
INSTALL_PATH = "$(HOME)/bin";
|
||||
LIBRARY_SEARCH_PATHS = (
|
||||
"$(LIBRARY_SEARCH_PATHS_QUOTED_3)",
|
||||
|
@ -1624,9 +1623,7 @@
|
|||
LIBRARY_SEARCH_PATHS_QUOTED_2 = "\"$(SRCROOT)\"";
|
||||
LIBRARY_SEARCH_PATHS_QUOTED_3 = "\"$(SRCROOT)/build/Debug\"";
|
||||
LIBRARY_SEARCH_PATHS_QUOTED_4 = "\"$(SRCROOT)/libevent\"";
|
||||
OTHER_CFLAGS = (
|
||||
);
|
||||
HEADER_SEARCH_PATHS = "\"$(SRCROOT)\"";
|
||||
OTHER_CFLAGS = "";
|
||||
PREBINDING = NO;
|
||||
PRODUCT_NAME = "transmission-remote";
|
||||
ZERO_LINK = NO;
|
||||
|
@ -1647,6 +1644,7 @@
|
|||
GCC_GENERATE_DEBUGGING_SYMBOLS = YES;
|
||||
GCC_MODEL_TUNING = G5;
|
||||
GCC_OPTIMIZATION_LEVEL = 3;
|
||||
HEADER_SEARCH_PATHS = "\"$(SRCROOT)\"";
|
||||
INSTALL_PATH = "$(HOME)/bin";
|
||||
LIBRARY_SEARCH_PATHS = (
|
||||
"$(LIBRARY_SEARCH_PATHS_QUOTED_4)",
|
||||
|
@ -1657,9 +1655,7 @@
|
|||
LIBRARY_SEARCH_PATHS_QUOTED_3 = "\"$(SRCROOT)\"";
|
||||
LIBRARY_SEARCH_PATHS_QUOTED_4 = "\"$(SRCROOT)/build/Debug\"";
|
||||
LIBRARY_SEARCH_PATHS_QUOTED_5 = "\"$(SRCROOT)/libevent\"";
|
||||
OTHER_CFLAGS = (
|
||||
);
|
||||
HEADER_SEARCH_PATHS = "\"$(SRCROOT)\"";
|
||||
OTHER_CFLAGS = "";
|
||||
PREBINDING = NO;
|
||||
PRODUCT_NAME = "transmission-proxy";
|
||||
ZERO_LINK = NO;
|
||||
|
|
|
@ -1493,29 +1493,29 @@ static void sleepCallBack(void * controller, io_service_t y, natural_t messageTy
|
|||
- (void) torrentFinishedDownloading: (NSNotification *) notification
|
||||
{
|
||||
Torrent * torrent = [notification object];
|
||||
|
||||
[fInfoController updateInfoStats];
|
||||
|
||||
if ([fDefaults boolForKey: @"PlayDownloadSound"])
|
||||
if ([torrent isActive])
|
||||
{
|
||||
NSSound * sound;
|
||||
if ((sound = [NSSound soundNamed: [fDefaults stringForKey: @"DownloadSound"]]))
|
||||
[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 isKeyWindow])
|
||||
[fBadger incrementCompleted];
|
||||
|
||||
if ([fDefaults boolForKey: @"QueueSeed"] && [self numToStartFromQueue: NO] <= 0)
|
||||
{
|
||||
[torrent stopTransfer];
|
||||
[torrent setWaitToStart: YES];
|
||||
if ([fDefaults boolForKey: @"PlayDownloadSound"])
|
||||
{
|
||||
NSSound * sound;
|
||||
if ((sound = [NSSound soundNamed: [fDefaults stringForKey: @"DownloadSound"]]))
|
||||
[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 isKeyWindow])
|
||||
[fBadger incrementCompleted];
|
||||
|
||||
if ([fDefaults boolForKey: @"QueueSeed"] && [self numToStartFromQueue: NO] <= 0)
|
||||
{
|
||||
[torrent stopTransfer];
|
||||
[torrent setWaitToStart: YES];
|
||||
}
|
||||
}
|
||||
|
||||
[self updateTorrentsInQueue];
|
||||
|
@ -1524,13 +1524,13 @@ static void sleepCallBack(void * controller, io_service_t y, natural_t messageTy
|
|||
- (void) torrentRestartedDownloading: (NSNotification *) notification
|
||||
{
|
||||
Torrent * torrent = [notification object];
|
||||
|
||||
[fInfoController updateInfoStats];
|
||||
|
||||
if ([fDefaults boolForKey: @"Queue"] && [self numToStartFromQueue: YES] <= 0)
|
||||
if ([torrent isActive])
|
||||
{
|
||||
[torrent stopTransfer];
|
||||
[torrent setWaitToStart: YES];
|
||||
if ([fDefaults boolForKey: @"Queue"] && [self numToStartFromQueue: YES] <= 0)
|
||||
{
|
||||
[torrent stopTransfer];
|
||||
[torrent setWaitToStart: YES];
|
||||
}
|
||||
}
|
||||
|
||||
[self updateTorrentsInQueue];
|
||||
|
|
|
@ -812,8 +812,8 @@ static uint32_t kRed = BE(0xFF6450FF), //255, 100, 80
|
|||
|
||||
uint64_t existingSize = 0;
|
||||
NSDirectoryEnumerator * enumerator;
|
||||
if (enumerator = [[NSFileManager defaultManager] enumeratorAtPath:
|
||||
[[self downloadFolder] stringByAppendingPathComponent: [self name]]])
|
||||
if ((enumerator = [[NSFileManager defaultManager] enumeratorAtPath:
|
||||
[[self downloadFolder] stringByAppendingPathComponent: [self name]]]))
|
||||
{
|
||||
NSDictionary * fileAttributes;
|
||||
while ([enumerator nextObject])
|
||||
|
@ -1374,8 +1374,6 @@ static uint32_t kRed = BE(0xFF6450FF), //255, 100, 80
|
|||
free(files);
|
||||
|
||||
[self update];
|
||||
if ([self isPaused])
|
||||
[[NSNotificationCenter defaultCenter] postNotificationName: @"UpdateQueue" object: self]; //for paused torrents
|
||||
}
|
||||
|
||||
- (void) setFilePriority: (int) priority forIndexes: (NSIndexSet *) indexSet
|
||||
|
|
Loading…
Reference in a new issue