source: trunk/macosx/Torrent.h @ 6325

Last change on this file since 6325 was 6325, checked in by livings124, 14 years ago

#1042: show "in progress" in the inspector when announcing/scraping

  • Property svn:keywords set to Date Rev Author Id
File size: 7.1 KB
Line 
1/******************************************************************************
2 * $Id: Torrent.h 6325 2008-07-11 21:48:43Z livings124 $
3 *
4 * Copyright (c) 2006-2008 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 INVALID -99
29
30typedef enum
31{
32    TORRENT_FILE_DELETE,
33    TORRENT_FILE_SAVE,
34    TORRENT_FILE_DEFAULT
35} torrentFileState;
36
37#define STAT_TIME_NONE -1
38#define STAT_TIME_NOW -2
39
40@interface Torrent : NSObject
41{
42    tr_torrent * fHandle;
43    const tr_info * fInfo;
44    const tr_stat * fStat;
45   
46    BOOL fResumeOnWake;
47   
48    BOOL fUseIncompleteFolder;
49    NSString * fDownloadFolder, * fIncompleteFolder;
50   
51    BOOL fPublicTorrent;
52    NSString * fPublicTorrentLocation;
53       
54    NSUserDefaults * fDefaults;
55
56    NSImage * fIcon;
57   
58    NSString * fNameString, * fHashString;
59   
60    tr_file_stat * fFileStat;
61    NSArray * fFileList;
62   
63    NSIndexSet * fPreviousFinishedIndexes;
64    NSDate * fPreviousFinishedIndexesDate;
65   
66    float fRatioLimit;
67    int fRatioSetting;
68    BOOL fFinishedSeeding, fWaitToStart, fStalled;
69   
70    int fOrderValue, fGroupValue;
71   
72    BOOL fAddedTrackers;
73   
74    NSDictionary * fQuickPauseDict;
75}
76
77- (id) initWithPath: (NSString *) path location: (NSString *) location deleteTorrentFile: (torrentFileState) torrentDelete
78        lib: (tr_handle *) lib;
79- (id) initWithTorrentStruct: (tr_torrent *) torrentStruct location: (NSString *) location lib: (tr_handle *) lib;
80- (id) initWithHistory: (NSDictionary *) history lib: (tr_handle *) lib;
81
82- (NSDictionary *) history;
83
84- (void) closeRemoveTorrentInterface;
85- (void) closeRemoveTorrent;
86
87- (void) changeIncompleteDownloadFolder: (NSString *) folder;
88- (void) changeDownloadFolder: (NSString *) folder;
89- (NSString *) downloadFolder;
90
91- (void) getAvailability: (int8_t *) tab size: (int) size;
92- (void) getAmountFinished: (float *) tab size: (int) size;
93- (NSIndexSet *) previousFinishedPieces;
94-(void) setPreviousFinishedPieces: (NSIndexSet *) indexes;
95
96- (void) update;
97
98- (void) startTransfer;
99- (void) stopTransfer;
100- (void) sleep;
101- (void) wakeUp;
102
103- (void) manualAnnounce;
104- (BOOL) canManualAnnounce;
105
106- (void) resetCache;
107
108- (float) ratio;
109- (int) ratioSetting;
110- (void) setRatioSetting: (int) setting;
111- (float) ratioLimit;
112- (void) setRatioLimit: (float) limit;
113- (float) actualStopRatio; //returns INVALID if will not stop
114- (float) progressStopRatio;
115
116- (tr_speedlimit) speedMode: (BOOL) upload;
117- (void) setSpeedMode: (tr_speedlimit) mode upload: (BOOL) upload;
118- (int) speedLimit: (BOOL) upload;
119- (void) setSpeedLimit: (int) limit upload: (BOOL) upload;
120
121- (void) setMaxPeerConnect: (uint16_t) count;
122- (uint16_t) maxPeerConnect;
123
124- (void) setWaitToStart: (BOOL) wait;
125- (BOOL) waitingToStart;
126
127- (void) revealData;
128- (void) revealPublicTorrent;
129- (void) trashData;
130- (void) trashTorrent;
131- (void) moveTorrentDataFileTo: (NSString *) folder;
132- (void) copyTorrentFileTo: (NSString *) path;
133
134- (BOOL) alertForRemainingDiskSpace;
135- (BOOL) alertForFolderAvailable;
136- (BOOL) alertForMoveFolderAvailable;
137
138- (NSImage *) icon;
139
140- (NSString *) name;
141- (BOOL) isFolder;
142- (uint64_t) size;
143- (uint64_t) sizeLeft;
144
145- (NSString *) trackerAddressAnnounce;
146- (NSDate *) lastAnnounceTime;
147- (int) nextAnnounceTime;
148- (NSString *) announceResponse;
149
150- (NSString *) trackerAddressScrape;
151- (NSDate *) lastScrapeTime;
152- (int) nextScrapeTime;
153- (NSString *) scrapeResponse;
154
155- (NSMutableArray *) allTrackers: (BOOL) separators;
156- (BOOL) updateAllTrackersForAdd: (NSMutableArray *) trackers;
157- (void) updateAllTrackersForRemove: (NSMutableArray *) trackers;
158- (BOOL) hasAddedTrackers;
159
160- (NSString *) comment;
161- (NSString *) creator;
162- (NSDate *) dateCreated;
163
164- (int) pieceSize;
165- (int) pieceCount;
166- (NSString *) hashString;
167- (BOOL) privateTorrent;
168
169- (NSString *) torrentLocation;
170- (NSString *) publicTorrentLocation;
171- (NSString *) dataLocation;
172
173- (BOOL) publicTorrent;
174
175- (float) progress;
176- (float) progressDone;
177- (float) progressLeft;
178- (float) checkingProgress;
179
180- (int) eta;
181- (int) etaRatio;
182
183- (float) notAvailableDesired;
184
185- (BOOL) isActive;
186- (BOOL) isSeeding;
187- (BOOL) isChecking;
188- (BOOL) isCheckingWaiting;
189- (BOOL) allDownloaded;
190- (BOOL) isComplete;
191- (BOOL) isError;
192- (NSString *) errorMessage;
193
194- (NSArray *) peers;
195
196- (NSUInteger) webSeedCount;
197- (NSArray *) webSeeds;
198
199- (NSString *) progressString;
200- (NSString *) statusString;
201- (NSString *) shortStatusString;
202- (NSString *) remainingTimeString;
203
204- (NSString *) stateString;
205
206- (int) seeders;
207- (int) leechers;
208- (int) completedFromTracker;
209
210- (int) totalPeersConnected;
211- (int) totalPeersTracker;
212- (int) totalPeersIncoming;
213- (int) totalPeersCache;
214- (int) totalPeersPex;
215- (int) totalPeersKnown;
216
217- (int) peersSendingToUs;
218- (int) peersGettingFromUs;
219
220- (float) downloadRate;
221- (float) uploadRate;
222- (float) totalRate;
223- (uint64_t) haveVerified;
224- (uint64_t) haveTotal;
225- (uint64_t) totalSizeSelected;
226- (uint64_t) downloadedTotal;
227- (uint64_t) uploadedTotal;
228- (uint64_t) failedHash;
229- (float) swarmSpeed;
230
231- (int) orderValue;
232- (void) setOrderValue: (int) orderValue;
233
234- (int) groupValue;
235- (void) setGroupValue: (int) groupValue;
236- (int) groupOrderValue;
237- (void) checkGroupValueForRemoval: (NSNotification *) notification;
238
239- (NSArray *) fileList;
240- (int) fileCount;
241- (void) updateFileStat;
242
243//methods require fileStats to have been updated recently to be accurate
244- (float) fileProgress: (int) index;
245- (BOOL) canChangeDownloadCheckForFile: (int) index;
246- (BOOL) canChangeDownloadCheckForFiles: (NSIndexSet *) indexSet;
247- (int) checkForFiles: (NSIndexSet *) indexSet;
248- (void) setFileCheckState: (int) state forIndexes: (NSIndexSet *) indexSet;
249- (void) setFilePriority: (int) priority forIndexes: (NSIndexSet *) indexSet;
250- (BOOL) hasFilePriority: (int) priority forIndexes: (NSIndexSet *) indexSet;
251- (NSSet *) filePrioritiesForIndexes: (NSIndexSet *) indexSet;
252
253- (NSDate *) dateAdded;
254- (NSDate *) dateCompleted;
255- (NSDate *) dateActivity;
256- (NSDate *) dateActivityOrAdd;
257
258- (int) stalledMinutes;
259- (BOOL) isStalled;
260
261- (NSInteger) stateSortKey;
262
263- (tr_torrent *) torrentStruct;
264
265@end
Note: See TracBrowser for help on using the repository browser.