source: trunk/macosx/Torrent.h @ 3207

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

clean up some of the new display string code

  • Property svn:keywords set to Date Rev Author Id
File size: 6.2 KB
Line 
1/******************************************************************************
2 * $Id: Torrent.h 3207 2007-09-27 21:02:25Z livings124 $
3 *
4 * Copyright (c) 2006-2007 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        BOOL fPex;
56
57    NSUserDefaults * fDefaults;
58
59    NSImage * fIcon;
60   
61    tr_file_stat * fileStat;
62    NSArray * fFileList, * fFlatFileList;
63   
64    NSMenu * fFileMenu;
65   
66    float   fRatioLimit;
67    int     fRatioSetting;
68    BOOL    fFinishedSeeding, fWaitToStart, fError, fChecking, fStalled;
69   
70    int fOrderValue;
71   
72    NSDictionary * fQuickPauseDict;
73}
74
75- (id) initWithPath: (NSString *) path location: (NSString *) location deleteTorrentFile: (torrentFileState) torrentDelete
76        lib: (tr_handle *) lib;
77- (id) initWithHistory: (NSDictionary *) history lib: (tr_handle *) lib;
78
79- (NSDictionary *) history;
80
81- (void) closeTorrent;
82- (void) closeRemoveTorrent;
83
84- (void) changeIncompleteDownloadFolder: (NSString *) folder;
85- (void) changeDownloadFolder: (NSString *) folder;
86- (NSString *) downloadFolder;
87
88- (void) getAvailability: (int8_t *) tab size: (int) size;
89- (void) getAmountFinished: (float *) tab size: (int) size;
90
91- (void) update;
92
93- (void) startTransfer;
94- (void) stopTransfer;
95- (void) sleep;
96- (void) wakeUp;
97
98- (void) manualAnnounce;
99- (BOOL) canManualAnnounce;
100
101- (void) resetCache;
102
103- (float) ratio;
104- (int) ratioSetting;
105- (void) setRatioSetting: (int) setting;
106- (float) ratioLimit;
107- (void) setRatioLimit: (float) limit;
108- (float) actualStopRatio; //returns INVALID if will not stop
109- (float) progressStopRatio;
110
111- (tr_speedlimit) speedMode: (BOOL) upload;
112- (void) setSpeedMode: (tr_speedlimit) mode upload: (BOOL) upload;
113- (int) speedLimit: (BOOL) upload;
114- (void) setSpeedLimit: (int) limit upload: (BOOL) upload;
115
116- (void) setWaitToStart: (BOOL) wait;
117- (BOOL) waitingToStart;
118
119- (void) revealData;
120- (void) revealPublicTorrent;
121- (void) trashData;
122- (void) trashTorrent;
123- (void) moveTorrentDataFileTo: (NSString *) folder;
124- (void) copyTorrentFileTo: (NSString *) path;
125
126- (BOOL) alertForRemainingDiskSpace;
127- (BOOL) alertForFolderAvailable;
128- (BOOL) alertForMoveFolderAvailable;
129
130- (NSImage *) icon;
131
132- (NSString *) name;
133- (uint64_t) size;
134- (NSString *) trackerAddress;
135- (NSString *) trackerAddressAnnounce;
136
137- (NSString *) comment;
138- (NSString *) creator;
139- (NSDate *) dateCreated;
140
141- (int) pieceSize;
142- (int) pieceCount;
143- (NSString *) hashString;
144- (BOOL) privateTorrent;
145
146- (NSString *) torrentLocation;
147- (NSString *) publicTorrentLocation;
148- (NSString *) dataLocation;
149
150- (BOOL) publicTorrent;
151
152- (NSString *) stateString;
153
154- (float) progress;
155- (float) progressDone;
156- (float) progressLeft;
157- (int) eta;
158- (NSString * ) etaString;
159
160- (float) notAvailableDesired;
161
162- (BOOL) isActive;
163- (BOOL) isSeeding;
164- (BOOL) isPaused;
165- (BOOL) isChecking;
166- (BOOL) allDownloaded;
167- (BOOL) isComplete;
168- (BOOL) isError;
169- (NSString *) errorMessage;
170
171- (NSArray *) peers;
172
173- (NSString *) progressString;
174- (NSString *) statusString;
175- (NSString *) shortStatusString;
176- (NSString *) remainingTimeString;
177
178- (int) seeders;
179- (int) leechers;
180- (int) completedFromTracker;
181
182- (int) totalPeersConnected;
183- (int) totalPeersTracker;
184- (int) totalPeersIncoming;
185- (int) totalPeersCache;
186- (int) totalPeersPex;
187
188- (int) peersSendingToUs;
189- (int) peersGettingFromUs;
190
191- (float) downloadRate;
192- (float) uploadRate;
193- (uint64_t) haveVerified;
194- (uint64_t) haveTotal;
195- (uint64_t) downloadedTotal;
196- (uint64_t) uploadedTotal;
197- (uint64_t) failedHash;
198- (float) swarmSpeed;
199
200- (BOOL) pex;
201- (void) setPex: (BOOL) setting;
202
203- (NSNumber *) orderValue;
204- (void) setOrderValue: (int) orderValue;
205
206- (NSArray *) fileList;
207- (int) fileCount;
208- (void) updateFileStat;
209
210//methods require fileStats to have been updated recently to be accurate
211- (float) fileProgress: (int) index;
212- (BOOL) canChangeDownloadCheckForFile: (int) index;
213- (BOOL) canChangeDownloadCheckForFiles: (NSIndexSet *) indexSet;
214- (int) checkForFiles: (NSIndexSet *) indexSet;
215- (void) setFileCheckState: (int) state forIndexes: (NSIndexSet *) indexSet;
216- (void) setFilePriority: (int) priority forIndexes: (NSIndexSet *) indexSet;
217- (BOOL) hasFilePriority: (int) priority forIndexes: (NSIndexSet *) indexSet;
218- (NSSet *) filePrioritiesForIndexes: (NSIndexSet *) indexSet;
219
220- (NSMenu *) fileMenu;
221
222- (NSDate *) dateAdded;
223- (NSDate *) dateCompleted;
224- (NSDate *) dateActivity;
225
226- (int) stalledMinutes;
227- (BOOL) isStalled;
228
229- (NSNumber *) stateSortKey;
230- (NSNumber *) progressSortKey;
231- (NSNumber *) ratioSortKey;
232- (NSNumber *) ratioProgressSortKey;
233
234- (int) torrentID;
235- (const tr_info *) torrentInfo;
236- (const tr_stat *) torrentStat;
237
238@end
Note: See TracBrowser for help on using the repository browser.