From 7bf30dc43e50b801b4eda5e31df124fcdb1ea144 Mon Sep 17 00:00:00 2001 From: Matthias Neeracher Date: Tue, 16 Aug 2011 03:57:53 +0200 Subject: [PATCH] Get rid of MAFolder. We decided on a more lightweight document format, so this eliminates pointless complexity --- Medianno.xcodeproj/project.pbxproj | 6 - Medianno/MADocument.mm | 26 ---- .../MADocument.xcdatamodel/contents | 9 +- Medianno/MAFolder.h | 33 ----- Medianno/MAFolder.mm | 19 --- Medianno/MAMedia.h | 2 +- Medianno/MAMedia.mm | 5 +- Medianno/en.lproj/MADocument.xib | 140 ++---------------- 8 files changed, 18 insertions(+), 222 deletions(-) delete mode 100644 Medianno/MAFolder.h delete mode 100644 Medianno/MAFolder.mm diff --git a/Medianno.xcodeproj/project.pbxproj b/Medianno.xcodeproj/project.pbxproj index 93b33a6..a070e73 100644 --- a/Medianno.xcodeproj/project.pbxproj +++ b/Medianno.xcodeproj/project.pbxproj @@ -17,7 +17,6 @@ 950BB68713F1F26200D8E669 /* MADocument.xcdatamodeld in Sources */ = {isa = PBXBuildFile; fileRef = 950BB68513F1F26200D8E669 /* MADocument.xcdatamodeld */; }; 950BB68F13F1F29D00D8E669 /* CoreData.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 950BB68D13F1F29D00D8E669 /* CoreData.framework */; }; 950BB69013F1F29D00D8E669 /* QTKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 950BB68E13F1F29D00D8E669 /* QTKit.framework */; }; - 950BB69713F2C6B300D8E669 /* MAFolder.mm in Sources */ = {isa = PBXBuildFile; fileRef = 950BB69613F2C6B300D8E669 /* MAFolder.mm */; }; 950BB69A13F2C6B400D8E669 /* MATag.mm in Sources */ = {isa = PBXBuildFile; fileRef = 950BB69913F2C6B400D8E669 /* MATag.mm */; }; 950BB69D13F2C6B400D8E669 /* MAAnno.mm in Sources */ = {isa = PBXBuildFile; fileRef = 950BB69C13F2C6B400D8E669 /* MAAnno.mm */; }; 950BB6A013F2C6B400D8E669 /* MAMedia.mm in Sources */ = {isa = PBXBuildFile; fileRef = 950BB69F13F2C6B400D8E669 /* MAMedia.mm */; }; @@ -48,8 +47,6 @@ 950BB68613F1F26200D8E669 /* MADocument.xcdatamodel */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcdatamodel; path = MADocument.xcdatamodel; sourceTree = ""; }; 950BB68D13F1F29D00D8E669 /* CoreData.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreData.framework; path = System/Library/Frameworks/CoreData.framework; sourceTree = SDKROOT; }; 950BB68E13F1F29D00D8E669 /* QTKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QTKit.framework; path = System/Library/Frameworks/QTKit.framework; sourceTree = SDKROOT; }; - 950BB69513F2C6B300D8E669 /* MAFolder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MAFolder.h; sourceTree = ""; }; - 950BB69613F2C6B300D8E669 /* MAFolder.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = MAFolder.mm; sourceTree = ""; }; 950BB69813F2C6B400D8E669 /* MATag.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MATag.h; sourceTree = ""; }; 950BB69913F2C6B400D8E669 /* MATag.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = MATag.mm; sourceTree = ""; }; 950BB69B13F2C6B400D8E669 /* MAAnno.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MAAnno.h; sourceTree = ""; }; @@ -156,8 +153,6 @@ isa = PBXGroup; children = ( 950BB68513F1F26200D8E669 /* MADocument.xcdatamodeld */, - 950BB69513F2C6B300D8E669 /* MAFolder.h */, - 950BB69613F2C6B300D8E669 /* MAFolder.mm */, 950BB69E13F2C6B400D8E669 /* MAMedia.h */, 950BB69F13F2C6B400D8E669 /* MAMedia.mm */, 950BB69B13F2C6B400D8E669 /* MAAnno.h */, @@ -260,7 +255,6 @@ 950BB67713F1F26200D8E669 /* main.m in Sources */, 950BB67E13F1F26200D8E669 /* MADocument.mm in Sources */, 950BB68713F1F26200D8E669 /* MADocument.xcdatamodeld in Sources */, - 950BB69713F2C6B300D8E669 /* MAFolder.mm in Sources */, 950BB69A13F2C6B400D8E669 /* MATag.mm in Sources */, 950BB69D13F2C6B400D8E669 /* MAAnno.mm in Sources */, 950BB6A013F2C6B400D8E669 /* MAMedia.mm in Sources */, diff --git a/Medianno/MADocument.mm b/Medianno/MADocument.mm index 7352d11..5422ba4 100644 --- a/Medianno/MADocument.mm +++ b/Medianno/MADocument.mm @@ -8,7 +8,6 @@ #import "MADocument.h" #import "MADocWindow.h" -#import "MAFolder.h" #import "MAMedia.h" #import "MAAnno.h" #import "MATagDescription.h" @@ -20,19 +19,6 @@ - (id)initWithType:(NSString *)typeName error:(NSError **)outError { self = [super initWithType:typeName error:outError]; - if (self) { - /* - * Start with an inbox folder - */ - NSManagedObjectContext *moc = [self managedObjectContext]; - [[moc undoManager] disableUndoRegistration]; - MAFolder * inboxFolder = [NSEntityDescription insertNewObjectForEntityForName:@"MAFolder" - inManagedObjectContext:moc]; - [inboxFolder setName:@"Inbox"]; - - [moc processPendingChanges]; - [[moc undoManager] enableUndoRegistration]; - } return self; } @@ -52,29 +38,17 @@ return YES; } -#pragma mark Folder management - -- (MAFolder *)inboxFolder -{ - NSManagedObjectContext *moc = [self managedObjectContext]; - NSFetchRequest * inbox = [NSFetchRequest fetchRequestWithEntityName:@"MAFolder"]; - [inbox setPredicate:[NSPredicate predicateWithFormat:@"name == 'Inbox' AND parent == NULL"]]; - return [[moc executeFetchRequest:inbox error:nil] objectAtIndex:0]; -} - #pragma mark Media management - (void)addMediaURL:(NSURL *)url name:(NSString *)name date:(NSDate *)date copying:(BOOL)copying { NSManagedObjectContext *moc = [self managedObjectContext]; - MAFolder *inbox = [self inboxFolder]; MAMedia * media = [NSEntityDescription insertNewObjectForEntityForName:@"MAMedia" inManagedObjectContext:moc]; NSString * path = [url path]; media.media = path; media.date = [date timeIntervalSinceReferenceDate]; media.name = name; media.notes = @""; - media.folder= inbox; } #pragma mark Annotation management diff --git a/Medianno/MADocument.xcdatamodeld/MADocument.xcdatamodel/contents b/Medianno/MADocument.xcdatamodeld/MADocument.xcdatamodel/contents index b105729..155a769 100644 --- a/Medianno/MADocument.xcdatamodeld/MADocument.xcdatamodel/contents +++ b/Medianno/MADocument.xcdatamodeld/MADocument.xcdatamodel/contents @@ -6,19 +6,13 @@ - - - - - - + - @@ -32,7 +26,6 @@ - diff --git a/Medianno/MAFolder.h b/Medianno/MAFolder.h deleted file mode 100644 index f0626da..0000000 --- a/Medianno/MAFolder.h +++ /dev/null @@ -1,33 +0,0 @@ -// -// MAFolder.h -// Medianno -// -// Created by Matthias Neeracher on 8/10/11. -// Copyright (c) 2011 Matthias Neeracher. All rights reserved. -// - -#import -#import - -@class MAFolder; - -@interface MAFolder : NSManagedObject { -@private -} -@property (nonatomic, retain) NSString * name; -@property (nonatomic, retain) MAFolder *parent; -@property (nonatomic, retain) NSSet *children; -@property (nonatomic, retain) NSSet *contents; -@end - -@interface MAFolder (CoreDataGeneratedAccessors) - -- (void)addChildrenObject:(MAFolder *)value; -- (void)removeChildrenObject:(MAFolder *)value; -- (void)addChildren:(NSSet *)values; -- (void)removeChildren:(NSSet *)values; -- (void)addContentsObject:(NSManagedObject *)value; -- (void)removeContentsObject:(NSManagedObject *)value; -- (void)addContents:(NSSet *)values; -- (void)removeContents:(NSSet *)values; -@end diff --git a/Medianno/MAFolder.mm b/Medianno/MAFolder.mm deleted file mode 100644 index 96791e1..0000000 --- a/Medianno/MAFolder.mm +++ /dev/null @@ -1,19 +0,0 @@ -// -// MAFolder.m -// Medianno -// -// Created by Matthias Neeracher on 8/10/11. -// Copyright (c) 2011 Matthias Neeracher. All rights reserved. -// - -#import "MAFolder.h" -#import "MAFolder.h" - - -@implementation MAFolder -@dynamic name; -@dynamic parent; -@dynamic children; -@dynamic contents; - -@end diff --git a/Medianno/MAMedia.h b/Medianno/MAMedia.h index f074eb6..e3c7b6f 100644 --- a/Medianno/MAMedia.h +++ b/Medianno/MAMedia.h @@ -20,7 +20,7 @@ @property (nonatomic) NSTimeInterval date; @property (nonatomic, retain) NSString * notes; @property (nonatomic, retain) NSSet *annotations; -@property (nonatomic, retain) MAFolder *folder; +@property (nonatomic) int64_t size; - (QTMovie *)movie; + (NSSet *)keyPathsForValuesAffectingMovie; diff --git a/Medianno/MAMedia.mm b/Medianno/MAMedia.mm index 883a534..7a7f527 100644 --- a/Medianno/MAMedia.mm +++ b/Medianno/MAMedia.mm @@ -7,9 +7,6 @@ // #import "MAMedia.h" -#import "MAAnno.h" -#import "MAFolder.h" - @implementation MAMedia @dynamic media; @@ -17,7 +14,7 @@ @dynamic date; @dynamic notes; @dynamic annotations; -@dynamic folder; +@dynamic size; + (NSSet *)keyPathsForValuesAffectingMovie { diff --git a/Medianno/en.lproj/MADocument.xib b/Medianno/en.lproj/MADocument.xib index 096a9fe..16691f1 100644 --- a/Medianno/en.lproj/MADocument.xib +++ b/Medianno/en.lproj/MADocument.xib @@ -21,26 +21,25 @@ YES - NSButton - NSCustomObject - NSArrayController + NSScroller NSSplitView - NSDateFormatter - NSTableView - NSWindowTemplate - NSTextFieldCell - NSButtonCell - NSTableColumn - NSBox - NSView - NSObjectController + NSArrayController + NSTableHeaderView NSScrollView QTMovieView - NSTokenFieldCell - NSUserDefaultsController - NSScroller - NSTableHeaderView + NSTextFieldCell + NSBox + NSDateFormatter + NSTableView NSTokenField + NSTokenFieldCell + NSButton + NSButtonCell + NSCustomObject + NSView + NSWindowTemplate + NSUserDefaultsController + NSTableColumn YES @@ -714,69 +713,6 @@ YES - - YES - - MAFolder - - - YES - - - 3 - valueForKey: - - 1 - - - YES - - 10 - name - - - - - 0 - Inbox - - - 4 - 0 - NO - 0 - - - - - 3 - valueForKey: - - - YES - - 10 - parent - - - - - 0 - - - - 4 - 0 - NO - 0 - - - - 1 - - - YES - YES YES @@ -878,42 +814,6 @@ 100104 - - - contentSet: selection.contents - - - - - - contentSet: selection.contents - contentSet - selection.contents - - NSDeletesObjectsOnRemove - - - 2 - - - 100145 - - - - managedObjectContext: document.managedObjectContext - - - - - - managedObjectContext: document.managedObjectContext - managedObjectContext - document.managedObjectContext - 2 - - - 100147 - contentSet: selection.annotations @@ -1402,12 +1302,6 @@ - - 100143 - - - SelectedFolderController - 100148 @@ -1481,8 +1375,6 @@ 100094.IBPluginDependency 100129.IBPluginDependency 100130.IBPluginDependency - 100143.IBPluginDependency - 100143.ibExternalFetchPredicateFormat 100148.IBPluginDependency 100161.IBPluginDependency 100162.IBPluginDependency @@ -1530,8 +1422,6 @@ com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin - name == "Inbox" AND parent == nil - com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin