Changeset 53 for trunk/Cocoa/Pester/Source/NJRQTMediaPopUpButton.m
- Timestamp:
- 01/02/03 05:30:03 (21 years ago)
- Location:
- trunk/Cocoa/Pester/Source
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Cocoa/Pester/Source
- Property svn:ignore
-
old new 1 1 build 2 .gdb_history
-
- Property svn:ignore
-
trunk/Cocoa/Pester/Source/NJRQTMediaPopUpButton.m
r47 r53 11 11 #import "NSMovie-NJRExtensions.h" 12 12 #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 13 19 14 20 static const int NJRQTMediaPopUpButtonMaxRecentItems = 10; … … 103 109 #pragma mark initialize-release 104 110 105 - (void) awakeFromNib;111 - (void)_setUp; 106 112 { 107 113 NSMenu *menu; … … 145 151 } 146 152 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 147 169 - (void)dealloc; 148 170 { … … 171 193 } 172 194 195 - (void)setAlias:(BDAlias *)alias; 196 { 197 [self _setAlias: alias]; 198 if ([self _validateWithPreview: NO]) { 199 [self selectItem: [self _itemForAlias: selectedAlias]]; 200 } 201 } 202 173 203 - (void)_setPath:(NSString *)path; 174 204 { … … 186 216 // [self _validateRecentMedia]; 187 217 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 } 189 229 // NSLog(@"_itemForAlias: %@", path); 190 230 … … 250 290 [preview setMovie: nil]; 251 291 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."); 253 293 [self _invalidateSelection]; 254 294 return NO; 255 295 } 256 296 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]]); 258 298 [self _invalidateSelection]; 259 299 [movie release]; … … 262 302 } 263 303 [movie release]; 264 [preview start: self];304 if (doPreview) [preview start: self]; 265 305 } 266 306 [[NSNotificationCenter defaultCenter] postNotificationName: NJRQTMediaPopUpButtonMovieChangedNotification object: self];
Note:
See TracChangeset
for help on using the changeset viewer.