transmission/macosx/Torrent.h

229 lines
6.1 KiB
C
Raw Normal View History

2006-07-16 19:39:23 +00:00
/******************************************************************************
* $Id$
*
2007-04-03 02:22:25 +00:00
* Copyright (c) 2006-2007 Transmission authors and contributors
2006-07-16 19:39:23 +00:00
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*****************************************************************************/
#import <Cocoa/Cocoa.h>
#import <transmission.h>
#define PRIORITY_LOW -1
#define PRIORITY_NORMAL 0
#define PRIORITY_HIGH 1
#define INVALID -99
2006-07-16 19:39:23 +00:00
@interface Torrent : NSObject
{
2007-06-30 21:53:45 +00:00
tr_handle_t * fLib;
2006-07-16 19:39:23 +00:00
tr_torrent_t * fHandle;
2007-06-30 21:53:45 +00:00
const tr_info_t * fInfo;
tr_stat_t * fStat;
2006-07-16 19:39:23 +00:00
int fID;
2006-07-16 19:39:23 +00:00
BOOL fResumeOnWake;
NSDate * fDateAdded, * fDateCompleted, * fAnnounceDate,
* fDateActivity;
2006-07-16 19:39:23 +00:00
BOOL fUseIncompleteFolder;
NSString * fDownloadFolder, * fIncompleteFolder;
BOOL fPublicTorrent;
2006-07-16 19:39:23 +00:00
NSString * fPublicTorrentLocation;
BOOL fPex;
2006-07-16 19:39:23 +00:00
2007-01-17 20:50:42 +00:00
NSUserDefaults * fDefaults;
2006-07-16 19:39:23 +00:00
2007-01-17 20:50:42 +00:00
NSImage * fIcon, * fIconFlipped, * fIconSmall;
NSMutableString * fNameString, * fProgressString, * fStatusString, * fShortStatusString, * fRemainingTimeString;
2006-07-16 19:39:23 +00:00
NSArray * fFileList, * fFlatFileList;
int fUploadLimit, fDownloadLimit;
2006-07-16 19:39:23 +00:00
float fRatioLimit;
2007-02-02 17:54:24 +00:00
int fCheckUpload, fCheckDownload, fRatioSetting;
BOOL fFinishedSeeding, fWaitToStart, fError, fChecking, fStalled;
2006-07-16 19:39:23 +00:00
int fOrderValue;
NSBitmapImageRep * fBitmap;
int8_t * fPieces;
2006-07-16 19:39:23 +00:00
}
- (id) initWithPath: (NSString *) path location: (NSString *) location forceDeleteTorrent: (BOOL) delete lib: (tr_handle_t *) lib;
- (id) initWithHistory: (NSDictionary *) history lib: (tr_handle_t *) lib;
2006-07-16 19:39:23 +00:00
- (NSDictionary *) history;
- (void) removeTorrent;
- (void) changeIncompleteDownloadFolder: (NSString *) folder;
- (void) changeDownloadFolder: (NSString *) folder;
2006-07-16 19:39:23 +00:00
- (NSString *) downloadFolder;
- (void) getAvailability: (int8_t *) tab size: (int) size;
2006-10-13 01:34:15 +00:00
- (void) getAmountFinished: (float *) tab size: (int) size;
2006-07-16 19:39:23 +00:00
- (void) update;
- (NSDictionary *) infoForCurrentView;
- (void) startTransfer;
- (void) stopTransfer;
- (void) sleep;
- (void) wakeUp;
- (void) announce;
- (NSDate *) announceDate;
- (void) resetCache;
- (float) ratio;
- (int) ratioSetting;
- (void) setRatioSetting: (int) setting;
- (float) ratioLimit;
- (void) setRatioLimit: (float) limit;
- (float) actualStopRatio; //returns INVALID if will not stop
- (float) progressStopRatio;
- (int) checkUpload;
- (void) setCheckUpload: (int) setting;
- (int) uploadLimit;
- (void) setUploadLimit: (int) limit;
- (int) checkDownload;
- (void) setCheckDownload: (int) setting;
- (int) downloadLimit;
- (void) setDownloadLimit: (int) limit;
2007-05-09 05:07:44 +00:00
- (void) updateSpeedSetting;
2006-07-16 19:39:23 +00:00
- (void) setWaitToStart: (BOOL) wait;
- (BOOL) waitingToStart;
2007-05-09 05:07:44 +00:00
- (void) revealData;
- (void) revealPublicTorrent;
- (void) trashData;
- (void) trashTorrent;
- (void) moveTorrentDataFileTo: (NSString *) folder;
- (void) copyTorrentFileTo: (NSString *) path;
2006-07-16 19:39:23 +00:00
- (BOOL) alertForRemainingDiskSpace;
- (BOOL) alertForFolderAvailable;
- (BOOL) alertForMoveFolderAvailable;
- (NSImage *) icon;
- (NSImage *) iconFlipped;
- (NSImage *) iconSmall;
2006-07-16 19:39:23 +00:00
- (NSString *) name;
- (uint64_t) size;
- (NSString *) trackerAddress;
- (NSString *) trackerAddressAnnounce;
- (NSString *) comment;
- (NSString *) creator;
- (NSDate *) dateCreated;
- (int) pieceSize;
- (int) pieceCount;
2006-07-16 19:39:23 +00:00
- (NSString *) hashString;
- (BOOL) privateTorrent;
2006-07-16 19:39:23 +00:00
- (NSString *) torrentLocation;
- (NSString *) publicTorrentLocation;
- (NSString *) dataLocation;
- (BOOL) publicTorrent;
- (NSString *) stateString;
- (float) progress;
2007-06-20 23:53:09 +00:00
- (float) progressDone;
- (int) eta;
- (BOOL) isActive;
- (BOOL) isSeeding;
- (BOOL) isPaused;
- (BOOL) isChecking;
- (BOOL) allDownloaded;
- (BOOL) isError;
- (NSString *) errorMessage;
2006-07-16 19:39:23 +00:00
- (NSArray *) peers;
- (NSString *) progressString;
- (NSString *) statusString;
- (NSString *) shortStatusString;
- (NSString *) remainingTimeString;
2006-07-16 19:39:23 +00:00
- (int) seeders;
- (int) leechers;
- (int) completedFromTracker;
2007-03-23 08:28:01 +00:00
2006-07-16 19:39:23 +00:00
- (int) totalPeers;
2007-03-23 08:28:01 +00:00
- (int) totalPeersTracker;
- (int) totalPeersIncoming;
2007-03-23 08:28:01 +00:00
- (int) totalPeersCache;
- (int) totalPeersPex;
2006-07-16 19:39:23 +00:00
- (int) peersUploading;
- (int) peersDownloading;
- (float) downloadRate;
- (float) uploadRate;
- (uint64_t) downloadedValid;
- (uint64_t) downloadedTotal;
- (uint64_t) uploadedTotal;
- (float) swarmSpeed;
2006-07-16 19:39:23 +00:00
- (BOOL) pex;
2007-03-31 20:19:19 +00:00
- (void) setPex: (BOOL) setting;
2006-07-16 19:39:23 +00:00
- (NSNumber *) orderValue;
- (void) setOrderValue: (int) orderValue;
- (NSArray *) fileList;
2007-01-17 06:43:07 +00:00
- (int) fileCount;
- (float) fileProgress: (int) index;
- (int) checkForFiles: (NSIndexSet *) indexSet;
- (BOOL) canChangeDownloadCheckForFiles: (NSIndexSet *) indexSet;
- (void) setFileCheckState: (int) state forIndexes: (NSIndexSet *) indexSet;
- (void) setFilePriority: (int) priority forIndexes: (NSIndexSet *) indexSet;
- (BOOL) hasFilePriority: (int) priority forIndexes: (NSIndexSet *) indexSet;
2006-07-16 19:39:23 +00:00
2007-03-30 18:58:18 +00:00
- (NSDate *) dateAdded;
2007-03-31 01:00:51 +00:00
- (NSDate *) dateCompleted;
- (NSDate *) dateActivity;
2007-03-31 01:00:51 +00:00
- (int) stalledMinutes;
- (BOOL) isStalled;
2006-07-16 19:39:23 +00:00
- (NSNumber *) stateSortKey;
- (NSNumber *) progressSortKey;
2007-01-15 04:41:01 +00:00
- (NSNumber *) ratioSortKey;
2006-07-16 19:39:23 +00:00
- (int) torrentID;
2007-06-30 21:53:45 +00:00
- (const tr_info_t *) torrentInfo;
- (tr_stat_t *) torrentStat;
2006-07-16 19:39:23 +00:00
@end