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

store date completed internally

This commit is contained in:
Mitchell Livingston 2007-03-31 01:00:51 +00:00
parent f42bf86042
commit 57e28bd661
2 changed files with 25 additions and 6 deletions

View file

@ -35,7 +35,7 @@
tr_stat_t * fStat; tr_stat_t * fStat;
BOOL fResumeOnWake; BOOL fResumeOnWake;
NSDate * fDateAdded, * fAnnounceDate; NSDate * fDateAdded, * fDateCompleted, * fAnnounceDate;
BOOL fUseIncompleteFolder; BOOL fUseIncompleteFolder;
NSString * fDownloadFolder, * fIncompleteFolder; NSString * fDownloadFolder, * fIncompleteFolder;
@ -189,6 +189,8 @@
- (NSMutableDictionary *) resetFileCheckStateForItemParent: (NSMutableDictionary *) originalChild; - (NSMutableDictionary *) resetFileCheckStateForItemParent: (NSMutableDictionary *) originalChild;
- (NSDate *) dateAdded; - (NSDate *) dateAdded;
- (NSDate *) dateCompleted;
- (NSNumber *) stateSortKey; - (NSNumber *) stateSortKey;
- (NSNumber *) progressSortKey; - (NSNumber *) progressSortKey;
- (NSNumber *) ratioSortKey; - (NSNumber *) ratioSortKey;

View file

