adium 3864:1ab0f8f8e8f4: Remove 10.5 and G5 compatibility code f...

commits at adium.im commits at adium.im
Thu Apr 14 19:10:47 UTC 2011


details:	http://hg.adium.im/adium/rev/1ab0f8f8e8f4
revision:	3864:1ab0f8f8e8f4
branch:		(none)
author:		Frank Dowsett <wixardy at adium.im>
date:		Wed Apr 13 23:39:16 2011 -0400

Remove 10.5 and G5 compatibility code from AdiumSound silencing a deprecated warning.
Subject: adium 3865:814c67ba82e1: A start on fixing VO; first up: contact list. The role being set (row) is not what it should be (static text).

details:	http://hg.adium.im/adium/rev/814c67ba82e1
revision:	3865:814c67ba82e1
branch:		(none)
author:		Frank Dowsett <wixardy at adium.im>
date:		Thu Apr 14 15:07:51 2011 -0400

A start on fixing VO; first up: contact list. The role being set (row) is not what it should be (static text).

Fixes #12916 and #9004 Refs #15115
Subject: adium 3866:842521f83bc7: Changelogging VO

details:	http://hg.adium.im/adium/rev/842521f83bc7
revision:	3866:842521f83bc7
branch:		(none)
author:		Frank Dowsett <wixardy at adium.im>
date:		Thu Apr 14 15:09:13 2011 -0400

Changelogging VO

diffs (448 lines):

diff -r cc1f3b9a378f -r 842521f83bc7 Adium.xcodeproj/project.pbxproj
--- a/Adium.xcodeproj/project.pbxproj	Tue Apr 12 18:46:34 2011 -0400
+++ b/Adium.xcodeproj/project.pbxproj	Thu Apr 14 15:09:13 2011 -0400
@@ -4530,7 +4530,7 @@
 		63A3A96E0F9C35D3006C9CB0 /* en */ = {isa = PBXFileReference; fileEncoding = 10; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/Localizable.strings; sourceTree = "<group>"; };
 		63A3A96F0F9C35D3006C9CB0 /* en_AU */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.strings; name = en_AU; path = en_AU.lproj/Localizable.strings; sourceTree = "<group>"; };
 		63A3A9700F9C35D3006C9CB0 /* en_CA */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.strings; name = en_CA; path = en_CA.lproj/Localizable.strings; sourceTree = "<group>"; };
-		63A3A9710F9C35D3006C9CB0 /* en_GB */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.strings; name = en_GB; path = en_GB.lproj/Localizable.strings; sourceTree = "<group>"; };
+		63A3A9710F9C35D3006C9CB0 /* en_GB */ = {isa = PBXFileReference; fileEncoding = 10; lastKnownFileType = text.plist.strings; name = en_GB; path = en_GB.lproj/Localizable.strings; sourceTree = "<group>"; };
 		63A3A9720F9C35D3006C9CB0 /* es */ = {isa = PBXFileReference; fileEncoding = 10; lastKnownFileType = text.plist.strings; name = es; path = es.lproj/Localizable.strings; sourceTree = "<group>"; };
 		63A3A9730F9C35D3006C9CB0 /* fi */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.strings; name = fi; path = fi.lproj/Localizable.strings; sourceTree = "<group>"; };
 		63A3A9740F9C35D3006C9CB0 /* fr */ = {isa = PBXFileReference; fileEncoding = 10; lastKnownFileType = text.plist.strings; name = fr; path = fr.lproj/Localizable.strings; sourceTree = "<group>"; };
diff -r cc1f3b9a378f -r 842521f83bc7 ChangeLogs/Changes.txt
--- a/ChangeLogs/Changes.txt	Tue Apr 12 18:46:34 2011 -0400
+++ b/ChangeLogs/Changes.txt	Thu Apr 14 15:09:13 2011 -0400
@@ -72,6 +72,10 @@
  * Miscellaneous improvements to Copyright.txt file.
  * Debug logging: All GLib's errors and messages, and all exceptions are now logged to the Debug Window.
 
