Display and add annotations
This commit is contained in:
parent
4a7c4ac7e0
commit
272e2720eb
|
@ -18,6 +18,10 @@
|
|||
@property (nonatomic, retain) NSString * notes;
|
||||
@property (nonatomic, retain) NSSet *tags;
|
||||
@property (nonatomic, retain) NSManagedObject *media;
|
||||
|
||||
- (NSString *)shortLocation;
|
||||
+ (NSSet *)keyPathsForValuesAffectingShortLocation;
|
||||
|
||||
@end
|
||||
|
||||
@interface MAAnno (CoreDataGeneratedAccessors)
|
||||
|
|
|
@ -16,4 +16,37 @@
|
|||
@dynamic tags;
|
||||
@dynamic media;
|
||||
|
||||
- (NSString *)shortLocation
|
||||
{
|
||||
NSString * location = self.location;
|
||||
NSRange rangeToUse = {0,0};
|
||||
//
|
||||
// Trim leading zeros, up to a point
|
||||
//
|
||||
while (rangeToUse.location < 6) {
|
||||
switch ([location characterAtIndex:rangeToUse.location]) {
|
||||
case '0':
|
||||
case ':':
|
||||
++rangeToUse.location;
|
||||
continue;
|
||||
}
|
||||
break;
|
||||
}
|
||||
//
|
||||
// Trim fractions of seconds
|
||||
//
|
||||
for (rangeToUse.length = [location length]-rangeToUse.location; rangeToUse.length-- > 0; )
|
||||
if ([location characterAtIndex:rangeToUse.location+rangeToUse.length] == '.')
|
||||
break;
|
||||
if (!rangeToUse.length)
|
||||
rangeToUse.length = [location length]-rangeToUse.location;
|
||||
|
||||
return [location substringWithRange:rangeToUse];
|
||||
}
|
||||
|
||||
+ (NSSet *)keyPathsForValuesAffectingShortLocation
|
||||
{
|
||||
return [NSSet setWithObject:@"location"];
|
||||
}
|
||||
|
||||
@end
|
||||
|
|
|
@ -9,9 +9,13 @@
|
|||
#import <Cocoa/Cocoa.h>
|
||||
|
||||
@interface MADocWindow : NSWindowController {
|
||||
IBOutlet NSArrayController* mediaController;
|
||||
IBOutlet NSArrayController* annotationController;
|
||||
IBOutlet QTMovieView * movieView;
|
||||
}
|
||||
|
||||
- (IBAction)addMediaFiles:(id)sender;
|
||||
- (void)addMedia:(NSArray *)urls;
|
||||
- (IBAction)addAnnotation:(id)sender;
|
||||
|
||||
@end
|
||||
|
|
|
@ -17,9 +17,6 @@
|
|||
- (id)initWithWindow:(NSWindow *)window
|
||||
{
|
||||
self = [super initWithWindow:window];
|
||||
if (self) {
|
||||
// Initialization code here.
|
||||
}
|
||||
|
||||
return self;
|
||||
}
|
||||
|
@ -27,8 +24,8 @@
|
|||
- (void)windowDidLoad
|
||||
{
|
||||
[super windowDidLoad];
|
||||
|
||||
// Implement this method to handle any initialization after your window controller's window has been loaded from its nib file.
|
||||
[mediaController setSortDescriptors:[NSArray arrayWithObject:[NSSortDescriptor sortDescriptorWithKey:@"name" ascending:YES]]];
|
||||
[annotationController setSortDescriptors:[NSArray arrayWithObject:[NSSortDescriptor sortDescriptorWithKey:@"location" ascending:YES]]];
|
||||
}
|
||||
|
||||
#pragma mark Media management
|
||||
|
@ -83,4 +80,10 @@
|
|||
[[[MAAddMediaSheet alloc] init] runWithParentWindow:self media:expandedURLs];
|
||||
}
|
||||
|
||||
- (IBAction)addAnnotation:(id)sender
|
||||
{
|
||||
QTTime location = [[movieView movie] currentTime];
|
||||
[[self document] addAnnotationForMedia:[[mediaController selectedObjects] objectAtIndex:0] location:location];
|
||||
}
|
||||
|
||||
@end
|
||||
|
|
|
@ -7,11 +7,15 @@
|
|||
//
|
||||
|
||||
#import <Cocoa/Cocoa.h>
|
||||
#import <QTKit/QTKit.h>
|
||||
|
||||
@class MAMedia;
|
||||
|
||||
@interface MADocument : NSPersistentDocument {
|
||||
NSFileWrapper * mediaWrapper;
|
||||
}
|
||||
|
||||
- (void)addMediaURL:(NSURL *)url name:(NSString *)name date:(NSDate *)date copying:(BOOL)copying;
|
||||
- (void)addAnnotationForMedia:(MAMedia *)media location:(QTTime)location;
|
||||
|
||||
@end
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
#import "MADocWindow.h"
|
||||
#import "MAFolder.h"
|
||||
#import "MAMedia.h"
|
||||
#import "MAAnno.h"
|
||||
|
||||
#pragma mark -
|
||||
#pragma mark MADocument
|
||||
|
@ -73,11 +74,23 @@
|
|||
MAMedia * media = [NSEntityDescription insertNewObjectForEntityForName:@"MAMedia" inManagedObjectContext:moc];
|
||||
NSString * path = [url path];
|
||||
media.media = path;
|
||||
media.date = [date timeIntervalSince1970];
|
||||
media.date = [date timeIntervalSinceReferenceDate];
|
||||
media.name = name;
|
||||
media.notes = @"";
|
||||
media.folder= inbox;
|
||||
[moc processPendingChanges];
|
||||
}
|
||||
|
||||
#pragma mark -
|
||||
#pragma mark Annotation management
|
||||
|
||||
- (void)addAnnotationForMedia:(MAMedia *)media location:(QTTime)location
|
||||
{
|
||||
NSManagedObjectContext *moc = [self managedObjectContext];
|
||||
MAAnno * annotation = [NSEntityDescription insertNewObjectForEntityForName:@"MAAnno" inManagedObjectContext:moc];
|
||||
annotation.media = media;
|
||||
annotation.location = QTStringFromTime(location);
|
||||
annotation.notes = @"";
|
||||
[moc processPendingChanges];
|
||||
}
|
||||
|
||||
@end
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -273,6 +273,26 @@
|
|||
<reference key="NSOnImage" ref="1033313550"/>
|
||||
<reference key="NSMixedImage" ref="310636482"/>
|
||||
</object>
|
||||
<object class="NSMenuItem" id="906148750">
|
||||
<reference key="NSMenu" ref="720053764"/>
|
||||
<bool key="NSIsDisabled">YES</bool>
|
||||
<bool key="NSIsSeparator">YES</bool>
|
||||
<string key="NSTitle"/>
|
||||
<string key="NSKeyEquiv"/>
|
||||
<int key="NSKeyEquivModMask">1048576</int>
|
||||
<int key="NSMnemonicLoc">2147483647</int>
|
||||
<reference key="NSOnImage" ref="1033313550"/>
|
||||
<reference key="NSMixedImage" ref="310636482"/>
|
||||
</object>
|
||||
<object class="NSMenuItem" id="7029338">
|
||||
<reference key="NSMenu" ref="720053764"/>
|
||||
<string key="NSTitle">Add Media Files…</string>
|
||||
<string key="NSKeyEquiv">A</string>
|
||||
<int key="NSKeyEquivModMask">1048576</int>
|
||||
<int key="NSMnemonicLoc">2147483647</int>
|
||||
<reference key="NSOnImage" ref="1033313550"/>
|
||||
<reference key="NSMixedImage" ref="310636482"/>
|
||||
</object>
|
||||
<object class="NSMenuItem" id="1010469920">
|
||||
<reference key="NSMenu" ref="720053764"/>
|
||||
<bool key="NSIsDisabled">YES</bool>
|
||||
|
@ -748,22 +768,22 @@
|
|||
</object>
|
||||
</object>
|
||||
</object>
|
||||
<object class="NSMenuItem" id="386451183">
|
||||
<object class="NSMenuItem" id="610990130">
|
||||
<reference key="NSMenu" ref="649796088"/>
|
||||
<string key="NSTitle">Collection</string>
|
||||
<string key="NSTitle">Annotate</string>
|
||||
<string key="NSKeyEquiv"/>
|
||||
<int key="NSMnemonicLoc">2147483647</int>
|
||||
<reference key="NSOnImage" ref="1033313550"/>
|
||||
<reference key="NSMixedImage" ref="310636482"/>
|
||||
<string key="NSAction">submenuAction:</string>
|
||||
<object class="NSMenu" key="NSSubmenu" id="281430727">
|
||||
<string key="NSTitle">Collection</string>
|
||||
<object class="NSMenu" key="NSSubmenu" id="352060197">
|
||||
<string key="NSTitle">Annotate</string>
|
||||
<object class="NSMutableArray" key="NSMenuItems">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
<object class="NSMenuItem" id="504872562">
|
||||
<reference key="NSMenu" ref="281430727"/>
|
||||
<string key="NSTitle">Add Media Files…</string>
|
||||
<string key="NSKeyEquiv">A</string>
|
||||
<object class="NSMenuItem" id="590509802">
|
||||
<reference key="NSMenu" ref="352060197"/>
|
||||
<string key="NSTitle">Add Annotation</string>
|
||||
<string key="NSKeyEquiv">t</string>
|
||||
<int key="NSKeyEquivModMask">1048576</int>
|
||||
<int key="NSMnemonicLoc">2147483647</int>
|
||||
<reference key="NSOnImage" ref="1033313550"/>
|
||||
|
@ -1258,10 +1278,18 @@
|
|||
<object class="IBActionConnection" key="connection">
|
||||
<string key="label">addMediaFiles:</string>
|
||||
<reference key="source" ref="1014"/>
|
||||
<reference key="destination" ref="504872562"/>
|
||||
<reference key="destination" ref="7029338"/>
|
||||
</object>
|
||||
<int key="connectionID">539</int>
|
||||
</object>
|
||||
<object class="IBConnectionRecord">
|
||||
<object class="IBActionConnection" key="connection">
|
||||
<string key="label">addAnnotation:</string>
|
||||
<reference key="source" ref="1014"/>
|
||||
<reference key="destination" ref="590509802"/>
|
||||
</object>
|
||||
<int key="connectionID">542</int>
|
||||
</object>
|
||||
</object>
|
||||
<object class="IBMutableOrderedSet" key="objectRecords">
|
||||
<object class="NSArray" key="orderedObjects">
|
||||
|
@ -1301,7 +1329,7 @@
|
|||
<reference ref="379814623"/>
|
||||
<reference ref="586577488"/>
|
||||
<reference ref="1050483726"/>
|
||||
<reference ref="386451183"/>
|
||||
<reference ref="610990130"/>
|
||||
</object>
|
||||
<reference key="parent" ref="0"/>
|
||||
</object>
|
||||
|
@ -1356,6 +1384,8 @@
|
|||
<reference ref="425164168"/>
|
||||
<reference ref="579971712"/>
|
||||
<reference ref="1010469920"/>
|
||||
<reference ref="906148750"/>
|
||||
<reference ref="7029338"/>
|
||||
</object>
|
||||
<reference key="parent" ref="379814623"/>
|
||||
</object>
|
||||
|
@ -1903,26 +1933,36 @@
|
|||
</object>
|
||||
<object class="IBObjectRecord">
|
||||
<int key="objectID">536</int>
|
||||
<reference key="object" ref="386451183"/>
|
||||
<reference key="object" ref="610990130"/>
|
||||
<object class="NSMutableArray" key="children">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
<reference ref="281430727"/>
|
||||
<reference ref="352060197"/>
|
||||
</object>
|
||||
<reference key="parent" ref="649796088"/>
|
||||
</object>
|
||||
<object class="IBObjectRecord">
|
||||
<int key="objectID">537</int>
|
||||
<reference key="object" ref="281430727"/>
|
||||
<reference key="object" ref="352060197"/>
|
||||
<object class="NSMutableArray" key="children">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
<reference ref="504872562"/>
|
||||
<reference ref="590509802"/>
|
||||
</object>
|
||||
<reference key="parent" ref="386451183"/>
|
||||
<reference key="parent" ref="610990130"/>
|
||||
</object>
|
||||
<object class="IBObjectRecord">
|
||||
<int key="objectID">540</int>
|
||||
<reference key="object" ref="906148750"/>
|
||||
<reference key="parent" ref="720053764"/>
|
||||
</object>
|
||||
<object class="IBObjectRecord">
|
||||
<int key="objectID">538</int>
|
||||
<reference key="object" ref="504872562"/>
|
||||
<reference key="parent" ref="281430727"/>
|
||||
<reference key="object" ref="7029338"/>
|
||||
<reference key="parent" ref="720053764"/>
|
||||
</object>
|
||||
<object class="IBObjectRecord">
|
||||
<int key="objectID">541</int>
|
||||
<reference key="object" ref="590509802"/>
|
||||
<reference key="parent" ref="352060197"/>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
|
@ -2011,6 +2051,8 @@
|
|||
<string>536.IBPluginDependency</string>
|
||||
<string>537.IBPluginDependency</string>
|
||||
<string>538.IBPluginDependency</string>
|
||||
<string>540.IBPluginDependency</string>
|
||||
<string>541.IBPluginDependency</string>
|
||||
<string>56.IBPluginDependency</string>
|
||||
<string>57.IBPluginDependency</string>
|
||||
<string>58.IBPluginDependency</string>
|
||||
|
@ -2123,6 +2165,8 @@
|
|||
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
|
||||
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
|
||||
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
|
||||
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
|
||||
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
|
||||
</object>
|
||||
</object>
|
||||
<object class="NSMutableDictionary" key="unlocalizedProperties">
|
||||
|
@ -2137,7 +2181,7 @@
|
|||
<reference key="dict.values" ref="0"/>
|
||||
</object>
|
||||
<nil key="sourceID"/>
|
||||
<int key="maxID">539</int>
|
||||
<int key="maxID">542</int>
|
||||
</object>
|
||||
<object class="IBClassDescriber" key="IBDocument.Classes">
|
||||
<object class="NSMutableArray" key="referencedPartialClassDescriptions">
|
||||
|
@ -2179,6 +2223,25 @@
|
|||
<string key="minorKey">./Classes/MADocWindow.h</string>
|
||||
</object>
|
||||
</object>
|
||||
<object class="IBPartialClassDescription">
|
||||
<string key="className">MADocument</string>
|
||||
<string key="superclassName">NSPersistentDocument</string>
|
||||
<object class="NSMutableDictionary" key="actions">
|
||||
<string key="NS.key.0">addAnnotation:</string>
|
||||
<string key="NS.object.0">id</string>
|
||||
</object>
|
||||
<object class="NSMutableDictionary" key="actionInfosByName">
|
||||
<string key="NS.key.0">addAnnotation:</string>
|
||||
<object class="IBActionInfo" key="NS.object.0">
|
||||
<string key="name">addAnnotation:</string>
|
||||
<string key="candidateClassName">id</string>
|
||||
</object>
|
||||
</object>
|
||||
<object class="IBClassDescriptionSource" key="sourceIdentifier">
|
||||
<string key="majorKey">IBProjectSource</string>
|
||||
<string key="minorKey">./Classes/MADocument.h</string>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
<int key="IBDocument.localizationMode">0</int>
|
||||
|
|
Loading…
Reference in New Issue
Block a user