source: trunk/macosx/Torrent.h @ 9297

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

add some more switch statement asserts

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