diff options
-rw-r--r-- | macosx/Controller.h | 9 | ||||
-rw-r--r-- | macosx/Controller.mm | 77 |
2 files changed, 36 insertions, 50 deletions
diff --git a/macosx/Controller.h b/macosx/Controller.h index d990118a1..744fe111e 100644 --- a/macosx/Controller.h +++ b/macosx/Controller.h @@ -219,9 +219,7 @@ NSString * AppSupportDirectory; NSString * UserPresetsFile; - NSString * x264ProfilesFile; NSMutableArray * UserPresets; - NSMutableArray * x264Profiles; NSMutableArray * UserPresetssortedArray; NSMutableDictionary * chosenPreset; int curUserPresetChosenNum; @@ -232,8 +230,8 @@ IBOutlet NSTableView * tableView; IBOutlet NSButton * fPresetsAdd; IBOutlet NSButton * fPresetsDelete; - IBOutlet MVMenuButton * fPresetsActionButton; - IBOutlet NSMenu * fPresetsActionMenu; + IBOutlet MVMenuButton * fPresetsActionButton; + IBOutlet NSMenu * fPresetsActionMenu; hb_handle_t * fHandle; hb_title_t * fTitle; @@ -243,7 +241,7 @@ int currentScanCount; int currentSuccessfulScanCount; NSString * currentSource; - HBOutputPanelController *outputPanel; + HBOutputPanelController *outputPanel; BOOL startButtonEnabled; BOOL pauseButtonEnabled; @@ -317,6 +315,7 @@ - (IBAction) X264AdvancedOptionsChanged: (id) sender; // Preset Methods Here +- (void) loadPresets; - (IBAction) CustomSettingUsed: (id) sender; - (IBAction) ShowAddPresetPanel: (id) sender; - (IBAction) CloseAddPresetPanel: (id) sender; diff --git a/macosx/Controller.mm b/macosx/Controller.mm index 0381e1c70..3587f6c81 100644 --- a/macosx/Controller.mm +++ b/macosx/Controller.mm @@ -141,52 +141,9 @@ static NSString* ChooseSourceIdentifier = @"Choose Source Item Identifie evaluate successive scans */ currentScanCount = 0; - /* Init User Presets .plist */ - /* We declare the default NSFileManager into fileManager */ - NSFileManager * fileManager = [NSFileManager defaultManager]; - //presetPrefs = [[NSUserDefaults standardUserDefaults] retain]; - /* we set the files and support paths here */ - AppSupportDirectory = @"~/Library/Application Support/HandBrake"; - AppSupportDirectory = [AppSupportDirectory stringByExpandingTildeInPath]; - - UserPresetsFile = @"~/Library/Application Support/HandBrake/UserPresets.plist"; - UserPresetsFile = [UserPresetsFile stringByExpandingTildeInPath]; - - x264ProfilesFile = @"~/Library/Application Support/HandBrake/x264Profiles.plist"; - x264ProfilesFile = [x264ProfilesFile stringByExpandingTildeInPath]; - /* We check for the app support directory for media fork */ - if ([fileManager fileExistsAtPath:AppSupportDirectory] == 0) - { - // If it doesnt exist yet, we create it here - [fileManager createDirectoryAtPath:AppSupportDirectory attributes:nil]; - } - // We check for the presets.plist here - - if ([fileManager fileExistsAtPath:UserPresetsFile] == 0) - { - - [fileManager createFileAtPath:UserPresetsFile contents:nil attributes:nil]; + /* Init UserPresets .plist */ + [self loadPresets]; - } - // We check for the x264profiles.plist here - - if ([fileManager fileExistsAtPath:x264ProfilesFile] == 0) - { - - [fileManager createFileAtPath:x264ProfilesFile contents:nil attributes:nil]; - } - - - UserPresetsFile = @"~/Library/Application Support/HandBrake/UserPresets.plist"; - UserPresetsFile = [[UserPresetsFile stringByExpandingTildeInPath]retain]; - - UserPresets = [[NSMutableArray alloc] initWithContentsOfFile:UserPresetsFile]; - if (nil == UserPresets) - { - UserPresets = [[NSMutableArray alloc] init]; - [self AddFactoryPresets:NULL]; - } - /* Show/Dont Show Presets drawer upon launch based @@ -329,6 +286,36 @@ static NSString* ChooseSourceIdentifier = @"Choose Source Item Identifie } +- (void) loadPresets { + /* We declare the default NSFileManager into fileManager */ + NSFileManager * fileManager = [NSFileManager defaultManager]; + /* we set the files and support paths here */ + AppSupportDirectory = @"~/Library/Application Support/HandBrake"; + AppSupportDirectory = [AppSupportDirectory stringByExpandingTildeInPath]; + //UserPresetsFile = @"~/Library/Application Support/HandBrake/UserPresets.plist"; + //UserPresetsFile = [UserPresetsFile stringByExpandingTildeInPath]; + /* We check for the app support directory for handbrake */ + if ([fileManager fileExistsAtPath:AppSupportDirectory] == 0) + { + // If it doesnt exist yet, we create it here + [fileManager createDirectoryAtPath:AppSupportDirectory attributes:nil]; + } + /* We check for the presets.plist here */ + if ([fileManager fileExistsAtPath:UserPresetsFile] == 0) + { + [fileManager createFileAtPath:UserPresetsFile contents:nil attributes:nil]; + } + UserPresetsFile = @"~/Library/Application Support/HandBrake/UserPresets.plist"; + UserPresetsFile = [[UserPresetsFile stringByExpandingTildeInPath]retain]; + + UserPresets = [[NSMutableArray alloc] initWithContentsOfFile:UserPresetsFile]; + if (nil == UserPresets) + { + UserPresets = [[NSMutableArray alloc] init]; + [self AddFactoryPresets:NULL]; + } + +} // ============================================================ // NSToolbar Related Methods |