source: branches/0.9x/macosx/Torrent.h @ 3677

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

Time Machine ignoring is going to have to wait until 1.00, since setting the project to use 10.5 libraries will just break other stuff

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