Changeset 5117
- Timestamp:
- 12/12/07 22:14:02 (10 months ago)
- Files:
-
- Spiral/trunk/SPPlaylistController.m (modified) (2 diffs)
- Spiral/trunk/SPPlaylistItem.h (modified) (1 diff)
- Spiral/trunk/SPPlaylistItem.m (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
Spiral/trunk/SPPlaylistController.m
r5116 r5117 234 234 [query setDelegate:smartGroup]; 235 235 [smartGroup removeAllFiles]; 236 [smartGroup setQueryIndex:0];237 236 [smartGroup setQuery:query]; 238 237 [query startQuery]; … … 247 246 248 247 - (void)_addFilesFromQuery:(NSMetadataQuery *)query { 249 SPPlaylistSmartGroup *smartGroup; 250 SPPlaylistRepresentedFile *file; 251 NSUInteger i, count; 252 253 smartGroup = [query delegate]; 254 count = [query resultCount]; 255 256 for(i = [smartGroup queryIndex]; i < count; i++) { 257 file = [SPPlaylistRepresentedFile fileWithPath:[[query resultAtIndex:i] valueForAttribute:@"kMDItemPath"]]; 258 259 [smartGroup addFile:file]; 260 } 261 248 [[query delegate] reload]; 249 262 250 [_outlineView reloadData]; 263 264 [smartGroup setQueryIndex:i]; 265 } 266 251 } 267 252 268 253 Spiral/trunk/SPPlaylistItem.h
r5099 r5117 151 151 - (void)setQuery:(NSMetadataQuery *)query; 152 152 - (NSMetadataQuery *)query; 153 - (void)setQueryIndex:(NSUInteger)index;154 - (NSUInteger)queryIndex;155 153 156 - (void) addFile:(SPPlaylistRepresentedFile *)file;154 - (void)reload; 157 155 - (void)removeAllFiles; 158 156 Spiral/trunk/SPPlaylistItem.m
r5099 r5117 851 851 [_sortedItems removeAllObjects]; 852 852 853 [_shuffledItems release]; 854 _shuffledItems = NULL; 855 853 856 path = [self resolvedPath]; 854 857 controller = [NSDocumentController sharedDocumentController]; … … 873 876 } 874 877 } 875 876 [_shuffledItems release];877 _shuffledItems = NULL;878 878 } 879 879 … … 962 962 963 963 964 - (void)setQueryIndex:(NSUInteger)queryIndex { 965 _queryIndex = queryIndex; 966 } 967 968 969 970 - (NSUInteger)queryIndex { 971 return _queryIndex; 972 } 973 974 975 976 #pragma mark - 977 978 - (void)addFile:(SPPlaylistRepresentedFile *)file { 979 [self _addItem:file]; 964 #pragma mark - 965 966 - (void)reload { 967 NSDocumentController *controller; 968 NSString *path; 969 id item; 970 NSUInteger i, count; 971 972 controller = [NSDocumentController sharedDocumentController]; 973 count = [_query resultCount]; 974 975 for(i = _queryIndex; i < count; i++) { 976 path = [[_query resultAtIndex:i] valueForAttribute:@"kMDItemPath"]; 977 item = [_allItems objectForKey:path]; 978 979 if(!item) { 980 if(![controller typeFromFileExtension:[path pathExtension]]) 981 continue; 982 983 item = [SPPlaylistRepresentedFile fileWithPath:path]; 984 } 985 986 [self _addItem:item]; 987 } 988 989 _queryIndex = 0; 980 990 } 981 991 … … 983 993 984 994 - (void)removeAllFiles { 985 [self _removeAllItems]; 986 } 987 988 @end 995 [_sortedItems removeAllObjects]; 996 997 [_shuffledItems release]; 998 _shuffledItems = NULL; 999 1000 _queryIndex = 0; 1001 } 1002 1003 @end
