1 | /****************************************************************************** |
---|
2 | * $Id: Torrent.h 985 2006-10-05 21:21:30Z livings124 $ |
---|
3 | * |
---|
4 | * Copyright (c) 2006 Transmission authors and contributors |
---|
5 | * |
---|
6 | * Permission is hereby granted, free of charge, to any person obtaining a |
---|
7 | * copy of this software and associated documentation files (the "Software"), |
---|
8 | * to deal in the Software without restriction, including without limitation |
---|
9 | * the rights to use, copy, modify, merge, publish, distribute, sublicense, |
---|
10 | * and/or sell copies of the Software, and to permit persons to whom the |
---|
11 | * Software is furnished to do so, subject to the following conditions: |
---|
12 | * |
---|
13 | * The above copyright notice and this permission notice shall be included in |
---|
14 | * all copies or substantial portions of the Software. |
---|
15 | * |
---|
16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
---|
17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
---|
18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
---|
19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
---|
20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING |
---|
21 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER |
---|
22 | * DEALINGS IN THE SOFTWARE. |
---|
23 | *****************************************************************************/ |
---|
24 | |
---|
25 | #import <Cocoa/Cocoa.h> |
---|
26 | #import <transmission.h> |
---|
27 | |
---|
28 | #define RATIO_CHECK 1 |
---|
29 | #define RATIO_GLOBAL -1 |
---|
30 | #define RATIO_NO_CHECK 0 |
---|
31 | |
---|
32 | @interface Torrent : NSObject |
---|
33 | { |
---|
34 | tr_handle_t * fLib; |
---|
35 | tr_torrent_t * fHandle; |
---|
36 | tr_info_t * fInfo; |
---|
37 | tr_stat_t * fStat; |
---|
38 | |
---|
39 | BOOL fResumeOnWake; |
---|
40 | NSDate * fDate; |
---|
41 | |
---|
42 | BOOL fPrivateTorrent, fPublicTorrent; |
---|
43 | NSString * fPublicTorrentLocation; |
---|
44 | |
---|
45 | NSUserDefaults * fDefaults; |
---|
46 | |
---|
47 | NSImage * fIcon, * fIconFlipped, * fIconSmall; |
---|
48 | NSMutableString * fNameString, * fProgressString, * fStatusString, * fShortStatusString, * fRemainingTimeString; |
---|
49 | |
---|
50 | int fStopRatioSetting; |
---|
51 | float fRatioLimit; |
---|
52 | BOOL fFinishedSeeding, fWaitToStart, fError; |
---|
53 | |
---|
54 | int fOrderValue; |
---|
55 | |
---|
56 | NSBitmapImageRep * fBitmap; |
---|
57 | int8_t * fPieces; |
---|
58 | } |
---|
59 | |
---|
60 | - (id) initWithPath: (NSString *) path lib: (tr_handle_t *) lib; |
---|
61 | - (id) initWithHistory: (NSDictionary *) history lib: (tr_handle_t *) lib; |
---|
62 | |
---|
63 | - (NSDictionary *) history; |
---|
64 | |
---|
65 | - (void) setDownloadFolder: (NSString *) path; |
---|
66 | - (NSString *) downloadFolder; |
---|
67 | - (void) getAvailability: (int8_t *) tab size: (int) size; |
---|
68 | |
---|
69 | - (void) update; |
---|
70 | - (NSDictionary *) infoForCurrentView; |
---|
71 | |
---|
72 | - (void) startTransfer; |
---|
73 | - (void) stopTransfer; |
---|
74 | - (void) stopTransferForQuit; |
---|
75 | - (void) removeForever; |
---|
76 | - (void) sleep; |
---|
77 | - (void) wakeUp; |
---|
78 | |
---|
79 | - (float) ratio; |
---|
80 | - (int) stopRatioSetting; |
---|
81 | - (void) setStopRatioSetting: (int) setting; |
---|
82 | - (float) ratioLimit; |
---|
83 | - (void) setRatioLimit: (float) limit; |
---|
84 | |
---|
85 | - (void) setWaitToStart: (BOOL) wait; |
---|
86 | - (BOOL) waitingToStart; |
---|
87 | |
---|
88 | - (void) revealData; |
---|
89 | - (void) trashData; |
---|
90 | - (void) trashTorrent; |
---|
91 | |
---|
92 | - (BOOL) remainingDiskSpaceForTorrent; |
---|
93 | |
---|
94 | - (NSImage *) icon; |
---|
95 | - (NSImage *) iconFlipped; |
---|
96 | - (NSImage *) iconSmall; |
---|
97 | |
---|
98 | - (NSString *) name; |
---|
99 | - (uint64_t) size; |
---|
100 | - (NSString *) tracker; |
---|
101 | - (NSString *) announce; |
---|
102 | - (int) pieceSize; |
---|
103 | - (int) pieceCount; |
---|
104 | - (NSString *) hashString; |
---|
105 | |
---|
106 | - (NSString *) torrentLocation; |
---|
107 | - (NSString *) publicTorrentLocation; |
---|
108 | - (NSString *) torrentLocationString; |
---|
109 | - (NSString *) dataLocation; |
---|
110 | |
---|
111 | - (BOOL) publicTorrent; |
---|
112 | - (BOOL) privateTorrent; |
---|
113 | |
---|
114 | - (NSString *) stateString; |
---|
115 | |
---|
116 | - (float) progress; |
---|
117 | - (int) eta; |
---|
118 | |
---|
119 | - (BOOL) isActive; |
---|
120 | - (BOOL) isSeeding; |
---|
121 | - (BOOL) isPaused; |
---|
122 | - (BOOL) isError; |
---|
123 | - (BOOL) justFinished; |
---|
124 | |
---|
125 | - (NSArray *) peers; |
---|
126 | |
---|
127 | - (NSString *) progressString; |
---|
128 | - (NSString *) statusString; |
---|
129 | - (NSString *) shortStatusString; |
---|
130 | - (NSString *) remainingTimeString; |
---|
131 | |
---|
132 | - (int) seeders; |
---|
133 | - (int) leechers; |
---|
134 | - (int) totalPeers; |
---|
135 | - (int) peersUploading; |
---|
136 | - (int) peersDownloading; |
---|
137 | |
---|
138 | - (float) downloadRate; |
---|
139 | - (float) uploadRate; |
---|
140 | - (float) downloadedValid; |
---|
141 | - (uint64_t) downloadedTotal; |
---|
142 | - (uint64_t) uploadedTotal; |
---|
143 | - (float) swarmSpeed; |
---|
144 | |
---|
145 | - (NSNumber *) orderValue; |
---|
146 | - (void) setOrderValue: (int) orderValue; |
---|
147 | |
---|
148 | - (NSArray *) fileList; |
---|
149 | |
---|
150 | - (NSDate *) date; |
---|
151 | - (NSNumber *) stateSortKey; |
---|
152 | - (NSNumber *) progressSortKey; |
---|
153 | |
---|
154 | @end |
---|