source: trunk/macosx/Torrent.h @ 9342

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

use libtransmission for moving, incomplete directory, and directory controlling in general (still rough around the edges)

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