NSString *HBTitleChangedNotification = @"HBTitleChangedNotification";
NSString *keyTitleTag = @"keyTitleTag";
-NSString *dragDropFiles = @"dragDropFiles";
-
// DockTile update freqency in total percent increment
#define dockTileUpdateFrequency 0.1f
error:NULL];
}
- // Inits the controllers
- outputPanel = [[HBOutputPanelController alloc] init];
- fPictureController = [[HBPictureController alloc] init];
- fQueueController = [[HBQueueController alloc] init];
-
// we init the HBPresetsManager class
NSURL *presetsURL = [NSURL fileURLWithPath:[[HBUtilities appSupportPath] stringByAppendingPathComponent:@"UserPresets.plist"]];
presetManager = [[HBPresetsManager alloc] initWithURL:presetsURL];
// Init a separate instance of libhb for user scanning and setting up jobs
_queueCore = [[HBCore alloc] initWithLoggingLevel:loggingLevel];
+
+ // Registers the observers to the cores notifications.
+ [self registerScanCoreNotifications];
+ [self registerQueueCoreNotifications];
+
+ // Set the Growl Delegate
+ [GrowlApplicationBridge setGrowlDelegate: self];
+
+ // Inits the controllers
+ outputPanel = [[HBOutputPanelController alloc] init];
+ fPictureController = [[HBPictureController alloc] init];
+ fQueueController = [[HBQueueController alloc] init];
+
+ [fPictureController setDelegate:self];
+ [fPictureController setHandle:self.core.hb_handle];
+
+ [fQueueController setHandle:self.queueCore.hb_handle];
+ [fQueueController setHBController:self];
+
+ [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(autoSetM4vExtension:) name:HBMixdownChangedNotification object:nil];
+ [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(updateMp4Checkboxes:) name:HBVideoEncoderChangedNotification object:nil];
+
+ dockIconProgress = 0;
}
return self;
- (void) applicationDidFinishLaunching: (NSNotification *) notification
{
- // Set the Growl Delegate
- [GrowlApplicationBridge setGrowlDelegate: self];
- /* Init others controllers */
- [fPictureController setDelegate: self];
- [fPictureController setHandle: self.core.hb_handle];
-
- [fQueueController setHandle: self.queueCore.hb_handle];
- [fQueueController setHBController: self];
-
- [[NSNotificationCenter defaultCenter] addObserver: self selector: @selector(autoSetM4vExtension:) name: HBMixdownChangedNotification object: nil];
- [[NSNotificationCenter defaultCenter] addObserver: self selector: @selector(updateMp4Checkboxes:) name: HBVideoEncoderChangedNotification object: nil];
-
- dockIconProgress = 0;
-
/* Init QueueFile .plist */
[self loadQueueFile];
[self initQueueFSEvent];
[self enableUI: NO];
- // Registers the observers to the cores notifications.
- [self registerScanCoreNotifications];
- [self registerQueueCoreNotifications];
-
// Open debug output window now if it was visible when HB was closed
if ([[NSUserDefaults standardUserDefaults] boolForKey:@"OutputPanelIsOpen"])
[self showDebugOutputPanel:nil];
[self showQueueWindow:nil];
[self openMainWindow:nil];
-
- /* We have to set the bool to tell hb what to do after a scan
- * Initially we set it to NO until we start processing the queue
- */
- applyQueueToScan = NO;
/* Now we re-check the queue array to see if there are
* any remaining encodes to be done in it and ask the
/* Since we addressed any pending or previously encoding items above, we go ahead and make sure
* the queue is empty of any finished items or cancelled items */
[self clearQueueAllItems];
- /* We show whichever open source window specified in LaunchSourceBehavior preference key */
- if ([[[NSUserDefaults standardUserDefaults] stringForKey:@"LaunchSourceBehavior"] isEqualToString: @"Open Source"])
- {
- [self browseSources:nil];
- }
- if ([[[NSUserDefaults standardUserDefaults] stringForKey:@"LaunchSourceBehavior"] isEqualToString: @"Open Source (Title Specific)"])
+ if (self.core.state != HBStateScanning && !titleLoaded)
{
- [self browseSources:(id)fOpenSourceTitleMMenu];
+ // We show whichever open source window specified in LaunchSourceBehavior preference key
+ if ([[[NSUserDefaults standardUserDefaults] stringForKey:@"LaunchSourceBehavior"] isEqualToString: @"Open Source"])
+ {
+ [self browseSources:nil];
+ }
+
+ if ([[[NSUserDefaults standardUserDefaults] stringForKey:@"LaunchSourceBehavior"] isEqualToString: @"Open Source (Title Specific)"])
+ {
+ [self browseSources:(id)fOpenSourceTitleMMenu];
+ }
}
}
}
else
{
- /* We show whichever open source window specified in LaunchSourceBehavior preference key */
- if ([[[NSUserDefaults standardUserDefaults] stringForKey:@"LaunchSourceBehavior"] isEqualToString: @"Open Source"])
+ if (self.core.state != HBStateScanning && !titleLoaded)
{
- [self browseSources:nil];
- }
-
- if ([[[NSUserDefaults standardUserDefaults] stringForKey:@"LaunchSourceBehavior"] isEqualToString: @"Open Source (Title Specific)"])
- {
- [self browseSources:(id)fOpenSourceTitleMMenu];
+ // We show whichever open source window specified in LaunchSourceBehavior preference key
+ if ([[[NSUserDefaults standardUserDefaults] stringForKey:@"LaunchSourceBehavior"] isEqualToString: @"Open Source"])
+ {
+ [self browseSources:nil];
+ }
+
+ if ([[[NSUserDefaults standardUserDefaults] stringForKey:@"LaunchSourceBehavior"] isEqualToString: @"Open Source (Title Specific)"])
+ {
+ [self browseSources:(id)fOpenSourceTitleMMenu];
+ }
}
}
currentQueueEncodeNameString = @"";
}
+- (void)application:(NSApplication *)sender openFiles:(NSArray *)filenames
+{
+ [self openFile:filenames.firstObject];
+ [NSApp replyToOpenOrPrint:NSApplicationDelegateReplySuccess];
+}
+
+- (void)openFile:(NSString *)filePath
+{
+ [browsedSourceDisplayName release];
+ browsedSourceDisplayName = [filePath.lastPathComponent retain];
+
+ [self performScan:filePath scanTitleNum:0];
+}
+
#pragma mark -
#pragma mark Multiple Instances
- (NSDragOperation)draggingEntered:(id <NSDraggingInfo>)sender
{
NSPasteboard *pboard = [sender draggingPasteboard];
-
+
if ([[pboard types] containsObject:NSFilenamesPboardType])
{
NSArray *paths = [pboard propertyListForType:NSFilenamesPboardType];
return paths.count == 1 ? NSDragOperationGeneric : NSDragOperationNone;
}
-
+
return NSDragOperationNone;
}
// This method is doing the job after the drag & drop operation has been validated by [self draggingEntered] and OSX
- (BOOL)performDragOperation:(id <NSDraggingInfo>)sender
{
- NSPasteboard *pboard;
-
- pboard = [sender draggingPasteboard];
-
+ NSPasteboard *pboard = [sender draggingPasteboard];
+
if ([[pboard types] containsObject:NSFilenamesPboardType])
{
- /*NSArray *paths = [pboard propertyListForType:NSFilenamesPboardType];
-
- if (paths.count > 0)
- {
- // For now, we just want to accept one file at a time
- // If for any reason, more than one file is submitted, we will take the first one
- NSArray *reducedPaths = [NSArray arrayWithObject:[paths objectAtIndex:0]];
- paths = reducedPaths;
- }
-
- [self openFiles:paths];*/
- //FIXME
+ NSArray *paths = [pboard propertyListForType:NSFilenamesPboardType];
+ [self openFile:paths.firstObject];
}
return YES;
- (void) awakeFromNib
-{
- fRipIndicatorShown = NO; // initially out of view in the nib
-
+{
/* For 64 bit builds, the threaded animation in the progress
* indicators conflicts with the animation in the advanced tab
* for reasons not completely clear. jbrjake found a note in the
[self.core scan:fileURL
titleNum:scanTitleNum
previewsNum:hb_num_previews minTitleDuration:min_title_duration_seconds];
-
- fWillScan = NO;
}
}