source: trunk/macosx/Torrent.h @ 8227

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

#8021 per-torrent vs. global speed limit confusion for mac ui

  • Property svn:keywords set to Date Rev Author Id
File size: 7.2 KB
Line 
1/******************************************************************************
2 * $Id: Torrent.h 8023 2009-03-05 01:10:09Z 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- (void) revealData;
127- (void) revealPublicTorrent;
128- (void) trashData;
129- (void) trashTorrent;
130- (void) moveTorrentDataFileTo: (NSString *) folder;
131- (void) copyTorrentFileTo: (NSString *) path;
132
133- (BOOL) alertForRemainingDiskSpace;
134- (BOOL) alertForFolderAvailable;
135- (BOOL) alertForMoveFolderAvailable;
136
137- (NSImage *) icon;
138
139- (NSString *) name;
140- (BOOL) isFolder;
141- (uint64_t) size;
142- (uint64_t) sizeLeft;
143
144- (NSString *) trackerAddressAnnounce;
145- (NSDate *) lastAnnounceTime;
146- (NSInteger) nextAnnounceTime;
147- (NSString *) announceResponse;
148
149- (NSString *) trackerAddressScrape;
150- (NSDate *) lastScrapeTime;
151- (NSInteger) nextScrapeTime;
152- (NSString *) scrapeResponse;
153
154- (NSMutableArray *) allTrackers: (BOOL) separators;
155- (NSArray *) allTrackersFlat;
156- (BOOL) updateAllTrackersForAdd: (NSMutableArray *) trackers;
157- (void) updateAllTrackersForRemove: (NSMutableArray *) trackers;
158- (BOOL) hasAddedTrackers;
159
160- (NSString *) comment;
161- (NSString *) creator;
162- (NSDate *) dateCreated;
163
164- (NSInteger) pieceSize;
165- (NSInteger) pieceCount;
166- (NSString *) hashString;
167- (BOOL) privateTorrent;
168
169- (NSString *) torrentLocation;
170- (NSString *) publicTorrentLocation;
171- (NSString *) dataLocation;
172
173- (BOOL) publicTorrent;
174
175- (CGFloat) progress;
176- (CGFloat) progressDone;
177- (CGFloat) progressLeft;
178- (CGFloat) checkingProgress;
179
180- (NSInteger) eta;
181
182- (CGFloat) notAvailableDesired;
183
184- (BOOL) isActive;
185- (BOOL) isSeeding;
186- (BOOL) isChecking;
187- (BOOL) isCheckingWaiting;
188- (BOOL) allDownloaded;
189- (BOOL) isComplete;
190- (BOOL) isError;
191- (NSString *) errorMessage;
192
193- (NSArray *) peers;
194
195- (NSUInteger) webSeedCount;
196- (NSArray *) webSeeds;
197
198- (NSString *) progressString;
199- (NSString *) statusString;
200- (NSString *) shortStatusString;
201- (NSString *) remainingTimeString;
202
203- (NSString *) stateString;
204
205- (NSInteger) seeders;
206- (NSInteger) leechers;
207- (NSInteger) completedFromTracker;
208
209- (NSInteger) totalPeersConnected;
210- (NSInteger) totalPeersTracker;
211- (NSInteger) totalPeersIncoming;
212- (NSInteger) totalPeersCache;
213- (NSInteger) totalPeersPex;
214- (NSInteger) totalPeersKnown;
215
216- (NSInteger) peersSendingToUs;
217- (NSInteger) peersGettingFromUs;
218
219- (CGFloat) downloadRate;
220- (CGFloat) uploadRate;
221- (CGFloat) totalRate;
222- (uint64_t) haveVerified;
223- (uint64_t) haveTotal;
224- (uint64_t) totalSizeSelected;
225- (uint64_t) downloadedTotal;
226- (uint64_t) uploadedTotal;
227- (uint64_t) failedHash;
228- (CGFloat) swarmSpeed;
229
230- (NSInteger) groupValue;
231- (void) setGroupValue: (NSInteger) groupValue;
232- (NSInteger) groupOrderValue;
233- (void) checkGroupValueForRemoval: (NSNotification *) notification;
234
235- (NSArray *) fileList;
236- (NSInteger) fileCount;
237- (void) updateFileStat;
238- (NSArray *) flatFileList;
239
240//methods require fileStats to have been updated recently to be accurate
241- (CGFloat) fileProgress: (FileListNode *) node;
242- (BOOL) canChangeDownloadCheckForFile: (NSInteger) index;
243- (BOOL) canChangeDownloadCheckForFiles: (NSIndexSet *) indexSet;
244- (NSInteger) checkForFiles: (NSIndexSet *) indexSet;
245- (void) setFileCheckState: (NSInteger) state forIndexes: (NSIndexSet *) indexSet;
246- (void) setFilePriority: (NSInteger) priority forIndexes: (NSIndexSet *) indexSet;
247- (BOOL) hasFilePriority: (NSInteger) priority forIndexes: (NSIndexSet *) indexSet;
248- (NSSet *) filePrioritiesForIndexes: (NSIndexSet *) indexSet;
249
250- (NSDate *) dateAdded;
251- (NSDate *) dateCompleted;
252- (NSDate *) dateActivity;
253- (NSDate *) dateActivityOrAdd;
254
255- (NSInteger) stalledMinutes;
256- (BOOL) isStalled;
257
258- (NSInteger) stateSortKey;
259
260- (tr_torrent *) torrentStruct;
261
262@end
Note: See TracBrowser for help on using the repository browser.