Implement Media / Annotation search
This commit is contained in:
parent
a41504067d
commit
b121d4f4ed
|
@ -26,8 +26,9 @@
|
||||||
QTTime lastMovieTime;
|
QTTime lastMovieTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
@property BOOL exportAnnotations;
|
@property BOOL exportAnnotations;
|
||||||
@property BOOL exportTags;
|
@property BOOL exportTags;
|
||||||
|
@property (retain) NSString * searchString;
|
||||||
|
|
||||||
- (IBAction)addMediaFiles:(id)sender;
|
- (IBAction)addMediaFiles:(id)sender;
|
||||||
- (IBAction)importText:(id)sender;
|
- (IBAction)importText:(id)sender;
|
||||||
|
|
|
@ -24,7 +24,7 @@ static const char * kMADocWindowObserver = "MADocWindowObserver";
|
||||||
|
|
||||||
@implementation MADocWindow
|
@implementation MADocWindow
|
||||||
|
|
||||||
@synthesize exportAnnotations, exportTags;
|
@synthesize exportAnnotations, exportTags, searchString;
|
||||||
|
|
||||||
- (id)initWithWindow:(NSWindow *)window
|
- (id)initWithWindow:(NSWindow *)window
|
||||||
{
|
{
|
||||||
|
@ -504,6 +504,26 @@ static NSTimeInterval sLastSkip = 0.0;
|
||||||
}];
|
}];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#pragma mark Searching
|
||||||
|
|
||||||
|
- (void)setSearchString:(NSString *)str
|
||||||
|
{
|
||||||
|
[self willChangeValueForKey:@"searchString"];
|
||||||
|
searchString = str;
|
||||||
|
if (!searchString || [searchString isEqual:@""]) {
|
||||||
|
[mediaController setFilterPredicate:nil];
|
||||||
|
[annotationController setFilterPredicate:nil];
|
||||||
|
} else {
|
||||||
|
NSArray * matchingTags = [[self document] tagDescriptionsMatching:searchString];
|
||||||
|
[mediaController setFilterPredicate:
|
||||||
|
[NSPredicate predicateWithFormat:@"SUBQUERY(annotations,$a,$a.notes CONTAINS[cd] %@ OR ANY $a.tagDescriptions IN %@).@count > 0",
|
||||||
|
searchString, matchingTags]];
|
||||||
|
[annotationController setFilterPredicate:
|
||||||
|
[NSPredicate predicateWithFormat:@"notes CONTAINS[cd] %@ OR ANY tagDescriptions IN %@",
|
||||||
|
searchString, matchingTags]];
|
||||||
|
}
|
||||||
|
[self didChangeValueForKey:@"searchString"];
|
||||||
|
}
|
||||||
@end
|
@end
|
||||||
|
|
||||||
@implementation MADocumentWindow
|
@implementation MADocumentWindow
|
||||||
|
|
|
@ -23,5 +23,6 @@
|
||||||
- (MATagDescription *)tagDescriptionForName:(NSString *)name notes:(NSString *)notes;
|
- (MATagDescription *)tagDescriptionForName:(NSString *)name notes:(NSString *)notes;
|
||||||
- (NSArray *)tagNamesMatchingPrefix:(NSString *)prefix;
|
- (NSArray *)tagNamesMatchingPrefix:(NSString *)prefix;
|
||||||
- (NSSet *)allTags;
|
- (NSSet *)allTags;
|
||||||
|
- (NSArray *)tagDescriptionsMatching:(NSString *)substring;
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
|
@ -133,6 +133,16 @@
|
||||||
return names;
|
return names;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (NSArray *)tagDescriptionsMatching:(NSString *)substring
|
||||||
|
{
|
||||||
|
NSManagedObjectContext *moc = [self managedObjectContext];
|
||||||
|
NSFetchRequest * fetch = [NSFetchRequest fetchRequestWithEntityName:@"MATagDescription"];
|
||||||
|
[fetch setPredicate:[NSPredicate predicateWithFormat:@"name CONTAINS[cd] %@ OR notes CONTAINS[cd] %@",
|
||||||
|
substring, substring]];
|
||||||
|
|
||||||
|
return [moc executeFetchRequest:fetch error:nil];
|
||||||
|
}
|
||||||
|
|
||||||
- (NSSet *)allTags
|
- (NSSet *)allTags
|
||||||
{
|
{
|
||||||
NSManagedObjectContext *moc = [self managedObjectContext];
|
NSManagedObjectContext *moc = [self managedObjectContext];
|
||||||
|
|
|
@ -162,6 +162,7 @@
|
||||||
<int key="NSvFlags">268</int>
|
<int key="NSvFlags">268</int>
|
||||||
<string key="NSFrame">{{0, 14}, {32, 32}}</string>
|
<string key="NSFrame">{{0, 14}, {32, 32}}</string>
|
||||||
<reference key="NSSuperview"/>
|
<reference key="NSSuperview"/>
|
||||||
|
<reference key="NSWindow"/>
|
||||||
<reference key="NSNextKeyView"/>
|
<reference key="NSNextKeyView"/>
|
||||||
<string key="NSReuseIdentifierKey">_NS:1491</string>
|
<string key="NSReuseIdentifierKey">_NS:1491</string>
|
||||||
<bool key="NSEnabled">YES</bool>
|
<bool key="NSEnabled">YES</bool>
|
||||||
|
@ -255,6 +256,7 @@
|
||||||
<int key="NSvFlags">268</int>
|
<int key="NSvFlags">268</int>
|
||||||
<string key="NSFrame">{{0, 14}, {32, 32}}</string>
|
<string key="NSFrame">{{0, 14}, {32, 32}}</string>
|
||||||
<reference key="NSSuperview"/>
|
<reference key="NSSuperview"/>
|
||||||
|
<reference key="NSWindow"/>
|
||||||
<reference key="NSNextKeyView"/>
|
<reference key="NSNextKeyView"/>
|
||||||
<string key="NSReuseIdentifierKey">_NS:1491</string>
|
<string key="NSReuseIdentifierKey">_NS:1491</string>
|
||||||
<bool key="NSEnabled">YES</bool>
|
<bool key="NSEnabled">YES</bool>
|
||||||
|
@ -322,6 +324,7 @@
|
||||||
<int key="NSvFlags">268</int>
|
<int key="NSvFlags">268</int>
|
||||||
<string key="NSFrame">{{0, 14}, {96, 22}}</string>
|
<string key="NSFrame">{{0, 14}, {96, 22}}</string>
|
||||||
<reference key="NSSuperview"/>
|
<reference key="NSSuperview"/>
|
||||||
|
<reference key="NSWindow"/>
|
||||||
<reference key="NSNextKeyView"/>
|
<reference key="NSNextKeyView"/>
|
||||||
<string key="NSReuseIdentifierKey">_NS:123</string>
|
<string key="NSReuseIdentifierKey">_NS:123</string>
|
||||||
<int key="NSTag">100</int>
|
<int key="NSTag">100</int>
|
||||||
|
@ -329,8 +332,8 @@
|
||||||
<object class="NSSearchFieldCell" key="NSCell" id="774960126">
|
<object class="NSSearchFieldCell" key="NSCell" id="774960126">
|
||||||
<int key="NSCellFlags">343014976</int>
|
<int key="NSCellFlags">343014976</int>
|
||||||
<int key="NSCellFlags2">268436544</int>
|
<int key="NSCellFlags2">268436544</int>
|
||||||
<string key="NSContents"/>
|
|
||||||
<reference key="NSSupport" ref="23905036"/>
|
<reference key="NSSupport" ref="23905036"/>
|
||||||
|
<string key="NSPlaceholderString">predicate</string>
|
||||||
<string key="NSCellIdentifier">_NS:123</string>
|
<string key="NSCellIdentifier">_NS:123</string>
|
||||||
<reference key="NSControlView" ref="891639952"/>
|
<reference key="NSControlView" ref="891639952"/>
|
||||||
<bool key="NSDrawsBackground">YES</bool>
|
<bool key="NSDrawsBackground">YES</bool>
|
||||||
|
@ -498,7 +501,7 @@
|
||||||
</object>
|
</object>
|
||||||
</object>
|
</object>
|
||||||
</object>
|
</object>
|
||||||
<object class="NSMutableArray" key="NSToolbarIBAllowedItems">
|
<object class="NSArray" key="NSToolbarIBAllowedItems">
|
||||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||||
<reference ref="271164239"/>
|
<reference ref="271164239"/>
|
||||||
<reference ref="962020774"/>
|
<reference ref="962020774"/>
|
||||||
|
@ -508,11 +511,11 @@
|
||||||
<reference ref="1015085479"/>
|
<reference ref="1015085479"/>
|
||||||
<reference ref="957210769"/>
|
<reference ref="957210769"/>
|
||||||
<reference ref="89055059"/>
|
<reference ref="89055059"/>
|
||||||
<reference ref="916551158"/>
|
|
||||||
<reference ref="202060684"/>
|
<reference ref="202060684"/>
|
||||||
<reference ref="585433049"/>
|
<reference ref="585433049"/>
|
||||||
|
<reference ref="916551158"/>
|
||||||
</object>
|
</object>
|
||||||
<object class="NSArray" key="NSToolbarIBDefaultItems">
|
<object class="NSMutableArray" key="NSToolbarIBDefaultItems">
|
||||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||||
<reference ref="490181719"/>
|
<reference ref="490181719"/>
|
||||||
<reference ref="585433049"/>
|
<reference ref="585433049"/>
|
||||||
|
@ -1094,7 +1097,7 @@
|
||||||
<reference key="NSWindow"/>
|
<reference key="NSWindow"/>
|
||||||
<reference key="NSNextKeyView" ref="196617426"/>
|
<reference key="NSNextKeyView" ref="196617426"/>
|
||||||
</object>
|
</object>
|
||||||
<string key="NSScreenRect">{{0, 0}, {2560, 1418}}</string>
|
<string key="NSScreenRect">{{0, 0}, {1440, 878}}</string>
|
||||||
<string key="NSMinSize">{450, 478}</string>
|
<string key="NSMinSize">{450, 478}</string>
|
||||||
<string key="NSMaxSize">{10000000000000, 10000000000000}</string>
|
<string key="NSMaxSize">{10000000000000, 10000000000000}</string>
|
||||||
<int key="NSWindowCollectionBehavior">128</int>
|
<int key="NSWindowCollectionBehavior">128</int>
|
||||||
|
@ -1903,6 +1906,22 @@
|
||||||
</object>
|
</object>
|
||||||
<int key="connectionID">100308</int>
|
<int key="connectionID">100308</int>
|
||||||
</object>
|
</object>
|
||||||
|
<object class="IBConnectionRecord">
|
||||||
|
<object class="IBBindingConnection" key="connection">
|
||||||
|
<string key="label">value: searchString</string>
|
||||||
|
<reference key="source" ref="891639952"/>
|
||||||
|
<reference key="destination" ref="512844837"/>
|
||||||
|
<object class="NSNibBindingConnector" key="connector">
|
||||||
|
<reference key="NSSource" ref="891639952"/>
|
||||||
|
<reference key="NSDestination" ref="512844837"/>
|
||||||
|
<string key="NSLabel">value: searchString</string>
|
||||||
|
<string key="NSBinding">value</string>
|
||||||
|
<string key="NSKeyPath">searchString</string>
|
||||||
|
<int key="NSNibBindingConnectorVersion">2</int>
|
||||||
|
</object>
|
||||||
|
</object>
|
||||||
|
<int key="connectionID">100316</int>
|
||||||
|
</object>
|
||||||
</object>
|
</object>
|
||||||
<object class="IBMutableOrderedSet" key="objectRecords">
|
<object class="IBMutableOrderedSet" key="objectRecords">
|
||||||
<object class="NSArray" key="orderedObjects">
|
<object class="NSArray" key="orderedObjects">
|
||||||
|
@ -2619,7 +2638,7 @@
|
||||||
<reference key="dict.values" ref="0"/>
|
<reference key="dict.values" ref="0"/>
|
||||||
</object>
|
</object>
|
||||||
<nil key="sourceID"/>
|
<nil key="sourceID"/>
|
||||||
<int key="maxID">100308</int>
|
<int key="maxID">100316</int>
|
||||||
</object>
|
</object>
|
||||||
<object class="IBClassDescriber" key="IBDocument.Classes">
|
<object class="IBClassDescriber" key="IBDocument.Classes">
|
||||||
<object class="NSMutableArray" key="referencedPartialClassDescriptions">
|
<object class="NSMutableArray" key="referencedPartialClassDescriptions">
|
||||||
|
|
Loading…
Reference in New Issue
Block a user