source: trunk/macosx/Torrent.h @ 8260

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

skeleton for priorities in the Mac UI - still lacks ability to actually change the priority

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