Changeset 81
- Timestamp:
- 06/29/07 15:39:16 (2 years ago)
- Files:
-
- trunk/SapphireMediaPreview.h (modified) (1 diff)
- trunk/SapphireMediaPreview.m (modified) (1 diff)
- trunk/SapphireMetaData.h (modified) (1 diff)
- trunk/SapphireMetaData.m (modified) (2 diffs)
- trunk/SapphirePopulateDataMenu.h (modified) (1 diff)
- trunk/SapphirePopulateDataMenu.m (modified) (9 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/SapphireMediaPreview.h
r37 r81 17 17 18 18 - (void)setText:(NSAttributedString *)text; 19 - (void)setFileProgress:(NSAttributedString *)fileProgress ; 19 20 - (void)setImage:(CGImageRef)image; 20 21 trunk/SapphireMediaPreview.m
r37 r81 37 37 { 38 38 [textLayer setAttributedString:text]; 39 [self setFrame:[self frame]]; 40 } 41 42 43 - (void)setFileProgress:(NSAttributedString *)fileProgress 44 { 45 [textLayer setAttributedString:fileProgress]; 39 46 [self setFrame:[self frame]]; 40 47 } trunk/SapphireMetaData.h
r78 r81 86 86 } 87 87 88 - ( void) updateMetaData;88 - (BOOL) updateMetaData; 89 89 90 90 - (int)modified; trunk/SapphireMetaData.m
r78 r81 614 614 @implementation SapphireFileMetaData : SapphireMetaData 615 615 616 - ( void) updateMetaData616 - (BOOL) updateMetaData 617 617 { 618 618 NSDictionary *props = [[NSFileManager defaultManager] fileAttributesAtPath:path traverseLink:YES]; 619 619 int modTime = [[props objectForKey:NSFileModificationDate] timeIntervalSince1970]; 620 BOOL updated =FALSE; 620 621 621 622 if(props == nil) 622 623 //No file 623 return ;624 return FALSE; 624 625 625 626 if(modTime != [self modified] || [[metaData objectForKey:META_VERSION_KEY] intValue] != META_VERSION) 626 627 { 628 updated=TRUE ; 627 629 NSMutableDictionary *fileMeta = [NSMutableDictionary dictionary]; 628 630 … … 685 687 [metaData addEntriesFromDictionary:fileMeta]; 686 688 } 689 return updated ; 687 690 } 688 691 trunk/SapphirePopulateDataMenu.h
r36 r81 18 18 { 19 19 BRHeaderControl *title; 20 BRButtonControl *button; 21 BRTextControl *text; 20 BRButtonControl *button; 21 BRTextControl *text; 22 BRTextControl *fileProgress; 22 23 BRProgressBarWidget *bar; 23 24 24 SapphireDirectoryMetaData *meta;25 NSMutableArray *importItems;25 SapphireDirectoryMetaData *meta; 26 NSMutableArray *importItems; 26 27 NSTimer *importTimer; 27 float max; 28 float current; 28 float max; 29 float current; 30 float updated ; 29 31 } 30 32 - (id) initWithScene: (BRRenderScene *) scene metaData:(SapphireDirectoryMetaData *)metaData; trunk/SapphirePopulateDataMenu.m
r46 r81 13 13 @interface SapphirePopulateDataMenu (private) 14 14 - (void)setText:(NSString *)theText; 15 - (void)setFileProgress:(NSString *)updateFileProgress; 15 16 - (void)resetUIElements; 16 17 @end … … 30 31 [title setFrame: frame]; 31 32 32 33 33 // Setup the Header Control with default contents 34 // _warning = [[BRTextWithSpinnerController alloc] initWithScene: scene title:@"Test" text:@"Body" showBack:TRUE];35 // [_warning setTitle: @"Depending on the size of your TV show collection, this could take several minutes."];36 // [_warning setTitle:@"This can take several minutes"];37 // [_warning showProgress:TRUE ] ;38 // NSRect frame = [[self masterLayer] frame];39 34 frame.origin.y = frame.size.height * 0.80f; 40 35 frame.size.height = [[BRThemeInfo sharedTheme] listIconHeight]; 41 // [_warning setFrame: frame];42 43 44 36 45 37 // setup the button control … … 50 42 // setup the text entry control 51 43 text = [[BRTextControl alloc] initWithScene: scene]; 44 fileProgress = [[BRTextControl alloc] initWithScene: scene]; 52 45 53 46 bar = [[BRProgressBarWidget alloc] initWithScene: scene]; … … 65 58 [self addControl: title]; 66 59 [self addControl: text]; 60 [self addControl: fileProgress] ; 67 61 [[self masterLayer] addSublayer:bar]; 68 62 [self addControl: button]; … … 87 81 } 88 82 83 - (void)setFileProgress:(NSString *)theFileProgress 84 { 85 [fileProgress setTextAttributes:[[BRThemeInfo sharedTheme] paragraphTextAttributes]]; 86 [fileProgress setText:theFileProgress]; 87 88 NSRect master = [[self masterLayer] frame]; 89 [fileProgress setMaximumSize:NSMakeSize(master.size.width * 1.0f/2.0f, master.size.height * 0.3f)]; 90 NSSize progressSize = [fileProgress renderedSize]; 91 92 NSRect frame; 93 // frame.origin.x = (master.size.width - progressSize.width) * 0.2f; 94 frame.origin.x = (master.size.width) * 0.2f; 95 frame.origin.y = (master.size.height * 0.00f - progressSize.height) + master.size.height * 0.25f/0.8f; 96 frame.size = progressSize; 97 [fileProgress setFrame:frame]; 98 } 99 89 100 - (void) dealloc 90 101 { 91 [title release]; 92 [text release]; 102 [title release]; 103 [text release]; 104 [fileProgress release] ; 93 105 [bar release]; 94 [button release];106 [button release]; 95 107 [meta release]; 96 108 [importTimer invalidate]; 97 98 [super dealloc]; 109 [super dealloc]; 99 110 } 100 111 … … 103 114 [button setTitle:@"Cancel Import"]; 104 115 [button setAction:@selector(cancel)]; 116 [self setFileProgress:@"Initializing..."]; 105 117 [[self scene] renderScene]; 106 118 importItems = [[meta subFileMetas] mutableCopy]; 119 updated = 0 ; 107 120 current = 0; 121 // [self setFileProgress:@"File Progress: <Checking> "]; 122 // [[self scene] renderScene]; 108 123 max = [importItems count]; 109 124 importTimer = [NSTimer scheduledTimerWithTimeInterval:0.0f target:self selector:@selector(importNextItem:) userInfo:nil repeats:YES]; … … 113 128 { 114 129 SapphireFileMetaData *fileMeta = [importItems objectAtIndex:0]; 115 [fileMeta updateMetaData];130 if([fileMeta updateMetaData])updated++; 116 131 [importItems removeObjectAtIndex:0]; 117 current++; 132 current++ ; 133 [self setFileProgress:[NSString stringWithFormat:@"File Progress: %0.0f / %0.0f", current, max,updated]]; 118 134 [bar setPercentage:current/max * 100.0f]; 119 135 … … 126 142 [button setTarget:nil]; 127 143 [title setTitle: @"Import Complete"]; 144 [self setFileProgress:[NSString stringWithFormat:@"Updated %0.0f Entries.", updated]]; 128 145 [self setText:@"Sapphire will continue to import new files as it encounters them. You may initiate this import again at any time, and any new or changed files will be imported"]; 129 146 [[self scene] renderScene]; … … 143 160 [title setTitle: @"Populate Show Data"]; 144 161 [self setText:@"This will populate Sapphire's Meta data. This proceedure may take a while, but you may cancel at any time"]; 162 // [self setFileProgress:@"File Progress: ? / ? "]; 145 163 [bar setPercentage:0.0f]; 146 164 [button setTitle: @"Import Meta Data"];
