Changeset 913
- Timestamp:
- 12/04/04 19:41:24 (4 years ago)
- Files:
-
- Footagehead/trunk/FHCache.h (modified) (3 diffs)
- Footagehead/trunk/FHCache.m (modified) (4 diffs)
- Footagehead/trunk/FHController.m (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
Footagehead/trunk/FHCache.h
r901 r913 1 /* $Id: FHCache.h,v 1. 2 2004/12/03 12:29:49morris Exp $ */1 /* $Id: FHCache.h,v 1.3 2004/12/04 18:41:24 morris Exp $ */ 2 2 3 3 /* … … 30 30 NSImage *_directoryIcon; 31 31 NSMutableDictionary *_fileIcons; 32 NSMutableDictionary *_images;33 32 NSMutableArray *_temporaryPaths; 34 33 … … 47 46 - (NSImage *) fileIconForPath:(NSString *)path; 48 47 49 - (void) setImage:(NSImage *)image forURL:(NSURL *)url;50 - (NSImage *) imageForURL:(NSURL *)url;51 52 48 - (void) addTemporaryPath:(NSString *)path; 53 49 - (void) purgeTemporaryPaths; Footagehead/trunk/FHCache.m
r901 r913 1 /* $Id: FHCache.m,v 1. 3 2004/12/03 12:29:49morris Exp $ */1 /* $Id: FHCache.m,v 1.4 2004/12/04 18:41:24 morris Exp $ */ 2 2 3 3 /* … … 49 49 50 50 _fileIcons = [[NSMutableDictionary alloc] initWithCapacity:100]; 51 _images = [[NSMutableDictionary alloc] initWithCapacity:5];52 51 _temporaryPaths = [[NSMutableArray alloc] initWithCapacity:10]; 53 52 … … 62 61 [_directoryIcon release]; 63 62 [_fileIcons release]; 64 [_images release];65 63 [_temporaryPaths release]; 66 64 … … 136 134 #pragma mark - 137 135 138 - (void)setImage:(NSImage *)image forURL:(NSURL *)url {139 [_lock lock];140 141 if(!image) {142 [_images removeObjectForKey:url];143 } else {144 if([_images count] > 5)145 [_images removeObjectForKey:[[_images allKeys] objectAtIndex:0]];146 147 [_images setObject:image forKey:[url absoluteString]];148 }149 150 [_lock unlock];151 }152 153 154 155 - (NSImage *)imageForURL:(NSURL *)url {156 NSImage *image;157 158 [_lock lock];159 image = [[_images objectForKey:[url absoluteString]] retain];160 [_lock unlock];161 162 return [image autorelease];163 }164 165 166 167 #pragma mark -168 169 136 - (void)addTemporaryPath:(NSString *)path { 170 137 [_lock lock]; Footagehead/trunk/FHController.m
r912 r913 1 /* $Id: FHController.m,v 1.2 2 2004/12/04 16:55:54 morris Exp $ */1 /* $Id: FHController.m,v 1.23 2004/12/04 18:41:24 morris Exp $ */ 2 2 3 3 /* … … 27 27 */ 28 28 29 #import "NSImage-FHAdditions.h"30 29 #import "FHCache.h" 31 30 #import "FHController.h"
