diff --git a/libtransmission/metainfo.c b/libtransmission/metainfo.c index 801a4a774..8977cfa80 100644 --- a/libtransmission/metainfo.c +++ b/libtransmission/metainfo.c @@ -190,6 +190,24 @@ int tr_metainfoParse( tr_info_t * inf, const char * path, return 1; } snprintf( inf->trackerAnnounce, MAX_PATH_LENGTH, "%s", s2 ); + + /* Comment info */ + if( ( val = tr_bencDictFind( &meta, "comment" ) ) ) + { + strcatUTF8( inf->comment, val->val.s.s ); + } + + /* Creator info */ + if( ( val = tr_bencDictFind( &meta, "created by" ) ) ) + { + strcatUTF8( inf->creator, val->val.s.s ); + } + + /* Date created */ + if( ( val = tr_bencDictFind( &meta, "creation date" ) ) ) + { + inf->dateCreated = val->val.i; + } /* Piece length */ if( !( val = tr_bencDictFind( beInfo, "piece length" ) ) ) diff --git a/libtransmission/transmission.h b/libtransmission/transmission.h index 16fa29cb3..c55128199 100644 --- a/libtransmission/transmission.h +++ b/libtransmission/transmission.h @@ -318,6 +318,11 @@ struct tr_info_s char trackerAddress[256]; int trackerPort; char trackerAnnounce[MAX_PATH_LENGTH]; + + /* Torrent info */ + char comment[MAX_PATH_LENGTH]; + char creator[MAX_PATH_LENGTH]; + int dateCreated; /* Pieces info */ int pieceSize; diff --git a/macosx/Controller.h b/macosx/Controller.h index 3a0b509b6..aa6f48716 100644 --- a/macosx/Controller.h +++ b/macosx/Controller.h @@ -94,7 +94,7 @@ Badger * fBadger; NSMutableArray * fAutoImportedNames; - NSMutableDictionary * fPendingTorrentDownloads; + NSMutableDictionary * fPendingTorrentDownloads; } - (void) openFiles: (NSArray *) filenames; diff --git a/macosx/English.lproj/InfoWindow.nib/classes.nib b/macosx/English.lproj/InfoWindow.nib/classes.nib index c90acacb7..df8acf1df 100644 --- a/macosx/English.lproj/InfoWindow.nib/classes.nib +++ b/macosx/English.lproj/InfoWindow.nib/classes.nib @@ -19,8 +19,11 @@ LANGUAGE = ObjC; OUTLETS = { fAnnounceField = NSTextField; + fCommentField = NSTextField; fConnectedPeersField = NSTextField; + fCreatorField = NSTextField; fDataLocationField = NSTextField; + fDateCreatedField = NSTextField; fDateStartedField = NSTextField; fDownloadedTotalField = NSTextField; fDownloadedValidField = NSTextField; diff --git a/macosx/English.lproj/InfoWindow.nib/info.nib b/macosx/English.lproj/InfoWindow.nib/info.nib index 75fb3ace8..79cb4c496 100644 --- a/macosx/English.lproj/InfoWindow.nib/info.nib +++ b/macosx/English.lproj/InfoWindow.nib/info.nib @@ -3,7 +3,7 @@ IBDocumentLocation - 69 61 356 240 0 0 1152 842 + 58 51 356 240 0 0 1024 746 IBEditorPositions 549 diff --git a/macosx/English.lproj/InfoWindow.nib/keyedobjects.nib b/macosx/English.lproj/InfoWindow.nib/keyedobjects.nib index cc376cfbf..bbef6fe2e 100644 Binary files a/macosx/English.lproj/InfoWindow.nib/keyedobjects.nib and b/macosx/English.lproj/InfoWindow.nib/keyedobjects.nib differ diff --git a/macosx/InfoWindowController.h b/macosx/InfoWindowController.h index 11f534620..3d5385fd3 100644 --- a/macosx/InfoWindowController.h +++ b/macosx/InfoWindowController.h @@ -38,9 +38,11 @@ IBOutlet NSImageView * fImageView; IBOutlet NSTextField * fNameField, * fSizeField, * fTrackerField, * fAnnounceField, * fPieceSizeField, * fPiecesField, - * fHashField, + * fHashField, * fCommentField, * fTorrentLocationField, * fDataLocationField, - * fDateStartedField, * fStateField, + * fDateStartedField, + * fCreatorField, * fDateCreatedField, + * fStateField, * fDownloadedValidField, * fDownloadedTotalField, * fUploadedTotalField, * fRatioField, * fSwarmSpeedField; IBOutlet NSButton * fRevealDataButton, * fRevealTorrentButton; diff --git a/macosx/InfoWindowController.m b/macosx/InfoWindowController.m index 3c092a91a..b1cf5dd5b 100644 --- a/macosx/InfoWindowController.m +++ b/macosx/InfoWindowController.m @@ -39,7 +39,7 @@ #define TAB_OPTIONS_IDENT @"Options" //15 spacing at the bottom of each tab -#define TAB_INFO_HEIGHT 182.0 +#define TAB_INFO_HEIGHT 255.0 #define TAB_ACTIVITY_HEIGHT 109.0 #define TAB_PEERS_HEIGHT 260.0 #define TAB_FILES_HEIGHT 260.0 @@ -157,6 +157,11 @@ [fPiecesField setStringValue: @""]; [fHashField setStringValue: @""]; [fHashField setToolTip: nil]; + [fCommentField setStringValue: @""]; + [fCommentField setToolTip: @""]; + + [fCreatorField setStringValue: @""]; + [fDateCreatedField setStringValue: @""]; [fTorrentLocationField setStringValue: @""]; [fTorrentLocationField setToolTip: nil]; @@ -171,6 +176,8 @@ [fTrackerField setSelectable: NO]; [fAnnounceField setSelectable: NO]; [fHashField setSelectable: NO]; + [fCommentField setSelectable: NO]; + [fCreatorField setSelectable: NO]; [fTorrentLocationField setSelectable: NO]; [fDataLocationField setSelectable: NO]; @@ -202,7 +209,8 @@ NSString * tracker = [torrent tracker], * announce = [torrent announce], - * hashString = [torrent hashString]; + * hashString = [torrent hashString], + * commentString = [torrent comment]; [fTrackerField setStringValue: tracker]; [fTrackerField setToolTip: tracker]; [fAnnounceField setStringValue: announce]; @@ -211,6 +219,11 @@ [fPiecesField setIntValue: [torrent pieceCount]]; [fHashField setStringValue: hashString]; [fHashField setToolTip: hashString]; + [fCommentField setStringValue: commentString]; + [fCommentField setToolTip: commentString]; + + [fCreatorField setStringValue: [torrent creator]]; + [fDateCreatedField setObjectValue: [torrent dateCreated]]; BOOL publicTorrent = [torrent publicTorrent]; [fTorrentLocationField setStringValue: publicTorrent @@ -231,6 +244,8 @@ [fTrackerField setSelectable: YES]; [fAnnounceField setSelectable: YES]; [fHashField setSelectable: YES]; + [fCommentField setSelectable: YES]; + [fCreatorField setSelectable: YES]; [fTorrentLocationField setSelectable: YES]; [fDataLocationField setSelectable: YES]; diff --git a/macosx/Torrent.h b/macosx/Torrent.h index 015ae093f..648a5b5b4 100644 --- a/macosx/Torrent.h +++ b/macosx/Torrent.h @@ -107,6 +107,11 @@ - (uint64_t) size; - (NSString *) tracker; - (NSString *) announce; + +- (NSString *) comment; +- (NSString *) creator; +- (NSDate *) dateCreated; + - (int) pieceSize; - (int) pieceCount; - (NSString *) hashString; diff --git a/macosx/Torrent.m b/macosx/Torrent.m index b63c02c05..2b83a9098 100644 --- a/macosx/Torrent.m +++ b/macosx/Torrent.m @@ -712,6 +712,22 @@ static uint32_t kRed = BE(0xFF6450FF), //255, 100, 80 return [NSString stringWithUTF8String: fInfo->trackerAnnounce]; } +- (NSString *) comment +{ + return [NSString stringWithUTF8String: fInfo->comment]; +} + +- (NSString *) creator +{ + return [NSString stringWithUTF8String: fInfo->creator]; +} + +- (NSDate *) dateCreated +{ + int date = fInfo->dateCreated; + return date > 0 ? [NSDate dateWithTimeIntervalSince1970: fInfo->dateCreated] : nil; +} + - (int) pieceSize { return fInfo->pieceSize;