-
Notifications
You must be signed in to change notification settings - Fork 0
/
SettingsController.m
116 lines (71 loc) · 2.32 KB
/
SettingsController.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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
//
// SettingsController.m
// Bartender
//
// Created by Tom Houpt on 23/7/8.
//
#import "SettingsController.h"
@implementation SettingsController
@synthesize dialog;
@synthesize serialnameField;
@synthesize serialname;
@synthesize localdataField;
@synthesize localdata;
@synthesize firebaseField;
@synthesize firebase;
@synthesize firebaseEmailField;
@synthesize firebaseEmail;
@synthesize firebasePasswordField;
@synthesize firebasePassword;
@synthesize bartabField;
@synthesize bartab;
-(id)initWithNameArray:(NSArray *)names; {
self = [super init];
if (self) {
serialname = names[0];
localdata = names[1];
firebase = names[2];
bartab = names[3];
firebaseEmail = names[4];
firebasePassword = names[5];
if (!dialog) {
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
[NSBundle loadNibNamed:@"SettingsController" owner:self];
#pragma clang diagnostic pop
}
}
return self;
}
-(NSArray *)dialogForWindow:(NSWindow *)ownerWindow; {
[serialnameField setStringValue:serialname];
[localdataField setStringValue:localdata];
[firebaseField setStringValue:firebase];
[bartabField setStringValue:bartab];
[firebaseEmailField setStringValue: firebaseEmail];
[firebasePasswordField setStringValue: firebasePassword];
[NSApp beginSheet: dialog
modalForWindow: ownerWindow
modalDelegate: nil
didEndSelector: nil
contextInfo: nil];
[NSApp runModalForWindow: dialog];
// See NSApplication Class Reference/runModalSession
[NSApp endSheet: dialog];
[dialog orderOut: dialog];
return @[serialname,localdata,firebase,bartab,firebaseEmail,firebasePassword];
}
-(IBAction)cancelButtonPressed:(id)sender; {
[NSApp stopModal];
serialname = nil;
}
-(IBAction)OKButtonPressed:(id)sender; {
[NSApp stopModal];
serialname = [serialnameField stringValue];
localdata = [localdataField stringValue];
firebase = [firebaseField stringValue];
bartab = [bartabField stringValue];
firebaseEmail = [firebaseEmailField stringValue];
firebasePassword = [firebasePasswordField stringValue];
}
@end