source: releases/Pester/1.1b4/Source/PSMediaAlert.m@ 557

Last change on this file since 557 was 133, checked in by Nicholas Riley, 22 years ago

VERSION: Updated for 1.1b4.

PSMovieAlertController.[hm]: Set output volume from alert; save and
restore output volume (bug 27).

PSBeepAlert.[hm]: Save and set volume, disabled pending a
synchronous equivalent to NSBeep().

NJRQTMediaPopUpButton.[hm]: Save movieHasAudio (does not include
beeps, pending the above fix, since they don't permit volume
adjustment). savedVolume indicates whether the volume has been saved
but not restored yet; outputVolume stores the set volume (eventually
incorporated into a PSMediaAlert).

PSMediaAlert.[hm]: Stores repetitions and volume information for audio
alerts. New superclass of PSBeepAlert and PSMovieAlert.

PSPreferencesController.m: Fixed bug where hot keys still appeared
even after they couldn't be set - last of bug 29. Add Command-comma
to the list of disallowed equivalents, as it's reserved for
Preferences now (still a bug - it'll show the entire set key
equivalent at the left side of the window when you press
command-comma; ah well.)

Volume [0123].png: Volume-indicating small icons from QuickTime 6.

NJRSoundManager.[hm]: Interface to volume saving, restoring, setting -
necessary because the QuickTime call to SetDefaultOutputVolume sets
the right channel volume only (bug 27).

PSVolumeController.h: Controller for volume popup window (bug 27).
Not your average NSWindowController, but it works. Keyboard control
of volume is still necessary; filed as bug 31.

PSAlarmSetController.[hm]: Added references to sound volume button and
showVolume: action. Added volume setting support (bug 27); mostly
similar interface to calendar, though we need direct calls to
NJRSoundManager to restore sound volume at times. Only enable sound
volume button if selected media file has audio component (and isn't the
system alert sound, which I discussed above). Take advantage of
PSMediaAlert to factor some code in _readAlerts:. Save and restore
volume as part of alerts.

Read Me.rtfd: Updated release notes; fixed some bizarre text
formatting problems; search/replace "* " bullet-space with "*\t"
bullet-tab to improve alignment in release notes.

PSMovieAlert.[hm]: Factored code into PSMediaAlert. Describe output
volume as percentage of maximum.

NJRHotKey.m: Fixed some odd spacing left over from Ecky's code.

PSApplication.m: Restore saved output volume on quit.

English.lproj/MainMenu.nib: Added volume button.

English.lproj/Volume.nib: Volume nib (bug 27).

PSCalendarController.m: Removed casts from a copy/paste error. Fixed
variable names in some code inherited from my TextExtras incremental
search modifications - it's not always a text field now.

File size: 1.7 KB
Line 
1//
2// PSMediaAlert.m
3// Pester
4//
5// Created by Nicholas Riley on Tue Apr 08 2003.
6// Copyright (c) 2003 Nicholas Riley. All rights reserved.
7//
8
9#import "PSMediaAlert.h"
10#import "NSDictionary-NJRExtensions.h"
11#import "NJRSoundManager.h"
12#import <QuickTime/Movies.h>
13
14// property list keys
15static NSString * const PLAlertRepetitions = @"times"; // NSString
16static NSString * const PLAlertOutputVolume = @"volume"; // NSNumber
17
18@implementation PSMediaAlert
19
20#pragma mark initialize-release
21
22- (id)initWithRepetitions:(unsigned short)numReps;
23{
24 if ( (self = [super init]) != nil) {
25 repetitions = numReps;
26 }
27 return self;
28}
29
30#pragma mark accessing
31
32- (unsigned short)repetitions;
33{
34 return repetitions;
35}
36
37- (float)outputVolume;
38{
39 return outputVolume;
40}
41
42- (void)setOutputVolume:(float)volume;
43{
44 if ([NJRSoundManager volumeIsNotMutedOrInvalid: volume])
45 outputVolume = volume;
46 else
47 outputVolume = kNoVolume;
48}
49
50#pragma mark property list serialization (Pester 1.1)
51
52- (NSDictionary *)propertyListRepresentation;
53{
54 NSMutableDictionary *plAlert = [[super propertyListRepresentation] mutableCopy];
55 [plAlert setObject: [NSNumber numberWithUnsignedShort: repetitions] forKey: PLAlertRepetitions];
56 if (outputVolume != kNoVolume) {
57 [plAlert setObject: [NSNumber numberWithFloat: outputVolume] forKey: PLAlertOutputVolume];
58 }
59 return [plAlert autorelease];
60}
61
62- (id)initWithPropertyList:(NSDictionary *)dict;
63{
64 if ( (self = [self initWithRepetitions: [[dict objectForRequiredKey: PLAlertRepetitions] unsignedShortValue]]) != nil) {
65 [self setOutputVolume: [[dict objectForKey: PLAlertOutputVolume] floatValue]];
66 }
67 return self;
68}
69
70@end
Note: See TracBrowser for help on using the repository browser.