Commit eecfe431 authored by Felix Paul Kühne's avatar Felix Paul Kühne

macosx: add file size column to playlist table (close #9497)

parent 34b896f9
......@@ -76,11 +76,13 @@ static VLCMainMenu *_o_sharedInstance = nil;
_NS("Date"), DATE_COLUMN,
_NS("Language"), LANGUAGE_COLUMN,
_NS("URI"), URI_COLUMN,
_NS("File Size"), FILESIZE_COLUMN,
nil];
// this array also assigns tags (index) to type of menu item
o_ptc_menuorder = [[NSArray alloc] initWithObjects: TRACKNUM_COLUMN, TITLE_COLUMN,
ARTIST_COLUMN, DURATION_COLUMN, GENRE_COLUMN, ALBUM_COLUMN,
DESCRIPTION_COLUMN, DATE_COLUMN, LANGUAGE_COLUMN, URI_COLUMN, nil];
DESCRIPTION_COLUMN, DATE_COLUMN, LANGUAGE_COLUMN, URI_COLUMN,
FILESIZE_COLUMN,nil];
}
return _o_sharedInstance;
......
......@@ -36,6 +36,7 @@
#define DATE_COLUMN @"date"
#define LANGUAGE_COLUMN @"language"
#define URI_COLUMN @"uri"
#define FILESIZE_COLUMN @"file-size"
/*****************************************************************************
* VLCPlaylistView interface
......
......@@ -363,6 +363,22 @@
free(psz_value);
}
}
else if ([o_identifier isEqualToString:FILESIZE_COLUMN]) {
psz_value = input_item_GetURI(p_item->p_input);
o_value = @"";
if (psz_value) {
NSURL *url = [NSURL URLWithString:[NSString stringWithUTF8String:psz_value]];
if ([url isFileURL]) {
NSFileManager *fileManager = [NSFileManager defaultManager];
if ([fileManager fileExistsAtPath:[url path]]) {
NSError *error;
NSDictionary *attributes = [fileManager attributesOfItemAtPath:[url path] error:&error];
o_value = [NSByteCountFormatter stringFromByteCount:[attributes fileSize] countStyle:NSByteCountFormatterCountStyleDecimal];
}
}
free(psz_value);
}
}
else if ([o_identifier isEqualToString:@"status"]) {
if (input_item_HasErrorWhenReading(p_item->p_input)) {
o_value = [[NSWorkspace sharedWorkspace] iconForFileType:NSFileTypeForHFSTypeCode(kAlertCautionIcon)];
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment