Get rid of MAFolder. We decided on a more lightweight document format, so this eliminates pointless complexity

This commit is contained in:
Matthias Neeracher 2011-08-16 03:57:53 +02:00
parent 571b804c57
commit 7bf30dc43e
8 changed files with 18 additions and 222 deletions

View File

@ -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 = "<group>"; };
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 = "<group>"; };
950BB69613F2C6B300D8E669 /* MAFolder.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = MAFolder.mm; sourceTree = "<group>"; };
950BB69813F2C6B400D8E669 /* MATag.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MATag.h; sourceTree = "<group>"; };
950BB69913F2C6B400D8E669 /* MATag.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = MATag.mm; sourceTree = "<group>"; };
950BB69B13F2C6B400D8E669 /* MAAnno.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MAAnno.h; sourceTree = "<group>"; };
@ -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 */,

View File

@ -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

View File

@ -6,19 +6,13 @@
<relationship name="media" minCount="1" maxCount="1" deletionRule="Nullify" destinationEntity="MAMedia" inverseName="annotations" inverseEntity="MAMedia"/>
<relationship name="tags" optional="YES" toMany="YES" deletionRule="Cascade" destinationEntity="MATag" inverseName="annotation" inverseEntity="MATag"/>
</entity>
<entity name="MAFolder" representedClassName="MAFolder">
<attribute name="name" attributeType="String"/>
<relationship name="children" optional="YES" toMany="YES" deletionRule="Nullify" destinationEntity="MAFolder" inverseName="parent" inverseEntity="MAFolder"/>
<relationship name="contents" optional="YES" toMany="YES" deletionRule="Nullify" destinationEntity="MAMedia" inverseName="folder" inverseEntity="MAMedia"/>
<relationship name="parent" optional="YES" minCount="1" maxCount="1" deletionRule="Nullify" destinationEntity="MAFolder" inverseName="children" inverseEntity="MAFolder"/>
</entity>
<entity name="MAMedia" representedClassName="MAMedia">
<attribute name="date" attributeType="Date"/>
<attribute name="media" attributeType="String"/>
<attribute name="name" attributeType="String"/>
<attribute name="notes" attributeType="String"/>
<attribute name="size" optional="YES" attributeType="Integer 64" defaultValueString="0"/>
<relationship name="annotations" optional="YES" toMany="YES" deletionRule="Cascade" destinationEntity="MAAnno" inverseName="media" inverseEntity="MAAnno"/>
<relationship name="folder" minCount="1" maxCount="1" deletionRule="Nullify" destinationEntity="MAFolder" inverseName="contents" inverseEntity="MAFolder"/>
</entity>
<entity name="MATag" representedClassName="MATag">
<attribute name="seqNo" attributeType="Integer 16" defaultValueString="0"/>
@ -32,7 +26,6 @@
</entity>
<elements>
<element name="MAAnno" positionX="-1296" positionY="-585" width="128" height="105"/>
<element name="MAFolder" positionX="-864" positionY="-873" width="180" height="105"/>
<element name="MAMedia" positionX="-1116" positionY="-882" width="128" height="135"/>
<element name="MATag" positionX="-1044" positionY="-678" width="126" height="75"/>
<element name="MATagDescription" positionX="-866" positionY="-576" width="128" height="90"/>

View File

@ -1,33 +0,0 @@
//
// MAFolder.h
// Medianno
//
// Created by Matthias Neeracher on 8/10/11.
// Copyright (c) 2011 Matthias Neeracher. All rights reserved.
//
#import <Foundation/Foundation.h>
#import <CoreData/CoreData.h>
@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

View File

@ -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

View File

@ -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;

View File

@ -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
{

View File

@ -21,26 +21,25 @@
</object>
<object class="NSArray" key="IBDocument.IntegratedClassDependencies">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>NSButton</string>
<string>NSCustomObject</string>
<string>NSArrayController</string>
<string>NSScroller</string>
<string>NSSplitView</string>
<string>NSDateFormatter</string>
<string>NSTableView</string>
<string>NSWindowTemplate</string>
<string>NSTextFieldCell</string>
<string>NSButtonCell</string>
<string>NSTableColumn</string>
<string>NSBox</string>
<string>NSView</string>
<string>NSObjectController</string>
<string>NSArrayController</string>
<string>NSTableHeaderView</string>
<string>NSScrollView</string>
<string>QTMovieView</string>
<string>NSTokenFieldCell</string>
<string>NSUserDefaultsController</string>
<string>NSScroller</string>
<string>NSTableHeaderView</string>
<string>NSTextFieldCell</string>
<string>NSBox</string>
<string>NSDateFormatter</string>
<string>NSTableView</string>
<string>NSTokenField</string>
<string>NSTokenFieldCell</string>
<string>NSButton</string>
<string>NSButtonCell</string>
<string>NSCustomObject</string>
<string>NSView</string>
<string>NSWindowTemplate</string>
<string>NSUserDefaultsController</string>
<string>NSTableColumn</string>
</object>
<object class="NSArray" key="IBDocument.PluginDependencies">
<bool key="EncodedWithXMLCoder">YES</bool>
@ -714,69 +713,6 @@
<object class="NSUserDefaultsController" id="888619680">
<bool key="NSSharedInstance">YES</bool>
</object>
<object class="NSObjectController" id="764136931">
<bool key="NSAutomaticallyPreparesContent">YES</bool>
<object class="_NSManagedProxy" key="_NSManagedProxy">
<string key="NSEntityName">MAFolder</string>
<object class="NSCompoundPredicate" key="NSFetchPredicate">
<object class="NSArray" key="NSSubpredicates">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="NSComparisonPredicate">
<object class="NSKeyPathExpression" key="NSLeftExpression">
<int key="NSExpressionType">3</int>
<string key="NSSelectorName">valueForKey:</string>
<object class="NSSelfExpression" key="NSOperand" id="275041018">
<int key="NSExpressionType">1</int>
</object>
<object class="NSMutableArray" key="NSArguments">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="NSKeyPathSpecifierExpression">
<int key="NSExpressionType">10</int>
<string key="NSKeyPath">name</string>
</object>
</object>
</object>
<object class="NSConstantValueExpression" key="NSRightExpression">
<int key="NSExpressionType">0</int>
<string key="NSConstantValue">Inbox</string>
</object>
<object class="NSEqualityPredicateOperator" key="NSPredicateOperator">
<int key="NSOperatorType">4</int>
<int key="NSModifier">0</int>
<bool key="NSNegate">NO</bool>
<int key="NSOptions">0</int>
</object>
</object>
<object class="NSComparisonPredicate">
<object class="NSKeyPathExpression" key="NSLeftExpression">
<int key="NSExpressionType">3</int>
<string key="NSSelectorName">valueForKey:</string>
<reference key="NSOperand" ref="275041018"/>
<object class="NSMutableArray" key="NSArguments">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="NSKeyPathSpecifierExpression">
<int key="NSExpressionType">10</int>
<string key="NSKeyPath">parent</string>
</object>
</object>
</object>
<object class="NSConstantValueExpression" key="NSRightExpression">
<int key="NSExpressionType">0</int>
<nil key="NSConstantValueClassName"/>
</object>
<object class="NSEqualityPredicateOperator" key="NSPredicateOperator">
<int key="NSOperatorType">4</int>
<int key="NSModifier">0</int>
<bool key="NSNegate">NO</bool>
<int key="NSOptions">0</int>
</object>
</object>
</object>
<int key="NSCompoundPredicateType">1</int>
</object>
</object>
<bool key="_NSIsUsingManagedProxy">YES</bool>
</object>
<object class="NSArrayController" id="603895450">
<bool key="NSEditable">YES</bool>
<bool key="NSAutomaticallyPreparesContent">YES</bool>
@ -878,42 +814,6 @@
</object>
<int key="connectionID">100104</int>
</object>
<object class="IBConnectionRecord">
<object class="IBBindingConnection" key="connection">
<string key="label">contentSet: selection.contents</string>
<reference key="source" ref="261388520"/>
<reference key="destination" ref="764136931"/>
<object class="NSNibBindingConnector" key="connector">
<reference key="NSSource" ref="261388520"/>
<reference key="NSDestination" ref="764136931"/>
<string key="NSLabel">contentSet: selection.contents</string>
<string key="NSBinding">contentSet</string>
<string key="NSKeyPath">selection.contents</string>
<object class="NSDictionary" key="NSOptions">
<string key="NS.key.0">NSDeletesObjectsOnRemove</string>
<boolean value="YES" key="NS.object.0"/>
</object>
<int key="NSNibBindingConnectorVersion">2</int>
</object>
</object>
<int key="connectionID">100145</int>
</object>
<object class="IBConnectionRecord">
<object class="IBBindingConnection" key="connection">
<string key="label">managedObjectContext: document.managedObjectContext</string>
<reference key="source" ref="764136931"/>
<reference key="destination" ref="512844837"/>
<object class="NSNibBindingConnector" key="connector">
<reference key="NSSource" ref="764136931"/>
<reference key="NSDestination" ref="512844837"/>
<string key="NSLabel">managedObjectContext: document.managedObjectContext</string>
<string key="NSBinding">managedObjectContext</string>
<string key="NSKeyPath">document.managedObjectContext</string>
<int key="NSNibBindingConnectorVersion">2</int>
</object>
</object>
<int key="connectionID">100147</int>
</object>
<object class="IBConnectionRecord">
<object class="IBBindingConnection" key="connection">
<string key="label">contentSet: selection.annotations</string>
@ -1402,12 +1302,6 @@
<reference key="object" ref="203405327"/>
<reference key="parent" ref="85974219"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">100143</int>
<reference key="object" ref="764136931"/>
<reference key="parent" ref="0"/>
<string key="objectName">SelectedFolderController</string>
</object>
<object class="IBObjectRecord">
<int key="objectID">100148</int>
<reference key="object" ref="603895450"/>
@ -1481,8 +1375,6 @@
<string>100094.IBPluginDependency</string>
<string>100129.IBPluginDependency</string>
<string>100130.IBPluginDependency</string>
<string>100143.IBPluginDependency</string>
<string>100143.ibExternalFetchPredicateFormat</string>
<string>100148.IBPluginDependency</string>
<string>100161.IBPluginDependency</string>
<string>100162.IBPluginDependency</string>
@ -1530,8 +1422,6 @@
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>name == "Inbox" AND parent == nil</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>