source: trunk/macosx/Torrent.h

Last change on this file was 14587, checked in by mikedld, 7 years ago

Use tr_sys_path_remove instead of remove

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