You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

106 lines
4.0 KiB

//
// CLAboutUsViewController.m
// Clocker
//
// Created by Abhishek Banthia on 12/12/15.
//
//
#import "CLAboutUsViewController.h"
#import "CommonStrings.h"
#import "CLAppFeedbackWindowController.h"
#import "CLUnderlinedButton.h"
@interface CLAboutUsViewController ()
@property (strong, nonatomic) CLAppFeedbackWindowController *feedbackWindow;
@property (weak) IBOutlet NSTextField *versionField;
@property (weak) IBOutlet CLUnderlinedButton *makerButton;
@property (weak) IBOutlet CLUnderlinedButton *quickCommentAction;
@property (weak) IBOutlet CLUnderlinedButton *privateFeedback;
@property (weak) IBOutlet CLUnderlinedButton *supportClocker;
@property (weak) IBOutlet CLUnderlinedButton *facebookButton;
@end
static CLAboutUsViewController *sharedAboutUs = nil;
NSString *const CLAboutUsNibIdentifier = @"CLAboutWindow";
NSString *const CLGitHubURL = @"https://github.com/Abhishaker17/Clocker";
NSString *const CLIssueURL =@"https://github.com/Abhishaker17/Clocker/issues";
NSString *const CLFacebookPageURL = @"https://www.facebook.com/ClockerMenubarClock/";
NSString *const CLTwitterLink = @"https://twitter.com/abgbm";
NSString *const CLPersonalWebsite = @"http://abhishekbanthia.com";
@implementation CLAboutUsViewController
- (void)viewDidLoad {
[super viewDidLoad];
[self underlineTextForActionButton];
self.versionField.stringValue = [NSString stringWithFormat:@"Clocker %@", [[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleShortVersionString"]];
// Do view setup here.
}
- (void)underlineTextForActionButton
{
NSMutableAttributedString *str = [[NSMutableAttributedString alloc] initWithAttributedString:self.makerButton.attributedTitle];
[str addAttribute:NSUnderlineStyleAttributeName value:[NSNumber numberWithInt:NSUnderlineStyleSingle] range:NSMakeRange(3, str.length-3)];
[self.makerButton setAttributedTitle:str];
NSMutableAttributedString *quickComment = [[NSMutableAttributedString alloc] initWithAttributedString:self.quickCommentAction.attributedTitle];
[quickComment addAttribute:NSUnderlineStyleAttributeName value:[NSNumber numberWithInt:NSUnderlineStyleSingle] range:NSMakeRange(3, 6)];
[self.quickCommentAction setAttributedTitle:quickComment];
NSMutableAttributedString *privateFeed = [[NSMutableAttributedString alloc] initWithAttributedString:self.privateFeedback.attributedTitle];
[privateFeed addAttribute:NSUnderlineStyleAttributeName value:[NSNumber numberWithInt:NSUnderlineStyleSingle] range:NSMakeRange(7, privateFeed.length-7)];
[self.privateFeedback setAttributedTitle:privateFeed];
NSMutableAttributedString *supportClocker = [[NSMutableAttributedString alloc] initWithAttributedString:self.supportClocker.attributedTitle];
[supportClocker addAttribute:NSUnderlineStyleAttributeName value:[NSNumber numberWithInt:NSUnderlineStyleSingle] range:NSMakeRange(27, 19)];
[self.supportClocker setAttributedTitle:supportClocker];
[self.quickCommentAction setCursor:[NSCursor pointingHandCursor]];
[self.supportClocker setCursor:[NSCursor pointingHandCursor]];
[self.privateFeedback setCursor:[NSCursor pointingHandCursor]];
[self.makerButton setCursor:[NSCursor pointingHandCursor]];
[self.facebookButton setCursor:[NSCursor pointingHandCursor]];
}
- (IBAction)openMyTwitter:(id)sender
{
[[NSWorkspace sharedWorkspace] openURL:[NSURL URLWithString:CLTwitterLink]];
}
- (IBAction)viewSource:(id)sender
{
[[NSWorkspace sharedWorkspace] openURL:[NSURL URLWithString:CLGitHubURL]];
}
- (IBAction)reportIssue:(id)sender
{
self.feedbackWindow = [CLAppFeedbackWindowController sharedWindow];
[self.feedbackWindow showWindow:nil];
[NSApp activateIgnoringOtherApps:YES];
[self.view.window orderOut:self];
}
- (IBAction)openFacebookPage:(id)sender
{
[[NSWorkspace sharedWorkspace] openURL:[NSURL URLWithString:CLFacebookPageURL]];
}
- (IBAction)openWebsite:(id)sender {
[[NSWorkspace sharedWorkspace] openURL:[NSURL URLWithString:CLPersonalWebsite]];
}
@end