78 lines
1.8 KiB
Objective-C
78 lines
1.8 KiB
Objective-C
//
|
|
// AboutWindowController.m
|
|
// OverSight
|
|
//
|
|
// Created by Patrick Wardle on 7/15/16.
|
|
// Copyright (c) 2016 Objective-See. All rights reserved.
|
|
//
|
|
|
|
#import "Consts.h"
|
|
#import "Utilities.h"
|
|
#import "AboutWindowController.h"
|
|
|
|
@implementation AboutWindowController
|
|
|
|
@synthesize patrons;
|
|
@synthesize versionLabel;
|
|
|
|
//automatically called when nib is loaded
|
|
// ->center window
|
|
-(void)awakeFromNib
|
|
{
|
|
//center
|
|
[self.window center];
|
|
}
|
|
|
|
//automatically invoked when window is loaded
|
|
// ->set to white
|
|
-(void)windowDidLoad
|
|
{
|
|
//super
|
|
[super windowDidLoad];
|
|
|
|
//make white
|
|
[self.window setBackgroundColor: NSColor.whiteColor];
|
|
|
|
//set version sting
|
|
self.versionLabel.stringValue = [NSString stringWithFormat:@"Version: %@", getAppVersion()];
|
|
|
|
//load patrons
|
|
self.patrons.string = [NSString stringWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"patrons" ofType:@"txt"] encoding:NSUTF8StringEncoding error:NULL];
|
|
|
|
return;
|
|
}
|
|
|
|
//automatically invoked when window is closing
|
|
// ->make ourselves unmodal
|
|
-(void)windowWillClose:(NSNotification *)notification
|
|
{
|
|
//make un-modal
|
|
[[NSApplication sharedApplication] stopModal];
|
|
|
|
return;
|
|
}
|
|
|
|
//automatically invoked when user clicks any of the buttons
|
|
// ->load patreon or products webpage in user's default browser
|
|
-(IBAction)buttonHandler:(id)sender
|
|
{
|
|
//support us button
|
|
if(((NSButton*)sender).tag == BUTTON_SUPPORT_US)
|
|
{
|
|
//open URL
|
|
// ->invokes user's default browser
|
|
[[NSWorkspace sharedWorkspace] openURL:[NSURL URLWithString:PATREON_URL]];
|
|
}
|
|
|
|
//more info button
|
|
else if(((NSButton*)sender).tag == BUTTON_MORE_INFO)
|
|
{
|
|
//open URL
|
|
// ->invokes user's default browser
|
|
[[NSWorkspace sharedWorkspace] openURL:[NSURL URLWithString:PRODUCT_URL]];
|
|
}
|
|
|
|
return;
|
|
}
|
|
@end
|