source: trunk/macosx/Torrent.h @ 3946

Last change on this file since 3946 was 3946, checked in by livings124, 15 years ago

sort by speed, then last activity

  • Property svn:keywords set to Date Rev Author Id
File size: 6.2 KB
Line 
1/******************************************************************************
2 * $Id: Torrent.h 3946 2007-11-23 16:03:49Z livings124 $
3 *
4 * Copyright (c) 2006-2007 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#define INVALID -99
29
30typedef enum
31{
32    TORRENT_FILE_DELETE,
33    TORRENT_FILE_SAVE,
34    TORRENT_FILE_DEFAULT
35} torrentFileState;
36
37@interface Torrent : NSObject
38{
39    tr_handle * fLib;
40    tr_torrent * fHandle;
41    const tr_info * fInfo;
42    const tr_stat * fStat;
43   
44    int fID;
45   
46    BOOL         fResumeOnWake;
47    NSDate       * fDateAdded, * fDateCompleted, * fDateActivity;
48   
49    BOOL        fUseIncompleteFolder;
50    NSString    * fDownloadFolder, * fIncompleteFolder;
51   
52    BOOL        fPublicTorrent;
53    NSString    * fPublicTorrentLocation;
54       
55    NSUserDefaults * fDefaults;
56
57    NSImage * fIcon;
58   
59    tr_file_stat * fileStat;
60    NSArray * fFileList;
61   
62    NSMenu * fFileMenu;
63   
64    float fRatioLimit;
65    int fRatioSetting;
66    BOOL fFinishedSeeding, fWaitToStart, fError, fChecking, fStalled;
67   
68    int fOrderValue;
69   
70    NSDictionary * fQuickPauseDict;
71   
72    BOOL fNeedSetTimeMachine;
73}
74
75- (id) initWithPath: (NSString *) path location: (NSString *) location deleteTorrentFile: (torrentFileState) torrentDelete
76        lib: (tr_handle *) lib;
77- (id) initWithHistory: (NSDictionary *) history lib: (tr_handle *) lib;
78
79- (NSDictionary *) history;
80
81- (void) closeRemoveTorrent;
82
83- (void) changeIncompleteDownloadFolder: (NSString *) folder;
84- (void) changeDownloadFolder: (NSString *) folder;
85- (NSString *) downloadFolder;
86
87- (void) getAvailability: (int8_t *) tab size: (int) size;
88- (void) getAmountFinished: (float *) tab size: (int) size;
89
90- (void) update;
91
92- (void) startTransfer;
93- (void) stopTransfer;
94- (void) sleep;
95- (void) wakeUp;
96
97- (void) manualAnnounce;
98- (BOOL) canManualAnnounce;
99
100- (void) resetCache;
101
102- (float) ratio;
103- (int) ratioSetting;
104- (void) setRatioSetting: (int) setting;
105- (float) ratioLimit;
106- (void) setRatioLimit: (float) limit;
107- (float) actualStopRatio; //returns INVALID if will not stop
108- (float) progressStopRatio;
109
110- (tr_speedlimit) speedMode: (BOOL) upload;
111- (void) setSpeedMode: (tr_speedlimit) mode upload: (BOOL) upload;
112- (int) speedLimit: (BOOL) upload;
113- (void) setSpeedLimit: (int) limit upload: (BOOL) upload;
114
115- (void) setWaitToStart: (BOOL) wait;
116- (BOOL) waitingToStart;
117
118- (void) revealData;
119- (void) revealPublicTorrent;
120- (void) trashData;
121- (void) trashTorrent;
122- (void) moveTorrentDataFileTo: (NSString *) folder;
123- (void) copyTorrentFileTo: (NSString *) path;
124
125- (BOOL) alertForRemainingDiskSpace;
126- (BOOL) alertForFolderAvailable;
127- (BOOL) alertForMoveFolderAvailable;
128
129- (NSImage *) icon;
130
131- (NSString *) name;
132- (uint64_t) size;
133- (uint64_t) sizeLeft;
134- (NSString *) trackerAddress;
135- (NSString *) trackerAddressAnnounce;
136- (NSArray *) allTrackers;
137
138- (NSString *) comment;
139- (NSString *) creator;
140- (NSDate *) dateCreated;
141
142- (int) pieceSize;
143- (int) pieceCount;
144- (NSString *) hashString;
145- (BOOL) privateTorrent;
146
147- (NSString *) torrentLocation;
148- (NSString *) publicTorrentLocation;
149- (NSString *) dataLocation;
150
151- (BOOL) publicTorrent;
152
153- (float) progress;
154- (float) progressDone;
155- (float) progressLeft;
156- (int) eta;
157- (NSString * ) etaString;
158
159- (float) notAvailableDesired;
160
161- (BOOL) isActive;
162- (BOOL) isSeeding;
163- (BOOL) isChecking;
164- (BOOL) allDownloaded;
165- (BOOL) isComplete;
166- (BOOL) isError;
167- (NSString *) errorMessage;
168
169- (NSArray *) peers;
170
171- (NSString *) progressString;
172- (NSString *) statusString;
173- (NSString *) shortStatusString;
174- (NSString *) remainingTimeString;
175
176- (NSString *) stateString;
177
178- (int) seeders;
179- (int) leechers;
180- (int) completedFromTracker;
181
182- (int) totalPeersConnected;
183- (int) totalPeersTracker;
184- (int) totalPeersIncoming;
185- (int) totalPeersCache;
186- (int) totalPeersPex;
187- (int) totalPeersKnown;
188
189- (int) peersSendingToUs;
190- (int) peersGettingFromUs;
191
192- (float) downloadRate;
193- (float) uploadRate;
194- (float) totalRate;
195- (uint64_t) haveVerified;
196- (uint64_t) haveTotal;
197- (uint64_t) downloadedTotal;
198- (uint64_t) uploadedTotal;
199- (uint64_t) failedHash;
200- (float) swarmSpeed;
201
202- (BOOL) pex;
203- (void) setPex: (BOOL) enable;
204
205- (int) orderValue;
206- (void) setOrderValue: (int) orderValue;
207
208- (NSArray *) fileList;
209- (int) fileCount;
210- (void) updateFileStat;
211
212//methods require fileStats to have been updated recently to be accurate
213- (float) fileProgress: (int) index;
214- (BOOL) canChangeDownloadCheckForFile: (int) index;
215- (BOOL) canChangeDownloadCheckForFiles: (NSIndexSet *) indexSet;
216- (int) checkForFiles: (NSIndexSet *) indexSet;
217- (void) setFileCheckState: (int) state forIndexes: (NSIndexSet *) indexSet;
218- (void) setFilePriority: (int) priority forIndexes: (NSIndexSet *) indexSet;
219- (BOOL) hasFilePriority: (int) priority forIndexes: (NSIndexSet *) indexSet;
220- (NSSet *) filePrioritiesForIndexes: (NSIndexSet *) indexSet;
221
222- (NSMenu *) fileMenu;
223
224- (NSDate *) dateAdded;
225- (NSDate *) dateCompleted;
226- (NSDate *) dateActivity;
227- (NSDate *) dateActivityOrAdd;
228
229- (int) stalledMinutes;
230- (BOOL) isStalled;
231
232- (NSNumber *) stateSortKey;
233
234- (int) torrentID;
235- (const tr_info *) torrentInfo;
236- (const tr_stat *) torrentStat;
237
238@end
Note: See TracBrowser for help on using the repository browser.