source: trunk/macosx/Torrent.h @ 13327

Last change on this file since 13327 was 13327, checked in by livings124, 9 years ago

#4924 Use recycleURLs:completionHandler: to trash files

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