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/PSBeepAlert.m

    r34 r53  
    1010#import "PSBeepAlert.h"
    1111#import "PSAlarmAlertController.h"
     12#import "NSDictionary-NJRExtensions.h"
     13
     14// property list keys
     15static NSString * const PLAlertRepetitions = @"times"; // NSNumber
    1216
    1317@implementation PSBeepAlert
     
    3236}
    3337
     38- (unsigned short)repetitions;
     39{
     40    return repetitions;
     41}
     42
    3443- (void)beep;
    3544{
     
    3746    repetitionsRemaining--;
    3847    if (repetitionsRemaining == 0) {
     48        [self completedForAlarm: alarm];
    3949        [self release];
    4050        return;
     
    4858}
    4959
    50 - (void)triggerForAlarm:(PSAlarm *)alarm;
     60- (void)triggerForAlarm:(PSAlarm *)anAlarm;
    5161{
     62    alarm = anAlarm;
    5263    repetitionsRemaining = repetitions;
    5364    [self retain];
     
    5667}
    5768
     69- (NSAttributedString *)actionDescription;
     70{
     71    return [[@"Play the system alert sound" stringByAppendingString:
     72                                            repetitions == 1 ? @"" : [NSString stringWithFormat: @" %hu times", repetitions]] small];
     73}
     74
     75#pragma mark property list serialization (Pester 1.1)
     76
     77- (NSDictionary *)propertyListRepresentation;
     78{
     79    NSMutableDictionary *plAlert = [[super propertyListRepresentation] mutableCopy];
     80    [plAlert setObject: [NSNumber numberWithUnsignedShort: repetitions] forKey: PLAlertRepetitions];
     81    return [plAlert autorelease];
     82}
     83
     84- (id)initWithPropertyList:(NSDictionary *)dict;
     85{
     86    return [self initWithRepetitions: [[dict objectForRequiredKey: PLAlertRepetitions] unsignedShortValue]];
     87}
     88
    5889@end
Note: See TracChangeset for help on using the changeset viewer.