Sounds pulldowns only get sounds from the built-in system sound folder. This should avoid an Apple error (and resulting crash) with some wav files on Intel macs.
This commit is contained in:
parent
131fa9011d
commit
c9d2f7005c
|
@ -82,20 +82,19 @@
|
|||
|
||||
//set play sound
|
||||
NSMutableArray * sounds = [NSMutableArray array];
|
||||
NSEnumerator * soundEnumerator,
|
||||
* soundDirectoriesEnumerator = [[NSArray arrayWithObjects: @"System/Library/Sounds",
|
||||
[NSHomeDirectory() stringByAppendingPathComponent: @"Library/Sounds"], nil] objectEnumerator];
|
||||
NSString * soundPath, * sound;
|
||||
NSEnumerator * soundEnumerator;
|
||||
|
||||
//get list of all sounds and sort alphabetically
|
||||
while ((soundPath = [soundDirectoriesEnumerator nextObject]))
|
||||
if (soundEnumerator = [[NSFileManager defaultManager] enumeratorAtPath: soundPath])
|
||||
while ((sound = [soundEnumerator nextObject]))
|
||||
{
|
||||
sound = [sound stringByDeletingPathExtension];
|
||||
if ([NSSound soundNamed: sound])
|
||||
[sounds addObject: sound];
|
||||
}
|
||||
if (soundEnumerator = [[NSFileManager defaultManager] enumeratorAtPath: @"System/Library/Sounds"])
|
||||
{
|
||||
NSString * sound;
|
||||
while ((sound = [soundEnumerator nextObject]))
|
||||
{
|
||||
sound = [sound stringByDeletingPathExtension];
|
||||
if ([NSSound soundNamed: sound])
|
||||
[sounds addObject: sound];
|
||||
}
|
||||
}
|
||||
|
||||
fSounds = [[sounds sortedArrayUsingSelector: @selector(caseInsensitiveCompare:)] retain];
|
||||
}
|
||||
|
@ -146,7 +145,6 @@
|
|||
|
||||
//set port
|
||||
[fPortField setIntValue: [fDefaults integerForKey: @"BindPort"]];
|
||||
|
||||
[self updatePortStatus];
|
||||
|
||||
fNatStatus = -1;
|
||||
|
@ -419,32 +417,33 @@
|
|||
- (void) setSound: (id) sender
|
||||
{
|
||||
//play sound when selecting
|
||||
NSString * soundName = [sender titleOfSelectedItem];
|
||||
NSSound * sound;
|
||||
if ((sound = [NSSound soundNamed: soundName]))
|
||||
if ((sound = [NSSound soundNamed: [sender titleOfSelectedItem]]))
|
||||
[sound play];
|
||||
}
|
||||
|
||||
- (void) setUpdate: (id) sender
|
||||
{
|
||||
int index = [fUpdatePopUp indexOfSelectedItem];
|
||||
NSString * update;
|
||||
NSTimeInterval seconds;
|
||||
if (index == UPDATE_DAILY)
|
||||
{
|
||||
[fDefaults setObject: @"Daily" forKey: @"UpdateCheck"];
|
||||
update = @"Daily";
|
||||
seconds = 86400;
|
||||
}
|
||||
else if (index == UPDATE_WEEKLY)
|
||||
{
|
||||
[fDefaults setObject: @"Weekly" forKey: @"UpdateCheck"];
|
||||
update = @"Weekly";
|
||||
seconds = 604800;
|
||||
}
|
||||
else
|
||||
{
|
||||
[fDefaults setObject: @"Never" forKey: @"UpdateCheck"];
|
||||
update = @"Never";
|
||||
seconds = 0;
|
||||
}
|
||||
|
||||
[fDefaults setObject: update forKey: @"UpdateCheck"];
|
||||
[fDefaults setInteger: seconds forKey: @"SUScheduledCheckInterval"];
|
||||
|
||||
if (fUpdater)
|
||||
|
|
|
@ -1261,7 +1261,6 @@ static uint32_t kRed = BE(0xFF6450FF), //255, 100, 80
|
|||
|
||||
- (NSImage *) advancedBar
|
||||
{
|
||||
int h;
|
||||
uint32_t * p;
|
||||
uint8_t * bitmapData = [fBitmap bitmapData];
|
||||
int bytesPerRow = [fBitmap bytesPerRow];
|
||||
|
@ -1271,7 +1270,7 @@ static uint32_t kRed = BE(0xFF6450FF), //255, 100, 80
|
|||
[self getAvailability: piecesAvailablity size: pieceCount];
|
||||
|
||||
//lines 2 to 14: blue, green, or gray depending on whether we have the piece or not
|
||||
int i, index = 0;
|
||||
int i, h, index = 0;
|
||||
float increment = (float)pieceCount / (float)MAX_PIECES, indexValue = 0;
|
||||
uint32_t color;
|
||||
BOOL change;
|
||||
|
|
Loading…
Reference in New Issue