@@ -18,50 +18,128 @@ -(void) awakeFromNib
1818
1919
2020}
21+ -(bool ) checkTextField : (NSTextField *)field
22+ {
23+
24+ return (([field stringValue ] != nil ) && ([[field stringValue ] length ] > 0 ));
25+ }
26+ -(bool ) checkTextFieldContainsNumeric : (NSTextField *)field
27+ {
28+ NSString *s = [field stringValue ];
29+ NSNumberFormatter *numberFormatter = [[NSNumberFormatter alloc ] init ];
30+ return !([numberFormatter numberFromString: s] == nil );
31+
32+ }
33+ -(void ) updateOKButton
34+ {
35+ if (([self checkTextField: self .caserIDField] && [self checkTextFieldContainsNumeric: self .caserIDField])|| ([self checkTextField: self .caseTitleField] && ![self checkTextFieldContainsNumeric: self .caseTitleField]))
36+ {
37+ [self .okButton setEnabled: true ];
38+ }
39+ else
40+ [self .okButton setEnabled: false ];
41+ }
42+ - (void )controlTextDidChange : (NSNotification *)notification {
43+ [self updateOKButton ];
44+ }
45+
2146- (IBAction )OkButtonClicked : (id )sender {
2247 [self .window.sheetParent endSheet: self .window returnCode: NSModalResponseOK ];
2348}
2449- (IBAction )CancelButtonClicked : (id )sender {
2550 [self .window.sheetParent endSheet: self .window returnCode: NSModalResponseCancel ];
2651}
52+ - (IBAction )LogoutButtonClicked : (id )sender {
53+ [GTMOAuth2WindowController removeAuthFromKeychainForName: KEYCHAIN_ITEM];
54+ NSAlert *myAlert = [[NSAlert alloc ] init ];
55+ [myAlert setMessageText: @" You have been logged out" ];
56+ RadiopaediaFilter *p = (RadiopaediaFilter *)self.parent ;
57+ p.isSignedIn = false ;
58+ [self .logoutButton setEnabled: false ];
59+ [myAlert performSelectorOnMainThread: @selector (runModal ) withObject: nil waitUntilDone: NO ];
60+ [self .window.sheetParent endSheet: self .window returnCode: NSModalResponseCancel ];
61+ }
62+ -(long ) getSelectedIndex
63+ {
64+
65+ int s = (int )[self .systemSelect indexOfSelectedItem ];
66+ long ret = (long )[(NSNumber *)[self .indexOfSelected objectAtIndex: s] intValue ];
67+ return ret;
68+ }
2769- (void )windowDidLoad
2870{
29-
3071
3172
73+ RadiopaediaFilter *p = (RadiopaediaFilter *)self.parent ;
74+ if ([p isSignedIn ])
75+ {
76+ [self .logoutButton setEnabled: true ];
77+ }
78+ self.caseTitleField .delegate = self;
79+ self.caserIDField .delegate = self;
80+ self.indexOfSelected = @[@1 ,@2 ,@3 ,@4 ,@6 ,@7 ,@8 ,@9 ,@11 ,@12 ,@15 ,@16 ,@17 ,@18 ,@19 ,@20 ,@21 ,@22 ,@23 ];
81+ self.titles = @[@" " ,
82+ @" Breast" ,
83+ @" Vascular" ,
84+ @" Central Nervous System" ,
85+ @" Chest" ,
86+ @" " ,
87+ @" Gastrointestinal" ,
88+ @" Head and Neck" ,
89+ @" Hepatobiliary" ,
90+ @" Musculoskeletal" ,
91+ @" " ,
92+ @" Urogenital" ,
93+ @" Paediatrics" ,
94+ @" " ,
95+ @" " ,
96+ @" Spine" ,
97+ @" Cardiac" ,
98+ @" Interventional" ,
99+ @" Obstetrics" ,
100+ @" Gynaecology" ,
101+ @" Haematology" ,
102+ @" Forensic" ,
103+ @" Oncology" ,
104+ @" Trauma" ];
105+
106+ self.titles = @[@" Breast" ,
107+ @" Vascular" ,
108+ @" Central Nervous System" ,
109+ @" Chest" ,
110+ @" Gastrointestinal" ,
111+ @" Head and Neck" ,
112+ @" Hepatobiliary" ,
113+ @" Musculoskeletal" ,
114+ @" Urogenital" ,
115+ @" Paediatrics" ,
116+ @" Spine" ,
117+ @" Cardiac" ,
118+ @" Interventional" ,
119+ @" Obstetrics" ,
120+ @" Gynaecology" ,
121+ @" Haematology" ,
122+ @" Forensic" ,
123+ @" Oncology" ,
124+ @" Trauma" ];
125+
126+
32127 [super windowDidLoad ];
33- NSArray *titles = @[@" Empty1" ,
34- @" Breast" ,
35- @" Vascular" ,
36- @" Central Nervous System" ,
37- @" Chest" ,
38- @" Empty2" ,
39- @" Gastrointestinal" ,
40- @" Head and Neck" ,
41- @" Hepatobiliary" ,
42- @" Musculoskeletal" ,
43- @" Empty3" ,
44- @" Urogenital" ,
45- @" Paediatrics" ,
46- @" Empty4" ,
47- @" Spine" ,
48- @" Cardiac" ,
49- @" Interventional" ,
50- @" Obstetrics" ,
51- @" Gynaecology" ,
52- @" Haematology" ,
53- @" Empty5" ,
54- @" Forensic" ,
55- @" Oncology" ,
56- @" Trauma" ];
57- for (NSString *title in titles)
128+
129+ for (NSString *title in self.titles )
58130 {
59131 [self .systemSelect addItemWithTitle: title];
60132 }
61133 [self .window makeFirstResponder: self .caseTitleField];
62134 [self .ageField setStringValue: ((RadiopaediaFilter *)self .parent).patientAge];
63135 [self .genderSelect selectItemWithTitle: ((RadiopaediaFilter *)self .parent).patientSex];
64136}
137+ - (IBAction )supportButton : (id )sender {
138+ [[NSWorkspace sharedWorkspace ] openURL: [NSURL URLWithString: @" https://radiopaedia.org/supporters" ]];
139+ }
140+ - (IBAction )sliderValueChanged : (id )sender {
141+ [self .compressionValueField setStringValue: [NSString stringWithFormat: @" %f " , [self .compressionSlider floatValue ]]];
142+ }
65143- (void )setupSheetTerminationHandling {
66144 NSWindow *sheet = [self window ];
67145
@@ -78,4 +156,7 @@ - (void)setupSheetTerminationHandling {
78156 [invocation invoke ];
79157 }
80158}
81- @end
159+ - (IBAction )openTipsAndTricks : (id )sender {
160+ [[NSWorkspace sharedWorkspace ] openURL: [NSURL URLWithString: @" https://radiopaedia.org/blog/radiopaedia-case-uploader-plugin-for-horos-osirix" ]];
161+ }
162+ @end
0 commit comments