source: trunk/macosx/Torrent.h @ 6048

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

handle all settings changed by rpc (previously download location was missing)

  • Property svn:keywords set to Date Rev Author Id
File size: 6.9 KB
Line 
1/******************************************************************************
2 * $Id: Torrent.h 6048 2008-06-05 15:22:18Z 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_torrent * fHandle;
40    const tr_info * fInfo;
41    const tr_stat * fStat;
42   
43    BOOL fResumeOnWake;
44   
45    BOOL fUseIncompleteFolder;
46    NSString * fDownloadFolder, * fIncompleteFolder;
47   
48    BOOL fPublicTorrent;
49    NSString * fPublicTorrentLocation;
50       
51    NSUserDefaults * fDefaults;
52
53    NSImage * fIcon;
54   
55    NSString * fNameString, * fHashString;
56   
57    tr_file_stat * fFileStat;
58    NSArray * fFileList;
59   
60    float * fPreviousFinishedPieces;
61    NSDate * fFinishedPiecesDate;
62   
63    float fRatioLimit;
64    int fRatioSetting;
65    BOOL fFinishedSeeding, fWaitToStart, fStalled;
66   
67    int fOrderValue, fGroupValue;
68   
69    BOOL fAddedTrackers;
70   
71    NSDictionary * fQuickPauseDict;
72}
73
74- (id) initWithPath: (NSString *) path location: (NSString *) location deleteTorrentFile: (torrentFileState) torrentDelete
75        lib: (tr_handle *) lib;
76- (id) initWithTorrentStruct: (tr_torrent *) torrentStruct location: (NSString *) location lib: (tr_handle *) lib;
77- (id) initWithHistory: (NSDictionary *) history lib: (tr_handle *) lib;
78
79- (NSDictionary *) history;
80
81- (void) closeRemoveTorrentInterface;
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- (float *) getPreviousAmountFinished;
91-(void) setPreviousAmountFinished: (float *) tab;
92
93- (void) update;
94
95- (void) startTransfer;
96- (void) stopTransfer;
97- (void) sleep;
98- (void) wakeUp;
99
100- (void) manualAnnounce;
101- (BOOL) canManualAnnounce;
102
103- (void) resetCache;
104
105- (float) ratio;
106- (int) ratioSetting;
107- (void) setRatioSetting: (int) setting;
108- (float) ratioLimit;
109- (void) setRatioLimit: (float) limit;
110- (float) actualStopRatio; //returns INVALID if will not stop
111- (float) progressStopRatio;
112
113- (tr_speedlimit) speedMode: (BOOL) upload;
114- (void) setSpeedMode: (tr_speedlimit) mode upload: (BOOL) upload;
115- (int) speedLimit: (BOOL) upload;
116- (void) setSpeedLimit: (int) limit upload: (BOOL) upload;
117
118- (void) setMaxPeerConnect: (uint16_t) count;
119- (uint16_t) maxPeerConnect;
120
121- (void) setWaitToStart: (BOOL) wait;
122- (BOOL) waitingToStart;
123
124- (void) revealData;
125- (void) revealPublicTorrent;
126- (void) trashData;
127- (void) trashTorrent;
128- (void) moveTorrentDataFileTo: (NSString *) folder;
129- (void) copyTorrentFileTo: (NSString *) path;
130
131- (BOOL) alertForRemainingDiskSpace;
132- (BOOL) alertForFolderAvailable;
133- (BOOL) alertForMoveFolderAvailable;
134
135- (NSImage *) icon;
136
137- (NSString *) name;
138- (BOOL) isFolder;
139- (uint64_t) size;
140- (uint64_t) sizeLeft;
141
142- (NSString *) trackerAddressAnnounce;
143- (NSDate *) lastAnnounceTime;
144- (int) nextAnnounceTime;
145- (NSString *) announceResponse;
146
147- (NSString *) trackerAddressScrape;
148- (NSDate *) lastScrapeTime;
149- (int) nextScrapeTime;
150- (NSString *) scrapeResponse;
151
152- (NSMutableArray *) allTrackers: (BOOL) separators;
153- (BOOL) updateAllTrackersForAdd: (NSMutableArray *) trackers;
154- (void) updateAllTrackersForRemove: (NSMutableArray *) trackers;
155- (BOOL) hasAddedTrackers;
156
157- (NSString *) comment;
158- (NSString *) creator;
159- (NSDate *) dateCreated;
160
161- (int) pieceSize;
162- (int) pieceCount;
163- (NSString *) hashString;
164- (BOOL) privateTorrent;
165
166- (NSString *) torrentLocation;
167- (NSString *) publicTorrentLocation;
168- (NSString *) dataLocation;
169
170- (BOOL) publicTorrent;
171
172- (float) progress;
173- (float) progressDone;
174- (float) progressLeft;
175- (float) checkingProgress;
176
177- (int) eta;
178- (int) etaRatio;
179
180- (float) notAvailableDesired;
181
182- (BOOL) isActive;
183- (BOOL) isSeeding;
184- (BOOL) isChecking;
185- (BOOL) isCheckingWaiting;
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- (NSDate *) dateAdded;
248- (NSDate *) dateCompleted;
249- (NSDate *) dateActivity;
250- (NSDate *) dateActivityOrAdd;
251
252- (int) stalledMinutes;
253- (BOOL) isStalled;
254
255- (NSNumber *) stateSortKey;
256
257- (tr_torrent *) torrentStruct;
258
259@end
Note: See TracBrowser for help on using the repository browser.