diff --git a/Clocker.xcodeproj/project.xcworkspace/xcuserdata/abhishekbanthia.xcuserdatad/UserInterfaceState.xcuserstate b/Clocker.xcodeproj/project.xcworkspace/xcuserdata/abhishekbanthia.xcuserdatad/UserInterfaceState.xcuserstate index 8705c62..762147a 100644 Binary files a/Clocker.xcodeproj/project.xcworkspace/xcuserdata/abhishekbanthia.xcuserdatad/UserInterfaceState.xcuserstate and b/Clocker.xcodeproj/project.xcworkspace/xcuserdata/abhishekbanthia.xcuserdatad/UserInterfaceState.xcuserstate differ diff --git a/Clocker/Panel.m b/Clocker/Panel.m index 5a2c893..2199884 100755 --- a/Clocker/Panel.m +++ b/Clocker/Panel.m @@ -41,6 +41,10 @@ return YES; } +#pragma mark - +#pragma mark Handling Keydown events +#pragma mark - + -(void)keyDown:(NSEvent *)theEvent { [super keyDown:theEvent]; diff --git a/Clocker/Panel.xib b/Clocker/Panel.xib index f468ce9..776c814 100755 --- a/Clocker/Panel.xib +++ b/Clocker/Panel.xib @@ -7,10 +7,8 @@ - - diff --git a/Clocker/PanelController.h b/Clocker/PanelController.h index dc1cef7..a00a18a 100755 --- a/Clocker/PanelController.h +++ b/Clocker/PanelController.h @@ -58,21 +58,18 @@ @property (nonatomic) BOOL hasActivePanel; @property (nonatomic, unsafe_unretained, readonly) id delegate; @property (weak) IBOutlet NSTableView *mainTableview; -@property (weak) IBOutlet NSScrollView *scrollView; @property (weak) IBOutlet NSLayoutConstraint *scrollViewHeight; @property (weak) IBOutlet NSButton *shutdownButton; @property (weak) IBOutlet NSButton *preferencesButton; -@property (weak) IBOutlet NSTextField *logoLabel; - - (id)initWithDelegate:(id)delegate; - (void)openPanel; - (void)closePanel; -- (void) updateDefaultPreferences; +- (void)updateDefaultPreferences; - (void)showOptions:(BOOL)value; @end diff --git a/Clocker/PanelController.m b/Clocker/PanelController.m index 045d3c7..e832045 100755 --- a/Clocker/PanelController.m +++ b/Clocker/PanelController.m @@ -84,6 +84,10 @@ } +#pragma mark - +#pragma mark Updating Timezones +#pragma mark - + - (void) updateDefaultPreferences { NSArray *defaultZones = [[NSUserDefaults standardUserDefaults] objectForKey:@"defaultPreferences"]; @@ -235,6 +239,10 @@ }); } +#pragma mark - +#pragma mark NSTableview Datasource +#pragma mark - + -(NSInteger)numberOfRowsInTableView:(NSTableView *)tableView { return self.defaultPreferences.count; @@ -261,6 +269,10 @@ return cell; } +#pragma mark - +#pragma mark Datasource formatting +#pragma mark - + - (NSString *)formatStringShouldContainCity:(BOOL)value withTimezoneName:(NSString *)name { if (value) { @@ -330,9 +342,6 @@ { return @"Tomorrow"; } - - - } - (NSString *)getDateForTimeZone:(NSString *)timezoneName @@ -348,6 +357,10 @@ return [self compareSystemDate:[self getLocalCurrentDate] toTimezoneDate:[dateFormatter stringFromDate:currentDate]];; } +#pragma mark - +#pragma mark NSTableview Drag and Drop +#pragma mark - + - (BOOL)tableView:(NSTableView *)tableView writeRowsWithIndexes:(NSIndexSet *)rowIndexes toPasteboard:(NSPasteboard *)pboard { @@ -383,17 +396,22 @@ return NSDragOperationEvery; } - +#pragma mark - +#pragma mark Preferences Target-Action +#pragma mark - - (IBAction)openPreferences:(id)sender { self.preferencesWindow = [PreferencesWindowController sharedPreferences]; [self.preferencesWindow showWindow:nil]; - [NSApp activateIgnoringOtherApps:YES]; } +#pragma mark - +#pragma mark Hiding Buttons on Mouse Exit +#pragma mark - + - (void)showOptions:(BOOL)value { if (self.defaultPreferences.count == 0) diff --git a/Clocker/PreferencesWindow.xib b/Clocker/PreferencesWindow.xib index 6280522..3697cde 100644 --- a/Clocker/PreferencesWindow.xib +++ b/Clocker/PreferencesWindow.xib @@ -10,7 +10,6 @@ - diff --git a/Clocker/PreferencesWindowController.h b/Clocker/PreferencesWindowController.h index 3e0268b..1ca89c4 100644 --- a/Clocker/PreferencesWindowController.h +++ b/Clocker/PreferencesWindowController.h @@ -38,7 +38,6 @@ @property (strong, nonatomic) NSMutableArray *timeZoneArray; @property (strong, nonatomic) NSMutableArray *selectedTimeZones; @property (strong, nonatomic) NSArray *filteredArray; -@property (strong, nonatomic) NSArray *fontFamilies; @property (atomic, assign) BOOL launchOnLogin; + (instancetype)sharedPreferences; diff --git a/Clocker/PreferencesWindowController.m b/Clocker/PreferencesWindowController.m index 7a8ef2a..2e33714 100644 --- a/Clocker/PreferencesWindowController.m +++ b/Clocker/PreferencesWindowController.m @@ -46,7 +46,6 @@ @property (weak) IBOutlet NSButton *is24HourFormatSelected; @property (weak) IBOutlet NSTextField *messageLabel; @property (weak) IBOutlet NSTextField *openSourceMessage; -@property (weak) IBOutlet NSButton *reportBug; @end @@ -62,11 +61,6 @@ static PreferencesWindowController *sharedPreferences = nil; NSString *credits = @"Clocker v1.0 is open source. You can find the source code here!"; [self.openSourceMessage setAttributedStringValue:[self stringFromHTML:credits withFont:[self.openSourceMessage font]]]; - NSMutableAttributedString *attrString = [[NSMutableAttributedString alloc]initWithString:@"Report Bug!x"]; - [attrString addAttribute:NSUnderlineStyleAttributeName value:[NSNumber numberWithInt:NSUnderlineStyleSingle] range:NSMakeRange(0, attrString.length)]; - [attrString addAttribute:NSForegroundColorAttributeName value:[NSColor blueColor] range:NSMakeRange(0, self.reportBug.title.length)]; - [self.reportBug setAttributedStringValue:attrString]; - NSMutableArray *defaultTimeZones = [[NSUserDefaults standardUserDefaults] objectForKey:@"defaultPreferences"]; @@ -77,8 +71,6 @@ static PreferencesWindowController *sharedPreferences = nil; self.filteredArray = [[NSArray alloc] init]; } - self.fontFamilies = [[NSArray alloc] initWithArray:[[NSFontManager sharedFontManager] availableFonts]]; - self.messageLabel.stringValue = @""; [self.timezoneTableView reloadData]; @@ -209,7 +201,9 @@ static PreferencesWindowController *sharedPreferences = nil; } - selectedTimezone = self.searchField.stringValue.length > 0 ? self.filteredArray[self.availableTimezoneTableView.selectedRow] : self.timeZoneArray[self.availableTimezoneTableView.selectedRow]; + selectedTimezone = self.searchField.stringValue.length > 0 ? + self.filteredArray[self.availableTimezoneTableView.selectedRow] : + self.timeZoneArray[self.availableTimezoneTableView.selectedRow]; [self.selectedTimeZones addObject:selectedTimezone]; @@ -263,10 +257,7 @@ static PreferencesWindowController *sharedPreferences = nil; [self.selectedTimeZones removeObjectsInArray:itemsToRemove]; - NSMutableArray *newDefaults; - - newDefaults = [[NSMutableArray alloc] initWithArray:self.selectedTimeZones]; - + NSMutableArray *newDefaults = [[NSMutableArray alloc] initWithArray:self.selectedTimeZones]; [[NSUserDefaults standardUserDefaults] setObject:newDefaults forKey:@"defaultPreferences"]; @@ -305,7 +296,9 @@ static PreferencesWindowController *sharedPreferences = nil; } - (IBAction)timeFormatSelectionChanged:(id)sender { - [[NSUserDefaults standardUserDefaults] setObject:[NSNumber numberWithInteger:self.is24HourFormatSelected.state] forKey:@"is24HourFormatSelected"]; + NSButton *is24HourFormatSelected = (NSButton *)sender; + + [[NSUserDefaults standardUserDefaults] setObject:[NSNumber numberWithInteger:is24HourFormatSelected.state] forKey:@"is24HourFormatSelected"]; [self refreshMainTableview]; }