From c46f48bd0a2cd5fac81bd3866b3b3191d9060912 Mon Sep 17 00:00:00 2001 From: dynaflash Date: Fri, 14 Sep 2007 18:36:34 +0000 Subject: MacGui: Use the parent folder if VIDEO_TS is chosen as a source for display as well as default output movie name. Move some icon files into Resources/icons folder in the Xcode proj file. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@964 b64f7644-9d1e-0410-96f1-a4d463321fa5 --- macosx/Controller.mm | 32 +++++++++++++++++++------------- 1 file changed, 19 insertions(+), 13 deletions(-) (limited to 'macosx/Controller.mm') diff --git a/macosx/Controller.mm b/macosx/Controller.mm index d92619a82..7a26b88e5 100644 --- a/macosx/Controller.mm +++ b/macosx/Controller.mm @@ -1007,11 +1007,23 @@ static NSString * ChooseSourceIdentifier = @"Choose Source It for( int i = 0; i < hb_list_count( list ); i++ ) { title = (hb_title_t *) hb_list_item( list, i ); - /*Set DVD Name at top of window*/ - [fSrcDVD2Field setStringValue:[NSString stringWithUTF8String: title->name]]; - - currentSource = [NSString stringWithUTF8String: title->dvd]; + currentSource = [NSString stringWithUTF8String: title->dvd]; + + /* To get the source name as well as the default output name, first we check to see if + the selected directory is the VIDEO_TS Directory */ + if ([[currentSource lastPathComponent] isEqualToString: @"VIDEO_TS"]) + { + /* If VIDEO_TS Folder is chosen, choose its parent folder for the source display name */ + sourceDisplayName = [NSString stringWithFormat:[[currentSource stringByDeletingLastPathComponent] lastPathComponent]]; + } + else + { + /* if not the VIDEO_TS Folder, we can assume the chosen folder is the source name */ + sourceDisplayName = [NSString stringWithFormat:[currentSource lastPathComponent]]; + } + /*Set DVD Name at top of window*/ + [fSrcDVD2Field setStringValue:[NSString stringWithFormat: @"%@", sourceDisplayName]]; /* Use the dvd name in the default output field here May want to add code to remove blank spaces for some dvd names*/ @@ -1019,14 +1031,12 @@ static NSString * ChooseSourceIdentifier = @"Choose Source It if ([[NSUserDefaults standardUserDefaults] stringForKey:@"LastDestinationDirectory"]) { [fDstFile2Field setStringValue: [NSString stringWithFormat: - @"%@/%@.mp4", [[NSUserDefaults standardUserDefaults] stringForKey:@"LastDestinationDirectory"],[NSString - stringWithUTF8String: title->name]]]; + @"%@/%@.mp4", [[NSUserDefaults standardUserDefaults] stringForKey:@"LastDestinationDirectory"],sourceDisplayName]]; } else { [fDstFile2Field setStringValue: [NSString stringWithFormat: - @"%@/Desktop/%@.mp4", NSHomeDirectory(),[NSString - stringWithUTF8String: title->name]]]; + @"%@/Desktop/%@.mp4", NSHomeDirectory(),sourceDisplayName]]; } @@ -1094,11 +1104,7 @@ static NSString * ChooseSourceIdentifier = @"Choose Source It SuccessfulScan = 1; [self enableUI: YES]; - /* we record the current source name here in case the next scan is unsuccessful, - then we can replace the scan progress with the old name if necessary */ - sourceDisplayName = [NSString stringWithFormat:[fSrcDVD2Field stringValue]]; - - /* if its the initial successful scan after awakeFromNib */ + /* if its the initial successful scan after awakeFromNib */ if (currentSuccessfulScanCount == 1) { [self selectDefaultPreset: NULL]; -- cgit v1.2.3