Transmission: update to 2.61
[tomato.git] / release / src / router / transmission / macosx / Torrent.h
blob201c8016d55e8eb9394de0e12111afb1d5d24d73
1 /******************************************************************************
2 * $Id: Torrent.h 13379 2012-07-07 02:14:08Z livings124 $
4 * Copyright (c) 2006-2012 Transmission authors and contributors
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:
13 * The above copyright notice and this permission notice shall be included in
14 * all copies or substantial portions of the Software.
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 *****************************************************************************/
25 #import <Cocoa/Cocoa.h>
26 #import <transmission.h>
27 #import <Quartz/Quartz.h>
29 @class FileListNode;
31 @interface Torrent : NSObject <NSCopying, QLPreviewItem>
33 tr_torrent * fHandle;
34 const tr_info * fInfo;
35 const tr_stat * fStat;
37 NSUserDefaults * fDefaults;
39 NSImage * fIcon;
41 NSString * fHashString;
43 tr_file_stat * fFileStat;
44 NSArray * fFileList, * fFlatFileList;
46 NSIndexSet * fPreviousFinishedIndexes;
47 NSDate * fPreviousFinishedIndexesDate;
49 BOOL fRemoveWhenFinishSeeding;
51 NSInteger fGroupValue;
53 BOOL fResumeOnWake;
55 NSString * fTimeMachineExclude;
58 - (id) initWithPath: (NSString *) path location: (NSString *) location deleteTorrentFile: (BOOL) torrentDelete
59 lib: (tr_session *) lib;
60 - (id) initWithTorrentStruct: (tr_torrent *) torrentStruct location: (NSString *) location lib: (tr_session *) lib;
61 - (id) initWithMagnetAddress: (NSString *) address location: (NSString *) location lib: (tr_session *) lib;
62 - (id) initWithHistory: (NSDictionary *) history lib: (tr_session *) lib forcePause: (BOOL) pause;
64 - (NSDictionary *) history;
66 - (void) closeRemoveTorrent: (BOOL) trashFiles;
68 - (void) changeDownloadFolderBeforeUsing: (NSString *) folder;
70 - (NSString *) currentDirectory;
72 - (void) getAvailability: (int8_t *) tab size: (NSInteger) size;
73 - (void) getAmountFinished: (float *) tab size: (NSInteger) size;
74 - (NSIndexSet *) previousFinishedPieces;
75 - (void) setPreviousFinishedPieces: (NSIndexSet *) indexes;
77 - (void) update;
79 - (void) startTransferIgnoringQueue: (BOOL) ignoreQueue;
80 - (void) startTransferNoQueue;
81 - (void) startTransfer;
82 - (void) stopTransfer;
83 - (void) sleep;
84 - (void) wakeUp;
86 - (NSInteger) queuePosition;
87 - (void) setQueuePosition: (NSUInteger) index;
89 - (void) manualAnnounce;
90 - (BOOL) canManualAnnounce;
92 - (void) resetCache;
94 - (BOOL) isMagnet;
95 - (NSString *) magnetLink;
97 - (CGFloat) ratio;
98 - (tr_ratiolimit) ratioSetting;
99 - (void) setRatioSetting: (tr_ratiolimit) setting;
100 - (CGFloat) ratioLimit;
101 - (void) setRatioLimit: (CGFloat) limit;
102 - (CGFloat) progressStopRatio;
104 - (tr_idlelimit) idleSetting;
105 - (void) setIdleSetting: (tr_idlelimit) setting;
106 - (NSUInteger) idleLimitMinutes;
107 - (void) setIdleLimitMinutes: (NSUInteger) limit;
109 - (BOOL) usesSpeedLimit: (BOOL) upload;
110 - (void) setUseSpeedLimit: (BOOL) use upload: (BOOL) upload;
111 - (NSInteger) speedLimit: (BOOL) upload;
112 - (void) setSpeedLimit: (NSInteger) limit upload: (BOOL) upload;
113 - (BOOL) usesGlobalSpeedLimit;
114 - (void) setUseGlobalSpeedLimit: (BOOL) use;
116 - (void) setMaxPeerConnect: (uint16_t) count;
117 - (uint16_t) maxPeerConnect;
119 @property (nonatomic) BOOL removeWhenFinishSeeding;
121 - (BOOL) waitingToStart;
123 - (tr_priority_t) priority;
124 - (void) setPriority: (tr_priority_t) priority;
126 + (void) trashFile: (NSString *) path;
127 - (void) moveTorrentDataFileTo: (NSString *) folder;
128 - (void) copyTorrentFileTo: (NSString *) path;
130 - (BOOL) alertForRemainingDiskSpace;
132 - (NSImage *) icon;
134 - (NSString *) name;
135 - (BOOL) isFolder;
136 - (uint64_t) size;
137 - (uint64_t) sizeLeft;
139 - (NSMutableArray *) allTrackerStats;
140 - (NSArray *) allTrackersFlat; //used by GroupRules
141 - (BOOL) addTrackerToNewTier: (NSString *) tracker;
142 - (void) removeTrackers: (NSSet *) trackers;
144 - (NSString *) comment;
145 - (NSString *) creator;
146 - (NSDate *) dateCreated;
148 - (NSInteger) pieceSize;
149 - (NSInteger) pieceCount;
150 - (NSString *) hashString;
151 - (BOOL) privateTorrent;
153 - (NSString *) torrentLocation;
154 - (NSString *) dataLocation;
155 - (NSString *) fileLocation: (FileListNode *) node;
157 - (CGFloat) progress;
158 - (CGFloat) progressDone;
159 - (CGFloat) progressLeft;
160 - (CGFloat) checkingProgress;
162 - (CGFloat) availableDesired;
164 - (BOOL) isActive;
165 - (BOOL) isSeeding;
166 - (BOOL) isChecking;
167 - (BOOL) isCheckingWaiting;
168 - (BOOL) allDownloaded;
169 - (BOOL) isComplete;
170 - (BOOL) isFinishedSeeding;
171 - (BOOL) isError;
172 - (BOOL) isAnyErrorOrWarning;
173 - (NSString *) errorMessage;
175 - (NSArray *) peers;
177 - (NSUInteger) webSeedCount;
178 - (NSArray *) webSeeds;
180 - (NSString *) progressString;
181 - (NSString *) statusString;
182 - (NSString *) shortStatusString;
183 - (NSString *) remainingTimeString;
185 - (NSString *) stateString;
186 - (NSInteger) totalPeersConnected;
187 - (NSInteger) totalPeersTracker;
188 - (NSInteger) totalPeersIncoming;
189 - (NSInteger) totalPeersCache;
190 - (NSInteger) totalPeersPex;
191 - (NSInteger) totalPeersDHT;
192 - (NSInteger) totalPeersLocal;
193 - (NSInteger) totalPeersLTEP;
195 - (NSInteger) peersSendingToUs;
196 - (NSInteger) peersGettingFromUs;
198 - (CGFloat) downloadRate;
199 - (CGFloat) uploadRate;
200 - (CGFloat) totalRate;
201 - (uint64_t) haveVerified;
202 - (uint64_t) haveTotal;
203 - (uint64_t) totalSizeSelected;
204 - (uint64_t) downloadedTotal;
205 - (uint64_t) uploadedTotal;
206 - (uint64_t) failedHash;
208 - (NSInteger) groupValue;
209 - (void) setGroupValue: (NSInteger) groupValue;
210 - (NSInteger) groupOrderValue;
211 - (void) checkGroupValueForRemoval: (NSNotification *) notification;
213 - (NSArray *) fileList;
214 - (NSArray *) flatFileList;
215 - (NSInteger) fileCount;
216 - (void) updateFileStat;
218 //methods require fileStats to have been updated recently to be accurate
219 - (CGFloat) fileProgress: (FileListNode *) node;
220 - (BOOL) canChangeDownloadCheckForFile: (NSUInteger) index;
221 - (BOOL) canChangeDownloadCheckForFiles: (NSIndexSet *) indexSet;
222 - (NSInteger) checkForFiles: (NSIndexSet *) indexSet;
223 - (void) setFileCheckState: (NSInteger) state forIndexes: (NSIndexSet *) indexSet;
224 - (void) setFilePriority: (tr_priority_t) priority forIndexes: (NSIndexSet *) indexSet;
225 - (BOOL) hasFilePriority: (tr_priority_t) priority forIndexes: (NSIndexSet *) indexSet;
226 - (NSSet *) filePrioritiesForIndexes: (NSIndexSet *) indexSet;
228 - (NSDate *) dateAdded;
229 - (NSDate *) dateCompleted;
230 - (NSDate *) dateActivity;
231 - (NSDate *) dateActivityOrAdd;
233 - (NSInteger) secondsDownloading;
234 - (NSInteger) secondsSeeding;
236 - (NSInteger) stalledMinutes;
237 - (BOOL) isStalled;
239 - (void) updateTimeMachineExclude;
241 - (NSInteger) stateSortKey;
242 - (NSString *) trackerSortKey;
244 - (tr_torrent *) torrentStruct;
246 @end