From e16a922a514fa4d5adcb2bbd4b17ef6b1791035e Mon Sep 17 00:00:00 2001 From: Pierre d'Herbemont Date: Sat, 2 Aug 2008 03:47:00 +0200 Subject: [PATCH] macosx: Fix crash log and remove some unneeded NSLog. --- modules/gui/macosx/intf.m | 35 ++++++++++++++++------------------- 1 file changed, 16 insertions(+), 19 deletions(-) diff --git a/modules/gui/macosx/intf.m b/modules/gui/macosx/intf.m index a1b38da6da..c6f631b97b 100644 --- a/modules/gui/macosx/intf.m +++ b/modules/gui/macosx/intf.m @@ -516,8 +516,6 @@ static NSString * VLCToolbarMediaControl = @"VLCToolbarMediaControl"; - (NSArray *)toolbarAllowedItemIdentifiers:(NSToolbar *)toolbar { - NSLog(@"toolbarAllowedItemIdentifiers %s", __func__); - return [NSArray arrayWithObjects: // NSToolbarCustomizeToolbarItemIdentifier, // NSToolbarFlexibleSpaceItemIdentifier, @@ -529,8 +527,6 @@ static NSString * VLCToolbarMediaControl = @"VLCToolbarMediaControl"; - (NSArray *) toolbarDefaultItemIdentifiers: (NSToolbar *) toolbar { - NSLog(@"toolbarAllowedItemIdentifiers %s", __func__); - return [NSArray arrayWithObjects: VLCToolbarMediaControl, nil ]; @@ -538,7 +534,6 @@ static NSString * VLCToolbarMediaControl = @"VLCToolbarMediaControl"; - (NSToolbarItem *) toolbar:(NSToolbar *)toolbar itemForItemIdentifier:(NSString *)itemIdentifier willBeInsertedIntoToolbar:(BOOL)flag { - NSLog(@"toolbarAllowedItemIdentifiers %s", __func__); NSToolbarItem *toolbarItem = [[[NSToolbarItem alloc] initWithItemIdentifier: itemIdentifier] autorelease]; @@ -1341,7 +1336,6 @@ static NSString * VLCToolbarMediaControl = @"VLCToolbarMediaControl"; [o_btn_prev setEnabled: (b_plmul || b_chapters)]; [o_btn_next setEnabled: (b_plmul || b_chapters)]; - NSLog(@"seekable %d", b_seekable); [o_timeslider setFloatValue: 0.0]; [o_timeslider setEnabled: b_seekable]; [o_timefield setStringValue: @"00:00"]; @@ -2098,8 +2092,8 @@ end: "\n"; NSString * mailPath = [NSTemporaryDirectory() stringByAppendingPathComponent:@"vlc_crash_mail.eml"]; NSString * mailContent = [NSString stringWithFormat:[NSString stringWithUTF8String:mail], - _NS("Crash Report (Type Ctrl-shift-D and hit send)"), - _NS("(Type Command-shift-D (Menu 'Message'>'Send Again' and hit send)"), + _NS("Crash Report (Type Command-shift-D and hit send)"), + _NS("Type Command-shift-D (or in Menu \"Message\">\"Send Again\") and hit the \"Send Mail\" button."), userComment, crashLog]; BOOL ret = [mailContent writeToFile:mailPath atomically:YES encoding:NSUTF8StringEncoding error:nil]; if( !ret ) @@ -2117,7 +2111,6 @@ end: NSString * crashReporter = [@"~/Library/Logs/CrashReporter" stringByExpandingTildeInPath]; NSDirectoryEnumerator *direnum = [[NSFileManager defaultManager] enumeratorAtPath:crashReporter]; NSString *fname; - BOOL found = NO; NSString * latestLog = nil; NSInteger year = !previouslySeen ? [[NSUserDefaults standardUserDefaults] integerForKey:@"LatestCrashReportYear"] : 0; NSInteger month = !previouslySeen ? [[NSUserDefaults standardUserDefaults] integerForKey:@"LatestCrashReportMonth"]: 0; @@ -2130,25 +2123,29 @@ end: if([fname hasPrefix:@"VLC"] && [fname hasSuffix:@"crash"]) { NSArray * compo = [fname componentsSeparatedByString:@"_"]; - if( [compo count] < 3 ) { found = NO; break; } + if( [compo count] < 3 ) continue; compo = [[compo objectAtIndex:1] componentsSeparatedByString:@"-"]; - if( [compo count] < 4 ) { found = NO; break; } - if( year < [[compo objectAtIndex:0] intValue] && - month < [[compo objectAtIndex:1] intValue] && - day < [[compo objectAtIndex:2] intValue] && - hours < [[compo objectAtIndex:3] intValue] ) + if( [compo count] < 4 ) continue; + + // Dooh. ugly. + if( year < [[compo objectAtIndex:0] intValue] || + (year ==[[compo objectAtIndex:0] intValue] && + (month < [[compo objectAtIndex:1] intValue] || + (month ==[[compo objectAtIndex:1] intValue] && + (day < [[compo objectAtIndex:2] intValue] || + (day ==[[compo objectAtIndex:2] intValue] && + hours < [[compo objectAtIndex:3] intValue] )))))) { year = [[compo objectAtIndex:0] intValue]; month = [[compo objectAtIndex:1] intValue]; day = [[compo objectAtIndex:2] intValue]; hours = [[compo objectAtIndex:3] intValue]; latestLog = [crashReporter stringByAppendingPathComponent:fname]; - found = YES; } } } - if(!(found && [[NSFileManager defaultManager] fileExistsAtPath: latestLog])) + if(!(latestLog && [[NSFileManager defaultManager] fileExistsAtPath:latestLog])) return nil; if( !previouslySeen ) @@ -2179,14 +2176,14 @@ end: [pool release]; } -- (void)notifyCrashLogToUser:(NSString *)crashLog +- (void)notifyCrashLogToUser:(NSString *)crashLogPath { int ret = NSRunInformationalAlertPanel(_NS("VLC has previously crashed"), _NS("VLC has previously crashed, do you want to send an email with the crash to VLC's team?"), _NS("Send"), _NS("Don't Send"), nil, nil); if( ret == NSAlertDefaultReturn ) { - [self mailCrashLog:crashLog withUserComment:_NS("")]; + [self mailCrashLog:[NSString stringWithContentsOfFile:crashLogPath] withUserComment:_NS("")]; } } -- 2.39.2