Changeset 4183
- Timestamp:
- 06/02/06 17:30:52 (3 years ago)
- Files:
-
- WiredClient/trunk/WCFile.h (modified) (1 diff)
- WiredClient/trunk/WCFile.m (modified) (6 diffs)
- WiredClient/trunk/WCFiles.m (modified) (2 diffs)
- WiredClient/trunk/WCFilesController.m (modified) (3 diffs)
- WiredClient/trunk/WCSearch.h (modified) (1 diff)
- WiredClient/trunk/WCSearch.m (modified) (12 diffs)
- WiredClient/trunk/WCServerConnection.m (modified) (2 diffs)
- WiredClient/trunk/WCTrackerConnection.m (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
WiredClient/trunk/WCFile.h
r3942 r4183 42 42 NSString *_path; 43 43 NSDate *_creationDate; 44 NSString *_creationDateString; 44 45 NSDate *_modificationDate; 46 NSString *_modificationDateString; 45 47 NSString *_checksum; 46 48 NSString *_comment; WiredClient/trunk/WCFile.m
r3942 r4183 34 34 - (void)_setType:(WCFileType)type; 35 35 - (void)_setPath:(NSString *)path; 36 - (void)_setCreationDate :(NSDate *)creationDate;37 - (void)_setModificationDate :(NSDate *)modificationDate;36 - (void)_setCreationDateString:(NSString *)creationDateString; 37 - (void)_setModificationDateString:(NSString *)modificationDateString; 38 38 - (void)_setChecksum:(NSString *)checksum; 39 39 - (void)_setComment:(NSString *)comment; … … 59 59 60 60 61 - (void)_setCreationDate :(NSDate *)creationDate{62 [creationDate retain];63 [_creationDate release];64 65 _creationDate = creationDate;66 } 67 68 69 70 - (void)_setModificationDate :(NSDate *)modificationDate{71 [modificationDate retain];72 [_modificationDate release];73 74 _modificationDate = modificationDate;61 - (void)_setCreationDateString:(NSString *)creationDateString { 62 [creationDateString retain]; 63 [_creationDateString release]; 64 65 _creationDateString = creationDateString; 66 } 67 68 69 70 - (void)_setModificationDateString:(NSString *)modificationDateString { 71 [modificationDateString retain]; 72 [_modificationDateString release]; 73 74 _modificationDateString = modificationDateString; 75 75 } 76 76 … … 259 259 [file _setPath:[arguments safeObjectAtIndex:0]]; 260 260 [file setSize:[[arguments safeObjectAtIndex:2] unsignedLongLongValue]]; 261 [file _setCreationDate :[NSDate dateWithISO8601String:[arguments safeObjectAtIndex:3]]];262 [file _setModificationDate :[NSDate dateWithISO8601String:[arguments safeObjectAtIndex:4]]];261 [file _setCreationDateString:[arguments safeObjectAtIndex:3]]; 262 [file _setModificationDateString:[arguments safeObjectAtIndex:4]]; 263 263 264 264 return [file autorelease]; … … 274 274 [file _setPath:[arguments safeObjectAtIndex:0]]; 275 275 [file setSize:[[arguments safeObjectAtIndex:2] unsignedLongLongValue]]; 276 [file _setCreationDate :[NSDate dateWithISO8601String:[arguments safeObjectAtIndex:3]]];277 [file _setModificationDate :[NSDate dateWithISO8601String:[arguments safeObjectAtIndex:4]]];276 [file _setCreationDateString:[arguments safeObjectAtIndex:3]]; 277 [file _setModificationDateString:[arguments safeObjectAtIndex:4]]; 278 278 [file _setChecksum:[arguments safeObjectAtIndex:5]]; 279 279 [file _setComment:[arguments safeObjectAtIndex:6]]; … … 405 405 406 406 - (NSDate *)creationDate { 407 if(!_creationDate && _creationDateString) 408 _creationDate = [[NSDate alloc] initWithISO8601String:_creationDateString]; 409 407 410 return _creationDate; 408 411 } … … 411 414 412 415 - (NSDate *)modificationDate { 416 if(!_modificationDate && _modificationDateString) 417 _modificationDate = [[NSDate alloc] initWithISO8601String:_modificationDateString]; 418 413 419 return _modificationDate; 414 420 } WiredClient/trunk/WCFiles.m
r4182 r4183 399 399 400 400 - (void)windowDidLoad { 401 WIIconCell *iconCell;402 403 iconCell = [[WIIconCell alloc] init];404 [_nameTableColumn setDataCell:iconCell];405 [iconCell release];406 407 401 [_filesBrowser setCellClass:[WCFilesBrowserCell class]]; 408 402 [_filesBrowser setMatrixClass:[WIMatrix class]]; … … 473 467 - (void)windowTemplateShouldSave:(NSMutableDictionary *)windowTemplate { 474 468 [windowTemplate setObject:[_filesTableView propertiesDictionary] forKey:@"WCFilesTableView"]; 475 }476 477 478 479 - (void)connectionDidClose:(NSNotification *)notification {480 [self validate];481 469 } 482 470 WiredClient/trunk/WCFilesController.m
r4182 r4183 39 39 self = [super initWithWindowNibName:windowNibName name:name connection:connection]; 40 40 41 _files = [[NSMutableArray alloc] init ];41 _files = [[NSMutableArray alloc] initWithCapacity:5000]; 42 42 43 43 [[NSNotificationCenter defaultCenter] … … 64 64 65 65 - (void)windowDidLoad { 66 WIIconCell *iconCell; 67 68 iconCell = [[WIIconCell alloc] init]; 69 [_nameTableColumn setDataCell:iconCell]; 70 [iconCell release]; 71 66 72 [_filesTableView setAllowsUserCustomization:YES]; 67 73 [_filesTableView setDefaultHighlightedTableColumnIdentifier:@"Name"]; … … 72 78 73 79 [super windowDidLoad]; 80 } 81 82 83 84 - (void)connectionDidClose:(NSNotification *)notification { 85 [self validate]; 74 86 } 75 87 WiredClient/trunk/WCSearch.h
r4182 r4183 47 47 IBOutlet NSButton *_searchButton; 48 48 49 NSMutableArray *_allFiles; 49 NSMutableSet *_receivedFiles; 50 51 WCSearchType _searchType; 50 52 } 51 53 WiredClient/trunk/WCSearch.m
r4182 r4183 40 40 @interface WCSearch(Private) 41 41 42 + (NS Array*)_audioFileTypes;43 + (NS Array*)_imageFileTypes;44 + (NS Array*)_movieFileTypes;42 + (NSSet *)_audioFileTypes; 43 + (NSSet *)_imageFileTypes; 44 + (NSSet *)_movieFileTypes; 45 45 46 46 - (id)_initSearchWithConnection:(WCServerConnection *)connection; … … 51 51 @implementation WCSearch(Private) 52 52 53 + (NS Array*)_audioFileTypes {54 static NSMutable Array*extensions;53 + (NSSet *)_audioFileTypes { 54 static NSMutableSet *extensions; 55 55 56 56 if(!extensions) { 57 extensions = [[NSMutable Arrayalloc] init];57 extensions = [[NSMutableSet alloc] init]; 58 58 [extensions addObjectsFromArray:[[WCSearchTypeAudioExtensions lowercaseString] 59 59 componentsSeparatedByString:@" "]]; … … 67 67 68 68 69 + (NS Array*)_imageFileTypes {70 static NSMutable Array*extensions;69 + (NSSet *)_imageFileTypes { 70 static NSMutableSet *extensions; 71 71 72 72 if(!extensions) { 73 extensions = [[NSMutable Arrayalloc] init];73 extensions = [[NSMutableSet alloc] init]; 74 74 [extensions addObjectsFromArray:[[WCSearchTypeImageExtensions lowercaseString] 75 75 componentsSeparatedByString:@" "]]; … … 83 83 84 84 85 + (NS Array*)_movieFileTypes {86 static NSMutable Array*extensions;85 + (NSSet *)_movieFileTypes { 86 static NSMutableSet *extensions; 87 87 88 88 if(!extensions) { 89 extensions = [[NSMutable Arrayalloc] init];89 extensions = [[NSMutableSet alloc] init]; 90 90 [extensions addObjectsFromArray:[[WCSearchTypeMovieExtensions lowercaseString] 91 91 componentsSeparatedByString:@" "]]; … … 106 106 connection:connection]; 107 107 108 _ allFiles = [[NSMutableArrayalloc] init];108 _receivedFiles = [[NSMutableSet alloc] init]; 109 109 110 110 [self window]; … … 135 135 136 136 - (void)dealloc { 137 [_ allFiles release];137 [_receivedFiles release]; 138 138 139 139 [super dealloc]; … … 145 145 146 146 - (void)windowDidLoad { 147 WIIconCell *iconCell;148 149 iconCell = [[WIIconCell alloc] init];150 [_nameTableColumn setDataCell:iconCell];151 [iconCell release];152 153 147 [_filesTableView setDoubleAction:@selector(open:)]; 154 148 … … 172 166 173 167 174 - (void)connectionDidClose:(NSNotification *)notification {175 [self validate];176 }177 178 179 180 168 - (void)connectionWillTerminate:(NSNotification *)notification { 181 169 [_filesTableView setDataSource:NULL]; … … 207 195 file = [WCFile fileWithListArguments:[[notification userInfo] objectForKey:WCArgumentsKey]]; 208 196 209 if(![_ allFiles containsObject:file]) {210 switch( [[_kindPopUpButton selectedItem] tag]) {197 if(![_receivedFiles containsObject:file]) { 198 switch(_searchType) { 211 199 case WCSearchTypeAny: 212 200 add = YES; … … 240 228 241 229 if(add) { 242 [_ allFiles addObject:file];243 244 if([_ allFiles count] == 10) {245 [_files addObjectsFromArray: _allFiles];246 [_ allFiles removeAllObjects];230 [_receivedFiles addObject:file]; 231 232 if([_receivedFiles count] == 10) { 233 [_files addObjectsFromArray:[_receivedFiles allObjects]]; 234 [_receivedFiles removeAllObjects]; 247 235 248 236 [_filesTableView reloadData]; … … 256 244 - (void)searchCompletedFiles:(NSNotification *)notification { 257 245 [_progressIndicator stopAnimation:self]; 258 [_files addObjectsFromArray: _allFiles];246 [_files addObjectsFromArray:[_receivedFiles allObjects]]; 259 247 260 248 [self updateStatus]; 261 262 249 [self sortFiles]; 250 263 251 [_filesTableView reloadData]; 264 252 [_filesTableView setNeedsDisplay:YES]; … … 299 287 if([[_searchTextField stringValue] length] == 0) 300 288 return; 301 302 [_allFiles removeAllObjects]; 289 290 _searchType = [[_kindPopUpButton selectedItem] tag]; 291 292 [_receivedFiles removeAllObjects]; 303 293 [_files removeAllObjects]; 304 294 [_filesTableView reloadData]; WiredClient/trunk/WCServerConnection.m
r4148 r4183 659 659 660 660 - (void)link:(WCLink *)link receivedMessage:(unsigned int)message arguments:(NSArray *)arguments { 661 NSString * string, *name = NULL;661 NSString *name = NULL; 662 662 NSMutableDictionary *userInfo; 663 663 WCError *error; 664 664 665 string = [NSString stringWithFormat:@"%u %@", message, [arguments componentsJoinedByString:@"\t"]];666 665 userInfo = [NSMutableDictionary dictionaryWithObjectsAndKeys: 667 666 arguments, WCArgumentsKey, … … 836 835 } 837 836 838 [self postNotificationName:WCConnectionReceivedMessage object:string]; 837 838 #if defined(DEBUG) || defined(TEST) 839 [self postNotificationName:WCConnectionReceivedMessage 840 object:[NSSWF:@"%u %@", message, [arguments componentsJoinedByString:@"\t"]]]; 841 #endif 839 842 840 843 if(name) WiredClient/trunk/WCTrackerConnection.m
r3963 r4183 262 262 263 263 - (void)link:(WCLink *)link receivedMessage:(unsigned int)message arguments:(NSArray *)arguments { 264 NSString * string, *name = NULL;264 NSString *name = NULL; 265 265 NSMutableDictionary *userInfo; 266 266 WCError *error; 267 267 268 string = [NSString stringWithFormat:@"%u %@", message, [arguments componentsJoinedByString:@"\t"]];269 268 userInfo = [NSMutableDictionary dictionaryWithObjectsAndKeys: 270 269 arguments, WCArgumentsKey, 271 270 [NSNumber numberWithInt:message], WCMessageKey, 272 271 NULL]; 273 274 [self postNotificationName:WCConnectionReceivedMessage object:string];275 272 276 273 switch(message) { … … 309 306 } 310 307 308 #if defined(DEBUG) || defined(TEST) 309 [self postNotificationName:WCConnectionReceivedMessage 310 object:[NSSWF:@"%u %@", message, [arguments componentsJoinedByString:@"\t"]]]; 311 #endif 312 311 313 if(name) 312 314 [self postNotificationName:name object:self userInfo:userInfo];
