forked from mitzpettel/Vidi
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDBVidiAboutPanelController.m
86 lines (75 loc) · 2.38 KB
/
DBVidiAboutPanelController.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
//
// DBVidiAboutPanelController.m
// Vidi
//
// Created by Mitz Pettel on Mar 28 2003.
// Copyright (c) 2003 Mitz Pettel. All rights reserved.
//
#import "DBVidiAboutPanelController.h"
#import "DBVidi.h"
@implementation DBVidiAboutPanelController
+ (id)sharedAboutPanelController {
static DBVidiAboutPanelController *sharedInstance = nil;
if (!sharedInstance) {
sharedInstance = [[self alloc] init];
}
return sharedInstance;
}
- (id)init {
NSBundle *bundle;
self = [super init];
if (self) {
[NSBundle loadNibNamed:@"AboutPanel" owner:self];
}
bundle = [NSBundle mainBundle];
[appNameField setStringValue:[bundle objectForInfoDictionaryKey:(NSString *)kCFBundleNameKey]];
[legalTextField setStringValue:[bundle objectForInfoDictionaryKey:@"NSHumanReadableCopyright"]];
[tunerTextField
setStringValue:[self hardwareInfoString]
];
[versionField
setStringValue:[NSString
stringWithFormat:@"%@ (v%@)",
[bundle objectForInfoDictionaryKey:@"CFBundleShortVersionString"],
[bundle objectForInfoDictionaryKey:(NSString *)kCFBundleVersionKey]
]
];
return self;
}
- (NSString *)firmwareVersionString
{
unsigned firmwareVersion = [[NSApp delegate] firmwareVersion];
return [NSString
stringWithFormat:@"%d.%d.%d",
(firmwareVersion >>24) & 0xFF,
(firmwareVersion >>16) & 0xFF,
(firmwareVersion >>8) & 0xFF
];
}
- (NSString *)hardwareInfoString
{
if ( [[NSApp delegate] firmwareVersion]==0 )
return NSLocalizedString( @"Generic DV device", @"hardware info in About Vidi" );
if ( [[NSApp delegate] tunerDisplayName] )
return [NSString
stringWithFormat:NSLocalizedString( @"Formac Studio DV/TV (%@)\nTuner: %@", @"hardware info in About Vidi. parameters are frimware version and tuner model" ),
[self firmwareVersionString],
[[NSApp delegate] tunerDisplayName]
];
return [NSString
stringWithFormat:NSLocalizedString( @"Formac Studio DV (%@)", @"hardware info in About Vidi. parameter is frimware version" ),
[self firmwareVersionString]
];
}
- (void)dealloc
{
[infoPanel release];
[super dealloc];
}
- (IBAction)showPanel:(id)sender
{
if ( ![infoPanel isVisible] )
[infoPanel center];
[infoPanel makeKeyAndOrderFront:nil];
}
@end