1
0
Fork 0
mirror of https://github.com/transmission/transmission synced 2024-12-25 09:13:06 +00:00

Saves in history the date at which the torrent was loaded

This commit is contained in:
Eric Petit 2006-04-25 16:31:19 +00:00
parent cf56d58f06
commit 734845196a
3 changed files with 130 additions and 107 deletions

View file

@ -109,6 +109,7 @@ static void sleepCallBack( void * controller, io_service_t y,
NSLog( @"Could not IORegisterForSystemPower" ); NSLog( @"Could not IORegisterForSystemPower" );
NSString * torrentPath, * downloadFolder, * paused; NSString * torrentPath, * downloadFolder, * paused;
NSDate * date;
NSDictionary * dic; NSDictionary * dic;
Torrent * torrent; Torrent * torrent;
@ -122,7 +123,11 @@ static void sleepCallBack( void * controller, io_service_t y,
if (!torrentPath || !downloadFolder || !paused) if (!torrentPath || !downloadFolder || !paused)
continue; continue;
if ((date = [dic objectForKey: @"Date"]))
torrent = [[Torrent alloc] initWithPath: torrentPath lib: fLib date: date];
else
torrent = [[Torrent alloc] initWithPath: torrentPath lib: fLib]; torrent = [[Torrent alloc] initWithPath: torrentPath lib: fLib];
if( !torrent ) if( !torrent )
continue; continue;
@ -679,6 +684,7 @@ static void sleepCallBack( void * controller, io_service_t y,
[torrent path], @"TorrentPath", [torrent path], @"TorrentPath",
[torrent getFolder], @"DownloadFolder", [torrent getFolder], @"DownloadFolder",
[torrent isActive] ? @"NO" : @"YES", @"Paused", [torrent isActive] ? @"NO" : @"YES", @"Paused",
[torrent date], @"Date",
nil]]; nil]];
} }

View file

@ -30,6 +30,7 @@
tr_info_t * fInfo; tr_info_t * fInfo;
tr_stat_t * fStat; tr_stat_t * fStat;
BOOL fResumeOnWake; BOOL fResumeOnWake;
NSDate * fDate;
NSImage * fIcon; NSImage * fIcon;
NSImage * fIconNonFlipped; NSImage * fIconNonFlipped;
@ -40,6 +41,8 @@
} }
- (id) initWithPath: (NSString *) path lib: (tr_handle_t *) lib; - (id) initWithPath: (NSString *) path lib: (tr_handle_t *) lib;
- (id) initWithPath: (NSString *) path lib: (tr_handle_t *) lib
date: (NSDate *) date;
- (void) setFolder: (NSString *) path; - (void) setFolder: (NSString *) path;
- (NSString *) getFolder; - (NSString *) getFolder;
- (void) getAvailability: (int8_t *) tab size: (int) size; - (void) getAvailability: (int8_t *) tab size: (int) size;
@ -78,5 +81,6 @@
- (int) leechers; - (int) leechers;
- (uint64_t) downloaded; - (uint64_t) downloaded;
- (uint64_t) uploaded; - (uint64_t) uploaded;
- (NSDate *) date;
@end @end

View file

@ -33,7 +33,7 @@
@implementation Torrent @implementation Torrent
- (id) initWithPath: (NSString *) path lib: (tr_handle_t *) lib - (id) initWithPath: (NSString *) path lib: (tr_handle_t *) lib date: (NSDate *) date
{ {
fLib = lib; fLib = lib;
@ -45,6 +45,7 @@
return nil; return nil;
} }
fDate = [date retain];
fInfo = tr_torrentInfo( fHandle ); fInfo = tr_torrentInfo( fHandle );
NSString * fileType = ( fInfo->fileCount > 1 ) ? NSString * fileType = ( fInfo->fileCount > 1 ) ?
@ -64,12 +65,19 @@
return self; return self;
} }
- (id) initWithPath: (NSString *) path lib: (tr_handle_t *) lib
{
return [self initWithPath: path lib: lib date: [NSDate date]];
}
- (void) dealloc - (void) dealloc
{ {
if( fHandle ) if( fHandle )
{ {
tr_torrentClose( fLib, fHandle ); tr_torrentClose( fLib, fHandle );
[fDate release];
[fIcon release]; [fIcon release];
[fIconNonFlipped release];
[fStatusString release]; [fStatusString release];
[fInfoString release]; [fInfoString release];
[fDownloadString release]; [fDownloadString release];
@ -351,6 +359,11 @@
return fStat->uploaded; return fStat->uploaded;
} }
- (NSDate *) date
{
return fDate;
}
@end @end