1
0
Fork 0
mirror of https://github.com/transmission/transmission synced 2024-12-23 00:04:06 +00:00

make sure the blocklist sheet's initial text matches the current download status (this will matter later on)

This commit is contained in:
Mitchell Livingston 2008-08-31 21:10:45 +00:00
parent 12d148ea45
commit b9ca63e0d4
2 changed files with 28 additions and 0 deletions

View file

@ -26,6 +26,13 @@
@class BlocklistDownloaderViewController;
typedef enum
{
BLOCKLIST_DL_START,
BLOCKLIST_DL_DOWNLOADING,
BLOCKLIST_DL_PROCESSING
} blocklistDownloadState;
@interface BlocklistDownloader : NSObject
{
NSURLDownload * fDownload;
@ -34,6 +41,8 @@
NSUInteger fCurrentSize;
long long fExpectedSize;
blocklistDownloadState fState;
}
+ (BlocklistDownloader *) downloader; //starts download if not already occuring

View file

@ -61,6 +61,19 @@ BlocklistDownloader * fDownloader = nil;
fViewController = viewController;
if (fViewController)
{
switch (fState)
{
case BLOCKLIST_DL_START:
[fViewController setStatusStarting];
break;
case BLOCKLIST_DL_DOWNLOADING:
[fViewController setStatusProgressForCurrentSize: fCurrentSize expectedSize: fExpectedSize];
break;
case BLOCKLIST_DL_PROCESSING:
[fViewController setStatusProcessing];
break;
}
#warning set actual status
[fViewController setStatusStarting];
}
@ -84,6 +97,8 @@ BlocklistDownloader * fDownloader = nil;
- (void) download: (NSURLDownload *) download didReceiveResponse: (NSURLResponse *) response
{
fState = BLOCKLIST_DL_DOWNLOADING;
fCurrentSize = 0;
fExpectedSize = [response expectedContentLength];
@ -106,6 +121,8 @@ BlocklistDownloader * fDownloader = nil;
- (void) downloadDidFinish: (NSURLDownload *) download
{
fState = BLOCKLIST_DL_PROCESSING;
if ([NSApp isOnLeopardOrBetter])
[self performSelectorInBackground: @selector(finishDownloadSuccess) withObject: nil];
else
@ -118,6 +135,8 @@ BlocklistDownloader * fDownloader = nil;
- (void) startDownload
{
fState = BLOCKLIST_DL_START;
NSURLRequest * request = [NSURLRequest requestWithURL: [NSURL URLWithString: LIST_URL]];
fDownload = [[NSURLDownload alloc] initWithRequest: request delegate: self];