source: trunk/macosx/Torrent.h @ 7892

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

have the mac ui use libT's ratio settings (attempt 1); when seed ratio is reached in libT, set the seed ratio setting to "seed forever"

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