+ VoiceOver
+  * VoiceOver no longer says "empty" before each item in the contact list. (#12916 and #9004)
+  * The contact window's toolbar items now have appropriate labels. (#13010)
+
 
 Version 1.4.2 (X/X/2011)
  * Updated to libpurple 2.7.11. Highlights of applicable changes:
diff -r cc1f3b9a378f -r 842521f83bc7 Frameworks/Adium Framework/Source/AIListCell.m
--- a/Frameworks/Adium Framework/Source/AIListCell.m	Tue Apr 12 18:46:34 2011 -0400
+++ b/Frameworks/Adium Framework/Source/AIListCell.m	Thu Apr 14 15:09:13 2011 -0400
@@ -397,26 +397,22 @@
 
 #pragma mark Accessibility
 
-#if ACCESSIBILITY_DEBUG
 - (NSArray *)accessibilityAttributeNames
 {
-	AILogWithSignature(@"names: %@", [super accessibilityAttributeNames]);
-	return [super accessibilityAttributeNames];
+	NSMutableArray *attributeNames = [[super accessibilityAttributeNames] mutableCopy];
+	[attributeNames addObject:NSAccessibilityValueAttribute];
+
+	return [attributeNames autorelease];
 }
-#endif
 
 - (id)accessibilityAttributeValue:(NSString *)attribute
 {
 	id value;
 
-#if ACCESSIBILITY_DEBUG
-	AILogWithSignature(@"Asked %@ for %@", listObject, attribute);
-#endif
-
-	if([attribute isEqualToString:NSAccessibilityRoleAttribute]) {
-		value = NSAccessibilityRowRole;
+	if ([attribute isEqualToString:NSAccessibilityRoleAttribute]) {
+		value = NSAccessibilityStaticTextRole;
 		
-	} else if([attribute isEqualToString:NSAccessibilityRoleDescriptionAttribute]) {
+	} else if ([attribute isEqualToString:NSAccessibilityValueAttribute]) {
 		if ([listObject isKindOfClass:[AIListGroup class]]) {
 			value = [NSString stringWithFormat:AILocalizedString(@"contact group %@", "%@ will be the name of a group in the contact list"), [listObject longDisplayName]];
 
@@ -430,7 +426,7 @@
 			statusDescription = [adium.statusController localizedDescriptionForStatusName:(listObject.statusName ?
 																					  listObject.statusName :
 																					  [adium.statusController defaultStatusNameForType:listObject.statusType])
-																		  statusType:listObject.statusType];
+																			   statusType:listObject.statusType];
 			statusMessage = [listObject statusMessageString];
 			
 			value = [[name mutableCopy] autorelease];
@@ -438,10 +434,10 @@
 			if (statusMessage) [value appendFormat:AILocalizedString(@"; status message %@", "please keep the semicolon at the start of the line. %@ will be replaced by a status message. This is used when reading an entry in the contact list aloud, such as 'Evan Schoenberg; status message I am bouncing up and down'"), statusMessage];
 		}
 
-	} else if([attribute isEqualToString:NSAccessibilityTitleAttribute]) {
+	} else if ([attribute isEqualToString:NSAccessibilityTitleAttribute]) {
 		value = [self labelString];
 		
-	} else if([attribute isEqualToString:NSAccessibilityWindowAttribute]) {
+	} else if ([attribute isEqualToString:NSAccessibilityWindowAttribute]) {
 		value = [controlView window];
                 
 	} else {
diff -r cc1f3b9a378f -r 842521f83bc7 Plugins/Dual Window Interface/AIMessageViewController.m
--- a/Plugins/Dual Window Interface/AIMessageViewController.m	Tue Apr 12 18:46:34 2011 -0400
+++ b/Plugins/Dual Window Interface/AIMessageViewController.m	Thu Apr 14 15:09:13 2011 -0400
@@ -334,6 +334,8 @@
 	[scrollView_messages setDocumentView:[messageDisplayController messageView]];
 	[[scrollView_messages documentView] setFrame:[scrollView_messages visibleRect]];
 	
+	[scrollView_messages setAccessibilityChild:[scrollView_messages documentView]];
+	
 	[textView_outgoing setNextResponder:view_contents];
 	[[scrollView_messages documentView] setNextResponder:textView_outgoing];
 }
diff -r cc1f3b9a378f -r 842521f83bc7 Source/AdiumSound.h
--- a/Source/AdiumSound.h	Tue Apr 12 18:46:34 2011 -0400
+++ b/Source/AdiumSound.h	Thu Apr 14 15:09:13 2011 -0400
@@ -24,8 +24,6 @@
     float				customVolume;
 	
 	NSUInteger			soundsAreMuted;
-
-	BOOL				reconfigureAudioContextBeforeEachPlay;
 }
 
 /*!
diff -r cc1f3b9a378f -r 842521f83bc7 Source/AdiumSound.m
--- a/Source/AdiumSound.m	Tue Apr 12 18:46:34 2011 -0400
+++ b/Source/AdiumSound.m	Thu Apr 14 15:09:13 2011 -0400
@@ -18,11 +18,7 @@
 #import "AISoundController.h"
 #import <AIUtilities/AIDictionaryAdditions.h>
 #import <AIUtilities/AISleepNotification.h>
-#ifdef __LP64__
-#	import <CoreAudio/AudioHardware.h>
-#else
-#	import <QTKit/QTKit.h>
-#endif
+#import <CoreAudio/AudioHardware.h>
 #import <CoreServices/CoreServices.h>
 #import <sys/sysctl.h>
 
@@ -34,23 +30,14 @@
 - (void)_setVolumeOfAllSoundsTo:(float)inVolume;
 - (void)cachedPlaySound:(NSString *)inPath;
 - (void)_uncacheLeastRecentlyUsedSound;
-#ifdef __LP64__
 - (NSString *)systemAudioDeviceID;
 - (void)configureAudioContextForSound:(NSSound *)sound;
-#else
-- (QTAudioContextRef)createAudioContextWithSystemOutputDevice;
-- (void)configureAudioContextForMovie:(QTMovie *)movie;
-#endif
 - (NSArray *)allSounds;
 - (void)workspaceSessionDidBecomeActive:(NSNotification *)notification;
 - (void)workspaceSessionDidResignActive:(NSNotification *)notification;
 - (void)systemWillSleep:(NSNotification *)notification;
 @end
 
- at interface NSProcessInfo (AIProcessorInfoAdditions)
-- (BOOL)processorFamilyIsG5;
- at end
-
 static dispatch_queue_t soundPlayingQueue;
 
 static OSStatus systemOutputDeviceDidChange(AudioObjectID inObjectID, UInt32 inNumberAddresses, const AudioObjectPropertyAddress inAddresses[], void* refcon);
@@ -89,26 +76,16 @@
 													 name:AISystemWillSleep_Notification
 												   object:nil];
 		
-		/* Sign up for notification when the user changes the system output device in the Sound pane of System Preferences.
-		 *
-		 * However, we avoid doing this on G5 machines. G5s spew a continuous stream of
-		 * kAudioHardwarePropertyDefaultSystemOutputDevice notifications without the device actually changing;
-		 * rather than stutter our audio and eat CPU continuously, we just won't try to update.
-		 */
-		if (![[NSProcessInfo processInfo] processorFamilyIsG5]) {
-			AudioObjectPropertyAddress audioAddress = {
-				kAudioHardwarePropertyDefaultSystemOutputDevice,
-				kAudioObjectPropertyScopeGlobal,
-				kAudioObjectPropertyElementMaster
-			};
-			OSStatus err = AudioObjectAddPropertyListener(kAudioObjectSystemObject, &audioAddress, systemOutputDeviceDidChange, self);
+		// Sign up for notification when the user changes the system output device in the Sound pane of System Preferences.
+		AudioObjectPropertyAddress audioAddress = {
+			kAudioHardwarePropertyDefaultSystemOutputDevice,
+			kAudioObjectPropertyScopeGlobal,
+			kAudioObjectPropertyElementMaster
+		};
+		OSStatus err = AudioObjectAddPropertyListener(kAudioObjectSystemObject, &audioAddress, systemOutputDeviceDidChange, self);
 
-			if (err != noErr)
-				NSLog(@"%s: Couldn't sign up for system-output-device-changed notification, because AudioHardwareAddPropertyListener returned %i. Adium will not know when the default system audio device changes.", __PRETTY_FUNCTION__, err);			
-		} else {
-			//We won't be updating automatically, so reconfigure before a sound is played again
-			reconfigureAudioContextBeforeEachPlay = YES;
-		}
+		if (err != noErr)
+			NSLog(@"%s: Couldn't sign up for system-output-device-changed notification, because AudioHardwareAddPropertyListener returned %i. Adium will not know when the default system audio device changes.", __PRETTY_FUNCTION__, err);
 	}
 
 	return self;
