WelcomeWindowController.m 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451
  1. //
  2. // WelcomeWindowController.m
  3. // PDF Reader
  4. //
  5. // Created by wangshuai on 13-12-11.
  6. // Copyright (c) 2013年 zhangjie. All rights reserved.
  7. //
  8. #import "WelcomeWindowController.h"
  9. #import <PDF_Master-Swift.h>
  10. static WelcomeWindowController *windowController = nil;
  11. static NSString * const kKMWelcomeHasShowKey = @"WelcomeHasShowKey";
  12. static NSString * const kKMWelcomeRemindMeLaterKey = @"WelcomeRemindMeLaterKey";
  13. @interface WelcomeWindowController ()
  14. @property (nonatomic,assign) IBOutlet NSScrollView *scrollView;
  15. @property (nonatomic,assign) IBOutlet NSView *content1View;
  16. @property (nonatomic,assign) IBOutlet NSView *content2View;
  17. @property (nonatomic,assign) IBOutlet NSView *content3View;
  18. @property (nonatomic,assign) IBOutlet NSView *content4View;
  19. @property (strong) IBOutlet NSView *content5View;
  20. @property (strong) IBOutlet NSView *content6View;
  21. @property (weak) IBOutlet NSImageView *imageView1;
  22. @property (weak) IBOutlet NSImageView *imageView2;
  23. @property (weak) IBOutlet NSImageView *imageView3;
  24. @property (weak) IBOutlet NSImageView *imageView4;
  25. @property (weak) IBOutlet NSImageView *imageView6;
  26. @property (weak) IBOutlet NSImageView *imageView5;
  27. @property (nonatomic,assign) IBOutlet NSTextField *title1Label;
  28. @property (nonatomic,assign) IBOutlet NSTextField *subtitle1Label;
  29. @property (nonatomic,assign) IBOutlet NSTextField *title2Label;
  30. @property (nonatomic,assign) IBOutlet NSTextField *subtitle2Label;
  31. @property (nonatomic,assign) IBOutlet NSTextField *title3Label;
  32. @property (nonatomic,assign) IBOutlet NSTextField *subtitle3Label;
  33. @property (nonatomic,assign) IBOutlet NSTextField *title4Label;
  34. @property (nonatomic,assign) IBOutlet NSTextField *subtitle4Label;
  35. @property (weak) IBOutlet NSTextField *title5Label;
  36. @property (weak) IBOutlet NSTextField *subtitle5Label;
  37. @property (weak) IBOutlet NSTextField *title6Label;
  38. @property (weak) IBOutlet NSTextField *subtitle6Label;
  39. @property (weak) IBOutlet NSBox *preBox;
  40. @property (weak) IBOutlet NSBox *nextBox;
  41. @property (nonatomic, strong) KMDesignButton *preButtonVC;
  42. @property (nonatomic, strong) KMDesignButton *nextButtonVC;
  43. @property (weak) IBOutlet NSBox *next1Box;
  44. @property (weak) IBOutlet NSBox *remindMeLaterBox;
  45. @property (weak) IBOutlet NSBox *next2Box;
  46. @property (weak) IBOutlet NSBox *next3Box;
  47. @property (weak) IBOutlet NSBox *next4Box;
  48. @property (weak) IBOutlet NSBox *next5Box;
  49. @property (weak) IBOutlet NSBox *signUpBox;
  50. @property (nonatomic, strong) KMDesignButton *next1ButtonVC;
  51. @property (nonatomic, strong) KMDesignButton *remindMeLaterButtonVC;
  52. @property (nonatomic, strong) KMDesignButton *next2ButtonVC;
  53. @property (nonatomic, strong) KMDesignButton *next3ButtonVC;
  54. @property (nonatomic, strong) KMDesignButton *next4ButtonVC;
  55. @property (nonatomic, strong) KMDesignButton *signUpButtonVC;
  56. @property (weak) IBOutlet TCPageIndicator *pageIndicator1;
  57. @property (weak) IBOutlet TCPageIndicator *pageIndicator2;
  58. @property (weak) IBOutlet TCPageIndicator *pageIndicator3;
  59. @property (weak) IBOutlet TCPageIndicator *pageIndicator4;
  60. @property (weak) IBOutlet TCPageIndicator *pageIndicator5;
  61. @property (weak) IBOutlet TCPageIndicator *pageIndicator6;
  62. @property (nonatomic,retain) NSArray *contentViews;
  63. @property (nonatomic,assign) NSInteger currentIndex;
  64. @property (weak) IBOutlet NSButton *closeButton;
  65. @property (weak) IBOutlet KMBox *closeBox;
  66. @end
  67. @implementation WelcomeWindowController
  68. - (void)dealloc {
  69. #if DEBUG
  70. NSLog(@"%s", __func__);
  71. #endif
  72. }
  73. + (void)load {
  74. // 处理再次提醒
  75. if ([[NSUserDefaults standardUserDefaults] boolForKey:kKMWelcomeRemindMeLaterKey]) {
  76. [[NSUserDefaults standardUserDefaults] setBool:NO forKey:kKMWelcomeRemindMeLaterKey];
  77. [[NSUserDefaults standardUserDefaults] setBool:NO forKey:kKMWelcomeHasShowKey];
  78. [[NSUserDefaults standardUserDefaults] synchronize];
  79. }
  80. }
  81. + (BOOL)welcomeHasShow {
  82. return [[NSUserDefaults standardUserDefaults] boolForKey:kKMWelcomeHasShowKey];
  83. }
  84. #pragma mark Init Methods
  85. - (id)init {
  86. if (self = [super initWithWindowNibName:@"WelcomeWindowController"]) {
  87. windowController = self;
  88. }
  89. return self;
  90. }
  91. - (void)awakeFromNib {
  92. [super awakeFromNib];
  93. NSClipView *clipView = self.scrollView.contentView;
  94. // ,self.content4View
  95. self.contentViews = @[self.content1View, self.content2View, self.content3View, self.content4View, self.content6View, self.content5View];
  96. for (int i=0; i<self.contentViews.count; i++) {
  97. NSView *view = self.contentViews[i];
  98. view.frame = CGRectMake(i*clipView.bounds.size.width, 0,
  99. clipView.bounds.size.width,
  100. clipView.bounds.size.height);
  101. [self.scrollView.documentView addSubview:view];
  102. }
  103. self.scrollView.documentView.frame = CGRectMake(0, 0, clipView.bounds.size.width*self.contentViews.count, clipView.bounds.size.height);
  104. }
  105. - (void)windowDidLoad {
  106. [super windowDidLoad];
  107. [self localizedString];
  108. [self initSubViews];
  109. [self setupUI];
  110. [self reloadData];
  111. // 设置【显示】标识
  112. [[NSUserDefaults standardUserDefaults] setBool:YES forKey:kKMWelcomeHasShowKey];
  113. [[NSUserDefaults standardUserDefaults] synchronize];
  114. }
  115. - (void)localizedString {
  116. //#if VERSION_DMG
  117. // self.imageView1.image = [NSImage imageNamed:@"KMImageNameWelcomeHomeNew"];
  118. // self.imageView2.image = [NSImage imageNamed:@"KMImageNameWelcomeAnnotation"];
  119. // self.imageView3.image = [NSImage imageNamed:@"KMImageNameWelcomeEdit"];
  120. // self.imageView4.image = [NSImage imageNamed:@"KMImageNameWelcomePageEdit"];
  121. // self.imageView5.image = [NSImage imageNamed:@"KMImageNameWelcomeConvert"];
  122. // self.imageView6.image = [NSImage imageNamed:@"KMImageNameWelcome3"];
  123. //
  124. // self.title1Label.stringValue = NSLocalizedString(@"The Brand New PDF Master", nil);
  125. // 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);
  126. //
  127. // self.title2Label.stringValue = NSLocalizedString(@"Comment PDFs with Rich Annotation Tools", nil);
  128. // self.subtitle2Label.stringValue = NSLocalizedString(@"Add highlights, freehand, text, stamps, links, shapes, and notes to your documents. Easily mark up your PDFs anytime!", nil);
  129. //
  130. //// self.title3Label.stringValue = NSLocalizedString(@"Convert PDF to Office Fast and Easily", nil);
  131. //// self.subtitle3Label.stringValue = NSLocalizedString(@"Convert PDF to editable Word, Excel, PPT, Text and image with all your fonts and formatting preserved.", nil);
  132. // self.title3Label.stringValue = NSLocalizedString(@"Edit Original Text and Images Like Word", nil);
  133. // 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);
  134. //
  135. //// self.title4Label.stringValue = NSLocalizedString(@"Fill out Form & Sign Documents", nil);
  136. //// self.subtitle4Label.stringValue = NSLocalizedString(@"Fill out forms effortlessly and add text, image or handwritten signatures to PDFs.", nil);
  137. // self.title4Label.stringValue = NSLocalizedString(@"Organize PDF Pages with Ease", nil);
  138. // self.subtitle4Label.stringValue = NSLocalizedString(@"Drag and drop page thumbnails to rearrange pages. Or easily delete, insert, rotate, split pages.", nil);
  139. //
  140. // self.title6Label.stringValue = NSLocalizedString(@"Convert PDF to Office Fast and Easily", nil);
  141. // self.subtitle6Label.stringValue = NSLocalizedString(@"Convert PDF to editable Word, Excel, PPT, Text and image with all your fonts and formatting preserved.", nil);
  142. //
  143. // self.title5Label.stringValue = NSLocalizedString(@"Sign up to Unlock Premium Features", nil);
  144. // self.subtitle5Label.stringValue = NSLocalizedString(@"All advanced features in PDF Master can be used after registration, including converting PDFs without limitation. ", nil);
  145. //#else
  146. self.imageView1.image = [NSImage imageNamed:@"KMImageNameWelcome1"];
  147. self.imageView2.image = [NSImage imageNamed:@"KMImageNameWelcome2"];
  148. self.imageView3.image = [NSImage imageNamed:@"KMImageNameWelcomeAnnotation"];
  149. self.imageView4.image = [NSImage imageNamed:@"KMImageNameWelcomeEdit"];
  150. self.imageView5.image = [NSImage imageNamed:@"KMImageNameWelcomePageEdit"];
  151. self.imageView6.image = [NSImage imageNamed:@"KMImageNameWelcomeConvert"];
  152. // self.imageView6.image = [NSImage imageNamed:@"KMImageNameWelcome3"];
  153. self.title1Label.stringValue = NSLocalizedString(@"The Brand New PDF Master", nil);
  154. 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);
  155. self.title2Label.stringValue = NSLocalizedString(@"Process PDF Document wit AI Robot", nil);
  156. 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);
  157. self.title3Label.stringValue = NSLocalizedString(@"Comment PDFs with Rich Annotation Tools", nil);
  158. self.subtitle3Label.stringValue = NSLocalizedString(@"Add highlights, freehand, text, stamps, links, shapes, and notes to your documents. Easily mark up your PDFs anytime!", nil);
  159. self.title4Label.stringValue = NSLocalizedString(@"Edit Original Text and Images Like Word", nil);
  160. 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);
  161. self.title6Label.stringValue = NSLocalizedString(@"Organize PDF Pages with Ease", nil);
  162. self.subtitle6Label.stringValue = NSLocalizedString(@"Drag and drop page thumbnails to rearrange pages. Or easily delete, insert, rotate, split pages.", nil);
  163. self.title5Label.stringValue = NSLocalizedString(@"Convert PDF to Office Fast and Easily", nil);
  164. self.subtitle5Label.stringValue = NSLocalizedString(@"Convert PDF to editable Word, Excel, PPT, Text and image with all your fonts and formatting preserved.", nil);
  165. // self.title5Label.stringValue = NSLocalizedString(@"Sign up to Unlock Premium Features", nil);
  166. // self.subtitle5Label.stringValue = NSLocalizedString(@"All advanced features in PDF Master can be used after registration.", nil);
  167. //#endif
  168. }
  169. - (void)initSubViews {
  170. self.preBox.borderType = NSNoBorder;
  171. self.preButtonVC = [[KMDesignButton alloc] initWithType:DesignButtonTypeImage];
  172. [self.preBox.contentView addSubview:self.preButtonVC.view];
  173. self.preButtonVC.view.frame = self.preBox.contentView.bounds;
  174. self.preButtonVC.view.autoresizingMask = NSViewWidthSizable | NSViewHeightSizable;
  175. self.preButtonVC.image = [NSImage imageNamed:@"KMImageNamePreviousPageImage"];
  176. [self.preButtonVC pagination];
  177. self.preButtonVC.target = self;
  178. self.preButtonVC.action = @selector(previousButtonAction:);
  179. self.nextBox.borderType = NSNoBorder;
  180. self.nextButtonVC = [[KMDesignButton alloc] initWithType:DesignButtonTypeImage];
  181. [self.nextBox.contentView addSubview:self.nextButtonVC.view];
  182. self.nextButtonVC.view.frame = self.nextBox.contentView.bounds;
  183. self.nextButtonVC.view.autoresizingMask = NSViewWidthSizable | NSViewHeightSizable;
  184. self.nextButtonVC.image = [NSImage imageNamed:@"KMImageNameNextPageImage"];
  185. [self.nextButtonVC pagination];
  186. self.nextButtonVC.target = self;
  187. self.nextButtonVC.action = @selector(nextButtonAction:);
  188. for (NSBox *box in @[self.next1Box, self.next2Box, self.next3Box, self.next4Box, self.next5Box]) {
  189. box.borderType = NSNoBorder;
  190. KMDesignButton *nextButtonVC = [[KMDesignButton alloc] initWithType:DesignButtonTypeText];
  191. [box.contentView addSubview:nextButtonVC.view];
  192. nextButtonVC.view.frame = box.contentView.bounds;
  193. nextButtonVC.view.autoresizingMask = NSViewWidthSizable | NSViewHeightSizable;
  194. // nextButtonVC.stringValue = NSLocalizedString(@"Next", nil);
  195. if (KMLightMemberManager.manager.isLogin) { // let’s start
  196. nextButtonVC.stringValue = NSLocalizedString(@"Let's Start", nil);
  197. } else {
  198. nextButtonVC.stringValue = NSLocalizedString(@"Sign up", nil);
  199. }
  200. nextButtonVC.target = self;
  201. // nextButtonVC.action = @selector(nextButtonAction:);
  202. nextButtonVC.action = @selector(signUpButtonAction:);
  203. [nextButtonVC buttonWithType:TokenButtonTypeCta size:TokenButtonSizeL height:[[NSLayoutConstraint alloc] init]];
  204. if ([box isEqual:self.next1Box]) {
  205. self.next1ButtonVC = nextButtonVC;
  206. } else if ([box isEqual:self.next2Box]) {
  207. self.next2ButtonVC = nextButtonVC;
  208. } else if ([box isEqual:self.next3Box]) {
  209. self.next3ButtonVC = nextButtonVC;
  210. } else if ([box isEqual:self.next4Box]) {
  211. self.next4ButtonVC = nextButtonVC;
  212. } else if ([box isEqual:self.next5Box]) {
  213. // self.next5
  214. }
  215. }
  216. self.remindMeLaterBox.borderType = NSNoBorder;
  217. self.remindMeLaterButtonVC = [[KMDesignButton alloc] initWithType:DesignButtonTypeText];
  218. [self.remindMeLaterBox.contentView addSubview:self.remindMeLaterButtonVC.view];
  219. self.remindMeLaterButtonVC.view.frame = self.remindMeLaterBox.contentView.bounds;
  220. self.remindMeLaterButtonVC.view.autoresizingMask = NSViewWidthSizable | NSViewHeightSizable;
  221. self.remindMeLaterButtonVC.stringValue = NSLocalizedString(@"Remind Me Later", nil);
  222. self.remindMeLaterButtonVC.target = self;
  223. self.remindMeLaterButtonVC.action = @selector(remindMeLaterButtonAction:);
  224. // TokenButtonTypeLink
  225. [self.remindMeLaterButtonVC buttonWithType:TokenButtonTypeText size:TokenButtonSizeM height:[[NSLayoutConstraint alloc] init]];
  226. self.signUpBox.borderType = NSNoBorder;
  227. self.signUpButtonVC = [[KMDesignButton alloc] initWithType:DesignButtonTypeText];
  228. [self.signUpBox.contentView addSubview:self.signUpButtonVC.view];
  229. self.signUpButtonVC.view.frame = self.signUpBox.contentView.bounds;
  230. self.signUpButtonVC.view.autoresizingMask = NSViewWidthSizable | NSViewHeightSizable;
  231. if (KMLightMemberManager.manager.isLogin) { // let’s start
  232. self.signUpButtonVC.stringValue = NSLocalizedString(@"Let's Start", nil);
  233. } else {
  234. self.signUpButtonVC.stringValue = NSLocalizedString(@"Sign up", nil);
  235. }
  236. self.signUpButtonVC.target = self;
  237. self.signUpButtonVC.action = @selector(signUpButtonAction:);
  238. [self.signUpButtonVC buttonWithType:TokenButtonTypeCta size:TokenButtonSizeL height:[[NSLayoutConstraint alloc] init]];
  239. // , self.pageIndicator5
  240. for (TCPageIndicator *pageindicator in @[self.pageIndicator1, self.pageIndicator2, self.pageIndicator3, self.pageIndicator4, self.pageIndicator5, self.pageIndicator6]) {
  241. pageindicator.numberOfPages = 6;
  242. pageindicator.selectedColor = [NSColor colorWithRed:39/255.f green:60/255.f blue:98/255.f alpha:1.f];
  243. pageindicator.normalColor = [NSColor colorWithRed:0/255.f green:0/255.f blue:0/255.f alpha:0.2];
  244. pageindicator.pageIndicatorSize = NSMakeSize(6, 6);
  245. pageindicator.enabled = NO;
  246. if ([pageindicator isEqual:self.pageIndicator1]) {
  247. pageindicator.currentPage = 0;
  248. } else if ([pageindicator isEqual:self.pageIndicator2]) {
  249. pageindicator.currentPage = 1;
  250. } else if ([pageindicator isEqual:self.pageIndicator3]) {
  251. pageindicator.currentPage = 2;
  252. } else if ([pageindicator isEqual:self.pageIndicator4]) {
  253. pageindicator.currentPage = 3;
  254. } else if ([pageindicator isEqual:self.pageIndicator5]) {
  255. pageindicator.currentPage = 5;
  256. } else if ([pageindicator isEqual:self.pageIndicator6]) {
  257. pageindicator.currentPage = 4;
  258. }
  259. }
  260. __weak typeof(self)weakSelf = self;
  261. self.closeBox.moveCallback = ^(BOOL mouseEntered, KMBox *mouseBox) {
  262. if (mouseEntered) {
  263. weakSelf.closeButton.image = [NSImage imageNamed:@"control_btn_icon_close_hov"];
  264. } else {
  265. weakSelf.closeButton.image = [NSImage imageNamed:@"control_btn_icon_close"];
  266. }
  267. };
  268. for (NSView *view in self.contentViews) {
  269. NSTextField *label = [NSTextField labelWithString:NSLocalizedString(@"Sign up to Unlock Premium Features", nil)];
  270. [view addSubview:label];
  271. label.frame = NSMakeRect(0, 14, NSWidth(view.frame), 18);
  272. label.alignment = NSTextAlignmentCenter;
  273. label.font = [NSFont fontWithName:@"SFProText-Regular" size:14];
  274. label.textColor = [NSColor colorWithRed:23/255.f green:112/255.f blue:244/255.f alpha:1.f];
  275. if (KMLightMemberManager.manager.isLogin) {
  276. label.hidden = YES;
  277. } else {
  278. label.hidden = NO;
  279. }
  280. }
  281. self.remindMeLaterBox.hidden = YES;
  282. }
  283. - (void)setupUI {
  284. for (NSTextField *titleLabel in @[self.title1Label, self.title2Label, self.title3Label,
  285. self.title4Label, self.title6Label, self.title5Label]) {
  286. titleLabel.font = [NSFont fontWithName:@"SFProText-Semibold" size:20];
  287. titleLabel.textColor = [NSColor colorWithRed:37/255.f green:38/255.f blue:41/255.f alpha:1.f];
  288. }
  289. NSMutableParagraphStyle *ps = [[NSMutableParagraphStyle alloc] init];
  290. ps.lineSpacing = 6;
  291. ps.alignment = NSTextAlignmentCenter;
  292. for (NSTextField *subtitleLabel in @[self.subtitle1Label, self.subtitle2Label, self.subtitle3Label,
  293. self.subtitle4Label, self.subtitle6Label, self.subtitle5Label]) {
  294. // if ([subtitleLabel isEqual:self.subtitle1Label]) {
  295. // NSMutableParagraphStyle *ps_ = [[NSMutableParagraphStyle alloc] init];
  296. // ps_.lineSpacing = 6;
  297. // ps_.alignment = NSTextAlignmentCenter;
  298. // subtitleLabel.attributedStringValue = [[NSAttributedString alloc] initWithString:subtitleLabel.stringValue attributes:@{
  299. // NSFontAttributeName : [NSFont fontWithName:@"SFProText-Regular" size:14],
  300. // NSForegroundColorAttributeName : [NSColor colorWithRed:97/255.f green:100/255.f blue:105/255.f alpha:1.f],
  301. // NSParagraphStyleAttributeName : ps_
  302. // }];
  303. // } else {
  304. subtitleLabel.attributedStringValue = [[NSAttributedString alloc] initWithString:subtitleLabel.stringValue attributes:@{
  305. NSFontAttributeName : [NSFont fontWithName:@"SFProText-Regular" size:14],
  306. NSForegroundColorAttributeName : [NSColor colorWithRed:97/255.f green:100/255.f blue:105/255.f alpha:1.f],
  307. NSParagraphStyleAttributeName : ps
  308. }];
  309. // }
  310. }
  311. }
  312. - (void)close {
  313. windowController = nil;
  314. [super close];
  315. }
  316. #pragma mark Private Methods
  317. - (void)reloadData {
  318. self.preBox.hidden = NO;
  319. self.nextBox.hidden = NO;
  320. if (self.currentIndex == 0) {
  321. self.preBox.hidden = YES;
  322. } else if (self.currentIndex == 1) {
  323. } else if (self.currentIndex == 2) {
  324. // self.nextBox.hidden = YES;
  325. } else if (self.currentIndex == 3) {
  326. } else if (self.currentIndex == 4){
  327. } else if (self.currentIndex == 5) {
  328. self.nextBox.hidden = YES;
  329. }
  330. }
  331. #pragma mark Button Actions
  332. - (IBAction)previousButtonAction:(id)sender {
  333. if (self.currentIndex <= 0) {
  334. return;
  335. }
  336. self.currentIndex--;
  337. [NSAnimationContext beginGrouping];
  338. NSClipView *clipView = [self.scrollView contentView];
  339. NSPoint newOrigin = [clipView bounds].origin;
  340. newOrigin.x = clipView.bounds.size.width*self.currentIndex;
  341. [[clipView animator] setBoundsOrigin:newOrigin];
  342. [NSAnimationContext endGrouping];
  343. [self reloadData];
  344. }
  345. - (IBAction)nextButtonAction:(id)sender {
  346. if (self.currentIndex >= self.contentViews.count-1) {
  347. return;
  348. }
  349. self.currentIndex++;
  350. [NSAnimationContext beginGrouping];
  351. NSClipView *clipView = [self.scrollView contentView];
  352. NSPoint newOrigin = [clipView bounds].origin;
  353. newOrigin.x = clipView.bounds.size.width*self.currentIndex;
  354. [[clipView animator] setBoundsOrigin:newOrigin];
  355. [NSAnimationContext endGrouping];
  356. [self reloadData];
  357. }
  358. - (IBAction)closeAction:(id)sender {
  359. if (self.itemClick) {
  360. self.itemClick(1, self);
  361. }
  362. [self close];
  363. }
  364. - (void)signUpButtonAction:(NSButton *)sender {
  365. if (KMLightMemberManager.manager.isLogin) {
  366. [self closeAction:sender];
  367. } else {
  368. if (self.itemClick) {
  369. self.itemClick(3, self);
  370. }
  371. [self close];
  372. }
  373. }
  374. - (void)remindMeLaterButtonAction:(NSButton *)sender {
  375. [[NSUserDefaults standardUserDefaults] setBool:YES forKey:kKMWelcomeRemindMeLaterKey];
  376. [[NSUserDefaults standardUserDefaults] synchronize];
  377. if (self.itemClick) {
  378. self.itemClick(2, self);
  379. }
  380. [self close];
  381. }
  382. @end