@ -34,7 +34,7 @@
- (id) initWithHash: (NSString *) hashString path: (NSString *) path lib: (tr_handle_t *) lib - (id) initWithHash: (NSString *) hashString path: (NSString *) path lib: (tr_handle_t *) lib
publicTorrent: (NSNumber *) publicTorrent publicTorrent: (NSNumber *) publicTorrent
dateAdded: (NSDate *) dateAdded dateAdded: (NSDate *) dateAdded dateCompleted: (NSDate *) dateCompleted
ratioSetting: (NSNumber *) ratioSetting ratioLimit: (NSNumber *) ratioLimit ratioSetting: (NSNumber *) ratioSetting ratioLimit: (NSNumber *) ratioLimit
limitSpeedCustom: (NSNumber *) limitCustom limitSpeedCustom: (NSNumber *) limitCustom
checkUpload: (NSNumber *) checkUpload uploadLimit: (NSNumber *) uploadLimit checkUpload: (NSNumber *) checkUpload uploadLimit: (NSNumber *) uploadLimit
@ -68,7 +68,7 @@ static uint32_t kRed = BE(0xFF6450FF), //255, 100, 80
{ {
self = [self initWithHash: nil path: path lib: lib self = [self initWithHash: nil path: path lib: lib
publicTorrent: delete ? [NSNumber numberWithBool: NO] : nil publicTorrent: delete ? [NSNumber numberWithBool: NO] : nil
dateAdded: nil dateAdded: nil dateCompleted: nil
ratioSetting: nil ratioLimit: nil ratioSetting: nil ratioLimit: nil
limitSpeedCustom: nil limitSpeedCustom: nil
checkUpload: nil uploadLimit: nil checkUpload: nil uploadLimit: nil
@ -92,6 +92,7 @@ static uint32_t kRed = BE(0xFF6450FF), //255, 100, 80
path: [history objectForKey: @"TorrentPath"] lib: lib path: [history objectForKey: @"TorrentPath"] lib: lib
publicTorrent: [history objectForKey: @"PublicCopy"] publicTorrent: [history objectForKey: @"PublicCopy"]
dateAdded: [history objectForKey: @"Date"] dateAdded: [history objectForKey: @"Date"]
dateCompleted: [history objectForKey: @"DateCompleted"]
ratioSetting: [history objectForKey: @"RatioSetting"] ratioSetting: [history objectForKey: @"RatioSetting"]
ratioLimit: [history objectForKey: @"RatioLimit"] ratioLimit: [history objectForKey: @"RatioLimit"]
limitSpeedCustom: [history objectForKey: @"LimitSpeedCustom"] limitSpeedCustom: [history objectForKey: @"LimitSpeedCustom"]
@ -169,7 +170,10 @@ static uint32_t kRed = BE(0xFF6450FF), //255, 100, 80
if (fPublicTorrent) if (fPublicTorrent)
[history setObject: [self publicTorrentLocation] forKey: @"TorrentPath"]; [history setObject: [self publicTorrentLocation] forKey: @"TorrentPath"];
if (fDateCompleted)
[history setObject: [self dateAdded] forKey: @"DateCompleted"];
return history; return history;
} }
@ -190,6 +194,8 @@ static uint32_t kRed = BE(0xFF6450FF), //255, 100, 80
tr_torrentRemoveSaved(fHandle); tr_torrentRemoveSaved(fHandle);
[fDateAdded release]; [fDateAdded release];
if (fDateCompleted)
[fDateCompleted release];
if (fAnnounceDate) if (fAnnounceDate)
[fAnnounceDate release]; [fAnnounceDate release];
@ -267,6 +273,10 @@ static uint32_t kRed = BE(0xFF6450FF), //255, 100, 80
fDownloadFolder = fIncompleteFolder; fDownloadFolder = fIncompleteFolder;
fIncompleteFolder = nil; fIncompleteFolder = nil;
} }
if (fDateCompleted)
[fDateCompleted release];
fDateCompleted = [[NSDate alloc] init];
fStat = tr_torrentStat(fHandle); fStat = tr_torrentStat(fHandle);
[[NSNotificationCenter defaultCenter] postNotificationName: @"TorrentFinishedDownloading" object: self]; [[NSNotificationCenter defaultCenter] postNotificationName: @"TorrentFinishedDownloading" object: self];
@ -1185,6 +1195,11 @@ static uint32_t kRed = BE(0xFF6450FF), //255, 100, 80
return fDateAdded; return fDateAdded;
} }
- (NSDate *) dateCompleted
{
return fDateCompleted;
}
- (NSNumber *) stateSortKey - (NSNumber *) stateSortKey
{ {
if (![self isActive]) if (![self isActive])
@ -1216,7 +1231,7 @@ static uint32_t kRed = BE(0xFF6450FF), //255, 100, 80
//if a hash is given, attempt to load that; otherwise, attempt to open file at path //if a hash is given, attempt to load that; otherwise, attempt to open file at path
- (id) initWithHash: (NSString *) hashString path: (NSString *) path lib: (tr_handle_t *) lib - (id) initWithHash: (NSString *) hashString path: (NSString *) path lib: (tr_handle_t *) lib
publicTorrent: (NSNumber *) publicTorrent publicTorrent: (NSNumber *) publicTorrent
dateAdded: (NSDate *) dateAdded dateAdded: (NSDate *) dateAdded dateCompleted: (NSDate *) dateCompleted
ratioSetting: (NSNumber *) ratioSetting ratioLimit: (NSNumber *) ratioLimit ratioSetting: (NSNumber *) ratioSetting ratioLimit: (NSNumber *) ratioLimit
limitSpeedCustom: (NSNumber *) limitCustom limitSpeedCustom: (NSNumber *) limitCustom
checkUpload: (NSNumber *) checkUpload uploadLimit: (NSNumber *) uploadLimit checkUpload: (NSNumber *) checkUpload uploadLimit: (NSNumber *) uploadLimit
@ -1253,7 +1268,9 @@ static uint32_t kRed = BE(0xFF6450FF), //255, 100, 80
fInfo = tr_torrentInfo(fHandle); fInfo = tr_torrentInfo(fHandle);
fDateAdded = dateAdded ? [dateAdded retain] : [[NSDate alloc] init]; fDateAdded = dateAdded ? [dateAdded retain] : [[NSDate alloc] init];
if (dateCompleted)
fDateCompleted = [dateCompleted retain];
fRatioSetting = ratioSetting ? [ratioSetting intValue] : NSMixedState; fRatioSetting = ratioSetting ? [ratioSetting intValue] : NSMixedState;
fRatioLimit = ratioLimit ? [ratioLimit floatValue] : [fDefaults floatForKey: @"RatioLimit"]; fRatioLimit = ratioLimit ? [ratioLimit floatValue] : [fDefaults floatForKey: @"RatioLimit"];
fFinishedSeeding = NO; fFinishedSeeding = NO;