source: trunk/macosx/Torrent.h @ 2237

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

fix #240: make sure internally-saved torrent files are only deleted when the torrent is removed, not when quitting...hopefully this will also mean that old torrents won't remain forever in app support

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