Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Edit Tags: Image subtitle with type, dimensions

  • Loading branch information...
commit aed9b5057fc685608d8b9f0b6dde48d31bf688bf 1 parent 83af073
Brian Wells authored
1  Edit MPEG-4 Metadata Tags/AlbumArt.h
View
@@ -39,6 +39,7 @@
@interface AlbumArt : NSManagedObject <NSPasteboardWriting> {
NSUInteger imageVersion;
+ NSString *imageTitle;
}
@property NSUInteger imageVersion;
41 Edit MPEG-4 Metadata Tags/AlbumArt.m
View
@@ -41,6 +41,13 @@ @implementation AlbumArt
@synthesize imageVersion;
@dynamic primitiveImageRepresentation;
+- (void) dealloc
+{
+ [imageTitle release];
+ imageTitle = nil;
+ [super dealloc];
+}
+
- (void)setImageRepresentation:(NSData *)data {
[self willChangeValueForKey:@"imageRepresentation"];
[self setPrimitiveImageRepresentation:data];
@@ -56,6 +63,40 @@ - (NSString *)imageUID {
return [[[self objectID] URIRepresentation] description];
}
+- (NSString *)imageSubtitle {
+ if (!imageTitle) {
+ NSUInteger artwork_type = [[self valueForKey:@"imageType"] unsignedIntegerValue];
+ NSString *imageType;
+ switch (artwork_type) {
+ case MP4_ART_JPEG:
+ imageType = @"JPEG";
+ break;
+ case MP4_ART_PNG:
+ imageType = @"PNG";
+ break;
+ case MP4_ART_BMP:
+ imageType = @"BMP";
+ break;
+ case MP4_ART_GIF:
+ imageType = @"GIF";
+ break;
+ default:
+ imageType = @"Image";
+ break;
+ }
+ // get image size
+ NSData *imageData = [self valueForKey:@"imageRepresentation"];
+ NSImage *image = [[NSImage alloc] initWithData:imageData];
+ if (image) {
+ NSSize imageSize = [image size];
+ imageTitle = [NSString stringWithFormat:@"%@ (%.0f x %.0f)",imageType,imageSize.width,imageSize.height];
+ } else {
+ imageTitle = [NSString stringWithString:imageType];
+ }
+ }
+ return imageTitle;
+}
+
- (NSArray *)writableTypesForPasteboard:(NSPasteboard *)pasteboard {
NSUInteger artwork_type = [[self valueForKey:@"imageType"] unsignedIntegerValue];
NSString *dataType = nil;
2  Edit MPEG-4 Metadata Tags/English.lproj/main.xib
View
@@ -1877,7 +1877,7 @@
<string key="NSFrameSize">{466, 98}</string>
<reference key="NSSuperview" ref="342699628"/>
<bool key="constrainsToOriginalSize">NO</bool>
- <bool key="cellsHaveSubtitle">NO</bool>
+ <bool key="cellsHaveSubtitle">YES</bool>
<bool key="cellsHaveTitle">NO</bool>
<bool key="outlinesCells">NO</bool>
<bool key="shadowsCells">YES</bool>
Please sign in to comment.
Something went wrong with that request. Please try again.