diff --git a/Clocker.xcodeproj/project.xcworkspace/xcuserdata/abhishekbanthia.xcuserdatad/UserInterfaceState.xcuserstate b/Clocker.xcodeproj/project.xcworkspace/xcuserdata/abhishekbanthia.xcuserdatad/UserInterfaceState.xcuserstate index 350453e..541b2c1 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/ApplicationDelegate.m b/Clocker/ApplicationDelegate.m index 27970ee..5773022 100755 --- a/Clocker/ApplicationDelegate.m +++ b/Clocker/ApplicationDelegate.m @@ -102,7 +102,15 @@ void *kContextActivePanel = &kContextActivePanel; [[NSUserDefaults standardUserDefaults] setObject:newDefaults forKey:CLDefaultPreferenceKey]; } - + NSString *defaultFont = [[NSUserDefaults standardUserDefaults] objectForKey:@"defaultFontFamily"]; + if (defaultFont == nil) { + [[NSUserDefaults standardUserDefaults] setObject:@"Default" forKey:@"defaultFontFamily"]; + } + + NSString *defaultTheme = [[NSUserDefaults standardUserDefaults] objectForKey:@"defaultTheme"]; + if (defaultTheme == nil) { + [[NSUserDefaults standardUserDefaults] setObject:@"Default" forKey:@"defaultTheme"]; + } // Install icon into the menu bar diff --git a/Clocker/ApptentiveConnect/ApptentiveConnect/xibs/ATFeedbackWindow.xib b/Clocker/ApptentiveConnect/ApptentiveConnect/xibs/ATFeedbackWindow.xib index e229cba..d45d872 100755 --- a/Clocker/ApptentiveConnect/ApptentiveConnect/xibs/ATFeedbackWindow.xib +++ b/Clocker/ApptentiveConnect/ApptentiveConnect/xibs/ATFeedbackWindow.xib @@ -20,7 +20,7 @@ - + diff --git a/Clocker/BackgroundView.m b/Clocker/BackgroundView.m index c048454..4540573 100755 --- a/Clocker/BackgroundView.m +++ b/Clocker/BackgroundView.m @@ -80,7 +80,11 @@ [path lineToPoint:NSMakePoint(_arrowX - ARROW_WIDTH / 2, NSMaxY(contentRect) - ARROW_HEIGHT)]; [path closePath]; - [[NSColor colorWithDeviceWhite:1 alpha:FILL_OPACITY] setFill]; + NSString *theme = [[NSUserDefaults standardUserDefaults] objectForKey:@"defaultTheme"]; + [theme isEqualToString:@"Default"] ? + [[NSColor colorWithDeviceRed:255.0f green:255.0f blue:255.0f alpha:FILL_OPACITY] setFill]: + [[NSColor colorWithDeviceRed:0.0f green:0.0f blue:0.0f alpha:FILL_OPACITY] setFill]; + [path fill]; [NSGraphicsContext saveGraphicsState]; diff --git a/Clocker/Custom Table Cell Views/CLTimezoneCellView.h b/Clocker/Custom Table Cell Views/CLTimezoneCellView.h index d6944b9..3c8ff59 100644 --- a/Clocker/Custom Table Cell Views/CLTimezoneCellView.h +++ b/Clocker/Custom Table Cell Views/CLTimezoneCellView.h @@ -15,5 +15,7 @@ @property (weak) IBOutlet NSTextField *time; @property (nonatomic) NSInteger rowNumber; - (void)updateFontFamilyWithFontName:(NSString *)fontName andCell:(CLTimezoneCellView*)cell; +- (void)updateTextColorWithColor:(NSColor *)color andCell:(CLTimezoneCellView*)cell; +- (void)setDefaultThemeForCell:(CLTimezoneCellView *)cell; @end diff --git a/Clocker/Custom Table Cell Views/CLTimezoneCellView.m b/Clocker/Custom Table Cell Views/CLTimezoneCellView.m index a16844f..6dab92d 100644 --- a/Clocker/Custom Table Cell Views/CLTimezoneCellView.m +++ b/Clocker/Custom Table Cell Views/CLTimezoneCellView.m @@ -49,7 +49,21 @@ { cell.relativeDate.font = [NSFont fontWithName:fontName size:13]; cell.customName.font = [NSFont fontWithName:fontName size:15]; - cell.time.font = [NSFont fontWithName:fontName size:31]; + cell.time.font = [NSFont fontWithName:fontName size:29]; +} + +- (void)updateTextColorWithColor:(NSColor *)color andCell:(CLTimezoneCellView*)cell +{ + cell.relativeDate.textColor = color; + cell.customName.textColor = color; + cell.time.textColor = color; +} + +- (void)setDefaultThemeForCell:(CLTimezoneCellView *)cell +{ + cell.relativeDate.font = [NSFont fontWithName:@"Helvetica-Bold" size:13]; + cell.customName.font = [NSFont fontWithName:@"Helvetica-Light" size:15]; + cell.time.font = [NSFont fontWithName:@"Helvetica-Light" size:29]; } @end diff --git a/Clocker/Images/PowerIcon-White.png b/Clocker/Images/PowerIcon-White.png new file mode 100644 index 0000000..80bdd4d Binary files /dev/null and b/Clocker/Images/PowerIcon-White.png differ diff --git a/Clocker/Panel.xib b/Clocker/Panel.xib index d2b99a3..0370f6d 100755 --- a/Clocker/Panel.xib +++ b/Clocker/Panel.xib @@ -11,6 +11,7 @@ + @@ -58,9 +59,9 @@ - + - + @@ -85,13 +86,13 @@ - + - - + + - - + + @@ -100,10 +101,10 @@ - + - + diff --git a/Clocker/PanelController.h b/Clocker/PanelController.h index ca577a8..8c60a06 100755 --- a/Clocker/PanelController.h +++ b/Clocker/PanelController.h @@ -65,6 +65,7 @@ @property (weak) IBOutlet NSButton *shutdownButton; @property (weak) IBOutlet NSButton *preferencesButton; @property (assign) BOOL showReviewCell; +@property (weak) IBOutlet NSTextField *titleField; - (id)initWithDelegate:(id)delegate; diff --git a/Clocker/PanelController.m b/Clocker/PanelController.m index 904d589..ec63f1a 100755 --- a/Clocker/PanelController.m +++ b/Clocker/PanelController.m @@ -279,10 +279,51 @@ NSString *const CLTimezoneCellViewIdentifier = @"timeZoneCell"; NSString *fontFamily = [[NSUserDefaults standardUserDefaults] objectForKey:@"defaultFontFamily"]; - if (fontFamily.length > 0) + if (fontFamily.length > 0 && ![fontFamily isEqualToString:@"Default"]) { [cell updateFontFamilyWithFontName:fontFamily andCell:cell]; } + fontFamily.length > 0 && ![fontFamily isEqualToString:@"Default"] ? [cell updateFontFamilyWithFontName:fontFamily andCell:cell] : [cell setDefaultThemeForCell:cell]; + + NSString *theme = [[NSUserDefaults standardUserDefaults] objectForKey:@"defaultTheme"]; + if (theme.length > 0 && ![theme isEqualToString:@"Default"]) + { + [cell updateTextColorWithColor:[NSColor whiteColor] andCell:cell]; + [self.mainTableview setBackgroundColor:[NSColor blackColor]]; + [self.titleField setBackgroundColor:[NSColor blackColor]]; + + NSMutableParagraphStyle *paragraphStyle = NSMutableParagraphStyle.new; + paragraphStyle.alignment = NSTextAlignmentCenter; + + NSDictionary *whiteDict = [NSDictionary dictionaryWithObjectsAndKeys:[NSColor whiteColor], NSForegroundColorAttributeName, [NSFont fontWithName:@"Palatino" size:17] ,NSFontAttributeName,paragraphStyle,NSParagraphStyleAttributeName, nil]; + NSAttributedString *whiteTitle = [[NSAttributedString alloc] + initWithString: @"Clocker" + attributes: whiteDict] ; + + + [self.titleField setPlaceholderAttributedString:whiteTitle]; + self.window.alphaValue = 0.90; + + } + else + { + [cell updateTextColorWithColor:[NSColor blackColor] andCell:cell]; + [self.mainTableview setBackgroundColor:[NSColor whiteColor]]; + [self.titleField setBackgroundColor:[NSColor whiteColor]]; + + NSMutableParagraphStyle *paragraphStyle = NSMutableParagraphStyle.new; + paragraphStyle.alignment = NSTextAlignmentCenter; + + NSDictionary *whiteDict = [NSDictionary dictionaryWithObjectsAndKeys:[NSColor blackColor], NSForegroundColorAttributeName, [NSFont fontWithName:@"Palatino" size:17] ,NSFontAttributeName,paragraphStyle,NSParagraphStyleAttributeName, nil]; + NSAttributedString *whiteTitle = [[NSAttributedString alloc] + initWithString: @"Clocker" + attributes: whiteDict] ; + + + [self.titleField setPlaceholderAttributedString:whiteTitle]; + self.window.alphaValue = 1; + + } cell.relativeDate.stringValue = [self getDateForTimeZone:self.defaultPreferences[row][CLTimezoneName]]; diff --git a/Clocker/Preferences/CLPreferencesView.xib b/Clocker/Preferences/CLPreferencesView.xib index 21308c8..002e0bb 100644 --- a/Clocker/Preferences/CLPreferencesView.xib +++ b/Clocker/Preferences/CLPreferencesView.xib @@ -150,7 +150,7 @@ - + @@ -160,12 +160,12 @@ - + - + @@ -173,6 +173,8 @@ + + diff --git a/Clocker/Preferences/CLPreferencesViewController.m b/Clocker/Preferences/CLPreferencesViewController.m index 5b6bdf3..67cd6a2 100644 --- a/Clocker/Preferences/CLPreferencesViewController.m +++ b/Clocker/Preferences/CLPreferencesViewController.m @@ -62,27 +62,32 @@ NSString *const CLPreferencesAvailableTimezoneIdentifier = @"availableTimezones" //Register for drag and drop [self.timezoneTableView registerForDraggedTypes: [NSArray arrayWithObject: CLDragSessionKey]]; - NSMutableSet *sampleArray = [[NSMutableSet alloc] init]; + NSMutableArray *availableFonts = [[NSMutableArray alloc] init]; NSFontCollection *fontCollection = [NSFontCollection fontCollectionWithName:@"com.apple.UserFonts"]; for (NSFontDescriptor *descriptor in fontCollection.matchingDescriptors) { if ([descriptor objectForKey:@"NSFontFamilyAttribute"]) { - if (![sampleArray containsObject:[descriptor objectForKey:@"NSFontFamilyAttribute"]]) { - [sampleArray addObject:[descriptor objectForKey:@"NSFontFamilyAttribute"]]; + if (![availableFonts containsObject:[descriptor objectForKey:@"NSFontFamilyAttribute"]]) { + [availableFonts addObject:[descriptor objectForKey:@"NSFontFamilyAttribute"]]; } } } - if ([sampleArray containsObject:@"Apple Chancery"]) { - [sampleArray removeObject:@"Apple Chancery"]; - [sampleArray removeObject:@"Zapfino"]; - [sampleArray removeObject:@"Trattatello"]; - [sampleArray removeObject:@"Noteworthy"]; - + //Certain fonts don't look good with constraints set + + NSArray *fontsToRemove = [NSArray arrayWithObjects:@"Apple Chancery", @"Zapfino", + @"Trattatello", @"Noteworthy", @"Arial Black", @"Chalkduster",@"Monoid", nil]; + for (NSString *font in fontsToRemove) { + if([availableFonts containsObject:font]) + { + [availableFonts removeObject:font]; + } } - self.fontFamilies = [[NSArray alloc] initWithArray:sampleArray.allObjects]; + [availableFonts insertObject:@"Default" atIndex:0]; + self.themes = [NSArray arrayWithObjects:@"Default", @"Black", nil]; + self.fontFamilies = [[NSArray alloc] initWithArray:availableFonts]; // Do view setup here. } @@ -430,14 +435,29 @@ NSString *const CLPreferencesAvailableTimezoneIdentifier = @"availableTimezones" } } -- (IBAction)changeTheme:(id)sender { +- (IBAction)changeFont:(id)sender +{ + ApplicationDelegate *appDelegate = [[NSApplication sharedApplication] delegate]; + PanelController *panelController = appDelegate.panelController; + [panelController.mainTableview reloadData]; } -- (IBAction)changeFont:(id)sender +- (IBAction)changeTheme:(id)sender { + NSPopUpButton *popUpButtonTitle = (NSPopUpButton *)sender; ApplicationDelegate *appDelegate = [[NSApplication sharedApplication] delegate]; PanelController *panelController = appDelegate.panelController; + [panelController.backgroundView setNeedsDisplay:YES]; + if ([[popUpButtonTitle titleOfSelectedItem] isEqualToString:@"Black"]) { + panelController.shutdownButton.image = [NSImage imageNamed:@"PowerIcon-White"]; + } + else + { + panelController.shutdownButton.image = [NSImage imageNamed:@"PowerIcon"]; + } + + [panelController.mainTableview reloadData]; } @@ -447,10 +467,6 @@ NSString *const CLPreferencesAvailableTimezoneIdentifier = @"availableTimezones" PanelController *panelController = appDelegate.panelController; NSSlider *slider = (NSSlider *)sender; - if (![panelController.window isVisible]) - { - [panelController openPanel]; - } [NSAnimationContext beginGrouping]; [[NSAnimationContext currentContext] setDuration:0.10]; [[panelController.window animator] setAlphaValue:slider.floatValue/100]; diff --git a/Media.xcassets/PowerIcon-White.imageset/Contents.json b/Media.xcassets/PowerIcon-White.imageset/Contents.json new file mode 100644 index 0000000..98c0ad9 --- /dev/null +++ b/Media.xcassets/PowerIcon-White.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "idiom" : "universal", + "filename" : "PowerIcon-White.png", + "scale" : "1x" + }, + { + "idiom" : "universal", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/Media.xcassets/PowerIcon-White.imageset/PowerIcon-White.png b/Media.xcassets/PowerIcon-White.imageset/PowerIcon-White.png new file mode 100644 index 0000000..80bdd4d Binary files /dev/null and b/Media.xcassets/PowerIcon-White.imageset/PowerIcon-White.png differ diff --git a/Screenshots/Screenshot1.png b/Screenshots/Screenshot1.png new file mode 100644 index 0000000..34d031b Binary files /dev/null and b/Screenshots/Screenshot1.png differ diff --git a/Screenshots/Screenshot2.png b/Screenshots/Screenshot2.png new file mode 100644 index 0000000..ac433f1 Binary files /dev/null and b/Screenshots/Screenshot2.png differ diff --git a/Screenshots/Screenshot3.png b/Screenshots/Screenshot3.png new file mode 100644 index 0000000..038a3d5 Binary files /dev/null and b/Screenshots/Screenshot3.png differ