-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathDownloadItem.h
76 lines (58 loc) · 1.54 KB
/
DownloadItem.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
/* DownloadItem */
#import <Cocoa/Cocoa.h>
#define DOWNLOADING NSLocalizedString(@"Downloading",@"")
#define CONNECTING NSLocalizedString(@"Connecting",@"")
#define FINISHED NSLocalizedString(@"Finished",@"")
#define WAITING NSLocalizedString(@"waiting",@"")
#define CANCELED NSLocalizedString(@"Canceled",@"")
#define DEBUG
#ifdef DEBUG
#define NSLOG NSLog
#else
#define NSLOG(fmt, ...) //(fmt)
#endif
@interface DownloadItem : NSObject
{
NSMutableString *status;
NSMutableString *percent;
NSMutableString *speed;
NSString *downloadedFilePath;
NSImage *icon;
NSString *url;
NSString *httpUser;
NSString *httpPassword;
NSString *referer;
id resume;
id checkTimeStamp;
id recursive;
id recursiveType;
id recursiveLevel;
//task
NSTask *wgetTask;
NSPipe *wgetPipe;
NSMutableString *lastLogLine;
NSMutableString *logString;
id delegate;
}
/// return true if this item is downloading
-(BOOL)isDownloading;
/// return filename of item
-(NSString*)fileName;
/// icon file of this file. icon is specified by file extension
-(NSImage*)icon;
/// return all log
-(NSString*)logString;
/// return last line of log
-(NSString*)lastLogLine;
/// start downloadging
-(void)startDownload;
/// stop downloading
-(void)stopDownload;
/// if downloadin stop downloading, otherwise start downloading
-(void)startStop;
-(void)setDelegate:(id)aDelegate;
@end
@interface NSObject(DownloadItemDelegate)
-(void)logUpdated:(DownloadItem*)item;
-(void)downloadFinished:(DownloadItem*)item;
@end