source: trunk/macosx/Torrent.h @ 9125

Last change on this file since 9125 was 9125, checked in by livings124, 13 years ago

remove distinction between built-in trackers and custom-added trackers; add trackers to the end of the list instead of the beginning

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