@@ -146,17 +123,10 @@
 
 - (void)stopPlayingSoundAtPath:(NSString *)inPath
 {
-#ifdef __LP64__
 	NSSound *sound = [soundCacheDict objectForKey:inPath];
 	if (sound) {
 		[sound stop];
 	}
-#else
-    QTMovie *movie = [soundCacheDict objectForKey:inPath];
-    if (movie) {
-		[movie stop];
-	}
-#endif
 }
 
 /*!
@@ -197,13 +167,12 @@
 }
 
 /*!
- * @brief Play a QTMovie, possibly cached
+ * @brief Play an NSSound, possibly cached
  * 
  * @param inPath path to the sound file
  */
 - (void)cachedPlaySound:(NSString *)inPath
 {
-#ifdef __LP64__
 	NSSound *sound = [soundCacheDict objectForKey:inPath];
 	
 	//Load the sound if necessary
@@ -234,11 +203,6 @@
 		//Move this sound to the front of the cache (This will naturally move lesser used sounds to the back for removal)
 		[soundCacheArray removeObject:inPath];
 		[soundCacheArray insertObject:inPath atIndex:0];
-		
-		if (reconfigureAudioContextBeforeEachPlay) {
-			[sound stop];
-			[self configureAudioContextForSound:sound];
-		}
     }
 	
     //Engage!
