forked from hac/googlebookdownloader
-
Notifications
You must be signed in to change notification settings - Fork 0
/
AppController.m
55 lines (45 loc) · 1.61 KB
/
AppController.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
#import "AppController.h"
@implementation AppController
+ (AppController *)sharedController
{
return sharedController;
}
+ (void)setSharedController:(AppController *)value
{
sharedController = value;
}
- (void)awakeFromNib
{
[AppController setSharedController:self];
[[AppController sharedController] writeStringToLog:@"Google Book Downloader Version 1.0b2"];
}
- (void)writeStringToLog:(NSString *)string
{
[logView setString:[NSString stringWithFormat:@"%@%@\n\n", [logView string], string]];
[logView setFont:[NSFont fontWithName:@"Monaco" size:10]];
}
- (void)openCompanyURL:(id)sender
{
NSString *homePageURL = [[NSBundle mainBundle] objectForInfoDictionaryKey:@"Company URL"];
[[NSWorkspace sharedWorkspace] openURL:[NSURL URLWithString:homePageURL]];
}
- (void)openAppURL:(id)sender
{
NSString *homePageURL = [[NSBundle mainBundle] objectForInfoDictionaryKey:@"Application URL"];
[[NSWorkspace sharedWorkspace] openURL:[NSURL URLWithString:homePageURL]];
}
- (void)openDonateURL:(id)sender
{
NSString *donateURL = [[NSBundle mainBundle] objectForInfoDictionaryKey:@"Donate URL"];
[[NSWorkspace sharedWorkspace] openURL:[NSURL URLWithString:donateURL]];
}
- (void)showDonateAlert
{
int button = NSRunAlertPanel(@"Please Donate!", @"The many hours spent maintaining and improving Google Book Downloader are paid for by donations. Please show your support by donating—that's the best way to ensure this application will continue to improve!", @"Donate!", @"No, thanks", nil);
if (button == 1)
{
[self openDonateURL:nil];
}
[[NSUserDefaults standardUserDefaults] setBool:YES forKey:@"DonateAlertShown"];
}
@end