fPresetsBuiltin = [[HBPresets alloc] init];
fPreferencesController = [[HBPreferencesController alloc] init];
/* Lets report the HandBrake version number here to the activity log and text log file */
- NSString *versionStringFull = [[NSString stringWithFormat: @"Handbrake Version: %@", [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleGetInfoString"]] stringByAppendingString: [NSString stringWithFormat: @" (%@)", [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleVersion"]]];
+ NSString *versionStringFull = [[NSString stringWithFormat: @"Handbrake Version: %@", [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleShortVersionString"]] stringByAppendingString: [NSString stringWithFormat: @" (%@)", [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleVersion"]]];
[self writeToActivityLog: "%s", [versionStringFull UTF8String]];
return self;
[fPresetsOutlineView setAutosaveName:@"Presets View"];
[fPresetsOutlineView setAutosaveExpandedItems:YES];
+
+ dockIconProgress = 0;
/* Call UpdateUI every 1/2 sec */
[[NSRunLoop currentRunLoop] addTimer:[NSTimer
- (NSApplicationTerminateReply) applicationShouldTerminate: (NSApplication *) app
{
- if ([fPreviewController fullScreen] == YES)
+ /* if we are in preview full screen mode, we need to go to
+ * windowed mode and release the display before we terminate.
+ * We do it here (instead of applicationWillTerminate) so we
+ * release the displays and can then see the alerts below.
+ */
+ if ([fPictureController previewFullScreenMode] == YES)
{
- [fPreviewController goWindowedScreen:nil];
+ [fPictureController previewGoWindowed:nil];
}
hb_state_t s;
- (void)applicationWillTerminate:(NSNotification *)aNotification
{
- [browsedSourceDisplayName release];
+
+ [browsedSourceDisplayName release];
[outputPanel release];
[fQueueController release];
+ [fPreviewController release];
[fPictureController release];
[fPictureFilterController release];
- [fPreviewController release];
hb_close(&fHandle);
hb_close(&fQueueEncodeLibhb);
}
NSLocalizedString( @"Scanning title %d of %d...", @"" ),
p.title_cur, p.title_count]];
[fScanIndicator setHidden: NO];
- [fScanIndicator setDoubleValue: 100.0 * ( p.title_cur - 1 ) / p.title_count];
+ [fScanIndicator setDoubleValue: 100.0 * ((double)( p.title_cur - 1 ) / p.title_count)];
break;
}
#undef p
[fQueueController setQueueStatusString: [NSString stringWithFormat:
NSLocalizedString( @"Queue Scanning title %d of %d...", @"" ),
p.title_cur, p.title_count]];
-
- [fRipIndicator setHidden: NO];
- [fRipIndicator setDoubleValue: 100.0 * ( p.title_cur - 1 ) / p.title_count];
break;
}
#undef p
#define p s.param.scandone
case HB_STATE_SCANDONE:
{
- [fRipIndicator setIndeterminate: NO];
- [fRipIndicator setDoubleValue: 0.0];
-
[self writeToActivityLog:"ScanDone state received from fQueueEncodeLibhb"];
[self processNewQueueEncode];
[[fWindow toolbar] validateVisibleItems];
#define p s.param.working
case HB_STATE_WORKING:
{
- float progress_total;
NSMutableString * string;
/* Update text field */
string = [NSMutableString stringWithFormat: NSLocalizedString( @"Encoding: pass %d of %d, %.2f %%", @"" ), p.job_cur, p.job_count, 100.0 * p.progress];
/* Set the status string in fQueueController as well */
[fQueueController setQueueStatusString: string];
/* Update slider */
- progress_total = ( p.progress + p.job_cur - 1 ) / p.job_count;
+ double progress_total = ( p.progress + p.job_cur - 1 ) / p.job_count;
[fRipIndicator setIndeterminate: NO];
- [fRipIndicator setDoubleValue: 100.0 * progress_total];
+ [fRipIndicator setDoubleValue:100.0 * progress_total];
// If progress bar hasn't been revealed at the bottom of the window, do
// that now. This code used to be in doRip. I moved it to here to handle
fRipIndicatorShown = YES;
}
-
+
/* Update dock icon */
- [self UpdateDockIcon: progress_total];
-
+ if( dockIconProgress < 100.0 * progress_total )
+ {
+ [self UpdateDockIcon: progress_total];
+ dockIconProgress += 5;
+ }
+
break;
}
#undef p
/* Set the status string in fQueueController as well */
[fQueueController setQueueStatusString: NSLocalizedString( @"Encode Finished.", @"" )];
[fRipIndicator setIndeterminate: NO];
+ [fRipIndicator stopAnimation: nil];
[fRipIndicator setDoubleValue: 0.0];
[[fWindow toolbar] validateVisibleItems];
/* Restore dock icon */
[self UpdateDockIcon: -1.0];
+ dockIconProgress = 0;
if( fRipIndicatorShown )
{
}
/* We use this to write messages to stderr from the macgui which show up in the activity window and log*/
-- (void) writeToActivityLog:(char *) format, ...
+- (void) writeToActivityLog:(const char *) format, ...
{
va_list args;
va_start(args, format);
}
/* this is actually called from the queue controller to modify the queue array and return it back to the queue controller */
-- (void)moveObjectsInQueueArray:(NSMutableArray *)array fromIndexes:(NSIndexSet *)indexSet toIndex:(unsigned)insertIndex
+- (void)moveObjectsInQueueArray:(NSMutableArray *)array fromIndexes:(NSIndexSet *)indexSet toIndex:(NSUInteger)insertIndex
{
- unsigned index = [indexSet lastIndex];
- unsigned aboveInsertIndexCount = 0;
+ NSUInteger index = [indexSet lastIndex];
+ NSUInteger aboveInsertIndexCount = 0;
- while (index != NSNotFound)
- {
- unsigned removeIndex;
-
- if (index >= insertIndex)
- {
- removeIndex = index + aboveInsertIndexCount;
- aboveInsertIndexCount++;
- }
- else
- {
- removeIndex = index;
- insertIndex--;
- }
-
- id object = [[QueueFileArray objectAtIndex:removeIndex] retain];
- [QueueFileArray removeObjectAtIndex:removeIndex];
- [QueueFileArray insertObject:object atIndex:insertIndex];
- [object release];
+
+ NSUInteger removeIndex;
- index = [indexSet indexLessThanIndex:index];
+ if (index >= insertIndex)
+ {
+ removeIndex = index + aboveInsertIndexCount;
+ aboveInsertIndexCount++;
+ }
+ else
+ {
+ removeIndex = index;
+ insertIndex--;
}
+
+ id object = [[QueueFileArray objectAtIndex:removeIndex] retain];
+ [QueueFileArray removeObjectAtIndex:removeIndex];
+ [QueueFileArray insertObject:object atIndex:insertIndex];
+ [object release];
+
+ index = [indexSet indexLessThanIndex:index];
+
/* We save all of the Queue data here
* and it also gets sent back to the queue controller*/
[self saveQueueFileItem];
}
/* We use this to deterimine children of an item */
-- (id)outlineView:(NSOutlineView *)fPresetsOutlineView child:(int)index ofItem:(id)item
+- (id)outlineView:(NSOutlineView *)fPresetsOutlineView child:(NSInteger)index ofItem:(id)item
{
/* we need to return the count of the array in ChildrenArray for this folder */
children = [item objectForKey:@"ChildrenArray"];
}
}
- if ((children == nil) || ([children count] <= index))
+ if ((children == nil) || ( [children count] <= (NSUInteger) index))
{
return nil;
}
return YES;
}
-- (NSDragOperation)outlineView:(NSOutlineView *)outlineView validateDrop:(id <NSDraggingInfo>)info proposedItem:(id)item proposedChildIndex:(int)index
+- (NSDragOperation)outlineView:(NSOutlineView *)outlineView validateDrop:(id <NSDraggingInfo>)info proposedItem:(id)item proposedChildIndex:(NSInteger)index
{
// Don't allow dropping ONTO an item since they can't really contain any children.
-- (BOOL)outlineView:(NSOutlineView *)outlineView acceptDrop:(id <NSDraggingInfo>)info item:(id)item childIndex:(int)index
+- (BOOL)outlineView:(NSOutlineView *)outlineView acceptDrop:(id <NSDraggingInfo>)info item:(id)item childIndex:(NSInteger)index
{
/* first, lets see if we are dropping into a folder */
if ([[fPresetsOutlineView itemAtRow:index] objectForKey:@"Folder"] && [[[fPresetsOutlineView itemAtRow:index] objectForKey:@"Folder"] intValue] == 1) // if its a folder
return YES;
}
-- (void)moveObjectsInPresetsArray:(NSMutableArray *)array fromIndexes:(NSIndexSet *)indexSet toIndex:(unsigned)insertIndex
+- (void)moveObjectsInPresetsArray:(NSMutableArray *)array fromIndexes:(NSIndexSet *)indexSet toIndex:(NSUInteger)insertIndex
{
- unsigned index = [indexSet lastIndex];
- unsigned aboveInsertIndexCount = 0;
+ NSUInteger index = [indexSet lastIndex];
+ NSUInteger aboveInsertIndexCount = 0;
- while (index != NSNotFound)
+ NSUInteger removeIndex;
+
+ if (index >= insertIndex)
{
- unsigned removeIndex;
-
- if (index >= insertIndex)
- {
- removeIndex = index + aboveInsertIndexCount;
- aboveInsertIndexCount++;
- }
- else
- {
- removeIndex = index;
- insertIndex--;
- }
-
- id object = [[array objectAtIndex:removeIndex] retain];
- [array removeObjectAtIndex:removeIndex];
- [array insertObject:object atIndex:insertIndex];
- [object release];
-
- index = [indexSet indexLessThanIndex:index];
+ removeIndex = index + aboveInsertIndexCount;
+ aboveInsertIndexCount++;
}
+ else
+ {
+ removeIndex = index;
+ insertIndex--;
+ }
+
+ id object = [[array objectAtIndex:removeIndex] retain];
+ [array removeObjectAtIndex:removeIndex];
+ [array insertObject:object atIndex:insertIndex];
+ [object release];
+
+ index = [indexSet indexLessThanIndex:index];
}