mirror of
https://github.com/transmission/transmission
synced 2025-03-03 10:15:45 +00:00
add support in libT and the mac interface for displaying comment, creator, and date created
This commit is contained in:
parent
d9e3d6b0b1
commit
4306c7cfa5
10 changed files with 70 additions and 6 deletions
|
@ -191,6 +191,24 @@ int tr_metainfoParse( tr_info_t * inf, const char * path,
|
|||
}
|
||||
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" ) ) )
|
||||
{
|
||||
|
|
|
@ -319,6 +319,11 @@ struct tr_info_s
|
|||
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;
|
||||
int pieceCount;
|
||||
|
|
|
@ -94,7 +94,7 @@
|
|||
Badger * fBadger;
|
||||
|
||||
NSMutableArray * fAutoImportedNames;
|
||||
NSMutableDictionary * fPendingTorrentDownloads;
|
||||
NSMutableDictionary * fPendingTorrentDownloads;
|
||||
}
|
||||
|
||||
- (void) openFiles: (NSArray *) filenames;
|
||||
|
|
3
macosx/English.lproj/InfoWindow.nib/classes.nib
generated
3
macosx/English.lproj/InfoWindow.nib/classes.nib
generated
|
@ -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;
|
||||
|
|
2
macosx/English.lproj/InfoWindow.nib/info.nib
generated
2
macosx/English.lproj/InfoWindow.nib/info.nib
generated
|
@ -3,7 +3,7 @@
|
|||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>IBDocumentLocation</key>
|
||||
<string>69 61 356 240 0 0 1152 842 </string>
|
||||
<string>58 51 356 240 0 0 1024 746 </string>
|
||||
<key>IBEditorPositions</key>
|
||||
<dict>
|
||||
<key>549</key>
|
||||
|
|
BIN
macosx/English.lproj/InfoWindow.nib/keyedobjects.nib
generated
BIN
macosx/English.lproj/InfoWindow.nib/keyedobjects.nib
generated
Binary file not shown.
|
@ -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;
|
||||
|
|
|
@ -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];
|
||||
|
||||
|
|
|
@ -107,6 +107,11 @@
|
|||
- (uint64_t) size;
|
||||
- (NSString *) tracker;
|
||||
- (NSString *) announce;
|
||||
|
||||
- (NSString *) comment;
|
||||
- (NSString *) creator;
|
||||
- (NSDate *) dateCreated;
|
||||
|
||||
- (int) pieceSize;
|
||||
- (int) pieceCount;
|
||||
- (NSString *) hashString;
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue