|
@@ -1,451 +0,0 @@
|
|
|
-//
|
|
|
-// WelcomeWindowController.m
|
|
|
-// PDF Reader
|
|
|
-//
|
|
|
-// Created by wangshuai on 13-12-11.
|
|
|
-// Copyright (c) 2013年 zhangjie. All rights reserved.
|
|
|
-//
|
|
|
-
|
|
|
-#import "WelcomeWindowController.h"
|
|
|
-#import <PDF_Master-Swift.h>
|
|
|
-
|
|
|
-static WelcomeWindowController *windowController = nil;
|
|
|
-static NSString * const kKMWelcomeHasShowKey = @"WelcomeHasShowKey";
|
|
|
-static NSString * const kKMWelcomeRemindMeLaterKey = @"WelcomeRemindMeLaterKey";
|
|
|
-
|
|
|
-@interface WelcomeWindowController ()
|
|
|
-
|
|
|
-@property (nonatomic,assign) IBOutlet NSScrollView *scrollView;
|
|
|
-
|
|
|
-@property (nonatomic,assign) IBOutlet NSView *content1View;
|
|
|
-@property (nonatomic,assign) IBOutlet NSView *content2View;
|
|
|
-@property (nonatomic,assign) IBOutlet NSView *content3View;
|
|
|
-@property (nonatomic,assign) IBOutlet NSView *content4View;
|
|
|
-
|
|
|
-@property (strong) IBOutlet NSView *content5View;
|
|
|
-@property (strong) IBOutlet NSView *content6View;
|
|
|
-
|
|
|
-@property (weak) IBOutlet NSImageView *imageView1;
|
|
|
-@property (weak) IBOutlet NSImageView *imageView2;
|
|
|
-@property (weak) IBOutlet NSImageView *imageView3;
|
|
|
-@property (weak) IBOutlet NSImageView *imageView4;
|
|
|
-@property (weak) IBOutlet NSImageView *imageView6;
|
|
|
-@property (weak) IBOutlet NSImageView *imageView5;
|
|
|
-
|
|
|
-@property (nonatomic,assign) IBOutlet NSTextField *title1Label;
|
|
|
-@property (nonatomic,assign) IBOutlet NSTextField *subtitle1Label;
|
|
|
-@property (nonatomic,assign) IBOutlet NSTextField *title2Label;
|
|
|
-@property (nonatomic,assign) IBOutlet NSTextField *subtitle2Label;
|
|
|
-@property (nonatomic,assign) IBOutlet NSTextField *title3Label;
|
|
|
-@property (nonatomic,assign) IBOutlet NSTextField *subtitle3Label;
|
|
|
-@property (nonatomic,assign) IBOutlet NSTextField *title4Label;
|
|
|
-@property (nonatomic,assign) IBOutlet NSTextField *subtitle4Label;
|
|
|
-
|
|
|
-@property (weak) IBOutlet NSTextField *title5Label;
|
|
|
-@property (weak) IBOutlet NSTextField *subtitle5Label;
|
|
|
-@property (weak) IBOutlet NSTextField *title6Label;
|
|
|
-@property (weak) IBOutlet NSTextField *subtitle6Label;
|
|
|
-
|
|
|
-@property (weak) IBOutlet NSBox *preBox;
|
|
|
-@property (weak) IBOutlet NSBox *nextBox;
|
|
|
-
|
|
|
-@property (nonatomic, strong) KMDesignButton *preButtonVC;
|
|
|
-@property (nonatomic, strong) KMDesignButton *nextButtonVC;
|
|
|
-
|
|
|
-@property (weak) IBOutlet NSBox *next1Box;
|
|
|
-@property (weak) IBOutlet NSBox *remindMeLaterBox;
|
|
|
-@property (weak) IBOutlet NSBox *next2Box;
|
|
|
-@property (weak) IBOutlet NSBox *next3Box;
|
|
|
-@property (weak) IBOutlet NSBox *next4Box;
|
|
|
-@property (weak) IBOutlet NSBox *next5Box;
|
|
|
-
|
|
|
-@property (weak) IBOutlet NSBox *signUpBox;
|
|
|
-
|
|
|
-@property (nonatomic, strong) KMDesignButton *next1ButtonVC;
|
|
|
-@property (nonatomic, strong) KMDesignButton *remindMeLaterButtonVC;
|
|
|
-@property (nonatomic, strong) KMDesignButton *next2ButtonVC;
|
|
|
-@property (nonatomic, strong) KMDesignButton *next3ButtonVC;
|
|
|
-@property (nonatomic, strong) KMDesignButton *next4ButtonVC;
|
|
|
-
|
|
|
-@property (nonatomic, strong) KMDesignButton *signUpButtonVC;
|
|
|
-
|
|
|
-@property (weak) IBOutlet TCPageIndicator *pageIndicator1;
|
|
|
-@property (weak) IBOutlet TCPageIndicator *pageIndicator2;
|
|
|
-@property (weak) IBOutlet TCPageIndicator *pageIndicator3;
|
|
|
-@property (weak) IBOutlet TCPageIndicator *pageIndicator4;
|
|
|
-@property (weak) IBOutlet TCPageIndicator *pageIndicator5;
|
|
|
-@property (weak) IBOutlet TCPageIndicator *pageIndicator6;
|
|
|
-
|
|
|
-@property (nonatomic,retain) NSArray *contentViews;
|
|
|
-@property (nonatomic,assign) NSInteger currentIndex;
|
|
|
-
|
|
|
-@property (weak) IBOutlet NSButton *closeButton;
|
|
|
-@property (weak) IBOutlet KMBox *closeBox;
|
|
|
-
|
|
|
-@end
|
|
|
-
|
|
|
-@implementation WelcomeWindowController
|
|
|
-
|
|
|
-- (void)dealloc {
|
|
|
-#if DEBUG
|
|
|
- NSLog(@"%s", __func__);
|
|
|
-#endif
|
|
|
-}
|
|
|
-
|
|
|
-+ (void)load {
|
|
|
- // 处理再次提醒
|
|
|
- if ([[NSUserDefaults standardUserDefaults] boolForKey:kKMWelcomeRemindMeLaterKey]) {
|
|
|
- [[NSUserDefaults standardUserDefaults] setBool:NO forKey:kKMWelcomeRemindMeLaterKey];
|
|
|
- [[NSUserDefaults standardUserDefaults] setBool:NO forKey:kKMWelcomeHasShowKey];
|
|
|
- [[NSUserDefaults standardUserDefaults] synchronize];
|
|
|
- }
|
|
|
-}
|
|
|
-
|
|
|
-+ (BOOL)welcomeHasShow {
|
|
|
- return [[NSUserDefaults standardUserDefaults] boolForKey:kKMWelcomeHasShowKey];
|
|
|
-}
|
|
|
-
|
|
|
-#pragma mark Init Methods
|
|
|
-
|
|
|
-- (id)init {
|
|
|
- if (self = [super initWithWindowNibName:@"WelcomeWindowController"]) {
|
|
|
- windowController = self;
|
|
|
- }
|
|
|
- return self;
|
|
|
-}
|
|
|
-
|
|
|
-- (void)awakeFromNib {
|
|
|
- [super awakeFromNib];
|
|
|
-
|
|
|
- NSClipView *clipView = self.scrollView.contentView;
|
|
|
- // ,self.content4View
|
|
|
- self.contentViews = @[self.content1View, self.content2View, self.content3View, self.content4View, self.content6View, self.content5View];
|
|
|
- for (int i=0; i<self.contentViews.count; i++) {
|
|
|
- NSView *view = self.contentViews[i];
|
|
|
- view.frame = CGRectMake(i*clipView.bounds.size.width, 0,
|
|
|
- clipView.bounds.size.width,
|
|
|
- clipView.bounds.size.height);
|
|
|
- [self.scrollView.documentView addSubview:view];
|
|
|
- }
|
|
|
- self.scrollView.documentView.frame = CGRectMake(0, 0, clipView.bounds.size.width*self.contentViews.count, clipView.bounds.size.height);
|
|
|
-}
|
|
|
-
|
|
|
-- (void)windowDidLoad {
|
|
|
- [super windowDidLoad];
|
|
|
-
|
|
|
- [self localizedString];
|
|
|
- [self initSubViews];
|
|
|
- [self setupUI];
|
|
|
- [self reloadData];
|
|
|
-
|
|
|
- // 设置【显示】标识
|
|
|
- [[NSUserDefaults standardUserDefaults] setBool:YES forKey:kKMWelcomeHasShowKey];
|
|
|
- [[NSUserDefaults standardUserDefaults] synchronize];
|
|
|
-}
|
|
|
-
|
|
|
-- (void)localizedString {
|
|
|
-//#if VERSION_DMG
|
|
|
-// self.imageView1.image = [NSImage imageNamed:@"KMImageNameWelcomeHomeNew"];
|
|
|
-// self.imageView2.image = [NSImage imageNamed:@"KMImageNameWelcomeAnnotation"];
|
|
|
-// self.imageView3.image = [NSImage imageNamed:@"KMImageNameWelcomeEdit"];
|
|
|
-// self.imageView4.image = [NSImage imageNamed:@"KMImageNameWelcomePageEdit"];
|
|
|
-// self.imageView5.image = [NSImage imageNamed:@"KMImageNameWelcomeConvert"];
|
|
|
-// self.imageView6.image = [NSImage imageNamed:@"KMImageNameWelcome3"];
|
|
|
-//
|
|
|
-// self.title1Label.stringValue = NSLocalizedString(@"The Brand New PDF Master", nil);
|
|
|
-// self.subtitle1Label.stringValue = NSLocalizedString(@"PDF Master Beta Invites You to Enjoy All Advanced Features!\n\nEdit, Annotate and Convert PDFs with PDF Master to boost your productivity", nil);
|
|
|
-//
|
|
|
-// self.title2Label.stringValue = NSLocalizedString(@"Comment PDFs with Rich Annotation Tools", nil);
|
|
|
-// self.subtitle2Label.stringValue = NSLocalizedString(@"Add highlights, freehand, text, stamps, links, shapes, and notes to your documents. Easily mark up your PDFs anytime!", nil);
|
|
|
-//
|
|
|
-//// self.title3Label.stringValue = NSLocalizedString(@"Convert PDF to Office Fast and Easily", nil);
|
|
|
-//// self.subtitle3Label.stringValue = NSLocalizedString(@"Convert PDF to editable Word, Excel, PPT, Text and image with all your fonts and formatting preserved.", nil);
|
|
|
-// self.title3Label.stringValue = NSLocalizedString(@"Edit Original Text and Images Like Word", nil);
|
|
|
-// self.subtitle3Label.stringValue = NSLocalizedString(@"Fix a typo or add a new text box in a PDF effortlessly. Crop, replace, rotate, flip, and export images as desired.", nil);
|
|
|
-//
|
|
|
-//// self.title4Label.stringValue = NSLocalizedString(@"Fill out Form & Sign Documents", nil);
|
|
|
-//// self.subtitle4Label.stringValue = NSLocalizedString(@"Fill out forms effortlessly and add text, image or handwritten signatures to PDFs.", nil);
|
|
|
-// self.title4Label.stringValue = NSLocalizedString(@"Organize PDF Pages with Ease", nil);
|
|
|
-// self.subtitle4Label.stringValue = NSLocalizedString(@"Drag and drop page thumbnails to rearrange pages. Or easily delete, insert, rotate, split pages.", nil);
|
|
|
-//
|
|
|
-// self.title6Label.stringValue = NSLocalizedString(@"Convert PDF to Office Fast and Easily", nil);
|
|
|
-// self.subtitle6Label.stringValue = NSLocalizedString(@"Convert PDF to editable Word, Excel, PPT, Text and image with all your fonts and formatting preserved.", nil);
|
|
|
-//
|
|
|
-// self.title5Label.stringValue = NSLocalizedString(@"Sign up to Unlock Premium Features", nil);
|
|
|
-// self.subtitle5Label.stringValue = NSLocalizedString(@"All advanced features in PDF Master can be used after registration, including converting PDFs without limitation. ", nil);
|
|
|
-//#else
|
|
|
- self.imageView1.image = [NSImage imageNamed:@"KMImageNameWelcome1"];
|
|
|
- self.imageView2.image = [NSImage imageNamed:@"KMImageNameWelcome2"];
|
|
|
- self.imageView3.image = [NSImage imageNamed:@"KMImageNameWelcomeAnnotation"];
|
|
|
- self.imageView4.image = [NSImage imageNamed:@"KMImageNameWelcomeEdit"];
|
|
|
- self.imageView5.image = [NSImage imageNamed:@"KMImageNameWelcomePageEdit"];
|
|
|
- self.imageView6.image = [NSImage imageNamed:@"KMImageNameWelcomeConvert"];
|
|
|
-// self.imageView6.image = [NSImage imageNamed:@"KMImageNameWelcome3"];
|
|
|
-
|
|
|
- self.title1Label.stringValue = NSLocalizedString(@"The Brand New PDF Master", nil);
|
|
|
- self.subtitle1Label.stringValue = NSLocalizedString(@"PDF Master Invites You to Enjoy All Advanced Features! Use the new powerful software integrated with AI technology to edit your PDFs", nil);
|
|
|
-
|
|
|
- self.title2Label.stringValue = NSLocalizedString(@"Process PDF Document wit AI Robot", nil);
|
|
|
- self.subtitle2Label.stringValue = NSLocalizedString(@"Smart PDF AI robot, powered by Chatgpt helps you translate, rewrite, and correct PDFs with ease, bringing you an enhanced PDF experience.", nil);
|
|
|
-
|
|
|
- self.title3Label.stringValue = NSLocalizedString(@"Comment PDFs with Rich Annotation Tools", nil);
|
|
|
- self.subtitle3Label.stringValue = NSLocalizedString(@"Add highlights, freehand, text, stamps, links, shapes, and notes to your documents. Easily mark up your PDFs anytime!", nil);
|
|
|
-
|
|
|
- self.title4Label.stringValue = NSLocalizedString(@"Edit Original Text and Images Like Word", nil);
|
|
|
- self.subtitle4Label.stringValue = NSLocalizedString(@"Fix a typo or add a new text box in a PDF effortlessly. Crop, replace, rotate, flip, and export images as desired.", nil);
|
|
|
-
|
|
|
- self.title6Label.stringValue = NSLocalizedString(@"Organize PDF Pages with Ease", nil);
|
|
|
- self.subtitle6Label.stringValue = NSLocalizedString(@"Drag and drop page thumbnails to rearrange pages. Or easily delete, insert, rotate, split pages.", nil);
|
|
|
-
|
|
|
- self.title5Label.stringValue = NSLocalizedString(@"Convert PDF to Office Fast and Easily", nil);
|
|
|
- self.subtitle5Label.stringValue = NSLocalizedString(@"Convert PDF to editable Word, Excel, PPT, Text and image with all your fonts and formatting preserved.", nil);
|
|
|
-
|
|
|
-// self.title5Label.stringValue = NSLocalizedString(@"Sign up to Unlock Premium Features", nil);
|
|
|
-// self.subtitle5Label.stringValue = NSLocalizedString(@"All advanced features in PDF Master can be used after registration.", nil);
|
|
|
-//#endif
|
|
|
-}
|
|
|
-
|
|
|
-- (void)initSubViews {
|
|
|
- self.preBox.borderType = NSNoBorder;
|
|
|
- self.preButtonVC = [[KMDesignButton alloc] initWithType:DesignButtonTypeImage];
|
|
|
- [self.preBox.contentView addSubview:self.preButtonVC.view];
|
|
|
- self.preButtonVC.view.frame = self.preBox.contentView.bounds;
|
|
|
- self.preButtonVC.view.autoresizingMask = NSViewWidthSizable | NSViewHeightSizable;
|
|
|
- self.preButtonVC.image = [NSImage imageNamed:@"KMImageNamePreviousPageImage"];
|
|
|
- [self.preButtonVC pagination];
|
|
|
- self.preButtonVC.target = self;
|
|
|
- self.preButtonVC.action = @selector(previousButtonAction:);
|
|
|
-
|
|
|
- self.nextBox.borderType = NSNoBorder;
|
|
|
- self.nextButtonVC = [[KMDesignButton alloc] initWithType:DesignButtonTypeImage];
|
|
|
- [self.nextBox.contentView addSubview:self.nextButtonVC.view];
|
|
|
- self.nextButtonVC.view.frame = self.nextBox.contentView.bounds;
|
|
|
- self.nextButtonVC.view.autoresizingMask = NSViewWidthSizable | NSViewHeightSizable;
|
|
|
- self.nextButtonVC.image = [NSImage imageNamed:@"KMImageNameNextPageImage"];
|
|
|
- [self.nextButtonVC pagination];
|
|
|
- self.nextButtonVC.target = self;
|
|
|
- self.nextButtonVC.action = @selector(nextButtonAction:);
|
|
|
-
|
|
|
- for (NSBox *box in @[self.next1Box, self.next2Box, self.next3Box, self.next4Box, self.next5Box]) {
|
|
|
- box.borderType = NSNoBorder;
|
|
|
- KMDesignButton *nextButtonVC = [[KMDesignButton alloc] initWithType:DesignButtonTypeText];
|
|
|
- [box.contentView addSubview:nextButtonVC.view];
|
|
|
- nextButtonVC.view.frame = box.contentView.bounds;
|
|
|
- nextButtonVC.view.autoresizingMask = NSViewWidthSizable | NSViewHeightSizable;
|
|
|
-// nextButtonVC.stringValue = NSLocalizedString(@"Next", nil);
|
|
|
- if (KMLightMemberManager.manager.isLogin) { // let’s start
|
|
|
- nextButtonVC.stringValue = NSLocalizedString(@"Let's Start", nil);
|
|
|
- } else {
|
|
|
- nextButtonVC.stringValue = NSLocalizedString(@"Sign up", nil);
|
|
|
- }
|
|
|
- nextButtonVC.target = self;
|
|
|
-// nextButtonVC.action = @selector(nextButtonAction:);
|
|
|
- nextButtonVC.action = @selector(signUpButtonAction:);
|
|
|
-
|
|
|
- [nextButtonVC buttonWithType:TokenButtonTypeCta size:TokenButtonSizeL height:[[NSLayoutConstraint alloc] init]];
|
|
|
-
|
|
|
- if ([box isEqual:self.next1Box]) {
|
|
|
- self.next1ButtonVC = nextButtonVC;
|
|
|
- } else if ([box isEqual:self.next2Box]) {
|
|
|
- self.next2ButtonVC = nextButtonVC;
|
|
|
- } else if ([box isEqual:self.next3Box]) {
|
|
|
- self.next3ButtonVC = nextButtonVC;
|
|
|
- } else if ([box isEqual:self.next4Box]) {
|
|
|
- self.next4ButtonVC = nextButtonVC;
|
|
|
- } else if ([box isEqual:self.next5Box]) {
|
|
|
-// self.next5
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- self.remindMeLaterBox.borderType = NSNoBorder;
|
|
|
- self.remindMeLaterButtonVC = [[KMDesignButton alloc] initWithType:DesignButtonTypeText];
|
|
|
- [self.remindMeLaterBox.contentView addSubview:self.remindMeLaterButtonVC.view];
|
|
|
- self.remindMeLaterButtonVC.view.frame = self.remindMeLaterBox.contentView.bounds;
|
|
|
- self.remindMeLaterButtonVC.view.autoresizingMask = NSViewWidthSizable | NSViewHeightSizable;
|
|
|
- self.remindMeLaterButtonVC.stringValue = NSLocalizedString(@"Remind Me Later", nil);
|
|
|
- self.remindMeLaterButtonVC.target = self;
|
|
|
- self.remindMeLaterButtonVC.action = @selector(remindMeLaterButtonAction:);
|
|
|
- // TokenButtonTypeLink
|
|
|
- [self.remindMeLaterButtonVC buttonWithType:TokenButtonTypeText size:TokenButtonSizeM height:[[NSLayoutConstraint alloc] init]];
|
|
|
-
|
|
|
- self.signUpBox.borderType = NSNoBorder;
|
|
|
- self.signUpButtonVC = [[KMDesignButton alloc] initWithType:DesignButtonTypeText];
|
|
|
- [self.signUpBox.contentView addSubview:self.signUpButtonVC.view];
|
|
|
- self.signUpButtonVC.view.frame = self.signUpBox.contentView.bounds;
|
|
|
- self.signUpButtonVC.view.autoresizingMask = NSViewWidthSizable | NSViewHeightSizable;
|
|
|
- if (KMLightMemberManager.manager.isLogin) { // let’s start
|
|
|
- self.signUpButtonVC.stringValue = NSLocalizedString(@"Let's Start", nil);
|
|
|
- } else {
|
|
|
- self.signUpButtonVC.stringValue = NSLocalizedString(@"Sign up", nil);
|
|
|
- }
|
|
|
-
|
|
|
- self.signUpButtonVC.target = self;
|
|
|
- self.signUpButtonVC.action = @selector(signUpButtonAction:);
|
|
|
- [self.signUpButtonVC buttonWithType:TokenButtonTypeCta size:TokenButtonSizeL height:[[NSLayoutConstraint alloc] init]];
|
|
|
-
|
|
|
- // , self.pageIndicator5
|
|
|
- for (TCPageIndicator *pageindicator in @[self.pageIndicator1, self.pageIndicator2, self.pageIndicator3, self.pageIndicator4, self.pageIndicator5, self.pageIndicator6]) {
|
|
|
- pageindicator.numberOfPages = 6;
|
|
|
- pageindicator.selectedColor = [NSColor colorWithRed:39/255.f green:60/255.f blue:98/255.f alpha:1.f];
|
|
|
- pageindicator.normalColor = [NSColor colorWithRed:0/255.f green:0/255.f blue:0/255.f alpha:0.2];
|
|
|
- pageindicator.pageIndicatorSize = NSMakeSize(6, 6);
|
|
|
- pageindicator.enabled = NO;
|
|
|
-
|
|
|
- if ([pageindicator isEqual:self.pageIndicator1]) {
|
|
|
- pageindicator.currentPage = 0;
|
|
|
- } else if ([pageindicator isEqual:self.pageIndicator2]) {
|
|
|
- pageindicator.currentPage = 1;
|
|
|
- } else if ([pageindicator isEqual:self.pageIndicator3]) {
|
|
|
- pageindicator.currentPage = 2;
|
|
|
- } else if ([pageindicator isEqual:self.pageIndicator4]) {
|
|
|
- pageindicator.currentPage = 3;
|
|
|
- } else if ([pageindicator isEqual:self.pageIndicator5]) {
|
|
|
- pageindicator.currentPage = 5;
|
|
|
- } else if ([pageindicator isEqual:self.pageIndicator6]) {
|
|
|
- pageindicator.currentPage = 4;
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- __weak typeof(self)weakSelf = self;
|
|
|
- self.closeBox.moveCallback = ^(BOOL mouseEntered, KMBox *mouseBox) {
|
|
|
- if (mouseEntered) {
|
|
|
- weakSelf.closeButton.image = [NSImage imageNamed:@"control_btn_icon_close_hov"];
|
|
|
- } else {
|
|
|
- weakSelf.closeButton.image = [NSImage imageNamed:@"control_btn_icon_close"];
|
|
|
- }
|
|
|
- };
|
|
|
-
|
|
|
- for (NSView *view in self.contentViews) {
|
|
|
- NSTextField *label = [NSTextField labelWithString:NSLocalizedString(@"Sign up to Unlock Premium Features", nil)];
|
|
|
- [view addSubview:label];
|
|
|
- label.frame = NSMakeRect(0, 14, NSWidth(view.frame), 18);
|
|
|
- label.alignment = NSTextAlignmentCenter;
|
|
|
- label.font = [NSFont fontWithName:@"SFProText-Regular" size:14];
|
|
|
- label.textColor = [NSColor colorWithRed:23/255.f green:112/255.f blue:244/255.f alpha:1.f];
|
|
|
-
|
|
|
- if (KMLightMemberManager.manager.isLogin) {
|
|
|
- label.hidden = YES;
|
|
|
- } else {
|
|
|
- label.hidden = NO;
|
|
|
- }
|
|
|
- }
|
|
|
- self.remindMeLaterBox.hidden = YES;
|
|
|
-}
|
|
|
-
|
|
|
-- (void)setupUI {
|
|
|
- for (NSTextField *titleLabel in @[self.title1Label, self.title2Label, self.title3Label,
|
|
|
- self.title4Label, self.title6Label, self.title5Label]) {
|
|
|
- titleLabel.font = [NSFont fontWithName:@"SFProText-Semibold" size:20];
|
|
|
- titleLabel.textColor = [NSColor colorWithRed:37/255.f green:38/255.f blue:41/255.f alpha:1.f];
|
|
|
- }
|
|
|
-
|
|
|
- NSMutableParagraphStyle *ps = [[NSMutableParagraphStyle alloc] init];
|
|
|
- ps.lineSpacing = 6;
|
|
|
- ps.alignment = NSTextAlignmentCenter;
|
|
|
- for (NSTextField *subtitleLabel in @[self.subtitle1Label, self.subtitle2Label, self.subtitle3Label,
|
|
|
- self.subtitle4Label, self.subtitle6Label, self.subtitle5Label]) {
|
|
|
-// if ([subtitleLabel isEqual:self.subtitle1Label]) {
|
|
|
-// NSMutableParagraphStyle *ps_ = [[NSMutableParagraphStyle alloc] init];
|
|
|
-// ps_.lineSpacing = 6;
|
|
|
-// ps_.alignment = NSTextAlignmentCenter;
|
|
|
-// subtitleLabel.attributedStringValue = [[NSAttributedString alloc] initWithString:subtitleLabel.stringValue attributes:@{
|
|
|
-// NSFontAttributeName : [NSFont fontWithName:@"SFProText-Regular" size:14],
|
|
|
-// NSForegroundColorAttributeName : [NSColor colorWithRed:97/255.f green:100/255.f blue:105/255.f alpha:1.f],
|
|
|
-// NSParagraphStyleAttributeName : ps_
|
|
|
-// }];
|
|
|
-// } else {
|
|
|
- subtitleLabel.attributedStringValue = [[NSAttributedString alloc] initWithString:subtitleLabel.stringValue attributes:@{
|
|
|
- NSFontAttributeName : [NSFont fontWithName:@"SFProText-Regular" size:14],
|
|
|
- NSForegroundColorAttributeName : [NSColor colorWithRed:97/255.f green:100/255.f blue:105/255.f alpha:1.f],
|
|
|
- NSParagraphStyleAttributeName : ps
|
|
|
- }];
|
|
|
-// }
|
|
|
- }
|
|
|
-}
|
|
|
-
|
|
|
-- (void)close {
|
|
|
- windowController = nil;
|
|
|
-
|
|
|
- [super close];
|
|
|
-}
|
|
|
-
|
|
|
-#pragma mark Private Methods
|
|
|
-
|
|
|
-- (void)reloadData {
|
|
|
- self.preBox.hidden = NO;
|
|
|
- self.nextBox.hidden = NO;
|
|
|
-
|
|
|
- if (self.currentIndex == 0) {
|
|
|
- self.preBox.hidden = YES;
|
|
|
- } else if (self.currentIndex == 1) {
|
|
|
- } else if (self.currentIndex == 2) {
|
|
|
-// self.nextBox.hidden = YES;
|
|
|
- } else if (self.currentIndex == 3) {
|
|
|
- } else if (self.currentIndex == 4){
|
|
|
-
|
|
|
- } else if (self.currentIndex == 5) {
|
|
|
- self.nextBox.hidden = YES;
|
|
|
- }
|
|
|
-}
|
|
|
-
|
|
|
-#pragma mark Button Actions
|
|
|
-
|
|
|
-- (IBAction)previousButtonAction:(id)sender {
|
|
|
- if (self.currentIndex <= 0) {
|
|
|
- return;
|
|
|
- }
|
|
|
- self.currentIndex--;
|
|
|
- [NSAnimationContext beginGrouping];
|
|
|
- NSClipView *clipView = [self.scrollView contentView];
|
|
|
- NSPoint newOrigin = [clipView bounds].origin;
|
|
|
- newOrigin.x = clipView.bounds.size.width*self.currentIndex;
|
|
|
- [[clipView animator] setBoundsOrigin:newOrigin];
|
|
|
- [NSAnimationContext endGrouping];
|
|
|
-
|
|
|
- [self reloadData];
|
|
|
-}
|
|
|
-
|
|
|
-- (IBAction)nextButtonAction:(id)sender {
|
|
|
- if (self.currentIndex >= self.contentViews.count-1) {
|
|
|
- return;
|
|
|
- }
|
|
|
- self.currentIndex++;
|
|
|
- [NSAnimationContext beginGrouping];
|
|
|
- NSClipView *clipView = [self.scrollView contentView];
|
|
|
- NSPoint newOrigin = [clipView bounds].origin;
|
|
|
- newOrigin.x = clipView.bounds.size.width*self.currentIndex;
|
|
|
- [[clipView animator] setBoundsOrigin:newOrigin];
|
|
|
- [NSAnimationContext endGrouping];
|
|
|
-
|
|
|
- [self reloadData];
|
|
|
-}
|
|
|
-
|
|
|
-- (IBAction)closeAction:(id)sender {
|
|
|
- if (self.itemClick) {
|
|
|
- self.itemClick(1, self);
|
|
|
- }
|
|
|
- [self close];
|
|
|
-}
|
|
|
-
|
|
|
-- (void)signUpButtonAction:(NSButton *)sender {
|
|
|
- if (KMLightMemberManager.manager.isLogin) {
|
|
|
- [self closeAction:sender];
|
|
|
- } else {
|
|
|
- if (self.itemClick) {
|
|
|
- self.itemClick(3, self);
|
|
|
- }
|
|
|
- [self close];
|
|
|
- }
|
|
|
-}
|
|
|
-
|
|
|
-- (void)remindMeLaterButtonAction:(NSButton *)sender {
|
|
|
- [[NSUserDefaults standardUserDefaults] setBool:YES forKey:kKMWelcomeRemindMeLaterKey];
|
|
|
- [[NSUserDefaults standardUserDefaults] synchronize];
|
|
|
-
|
|
|
- if (self.itemClick) {
|
|
|
- self.itemClick(2, self);
|
|
|
- }
|
|
|
- [self close];
|
|
|
-}
|
|
|
-
|
|
|
-@end
|