source: trunk/macosx/Torrent.h @ 7639

Last change on this file since 7639 was 7639, checked in by livings124, 12 years ago

#1668 Groups: filter torrents by evalutating a multivalue property (any tracker and any file)

  • Property svn:keywords set to Date Rev Author Id
File size: 7.4 KB
Line 
1/******************************************************************************
2 * $Id: Torrent.h 7639 2009-01-08 02:37: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@class FileListNode;
29
30#define INVALID -99
31
32typedef enum
33{
34    TORRENT_FILE_DELETE,
35    TORRENT_FILE_SAVE,
36    TORRENT_FILE_DEFAULT
37} torrentFileState;
38
39#define STAT_TIME_NONE -1
40#define STAT_TIME_NOW -2
41
42@interface Torrent : NSObject
43{
44    tr_torrent * fHandle;
45    const tr_info * fInfo;
46    const tr_stat * fStat;
47   
48    BOOL fResumeOnWake;
49   
50    BOOL fUseIncompleteFolder;
51    NSString * fDownloadFolder, * fIncompleteFolder;
52   
53    BOOL fPublicTorrent;
54    NSString * fPublicTorrentLocation;
55       
56    NSUserDefaults * fDefaults;
57
58    NSImage * fIcon;
59   
60    NSString * fNameString, * fHashString;
61   
62    tr_file_stat * fFileStat;
63    NSArray * fFileList, * fFlatFileList;
64   
65    NSIndexSet * fPreviousFinishedIndexes;
66    NSDate * fPreviousFinishedIndexesDate;
67   
68    CGFloat fRatioLimit;
69    NSInteger fRatioSetting;
70    BOOL fFinishedSeeding, fWaitToStart, fStalled;
71   
72    NSInteger fOrderValue, fGroupValue;
73   
74    BOOL fAddedTrackers;
75   
76    NSDictionary * fQuickPauseDict;
77}
78
79- (id) initWithPath: (NSString *) path location: (NSString *) location deleteTorrentFile: (torrentFileState) torrentDelete
80        lib: (tr_session *) lib;
81- (id) initWithTorrentStruct: (tr_torrent *) torrentStruct location: (NSString *) location lib: (tr_session *) lib;
82- (id) initWithHistory: (NSDictionary *) history lib: (tr_session *) lib;
83
84- (NSDictionary *) history;
85
86- (void) closeRemoveTorrent;
87
88- (void) changeIncompleteDownloadFolder: (NSString *) folder;
89- (void) changeDownloadFolder: (NSString *) folder;
90- (NSString *) downloadFolder;
91
92- (void) getAvailability: (int8_t *) tab size: (NSInteger) size;
93- (void) getAmountFinished: (float *) tab size: (NSInteger) size;
94- (NSIndexSet *) previousFinishedPieces;
95-(void) setPreviousFinishedPieces: (NSIndexSet *) indexes;
96
97- (void) update;
98
99- (void) startTransfer;
100- (void) stopTransfer;
101- (void) sleep;
102- (void) wakeUp;
103
104- (void) manualAnnounce;
105- (BOOL) canManualAnnounce;
106
107- (void) resetCache;
108
109- (CGFloat) ratio;
110- (NSInteger) ratioSetting;
111- (void) setRatioSetting: (NSInteger) setting;
112- (CGFloat) ratioLimit;
113- (void) setRatioLimit: (CGFloat) limit;
114- (CGFloat) actualStopRatio; //returns INVALID if will not stop
115- (CGFloat) progressStopRatio;
116
117- (tr_speedlimit) speedMode: (BOOL) upload;
118- (void) setSpeedMode: (tr_speedlimit) mode upload: (BOOL) upload;
119- (NSInteger) speedLimit: (BOOL) upload;
120- (void) setSpeedLimit: (NSInteger) limit upload: (BOOL) upload;
121
122- (void) setMaxPeerConnect: (uint16_t) count;
123- (uint16_t) maxPeerConnect;
124
125- (void) setWaitToStart: (BOOL) wait;
126- (BOOL) waitingToStart;
127
128- (void) revealData;
129- (void) revealPublicTorrent;
130- (void) trashData;
131- (void) trashTorrent;
132- (void) moveTorrentDataFileTo: (NSString *) folder;
133- (void) copyTorrentFileTo: (NSString *) path;
134
135- (BOOL) alertForRemainingDiskSpace;
136- (BOOL) alertForFolderAvailable;
137- (BOOL) alertForMoveFolderAvailable;
138
139- (NSImage *) icon;
140
141- (NSString *) name;
142- (BOOL) isFolder;
143- (uint64_t) size;
144- (uint64_t) sizeLeft;
145
146- (NSString *) trackerAddressAnnounce;
147- (NSDate *) lastAnnounceTime;
148- (NSInteger) nextAnnounceTime;
149- (NSString *) announceResponse;
150
151- (NSString *) trackerAddressScrape;
152- (NSDate *) lastScrapeTime;
153- (NSInteger) nextScrapeTime;
154- (NSString *) scrapeResponse;
155
156- (NSMutableArray *) allTrackers: (BOOL) separators;
157- (NSArray *) allTrackersFlat;
158- (BOOL) updateAllTrackersForAdd: (NSMutableArray *) trackers;
159- (void) updateAllTrackersForRemove: (NSMutableArray *) trackers;
160- (BOOL) hasAddedTrackers;
161
162- (NSString *) comment;
163- (NSString *) creator;
164- (NSDate *) dateCreated;
165
166- (NSInteger) pieceSize;
167- (NSInteger) pieceCount;
168- (NSString *) hashString;
169- (BOOL) privateTorrent;
170
171- (NSString *) torrentLocation;
172- (NSString *) publicTorrentLocation;
173- (NSString *) dataLocation;
174
175- (BOOL) publicTorrent;
176
177- (CGFloat) progress;
178- (CGFloat) progressDone;
179- (CGFloat) progressLeft;
180- (CGFloat) checkingProgress;
181
182- (NSInteger) eta;
183- (NSInteger) etaRatio;
184
185- (CGFloat) notAvailableDesired;
186
187- (BOOL) isActive;
188- (BOOL) isSeeding;
189- (BOOL) isChecking;
190- (BOOL) isCheckingWaiting;
191- (BOOL) allDownloaded;
192- (BOOL) isComplete;
193- (BOOL) isError;
194- (NSString *) errorMessage;
195
196- (NSArray *) peers;
197
198- (NSUInteger) webSeedCount;
199- (NSArray *) webSeeds;
200
201- (NSString *) progressString;
202- (NSString *) statusString;
203- (NSString *) shortStatusString;
204- (NSString *) remainingTimeString;
205
206- (NSString *) stateString;
207
208- (NSInteger) seeders;
209- (NSInteger) leechers;
210- (NSInteger) completedFromTracker;
211
212- (NSInteger) totalPeersConnected;
213- (NSInteger) totalPeersTracker;
214- (NSInteger) totalPeersIncoming;
215- (NSInteger) totalPeersCache;
216- (NSInteger) totalPeersPex;
217- (NSInteger) totalPeersKnown;
218
219- (NSInteger) peersSendingToUs;
220- (NSInteger) peersGettingFromUs;
221
222- (CGFloat) downloadRate;
223- (CGFloat) uploadRate;
224- (CGFloat) totalRate;
225- (uint64_t) haveVerified;
226- (uint64_t) haveTotal;
227- (uint64_t) totalSizeSelected;
228- (uint64_t) downloadedTotal;
229- (uint64_t) uploadedTotal;
230- (uint64_t) failedHash;
231- (CGFloat) swarmSpeed;
232
233- (NSInteger) orderValue;
234- (void) setOrderValue: (NSInteger) orderValue;
235
236- (NSInteger) groupValue;
237- (void) setGroupValue: (NSInteger) groupValue;
238- (NSInteger) groupOrderValue;
239- (void) checkGroupValueForRemoval: (NSNotification *) notification;
240
241- (NSArray *) fileList;
242- (NSInteger) fileCount;
243- (void) updateFileStat;
244- (NSArray *) flatFileList;
245
246//methods require fileStats to have been updated recently to be accurate
247- (CGFloat) fileProgress: (FileListNode *) node;
248- (BOOL) canChangeDownloadCheckForFile: (NSInteger) index;
249- (BOOL) canChangeDownloadCheckForFiles: (NSIndexSet *) indexSet;
250- (NSInteger) checkForFiles: (NSIndexSet *) indexSet;
251- (void) setFileCheckState: (NSInteger) state forIndexes: (NSIndexSet *) indexSet;
252- (void) setFilePriority: (NSInteger) priority forIndexes: (NSIndexSet *) indexSet;
253- (BOOL) hasFilePriority: (NSInteger) priority forIndexes: (NSIndexSet *) indexSet;
254- (NSSet *) filePrioritiesForIndexes: (NSIndexSet *) indexSet;
255
256- (NSDate *) dateAdded;
257- (NSDate *) dateCompleted;
258- (NSDate *) dateActivity;
259- (NSDate *) dateActivityOrAdd;
260
261- (NSInteger) stalledMinutes;
262- (BOOL) isStalled;
263
264- (NSInteger) stateSortKey;
265
266- (tr_torrent *) torrentStruct;
267
268@end
Note: See TracBrowser for help on using the repository browser.