source: trunk/macosx/Torrent.h @ 2363

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

get the mac os build building again

  • Property svn:keywords set to Date Rev Author Id
File size: 6.2 KB
Line 
1/******************************************************************************
2 * $Id: Torrent.h 2363 2007-07-15 21:57:42Z 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
30@interface Torrent : NSObject
31{
32    tr_handle_t * fLib;
33    tr_torrent_t * fHandle;
34    const tr_info_t * fInfo;
35    tr_stat_t * fStat;
36   
37    int fID;
38   
39    BOOL         fResumeOnWake;
40    NSDate       * fDateAdded, * fDateCompleted, * fAnnounceDate,
41                * fDateActivity;
42   
43    BOOL        fUseIncompleteFolder;
44    NSString    * fDownloadFolder, * fIncompleteFolder;
45   
46    BOOL        fPublicTorrent;
47    NSString    * fPublicTorrentLocation;
48       
49        BOOL fPex;
50
51    NSUserDefaults * fDefaults;
52
53    NSImage * fIcon, * fIconFlipped, * fIconSmall;
54    NSMutableString * fNameString, * fProgressString, * fStatusString, * fShortStatusString, * fRemainingTimeString;
55   
56    tr_file_stat_t * fileStat;
57    NSArray * fFileList, * fFlatFileList;
58   
59    int     fUploadLimit, fDownloadLimit;
60    float   fRatioLimit;
61    int     fCheckUpload, fCheckDownload, fRatioSetting;
62    BOOL    fFinishedSeeding, fWaitToStart, fError, fChecking, fStalled;
63   
64    int fOrderValue;
65   
66    NSBitmapImageRep * fBitmap;
67    int8_t * fPieces;
68}
69
70- (id) initWithPath: (NSString *) path location: (NSString *) location forceDeleteTorrent: (BOOL) delete lib: (tr_handle_t *) lib;
71- (id) initWithHistory: (NSDictionary *) history lib: (tr_handle_t *) lib;
72
73- (NSDictionary *) history;
74
75- (void) closeTorrent;
76- (void) closeRemoveTorrent;
77
78- (void) changeIncompleteDownloadFolder: (NSString *) folder;
79- (void) changeDownloadFolder: (NSString *) folder;
80- (NSString *) downloadFolder;
81
82- (void) getAvailability: (int8_t *) tab size: (int) size;
83- (void) getAmountFinished: (float *) tab size: (int) size;
84
85- (void) update;
86- (NSDictionary *) infoForCurrentView;
87
88- (void) startTransfer;
89- (void) stopTransfer;
90- (void) sleep;
91- (void) wakeUp;
92
93- (void) announce;
94- (NSDate *) announceDate;
95
96- (void) resetCache;
97
98- (float) ratio;
99- (int) ratioSetting;
100- (void) setRatioSetting: (int) setting;
101- (float) ratioLimit;
102- (void) setRatioLimit: (float) limit;
103- (float) actualStopRatio; //returns INVALID if will not stop
104- (float) progressStopRatio;
105
106- (int) checkUpload;
107- (void) setCheckUpload: (int) setting;
108- (int) uploadLimit;
109- (void) setUploadLimit: (int) limit;
110- (int) checkDownload;
111- (void) setCheckDownload: (int) setting;
112- (int) downloadLimit;
113- (void) setDownloadLimit: (int) limit;
114
115- (void) updateSpeedSetting;
116
117- (void) setWaitToStart: (BOOL) wait;
118- (BOOL) waitingToStart;
119
120- (void) revealData;
121- (void) revealPublicTorrent;
122- (void) trashData;
123- (void) trashTorrent;
124- (void) moveTorrentDataFileTo: (NSString *) folder;
125- (void) copyTorrentFileTo: (NSString *) path;
126
127- (BOOL) alertForRemainingDiskSpace;
128- (BOOL) alertForFolderAvailable;
129- (BOOL) alertForMoveFolderAvailable;
130
131- (NSImage *) icon;
132- (NSImage *) iconFlipped;
133- (NSImage *) iconSmall;
134
135- (NSString *) name;
136- (uint64_t) size;
137- (NSString *) trackerAddress;
138- (NSString *) trackerAddressAnnounce;
139
140- (NSString *) comment;
141- (NSString *) creator;
142- (NSDate *) dateCreated;
143
144- (int) pieceSize;
145- (int) pieceCount;
146- (NSString *) hashString;
147- (BOOL) privateTorrent;
148
149- (NSString *) torrentLocation;
150- (NSString *) publicTorrentLocation;
151- (NSString *) dataLocation;
152
153- (BOOL) publicTorrent;
154
155- (NSString *) stateString;
156
157- (float) progress;
158- (float) progressDone;
159- (int) eta;
160
161- (BOOL) isActive;
162- (BOOL) isSeeding;
163- (BOOL) isPaused;
164- (BOOL) isChecking;
165- (BOOL) allDownloaded;
166- (BOOL) isComplete;
167- (BOOL) isError;
168- (NSString *) errorMessage;
169
170- (NSArray *) peers;
171
172- (NSString *) progressString;
173- (NSString *) statusString;
174- (NSString *) shortStatusString;
175- (NSString *) remainingTimeString;
176
177- (int) seeders;
178- (int) leechers;
179- (int) completedFromTracker;
180
181- (int) totalPeersConnected;
182- (int) totalPeersTracker;
183- (int) totalPeersIncoming;
184- (int) totalPeersCache;
185- (int) totalPeersPex;
186
187- (int) peersUploading;
188- (int) peersDownloading;
189
190- (float) downloadRate;
191- (float) uploadRate;
192- (uint64_t) downloadedValid;
193- (uint64_t) downloadedTotal;
194- (uint64_t) uploadedTotal;
195- (float) swarmSpeed;
196
197- (BOOL) pex;
198- (void) setPex: (BOOL) setting;
199
200- (NSNumber *) orderValue;
201- (void) setOrderValue: (int) orderValue;
202
203- (NSArray *) fileList;
204- (int) fileCount;
205- (void) updateFileStat;
206
207//methods require fileStats to have been updated recently to be accurate
208- (float) fileProgress: (int) index;
209- (int) checkForFiles: (NSIndexSet *) indexSet;
210- (BOOL) canChangeDownloadCheckForFiles: (NSIndexSet *) indexSet;
211- (void) setFileCheckState: (int) state forIndexes: (NSIndexSet *) indexSet;
212- (void) setFilePriority: (int) priority forIndexes: (NSIndexSet *) indexSet;
213- (BOOL) hasFilePriority: (int) priority forIndexes: (NSIndexSet *) indexSet;
214- (NSSet *) filePrioritiesForIndexes: (NSIndexSet *) indexSet;
215
216- (NSDate *) dateAdded;
217- (NSDate *) dateCompleted;
218- (NSDate *) dateActivity;
219
220- (int) stalledMinutes;
221- (BOOL) isStalled;
222
223- (NSNumber *) stateSortKey;
224- (NSNumber *) progressSortKey;
225- (NSNumber *) ratioSortKey;
226
227- (int) torrentID;
228- (const tr_info_t *) torrentInfo;
229- (tr_stat_t *) torrentStat;
230
231@end
Note: See TracBrowser for help on using the repository browser.