@@ -251,61 +215,6 @@
 			[sound play];
 		});
     }
-#else
-    QTMovie *movie = [soundCacheDict objectForKey:inPath];
-
-	//Load the sound if necessary
-    if (!movie) {
-		//If the cache is full, remove the least recently used cached sound
-		if ([soundCacheDict count] >= MAX_CACHED_SOUNDS) {
-			[self _uncacheLeastRecentlyUsedSound];
-		}
-
-		//Load and cache the sound
-		NSError *error = nil;
-		movie = [[QTMovie alloc] initWithFile:inPath
-		                                error:&error];
-		if (movie) {
-			//Insert the player at the front of our cache
-			[soundCacheArray insertObject:inPath atIndex:0];
-			[soundCacheDict setObject:movie forKey:inPath];
-			[movie release];
-
-			//Set the volume (otherwise #2283 happens)
-			[movie setVolume:customVolume];
-
-			[self configureAudioContextForMovie:movie];
-		} else {
-			AILogWithSignature(@"Error loading %@: %@", inPath, error);
-		}
-
-    } else {
-		//Move this sound to the front of the cache (This will naturally move lesser used sounds to the back for removal)
-		[soundCacheArray removeObject:inPath];
-		[soundCacheArray insertObject:inPath atIndex:0];
-		
-		if (reconfigureAudioContextBeforeEachPlay) {
-			[movie stop];
-			[self configureAudioContextForMovie:movie];
-		}
-    }
-
-    //Engage!
-    if (movie) {
-		//Ensure the sound is starting from the beginning; necessary for cached sounds that have already been played
-		QTTime startOfMovie = {
-			.timeValue = 0LL,
-			.timeScale = [[movie attributeForKey:QTMovieTimeScaleAttribute] longValue],
-			.flags = 0,
-		};
-		[movie setCurrentTime:startOfMovie];
-
-		//This only has an effect if the movie is not already playing. It won't stop it, and it won't start it over (the latter is what setCurrentTime: is for).
-		dispatch_async(soundPlayingQueue, ^{
-			[movie play];
-		});
-    }
-#endif
 }
 
 /*!
@@ -314,7 +223,6 @@
 - (void)_uncacheLeastRecentlyUsedSound
 {
 	NSString			*lastCachedPath = [soundCacheArray lastObject];
-#ifdef __LP64__
 	NSSound *sound = [soundCacheDict objectForKey:lastCachedPath];
 	
 	//Remove it from the cache only if it is not playing.
@@ -322,55 +230,8 @@
 		[soundCacheDict removeObjectForKey:lastCachedPath];
 		[soundCacheArray removeLastObject];
 	}
-#else
-	QTMovie *movie = [soundCacheDict objectForKey:lastCachedPath];
-
-	//If a movie is stopped, then its rate is zero. Thus, this tests whether the movie is playing. We remove it from the cache only if it is not playing.
-	if ([movie rate] == 0.0) {
-		[soundCacheDict removeObjectForKey:lastCachedPath];
-		[soundCacheArray removeLastObject];
-	}
-#endif
 }
 
-#ifndef __LP64__
-- (QTAudioContextRef)createAudioContextWithSystemOutputDevice
-{
-	QTAudioContextRef newAudioContext = NULL;
-	OSStatus err;
-	UInt32 dataSize;
-
-	//First, obtain the device itself.
-	AudioDeviceID systemOutputDevice = 0;
-	dataSize = sizeof(systemOutputDevice);
-	err = AudioHardwareGetProperty(kAudioHardwarePropertyDefaultSystemOutputDevice, &dataSize, &systemOutputDevice);
-	if (err != noErr) {
-		NSLog(@"%s: Could not get the system output device: AudioHardwareGetProperty returned error %i", __PRETTY_FUNCTION__, err);
-		return NULL;
-	}
-
-	//Now get its UID. We'll need to release this.
-	CFStringRef deviceUID = NULL;
-	dataSize = sizeof(deviceUID);
-	err = AudioDeviceGetProperty(systemOutputDevice, /*channel*/ 0, /*isInput*/ false, kAudioDevicePropertyDeviceUID, &dataSize, &deviceUID);
-	if (err != noErr) {
-		NSLog(@"%s: Could not get the device UID for device %p: AudioDeviceGetProperty returned error %i", __PRETTY_FUNCTION__, systemOutputDevice, err);
-		return NULL;
-	}
-	[(NSObject *)deviceUID autorelease];
-
-	//Create an audio context for this device so that our movies can play into it.
-	err = QTAudioContextCreateForAudioDevice(kCFAllocatorDefault, deviceUID, /*options*/ NULL, &newAudioContext);
-	if (err != noErr) {
-		NSLog(@"%s: QTAudioContextCreateForAudioDevice with device UID %@ returned error %i", __PRETTY_FUNCTION__, deviceUID, err);
-		return NULL;
-	}
-
-	return newAudioContext;
-}
-
-#else
-
 - (NSString *)systemAudioDeviceID
 {
 	OSStatus err;
@@ -409,9 +270,7 @@
 	
 	return (NSString *)deviceUID;
 }
