Ignore:
Timestamp:
01/02/03 05:30:03 (21 years ago)
Author:
Nicholas Riley
Message:

Updated for Pester 1.1a5 (very limited release).

Pester 1.1a4 was never released.

Location:
trunk/Cocoa/Pester/Source
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Cocoa/Pester/Source

    • Property svn:ignore
      •  

        old new  
        11build
         2.gdb_history
  • trunk/Cocoa/Pester/Source/NJRQTMediaPopUpButton.m

    r47 r53  
    1111#import "NSMovie-NJRExtensions.h"
    1212#import "NSImage-NJRExtensions.h"
     13
     14// XXX workaround for SoundFileManager log message in 10.2.3 and earlier
     15#include <stdio.h>
     16#include <unistd.h>
     17#include <fcntl.h>
     18// XXX end workaround
    1319
    1420static const int NJRQTMediaPopUpButtonMaxRecentItems = 10;
     
    103109#pragma mark initialize-release
    104110
    105 - (void)awakeFromNib;
     111- (void)_setUp;
    106112{
    107113    NSMenu *menu;
     
    145151}
    146152
     153- (id)initWithFrame:(NSRect)frame;
     154{
     155    if ( (self = [super initWithFrame: frame]) != nil) {
     156        [self _setUp];
     157    }
     158    return self;
     159}
     160
     161- (id)initWithCoder:(NSCoder *)coder;
     162{
     163    if ( (self = [super initWithCoder: coder]) != nil) {
     164        [self _setUp];
     165    }
     166    return self;
     167}
     168
    147169- (void)dealloc;
    148170{
     
    171193}
    172194
     195- (void)setAlias:(BDAlias *)alias;
     196{
     197    [self _setAlias: alias];
     198    if ([self _validateWithPreview: NO]) {
     199        [self selectItem: [self _itemForAlias: selectedAlias]];
     200    }
     201}
     202
    173203- (void)_setPath:(NSString *)path;
    174204{
     
    186216    // [self _validateRecentMedia];
    187217    path = [alias fullPath];
    188     sf = [[SoundFileManager sharedSoundFileManager] soundFileFromPath: path];
     218    {   // XXX suppress log message from Apple's code:
     219        // 2002-12-14 14:09:58.740 Pester[26529] Could not find sound type for directory /Users/nicholas/Desktop
     220        int errfd = dup(STDERR_FILENO), nullfd = open("/dev/null", O_WRONLY, 0);
     221        // need to have something open in STDERR_FILENO because if it isn't,
     222        // NSLog will log to /dev/console
     223        dup2(nullfd, STDERR_FILENO);
     224        close(nullfd);
     225        sf = [[SoundFileManager sharedSoundFileManager] soundFileFromPath: path];
     226        dup2(errfd, STDERR_FILENO);
     227        close(errfd);
     228    }
    189229    // NSLog(@"_itemForAlias: %@", path);
    190230
     
    250290            [preview setMovie: nil];
    251291            if (movie == nil) {
    252                 NSBeginAlertSheet(@"Format not recognized", @"OK", nil, nil, [self window], nil, nil, nil, nil, @"The item you selected isnÕt a sound or movie recognized by QuickTime.  Please select a different item.");
     292                NSBeginAlertSheet(@"Format not recognized", nil, nil, nil, [self window], nil, nil, nil, nil, @"The item you selected isnÕt a sound or movie recognized by QuickTime.  Please select a different item.");
    253293                [self _invalidateSelection];
    254294                return NO;
    255295            }
    256296            if (![movie hasAudio] && ![movie hasVideo]) {
    257                 NSBeginAlertSheet(@"No video or audio", @"OK", nil, nil, [self window], nil, nil, nil, nil, @"Ò%@Ó contains neither audio nor video content playable by QuickTime.  Please select a different item.", [[NSFileManager defaultManager] displayNameAtPath: [selectedAlias fullPath]]);
     297                NSBeginAlertSheet(@"No video or audio", nil, nil, nil, [self window], nil, nil, nil, nil, @"Ò%@Ó contains neither audio nor video content playable by QuickTime.  Please select a different item.", [[NSFileManager defaultManager] displayNameAtPath: [selectedAlias fullPath]]);
    258298                [self _invalidateSelection];
    259299                [movie release];
     
    262302        }
    263303        [movie release];
    264         [preview start: self];
     304        if (doPreview) [preview start: self];
    265305    }
    266306    [[NSNotificationCenter defaultCenter] postNotificationName: NJRQTMediaPopUpButtonMovieChangedNotification object: self];
Note: See TracChangeset for help on using the changeset viewer.