diff options
author | dynaflash <[email protected]> | 2008-01-08 13:58:45 +0000 |
---|---|---|
committer | dynaflash <[email protected]> | 2008-01-08 13:58:45 +0000 |
commit | 0d85534e25aa641a2688f4037d9c79de4f5e62ab (patch) | |
tree | 0ff05f33993e834803f45b008b0ca858ce769161 | |
parent | dc025a66b61863c8578b86c256bffd7b0b7c6aab (diff) |
Macgui: Implement writeToActivityLog method with provides a simple way to send messages to the activity window and log much like hb_log including a time stamp.
- example call : [self writeToActivityLog:"trying to open a package"];
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@1172 b64f7644-9d1e-0410-96f1-a4d463321fa5
-rw-r--r-- | macosx/Controller.h | 2 | ||||
-rw-r--r-- | macosx/Controller.mm | 17 |
2 files changed, 13 insertions, 6 deletions
diff --git a/macosx/Controller.h b/macosx/Controller.h index a68087d23..fc0cdfc42 100644 --- a/macosx/Controller.h +++ b/macosx/Controller.h @@ -204,7 +204,7 @@ BOOL SuccessfulScan; NSString * currentSource; } - +- (void) writeToActivityLog:(char *) activityMessage; - (IBAction) browseSources: (id) sender; - (void) browseSourcesDone: (NSOpenPanel *) sheet returnCode: (int) returnCode contextInfo: (void *) contextInfo; diff --git a/macosx/Controller.mm b/macosx/Controller.mm index 6bf9a125b..7a109eff3 100644 --- a/macosx/Controller.mm +++ b/macosx/Controller.mm @@ -766,6 +766,13 @@ static NSString * ChooseSourceIdentifier = @"Choose Source It } } +/* We use this to write messages to stderr from the macgui which show up in the activity window and log*/ +- (void) writeToActivityLog:(char *) activityMessage +{ + time_t _now = time( NULL ); + struct tm * now = localtime( &_now ); + fprintf(stderr, "[%02d:%02d:%02d] MacGui: %s\n", now->tm_hour, now->tm_min, now->tm_sec, activityMessage ); +} #pragma mark - #pragma mark Toolbar @@ -1131,11 +1138,11 @@ static NSString * ChooseSourceIdentifier = @"Choose Source It /* We check to see if the chosen file at path is a package */ if ([[NSWorkspace sharedWorkspace] isFilePackageAtPath:path]) { - fprintf( stderr, "MacGui: trying to open a package\n"); + [self writeToActivityLog:"trying to open a package"]; /* We check to see if this is an .eyetv package */ if ([[path pathExtension] isEqualToString: @"eyetv"]) { - fprintf( stderr, "MacGui: trying to open eyetv package\n"); + [self writeToActivityLog:"trying to open eyetv package"]; /* We're looking at an EyeTV package - try to open its enclosed .mpg media file */ NSString *mpgname; @@ -1148,19 +1155,19 @@ static NSString * ChooseSourceIdentifier = @"Choose Source It /* Found an mpeg inside the eyetv package, make it our scan path and call performScan on the enclosed mpeg */ path = mpgname; - fprintf( stderr, "MacGui: found mpeg in eyetv package\n"); + [self writeToActivityLog:"found mpeg in eyetv package"]; [self performScan:path scanTitleNum:0]; } else { /* We did not find an mpeg file in our package, so we do not call performScan */ - fprintf( stderr, "MacGui: no valid mpeg in eyetv package\n"); + [self writeToActivityLog:"no valid mpeg in eyetv package"]; } } else { /* The package is not an eyetv package, so we do not call performScan */ - fprintf( stderr, "MacGui: unable to open package\n"); + [self writeToActivityLog:"unable to open package"]; } } else |