source: trunk/macosx/Torrent.h @ 5309

Last change on this file since 5309 was 5309, checked in by livings124, 14 years ago

#799 treat "waiting to check..." as paused

  • Property svn:keywords set to Date Rev Author Id
File size: 6.9 KB
Line 
1/******************************************************************************
2 * $Id: Torrent.h 5309 2008-03-19 18:03:02Z livings124 $
3 *
4 * Copyright (c) 2006-2008 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    NSString * fNameString, * fHashString;
60   
61    tr_file_stat * fFileStat;
62    NSArray * fFileList;
63   
64    float * fPreviousFinishedPieces;
65    NSDate * fFinishedPiecesDate;
66   
67    float fRatioLimit;
68    int fRatioSetting;
69    BOOL fFinishedSeeding, fWaitToStart, fStalled;
70   
71    int fOrderValue, fGroupValue;
72   
73    NSDictionary * fQuickPauseDict;
74}
75
76- (id) initWithPath: (NSString *) path location: (NSString *) location deleteTorrentFile: (torrentFileState) torrentDelete
77        lib: (tr_handle *) lib;
78- (id) initWithData: (NSData *) data location: (NSString *) location lib: (tr_handle *) lib;
79- (id) initWithHistory: (NSDictionary *) history lib: (tr_handle *) lib;
80
81- (NSDictionary *) history;
82
83- (void) closeRemoveTorrent;
84
85- (void) changeIncompleteDownloadFolder: (NSString *) folder;
86- (void) changeDownloadFolder: (NSString *) folder;
87- (NSString *) downloadFolder;
88
89- (void) getAvailability: (int8_t *) tab size: (int) size;
90- (void) getAmountFinished: (float *) tab size: (int) size;
91- (float *) getPreviousAmountFinished;
92-(void) setPreviousAmountFinished: (float *) tab;
93
94- (void) update;
95
96- (void) startTransfer;
97- (void) stopTransfer;
98- (void) sleep;
99- (void) wakeUp;
100
101- (void) manualAnnounce;
102- (BOOL) canManualAnnounce;
103
104- (void) resetCache;
105
106- (float) ratio;
107- (int) ratioSetting;
108- (void) setRatioSetting: (int) setting;
109- (float) ratioLimit;
110- (void) setRatioLimit: (float) limit;
111- (float) actualStopRatio; //returns INVALID if will not stop
112- (float) progressStopRatio;
113
114- (tr_speedlimit) speedMode: (BOOL) upload;
115- (void) setSpeedMode: (tr_speedlimit) mode upload: (BOOL) upload;
116- (int) speedLimit: (BOOL) upload;
117- (void) setSpeedLimit: (int) limit upload: (BOOL) upload;
118
119- (void) setMaxPeerConnect: (uint16_t) count;
120- (uint16_t) maxPeerConnect;
121
122- (void) setWaitToStart: (BOOL) wait;
123- (BOOL) waitingToStart;
124
125- (void) revealData;
126- (void) revealPublicTorrent;
127- (void) trashData;
128- (void) trashTorrent;
129- (void) moveTorrentDataFileTo: (NSString *) folder;
130- (void) copyTorrentFileTo: (NSString *) path;
131
132- (BOOL) alertForRemainingDiskSpace;
133- (BOOL) alertForFolderAvailable;
134- (BOOL) alertForMoveFolderAvailable;
135
136- (NSImage *) icon;
137
138- (NSString *) name;
139- (BOOL) folder;
140- (uint64_t) size;
141- (uint64_t) sizeLeft;
142
143- (NSString *) trackerAddress;
144- (NSString *) trackerAddressAnnounce;
145- (NSDate *) lastAnnounceTime;
146- (int) nextAnnounceTime;
147- (NSString *) announceResponse;
148
149- (NSString *) trackerAddressScrape;
150- (NSDate *) lastScrapeTime;
151- (int) nextScrapeTime;
152- (NSString *) scrapeResponse;
153
154- (NSArray *) allTrackers;
155
156- (NSString *) comment;
157- (NSString *) creator;
158- (NSDate *) dateCreated;
159
160- (int) pieceSize;
161- (int) pieceCount;
162- (NSString *) hashString;
163- (BOOL) privateTorrent;
164
165- (NSString *) torrentLocation;
166- (NSString *) publicTorrentLocation;
167- (NSString *) dataLocation;
168
169- (BOOL) publicTorrent;
170
171- (float) progress;
172- (float) progressDone;
173- (float) progressLeft;
174- (float) checkingProgress;
175
176- (int) eta;
177- (int) etaRatio;
178
179- (float) notAvailableDesired;
180
181- (BOOL) isActive;
182- (BOOL) isSeeding;
183- (BOOL) isChecking;
184- (BOOL) isCheckingWaiting;
185- (BOOL) allDownloaded;
186- (BOOL) isComplete;
187- (BOOL) isError;
188- (NSString *) errorMessage;
189
190- (NSArray *) peers;
191
192- (NSString *) progressString;
193- (NSString *) statusString;
194- (NSString *) shortStatusString;
195- (NSString *) remainingTimeString;
196
197- (NSString *) stateString;
198
199- (int) seeders;
200- (int) leechers;
201- (int) completedFromTracker;
202
203- (int) totalPeersConnected;
204- (int) totalPeersTracker;
205- (int) totalPeersIncoming;
206- (int) totalPeersCache;
207- (int) totalPeersPex;
208- (int) totalPeersKnown;
209
210- (int) peersSendingToUs;
211- (int) peersGettingFromUs;
212
213- (float) downloadRate;
214- (float) uploadRate;
215- (float) totalRate;
216- (uint64_t) haveVerified;
217- (uint64_t) haveTotal;
218- (uint64_t) totalSizeSelected;
219- (uint64_t) downloadedTotal;
220- (uint64_t) uploadedTotal;
221- (uint64_t) failedHash;
222- (float) swarmSpeed;
223
224- (int) orderValue;
225- (void) setOrderValue: (int) orderValue;
226
227- (int) groupValue;
228- (void) setGroupValue: (int) groupValue;
229- (int) groupOrderValue;
230- (void) checkGroupValueForRemoval: (NSNotification *) notification;
231
232- (NSArray *) fileList;
233- (int) fileCount;
234- (void) updateFileStat;
235
236//methods require fileStats to have been updated recently to be accurate
237- (float) fileProgress: (int) index;
238- (BOOL) canChangeDownloadCheckForFile: (int) index;
239- (BOOL) canChangeDownloadCheckForFiles: (NSIndexSet *) indexSet;
240- (int) checkForFiles: (NSIndexSet *) indexSet;
241- (void) setFileCheckState: (int) state forIndexes: (NSIndexSet *) indexSet;
242- (void) setFilePriority: (int) priority forIndexes: (NSIndexSet *) indexSet;
243- (BOOL) hasFilePriority: (int) priority forIndexes: (NSIndexSet *) indexSet;
244- (NSSet *) filePrioritiesForIndexes: (NSIndexSet *) indexSet;
245
246- (NSDate *) dateAdded;
247- (NSDate *) dateCompleted;
248- (NSDate *) dateActivity;
249- (NSDate *) dateActivityOrAdd;
250
251- (int) stalledMinutes;
252- (BOOL) isStalled;
253
254- (NSNumber *) stateSortKey;
255
256- (int) torrentID;
257- (const tr_info *) torrentInfo;
258- (const tr_stat *) torrentStat;
259
260@end
Note: See TracBrowser for help on using the repository browser.