source: trunk/macosx/Torrent.h @ 5149

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

show amount selected in open window

  • Property svn:keywords set to Date Rev Author Id
File size: 6.9 KB
Line 
1/******************************************************************************
2 * $Id: Torrent.h 5149 2008-02-27 19:34:55Z 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@interface Torrent : NSObject
38{
39    tr_handle * fLib;
40    tr_torrent * fHandle;
41    const tr_info * fInfo;
42    const tr_stat * fStat;
43   
44    int fID;
45   
46    BOOL         fResumeOnWake;
47    NSDate       * fDateAdded, * fDateCompleted, * fDateActivity;
48   
49    BOOL        fUseIncompleteFolder;
50    NSString    * fDownloadFolder, * fIncompleteFolder;
51   
52    BOOL        fPublicTorrent;
53    NSString    * fPublicTorrentLocation;
54       
55    NSUserDefaults * fDefaults;
56
57    NSImage * fIcon;
58   
59    NSString * fNameString, * fHashString;
60   
61    tr_file_stat * fileStat;
62    NSArray * fFileList;
63   
64    NSMenu * fFileMenu;
65   
66    float * fPreviousFinishedPieces;
67    NSDate * fFinishedPiecesDate;
68   
69    float fRatioLimit;
70    int fRatioSetting;
71    BOOL fFinishedSeeding, fWaitToStart, fStalled;
72   
73    int fOrderValue, fGroupValue;
74   
75    NSDictionary * fQuickPauseDict;
76}
77
78- (id) initWithPath: (NSString *) path location: (NSString *) location deleteTorrentFile: (torrentFileState) torrentDelete
79        lib: (tr_handle *) lib;
80- (id) initWithData: (NSData *) data location: (NSString *) location lib: (tr_handle *) lib;
81- (id) initWithHistory: (NSDictionary *) history lib: (tr_handle *) lib;
82
83- (NSDictionary *) history;
84
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- (float *) getPreviousAmountFinished;
94-(void) setPreviousAmountFinished: (float *) tab;
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) folder;
142- (uint64_t) size;
143- (uint64_t) sizeLeft;
144
145- (NSString *) trackerAddress;
146- (NSString *) trackerAddressAnnounce;
147- (NSDate *) lastAnnounceTime;
148- (int) nextAnnounceTime;
149- (NSString *) announceResponse;
150
151- (NSString *) trackerAddressScrape;
152- (NSDate *) lastScrapeTime;
153- (int) nextScrapeTime;
154- (NSString *) scrapeResponse;
155
156- (NSArray *) allTrackers;
157
158- (NSString *) comment;
159- (NSString *) creator;
160- (NSDate *) dateCreated;
161
162- (int) pieceSize;
163- (int) pieceCount;
164- (NSString *) hashString;
165- (BOOL) privateTorrent;
166
167- (NSString *) torrentLocation;
168- (NSString *) publicTorrentLocation;
169- (NSString *) dataLocation;
170
171- (BOOL) publicTorrent;
172
173- (float) progress;
174- (float) progressDone;
175- (float) progressLeft;
176- (float) checkingProgress;
177
178- (int) eta;
179- (int) etaRatio;
180
181- (float) notAvailableDesired;
182
183- (BOOL) isActive;
184- (BOOL) isSeeding;
185- (BOOL) isChecking;
186- (BOOL) allDownloaded;
187- (BOOL) isComplete;
188- (BOOL) isError;
189- (NSString *) errorMessage;
190
191- (NSArray *) peers;
192
193- (NSString *) progressString;
194- (NSString *) statusString;
195- (NSString *) shortStatusString;
196- (NSString *) remainingTimeString;
197
198- (NSString *) stateString;
199
200- (int) seeders;
201- (int) leechers;
202- (int) completedFromTracker;
203
204- (int) totalPeersConnected;
205- (int) totalPeersTracker;
206- (int) totalPeersIncoming;
207- (int) totalPeersCache;
208- (int) totalPeersPex;
209- (int) totalPeersKnown;
210
211- (int) peersSendingToUs;
212- (int) peersGettingFromUs;
213
214- (float) downloadRate;
215- (float) uploadRate;
216- (float) totalRate;
217- (uint64_t) haveVerified;
218- (uint64_t) haveTotal;
219- (uint64_t) totalSizeSelected;
220- (uint64_t) downloadedTotal;
221- (uint64_t) uploadedTotal;
222- (uint64_t) failedHash;
223- (float) swarmSpeed;
224
225- (int) orderValue;
226- (void) setOrderValue: (int) orderValue;
227
228- (int) groupValue;
229- (void) setGroupValue: (int) groupValue;
230- (int) groupOrderValue;
231- (void) checkGroupValueForRemoval: (NSNotification *) notification;
232
233- (NSArray *) fileList;
234- (int) fileCount;
235- (void) updateFileStat;
236
237//methods require fileStats to have been updated recently to be accurate
238- (float) fileProgress: (int) index;
239- (BOOL) canChangeDownloadCheckForFile: (int) index;
240- (BOOL) canChangeDownloadCheckForFiles: (NSIndexSet *) indexSet;
241- (int) checkForFiles: (NSIndexSet *) indexSet;
242- (void) setFileCheckState: (int) state forIndexes: (NSIndexSet *) indexSet;
243- (void) setFilePriority: (int) priority forIndexes: (NSIndexSet *) indexSet;
244- (BOOL) hasFilePriority: (int) priority forIndexes: (NSIndexSet *) indexSet;
245- (NSSet *) filePrioritiesForIndexes: (NSIndexSet *) indexSet;
246
247- (NSMenu *) fileMenu;
248
249- (NSDate *) dateAdded;
250- (NSDate *) dateCompleted;
251- (NSDate *) dateActivity;
252- (NSDate *) dateActivityOrAdd;
253
254- (int) stalledMinutes;
255- (BOOL) isStalled;
256
257- (NSNumber *) stateSortKey;
258
259- (int) torrentID;
260- (const tr_info *) torrentInfo;
261- (const tr_stat *) torrentStat;
262
263@end
Note: See TracBrowser for help on using the repository browser.