source: trunk/macosx/Torrent.h @ 1579

Last change on this file since 1579 was 1579, checked in by joshe, 15 years ago

Merge PEX branch, I hope this works.

  • Property svn:keywords set to Date Rev Author Id
File size: 5.5 KB
Line 
1/******************************************************************************
2 * $Id: Torrent.h 1579 2007-03-23 08:28:01Z joshe $
3 *
4 * Copyright (c) 2006 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    tr_info_t    * fInfo;
35    tr_stat_t    * fStat;
36   
37    BOOL         fResumeOnWake;
38    NSDate       * fDate, * fAnnounceDate;
39   
40    BOOL        fUseIncompleteFolder;
41    NSString    * fDownloadFolder, * fIncompleteFolder;
42   
43    BOOL        fPublicTorrent;
44    NSString    * fPublicTorrentLocation;
45
46    NSUserDefaults * fDefaults;
47
48    NSImage * fIcon, * fIconFlipped, * fIconSmall;
49    NSMutableString * fNameString, * fProgressString, * fStatusString, * fShortStatusString, * fRemainingTimeString;
50   
51    NSArray * fFileList, * fFileFlatList;
52   
53    int     fUploadLimit, fDownloadLimit;
54    float   fRatioLimit;
55    int     fCheckUpload, fCheckDownload, fRatioSetting;
56    BOOL    fFinishedSeeding, fWaitToStart, fError, fChecking;
57   
58    int fOrderValue;
59   
60    NSBitmapImageRep * fBitmap;
61    int8_t * fPieces;
62}
63
64- (id)  initWithPath: (NSString *) path forceDeleteTorrent: (BOOL) delete lib: (tr_handle_t *) lib;
65- (id)  initWithHistory: (NSDictionary *) history lib: (tr_handle_t *) lib;
66
67- (NSDictionary *) history;
68                   
69- (void)       setDownloadFolder: (NSString *) path;
70- (NSString *) downloadFolder;
71
72- (void) getAvailability: (int8_t *) tab size: (int) size;
73- (void) getAmountFinished: (float *) tab size: (int) size;
74
75- (void)            update;
76- (NSDictionary *)  infoForCurrentView;
77
78- (void)        startTransfer;
79- (void)        stopTransfer;
80- (void)        stopTransferForQuit;
81- (void)        sleep;
82- (void)        wakeUp;
83
84- (void)        announce;
85- (NSDate *)    announceDate;
86
87- (BOOL)        allDownloaded;
88
89- (float)       ratio;
90- (int)         ratioSetting;
91- (void)        setRatioSetting: (int) setting;
92- (float)       ratioLimit;
93- (void)        setRatioLimit: (float) limit;
94- (float)       actualStopRatio; //returns INVALID if will not stop
95
96- (int)     checkUpload;
97- (void)    setCheckUpload: (int) setting;
98- (int)     uploadLimit;
99- (void)    setUploadLimit: (int) limit;
100- (int)     checkDownload;
101- (void)    setCheckDownload: (int) setting;
102- (int)     downloadLimit;
103- (void)    setDownloadLimit: (int) limit;
104
105- (void)    updateSpeedSetting;
106
107- (void) setWaitToStart: (BOOL) wait;
108- (BOOL) waitingToStart;
109
110- (void)    revealData;
111- (void)    revealPublicTorrent;
112- (void)    trashData;
113- (void)    trashTorrent;
114
115- (BOOL) alertForRemainingDiskSpace;
116- (BOOL) alertForFolderAvailable;
117- (BOOL) alertForMoveFolderAvailable;
118
119- (NSImage *)   icon;
120- (NSImage *)   iconFlipped;
121- (NSImage *)   iconSmall;
122
123- (NSString *) name;
124- (uint64_t)   size;
125- (NSString *) trackerAddress;
126- (NSString *) trackerAddressAnnounce;
127
128- (NSString *) comment;
129- (NSString *) creator;
130- (NSDate *)   dateCreated;
131
132- (int)        pieceSize;
133- (int)        pieceCount;
134- (NSString *) hashString;
135- (BOOL)       privateTorrent;
136
137- (NSString *) torrentLocation;
138- (NSString *) publicTorrentLocation;
139- (NSString *) dataLocation;
140
141- (BOOL) publicTorrent;
142
143- (NSString *) stateString;
144
145- (float)   progress;
146- (int)     eta;
147
148- (BOOL)        isActive;
149- (BOOL)        isSeeding;
150- (BOOL)        isPaused;
151- (BOOL)        isError;
152- (NSString *)  errorMessage;
153- (BOOL)        justFinished;
154
155- (NSArray *) peers;
156
157- (NSString *) progressString;
158- (NSString *) statusString;
159- (NSString *) shortStatusString;
160- (NSString *) remainingTimeString;
161
162- (int) seeders;
163- (int) leechers;
164- (int) completedFromTracker;
165
166- (int) totalPeers;
167- (int) totalPeersTracker;
168- (int) totalPeersIncoming;
169- (int) totalPeersCache;
170- (int) totalPeersPex;
171
172- (int) peersUploading;
173- (int) peersDownloading;
174
175- (float)       downloadRate;
176- (float)       uploadRate;
177- (float)       downloadedValid;
178- (uint64_t)    downloadedTotal;
179- (uint64_t)    uploadedTotal;
180- (float)       swarmSpeed;
181
182- (NSNumber *) orderValue;
183- (void) setOrderValue: (int) orderValue;
184
185- (NSArray *) fileList;
186- (int) fileCount;
187- (BOOL) updateFileProgress;
188- (void) setFileCheckState: (int) state forFileItem: (NSMutableDictionary *) item;
189- (NSMutableDictionary *) resetFileCheckStateForItemParent: (NSMutableDictionary *) originalChild;
190
191- (NSDate *) date;
192- (NSNumber *) stateSortKey;
193- (NSNumber *) progressSortKey;
194- (NSNumber *) ratioSortKey;
195
196@end
Note: See TracBrowser for help on using the repository browser.