-#endif
 
-#ifdef __LP64__
 - (void)configureAudioContextForSound:(NSSound *)sound
 {
 	[sound pause];
@@ -424,32 +283,6 @@
 	//Resume playback, now on the new device.
 	[sound resume];
 }
-#else
-- (void)configureAudioContextForMovie:(QTMovie *)movie
-{
-	//QTMovie gets confused if we're playing when we do this, so pause momentarily.
-	CGFloat savedRate = [movie rate];
-	[movie setRate:0.0f];
-	
-	//Exchange the audio context for a new one with the new device.
-	QTAudioContextRef newAudioContext = [self createAudioContextWithSystemOutputDevice];
-	
-	if (newAudioContext) {
-		OSStatus err = SetMovieAudioContext([movie quickTimeMovie], newAudioContext);
-		if (err != noErr) {
-			NSLog(@"%s: Could not set audio context of movie %@ to %p: SetMovieAudioContext returned error %i. Sounds may be routed to the default audio device instead of the system alert audio device.", __PRETTY_FUNCTION__, movie, newAudioContext, err);
-		}
-		
-		//We created it, so we must release it.
-		QTAudioContextRelease(newAudioContext);
-	} else {
-		NSLog(@"%s: Could not set audio context because -[AdiumSound createAudioContextWithSystemOutputDevice] returned NULL", __PRETTY_FUNCTION__);
-	}
-	
-	//Resume playback, now on the new device.
-	[movie setRate:savedRate];
-}
-#endif
 
 - (NSArray *)allSounds
 {
@@ -491,18 +324,9 @@
 
 - (void)systemOutputDeviceDidChange
 {
-#ifdef __LP64__
 	for (NSSound *sound in [self allSounds]) {
 		[self configureAudioContextForSound:sound];
 	}
-#else
-	NSEnumerator	*soundsEnum = [[self allSounds] objectEnumerator];
-	QTMovie			*movie;
-
-	while ((movie = [soundsEnum nextObject])) {
-		[self configureAudioContextForMovie:movie];
-	}
-#endif
 }
 
 @end
@@ -525,29 +349,3 @@
 
 	return noErr;
 }
-
- at implementation NSProcessInfo (AIProcessorInfoAdditions)
-
-- (BOOL)processorFamilyIsG5
-{
-	/* Credit to http://www.cocoadev.com/index.pl?MacintoshModels */
-	BOOL	isG5 = NO;
-	char	buffer[128];
-	size_t	length = sizeof(buffer);
-	if (sysctlbyname("hw.model", &buffer, &length, NULL, 0) == 0) {
-		NSString	*hardwareModel = [NSString stringWithUTF8String:buffer];
-		NSArray		*knownG5Macs = [NSArray arrayWithObjects:@"PowerMac11,2" /* G5 PCIe */, @"PowerMac12,1" /* iMac G5 (iSight) */, 
-									@"PowerMac7,2" /* PowerMac G5 */, @"PowerMac7,3" /* PowerMac G5 */, @"PowerMac8,1" /* iMac G5 */,
-									@"PowerMac8,2" /* iMac G5 Ambient Light Sensor */, @"PowerMac9,1" /* Power Mac G5 (Late 2004) */,
-									@"RackMac3,1" /* Xserve G5 */, nil];
-
-		if ([knownG5Macs containsObject:hardwareModel]) {
-			AILogWithSignature(@"On a G5 Mac.");
-			isG5 = YES;
-		}
-	}
-	
-	return isG5;
-}
-
- at end




More information about the commits mailing list