source: trunk/macosx/Torrent.h @ 5049

Last change on this file since 5049 was 5049, checked in by livings124, 15 years ago

in minimal mode, show eta for seeding

  • Property svn:keywords set to Date Rev Author Id
File size: 6.7 KB
Line 
1/******************************************************************************
2 * $Id: Torrent.h 5049 2008-02-16 19:32:22Z 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- (NSString *) trackerAddress;
145- (NSString *) trackerAddressAnnounce;
146- (NSArray *) allTrackers;
147
148- (NSString *) comment;
149- (NSString *) creator;
150- (NSDate *) dateCreated;
151
152- (int) pieceSize;
153- (int) pieceCount;
154- (NSString *) hashString;
155- (BOOL) privateTorrent;
156
157- (NSString *) torrentLocation;
158- (NSString *) publicTorrentLocation;
159- (NSString *) dataLocation;
160
161- (BOOL) publicTorrent;
162
163- (float) progress;
164- (float) progressDone;
165- (float) progressLeft;
166- (float) checkingProgress;
167
168- (int) eta;
169- (int) etaRatio;
170- (NSString *) etaString: (int) eta;
171
172- (float) notAvailableDesired;
173
174- (BOOL) isActive;
175- (BOOL) isSeeding;
176- (BOOL) isChecking;
177- (BOOL) allDownloaded;
178- (BOOL) isComplete;
179- (BOOL) isError;
180- (NSString *) errorMessage;
181
182- (NSArray *) peers;
183
184- (NSString *) progressString;
185- (NSString *) statusString;
186- (NSString *) shortStatusString;
187- (NSString *) remainingTimeString;
188
189- (NSString *) stateString;
190
191- (int) seeders;
192- (int) leechers;
193- (int) completedFromTracker;
194
195- (int) totalPeersConnected;
196- (int) totalPeersTracker;
197- (int) totalPeersIncoming;
198- (int) totalPeersCache;
199- (int) totalPeersPex;
200- (int) totalPeersKnown;
201
202- (int) peersSendingToUs;
203- (int) peersGettingFromUs;
204
205- (float) downloadRate;
206- (float) uploadRate;
207- (float) totalRate;
208- (uint64_t) haveVerified;
209- (uint64_t) haveTotal;
210- (uint64_t) downloadedTotal;
211- (uint64_t) uploadedTotal;
212- (uint64_t) failedHash;
213- (float) swarmSpeed;
214
215- (int) orderValue;
216- (void) setOrderValue: (int) orderValue;
217
218- (int) groupValue;
219- (void) setGroupValue: (int) groupValue;
220- (int) groupOrderValue;
221- (void) checkGroupValueForRemoval: (NSNotification *) notification;
222
223- (NSArray *) fileList;
224- (int) fileCount;
225- (void) updateFileStat;
226
227//methods require fileStats to have been updated recently to be accurate
228- (float) fileProgress: (int) index;
229- (BOOL) canChangeDownloadCheckForFile: (int) index;
230- (BOOL) canChangeDownloadCheckForFiles: (NSIndexSet *) indexSet;
231- (int) checkForFiles: (NSIndexSet *) indexSet;
232- (void) setFileCheckState: (int) state forIndexes: (NSIndexSet *) indexSet;
233- (void) setFilePriority: (int) priority forIndexes: (NSIndexSet *) indexSet;
234- (BOOL) hasFilePriority: (int) priority forIndexes: (NSIndexSet *) indexSet;
235- (NSSet *) filePrioritiesForIndexes: (NSIndexSet *) indexSet;
236
237- (NSMenu *) fileMenu;
238
239- (NSDate *) dateAdded;
240- (NSDate *) dateCompleted;
241- (NSDate *) dateActivity;
242- (NSDate *) dateActivityOrAdd;
243
244- (int) stalledMinutes;
245- (BOOL) isStalled;
246
247- (NSNumber *) stateSortKey;
248
249- (int) torrentID;
250- (const tr_info *) torrentInfo;
251- (const tr_stat *) torrentStat;
252
253@end
Note: See TracBrowser for help on using the repository browser.