source: trunk/macosx/Torrent.h @ 2337

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

hopefully function for getting priorities is a bit faster

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