diff --git a/Clocker/Appearance Tab/CLAppearanceViewController.h b/Clocker/Appearance Tab/CLAppearanceViewController.h index e74a0bd9..f24c2295 100644 --- a/Clocker/Appearance Tab/CLAppearanceViewController.h +++ b/Clocker/Appearance Tab/CLAppearanceViewController.h @@ -10,5 +10,4 @@ @interface CLAppearanceViewController : NSViewController - @end diff --git a/Clocker/Appearance Tab/CLAppearanceViewController.m b/Clocker/Appearance Tab/CLAppearanceViewController.m index e91930f7..230187ca 100644 --- a/Clocker/Appearance Tab/CLAppearanceViewController.m +++ b/Clocker/Appearance Tab/CLAppearanceViewController.m @@ -11,6 +11,7 @@ #import "PanelController.h" #import "CommonStrings.h" #import "CLTimezoneData.h" +#import "CLFloatingWindowController.h" @interface CLAppearanceViewController () @property (weak) IBOutlet NSSegmentedControl *timeFormat; @@ -42,12 +43,16 @@ - (IBAction)timeFormatSelectionChanged:(id)sender [[NSUserDefaults standardUserDefaults] setObject:[NSNumber numberWithInteger:timeFormat.selectedSegment] forKey:CL24hourFormatSelectedKey]; - [self refreshMainTableview]; + [self refreshMainTableview:YES andUpdateFloatingWindow:YES]; } - (IBAction)themeChanged:(id)sender { NSSegmentedControl *themeSegment = (NSSegmentedControl *)sender; + + //Get the current display mode + [self refreshMainTableview:NO andUpdateFloatingWindow:YES]; + ApplicationDelegate *appDelegate = [[NSApplication sharedApplication] delegate]; PanelController *panelController = appDelegate.panelController; [panelController.backgroundView setNeedsDisplay:YES]; @@ -71,71 +76,80 @@ - (IBAction)themeChanged:(id)sender } +- (IBAction)displayModeChanged:(id)sender +{ + NSSegmentedControl *modeSegment = (NSSegmentedControl *)sender; + ApplicationDelegate *sharedDelege = (ApplicationDelegate*)[NSApplication sharedApplication].delegate; + + if (modeSegment.selectedSegment == 1) + { + sharedDelege.floatingWindow = [CLFloatingWindowController sharedFloatingWindow]; + [sharedDelege.floatingWindow showWindow:nil]; + [NSApp activateIgnoringOtherApps:YES]; + } + else + { + sharedDelege.floatingWindow = [CLFloatingWindowController sharedFloatingWindow]; + [sharedDelege.floatingWindow.window close]; + [sharedDelege.panelController updateDefaultPreferences]; + } +} + + - (IBAction)changeRelativeDayDisplay:(id)sender { NSSegmentedControl *relativeDayControl = (NSSegmentedControl*) sender; NSNumber *selectedIndex = [NSNumber numberWithInteger:relativeDayControl.selectedSegment]; [[NSUserDefaults standardUserDefaults] setObject:selectedIndex forKey:CLRelativeDateKey]; - [self refreshMainTableview]; + [self refreshMainTableview:YES andUpdateFloatingWindow:YES]; } -- (void)refreshMainTableview +- (void)refreshMainTableview:(BOOL)panel andUpdateFloatingWindow:(BOOL)value { dispatch_async(dispatch_get_main_queue(), ^{ - ApplicationDelegate *appDelegate = [[NSApplication sharedApplication] delegate]; - - PanelController *panelController = appDelegate.panelController; - - [panelController updateDefaultPreferences]; - - [panelController.mainTableview reloadData]; - [appDelegate.menubarController shouldIconBeUpdated:YES]; + if (panel) + { + ApplicationDelegate *appDelegate = [[NSApplication sharedApplication] delegate]; + + PanelController *panelController = appDelegate.panelController; + + [panelController updateDefaultPreferences]; + + [panelController.mainTableview reloadData]; + + [appDelegate.menubarController shouldIconBeUpdated:YES]; + } + if (value) + { + //Get the current display mode + NSNumber *displayMode = [[NSUserDefaults standardUserDefaults] objectForKey:CLShowAppInForeground]; + + if (displayMode.integerValue == 1) + { + //Get the Floating window instance + for (NSWindow *window in [NSApplication sharedApplication].windows) + { + if ([window.windowController isKindOfClass:[CLFloatingWindowController class]]) + { + CLFloatingWindowController *currentInstance = (CLFloatingWindowController *)window.windowController; + [currentInstance.mainTableview reloadData]; + + //Only one instance where we need to update panel color and in that instance we pass panel as NO + + if (!panel) + { + [currentInstance updatePanelColor]; + } + } + } + } + } }); } -- (NSImage *)imageWithSubviewsWithTextField:(NSTextField *)textField -{ - NSSize mySize = textField.bounds.size; - NSSize imgSize = NSMakeSize( mySize.width, mySize.height ); - - NSBitmapImageRep *bir = [textField bitmapImageRepForCachingDisplayInRect:[textField bounds]]; - [bir setSize:imgSize]; - [textField cacheDisplayInRect:[textField bounds] toBitmapImageRep:bir]; - - NSImage* image = [[NSImage alloc]initWithSize:imgSize]; - [image addRepresentation:bir]; - return image; - -} - -- (NSImage *)textWithTextField:(NSTextField *)textField -{ - NSString *myString = textField.stringValue; - unsigned char *string = (unsigned char *) [myString UTF8String]; - NSSize mySize = NSMakeSize(50,100); //or measure the string - - NSBitmapImageRep *bir = [[NSBitmapImageRep alloc] - initWithBitmapDataPlanes:&string - pixelsWide:mySize.width pixelsHigh:mySize.height - bitsPerSample:8 - samplesPerPixel:3 // or 4 with alpha - hasAlpha:NO - isPlanar:NO - colorSpaceName:NSDeviceRGBColorSpace - bitmapFormat:0 - bytesPerRow:0 // 0 == determine automatically - bitsPerPixel:0]; // 0 == determine automatically - - //draw text using -(void)drawInRect:(NSRect)aRect withAttributes:(NSDictionary *)attributes - - NSImage* image = [[NSImage alloc]initWithSize:mySize]; - [image addRepresentation:bir]; - return image; -} - - (IBAction)changeMenuBarDisplayPreferences:(id)sender { NSSegmentedControl *segmentedControl = (NSSegmentedControl *)sender; @@ -147,6 +161,11 @@ - (IBAction)changeMenuBarDisplayPreferences:(id)sender [userDefaults setObject:shouldCityBeShown forKey:@"shouldCityBeShown"]; } +- (IBAction)showFutureSlider:(id)sender +{ + //Get the current display mode + [self refreshMainTableview:NO andUpdateFloatingWindow:YES]; +} @end diff --git a/Clocker/CLParentPanelController.h b/Clocker/CLParentPanelController.h new file mode 100644 index 00000000..d8f300b1 --- /dev/null +++ b/Clocker/CLParentPanelController.h @@ -0,0 +1,32 @@ +// +// CLParentPanelController.h +// Clocker +// +// Created by Abhishek Banthia on 4/4/16. +// +// + +#import +#import "CLOneWindowController.h" + +@interface CLParentPanelController : NSWindowController + + +@property (nonatomic, strong) NSMutableArray *defaultPreferences; +@property (nonatomic, strong) NSDateFormatter *dateFormatter; +@property (nonatomic, assign) NSInteger futureSliderValue; +@property (nonatomic) BOOL showReviewCell; + +@property (weak) IBOutlet NSButton *shutdownButton; +@property (weak) IBOutlet NSButton *preferencesButton; +@property (weak) IBOutlet NSSlider *futureSlider; +@property (weak) IBOutlet NSTableView *mainTableview; +@property (weak) IBOutlet NSLayoutConstraint *scrollViewHeight; +@property (nonatomic, strong) CLOneWindowController *oneWindow; + +- (void)updateDefaultPreferences; +- (void)showOptions:(BOOL)value; +- (void)removeContextHelpForSlider; +- (void)updatePanelColor; + +@end diff --git a/Clocker/CLParentPanelController.m b/Clocker/CLParentPanelController.m new file mode 100644 index 00000000..8fde1c3d --- /dev/null +++ b/Clocker/CLParentPanelController.m @@ -0,0 +1,165 @@ +// +// CLParentPanelController.m +// Clocker +// +// Created by Abhishek Banthia on 4/4/16. +// +// + +#import "CLParentPanelController.h" +#import "CLRatingCellView.h" +#import "CLTimezoneData.h" +#import "CommonStrings.h" +#import "CLOneWindowController.h" + +@interface CLParentPanelController () + +@end + +@implementation CLParentPanelController + +- (void)awakeFromNib +{ + [super awakeFromNib]; + + if ([[[NSUserDefaults standardUserDefaults] objectForKey:CLThemeKey] isKindOfClass:[NSString class]]) { + [[NSUserDefaults standardUserDefaults] setObject:@0 forKey:CLThemeKey]; + } + + NSNumber *theme = [[NSUserDefaults standardUserDefaults] objectForKey:CLThemeKey]; + + if (theme.integerValue == 1) + { + self.shutdownButton.image = [NSImage imageNamed:@"PowerIcon-White"]; + self.preferencesButton.image = [NSImage imageNamed:@"Settings-White"]; + } + else + { + self.shutdownButton.image = [NSImage imageNamed:@"PowerIcon"]; + self.preferencesButton.image = [NSImage imageNamed:NSImageNameActionTemplate]; + } + + self.mainTableview.selectionHighlightStyle = NSTableViewSelectionHighlightStyleNone; + + +} + +- (void) updateDefaultPreferences +{ + + NSArray *defaultZones = [[NSUserDefaults standardUserDefaults] objectForKey:CLDefaultPreferenceKey]; + + self.defaultPreferences = self.defaultPreferences == nil ? [[NSMutableArray alloc] initWithArray:defaultZones] : [NSMutableArray arrayWithArray:defaultZones]; + + self.scrollViewHeight.constant = self.showReviewCell ? + (self.defaultPreferences.count+1)*55+40 : self.defaultPreferences.count*55 + 30; + + if (self.defaultPreferences.count == 1) { + self.futureSlider.hidden = YES; + } + else + { + self.futureSlider.hidden = NO; + } + + [self updatePanelColor]; +} + +- (void)updatePanelColor +{ + NSNumber *theme = [[NSUserDefaults standardUserDefaults] objectForKey:CLThemeKey]; + if (theme.integerValue == 1) + { + [self.mainTableview setBackgroundColor:[NSColor blackColor]]; + self.window.alphaValue = 0.90; + } + else + { + [self.mainTableview setBackgroundColor:[NSColor whiteColor]]; + self.window.alphaValue = 1; + } +} + + +- (void)showOptions:(BOOL)value +{ + + if (self.defaultPreferences.count == 0) + { + value = YES; + } + + dispatch_async(dispatch_get_main_queue(), ^{ + self.shutdownButton.hidden = !value; + self.preferencesButton.hidden = !value; + + }); + +} + + +- (IBAction)sliderMoved:(id)sender +{ + NSCalendar *currentCalendar = [NSCalendar autoupdatingCurrentCalendar]; + NSDate *newDate = [currentCalendar dateByAddingUnit:NSCalendarUnitMinute + value:self.futureSliderValue + toDate:[NSDate date] + options:kNilOptions]; + + self.dateFormatter.dateStyle = kCFDateFormatterNoStyle; + self.dateFormatter.timeStyle = kCFDateFormatterShortStyle; + + NSString *relativeDate = [currentCalendar isDateInToday:newDate] ? @"Today" : @"Tomorrow"; + + NSString *helper = [self.dateFormatter stringFromDate:newDate]; + + NSHelpManager *helpManager = [NSHelpManager sharedHelpManager]; + + NSPoint pointInScreen = [NSEvent mouseLocation]; + pointInScreen.y -= 5; + NSAttributedString *attributedString = [[NSAttributedString alloc] initWithString:[NSString stringWithFormat:@"%@ %@", relativeDate, helper]]; + [NSHelpManager setContextHelpModeActive:YES]; + [helpManager setContextHelp:attributedString forObject:self.futureSlider]; + [helpManager showContextHelpForObject:self.futureSlider locationHint:pointInScreen]; + + [self.mainTableview reloadData]; +} + +- (void)removeContextHelpForSlider +{ + NSEvent *newEvent = [NSEvent mouseEventWithType:NSLeftMouseDown + location:self.window.mouseLocationOutsideOfEventStream + modifierFlags:0 + timestamp:0 + windowNumber:self.window.windowNumber + context:self.window.graphicsContext + eventNumber:0 + clickCount:1 + pressure:0]; + [NSApp postEvent:newEvent atStart:NO]; + newEvent = [NSEvent mouseEventWithType:NSLeftMouseUp + location:self.window.mouseLocationOutsideOfEventStream + modifierFlags:0 + timestamp:0 + windowNumber:self.window.windowNumber + context:self.window.graphicsContext + eventNumber:0 + clickCount:1 + pressure:0]; + + [NSApp postEvent:newEvent atStart:NO]; +} + +#pragma mark - +#pragma mark Preferences Target-Action +#pragma mark - + +- (IBAction)openPreferences:(id)sender +{ + self.oneWindow = [CLOneWindowController sharedWindow]; + [self.oneWindow showWindow:nil]; + [NSApp activateIgnoringOtherApps:YES]; + +} + +@end diff --git a/Clocker/Onboarding/CLOnboardingWindowController.m b/Clocker/Onboarding/CLOnboardingWindowController.m index 8e90263c..a7b592c5 100644 --- a/Clocker/Onboarding/CLOnboardingWindowController.m +++ b/Clocker/Onboarding/CLOnboardingWindowController.m @@ -30,6 +30,8 @@ - (void)windowDidLoad { // Implement this method to handle any initialization after your window controller's window has been loaded from its nib file. } + + + (instancetype)sharedWindow { if (sharedOnboardingWindow == nil) diff --git a/Clocker/PanelController.h b/Clocker/PanelController.h index 1783887d..24d185d4 100755 --- a/Clocker/PanelController.h +++ b/Clocker/PanelController.h @@ -28,7 +28,7 @@ #import "BackgroundView.h" #import "StatusItemView.h" -#import "CLOneWindowController.h" +#import "CLParentPanelController.h" @class PanelController; @class CLTimezoneData; @@ -43,7 +43,7 @@ #pragma mark - -@interface PanelController : NSWindowController +@interface PanelController : CLParentPanelController { BOOL _hasActivePanel; __unsafe_unretained BackgroundView *_backgroundView; @@ -53,19 +53,9 @@ } -@property (nonatomic, strong) CLOneWindowController *oneWindow; -@property (nonatomic, strong) NSMutableArray *defaultPreferences; -@property (nonatomic, strong) NSDateFormatter *dateFormatter; -@property (nonatomic, assign) NSInteger futureSliderValue; @property (nonatomic) BOOL hasActivePanel; -@property (nonatomic) BOOL showReviewCell; @property (nonatomic, unsafe_unretained, readonly) id delegate; @property (nonatomic, unsafe_unretained) IBOutlet BackgroundView *backgroundView; -@property (weak) IBOutlet NSTableView *mainTableview; -@property (weak) IBOutlet NSLayoutConstraint *scrollViewHeight; -@property (weak) IBOutlet NSButton *shutdownButton; -@property (weak) IBOutlet NSButton *preferencesButton; -@property (weak) IBOutlet NSSlider *futureSlider; @property (strong, nonatomic) PanelController *panelWindow; @property (strong, nonatomic) NSTimer *floatingWindowTimer; @@ -73,8 +63,5 @@ - (void)openPanel; - (void)closePanel; - (void)updateDefaultPreferences; -- (void)showOptions:(BOOL)value; -- (void)removeContextHelpForSlider; -- (void)updatePanelColor; @end diff --git a/Clocker/PanelController.m b/Clocker/PanelController.m index 1a7f9ca7..5b191b64 100755 --- a/Clocker/PanelController.m +++ b/Clocker/PanelController.m @@ -90,28 +90,6 @@ - (void)awakeFromNib self.dateFormatter = [NSDateFormatter new]; } - if ([[[NSUserDefaults standardUserDefaults] objectForKey:CLThemeKey] isKindOfClass:[NSString class]]) { - [[NSUserDefaults standardUserDefaults] setObject:@0 forKey:CLThemeKey]; - } - - NSNumber *theme = [[NSUserDefaults standardUserDefaults] objectForKey:CLThemeKey]; - - if (theme.integerValue == 1) - { - self.shutdownButton.image = [NSImage imageNamed:@"PowerIcon-White"]; - self.preferencesButton.image = [NSImage imageNamed:@"Settings-White"]; - } - else - { - self.shutdownButton.image = [NSImage imageNamed:@"PowerIcon"]; - self.preferencesButton.image = [NSImage imageNamed:NSImageNameActionTemplate]; - } - - [self updateDefaultPreferences]; - self.mainTableview.selectionHighlightStyle = NSTableViewSelectionHighlightStyleNone; - - - NSPanel *panel = (id)[self window]; [panel setAcceptsMouseMovedEvents:YES]; [panel setLevel:NSPopUpMenuWindowLevel]; @@ -121,59 +99,12 @@ - (void)awakeFromNib //Register for drag and drop [self.mainTableview registerForDraggedTypes: [NSArray arrayWithObject:CLDragSessionKey]]; - [self updatePanelColor]; + [super updatePanelColor]; -} - -/* -- (void)openAsFloatingWindow -{ - - if (self.panelWindow) - { - [self.panelWindow.window makeKeyAndOrderFront:nil]; - return; - } - - [[NSUserDefaults standardUserDefaults] setObject:@1 forKey:CLShowAppInForeground]; + [super updateDefaultPreferences]; - self.panelWindow = [PanelController sharedPanel]; - self.panelWindow.window.level = NSFloatingWindowLevel; - - self.panelWindow.window.styleMask = NSTitledWindowMask | NSClosableWindowMask | NSResizableWindowMask; - self.panelWindow.window.titlebarAppearsTransparent = YES; - self.panelWindow.window.titleVisibility = NSWindowTitleVisible; - [self.panelWindow showWindow:nil]; - NSSize maxWindowSize; - maxWindowSize.width = self.window.frame.size.width; - maxWindowSize.height = self.window.frame.size.height+40; - NSSize minWindowSize; - minWindowSize.width = 110; - minWindowSize.height = 50; - - NSSize currentSize; - currentSize.width = self.window.frame.size.width; - currentSize.height = self.window.frame.size.height; - - self.panelWindow.window.contentMaxSize = maxWindowSize; - self.panelWindow.window.contentMinSize = minWindowSize; - - [self.panelWindow.window setContentSize:currentSize]; - [NSApp activateIgnoringOtherApps:YES]; - - self.floatingWindowTimer = [NSTimer scheduledTimerWithTimeInterval:1.0 - target:self selector:@selector(updateTime) - userInfo:nil - repeats:YES]; } -- (void)updateTime -{ - if (self.panelWindow) - { - [self.panelWindow.mainTableview reloadData]; - } -}*/ #pragma mark - #pragma mark Updating Timezones @@ -181,21 +112,7 @@ - (void)updateTime - (void) updateDefaultPreferences { - - NSArray *defaultZones = [[NSUserDefaults standardUserDefaults] objectForKey:CLDefaultPreferenceKey]; - - self.defaultPreferences = self.defaultPreferences == nil ? [[NSMutableArray alloc] initWithArray:defaultZones] : [NSMutableArray arrayWithArray:defaultZones]; - - self.scrollViewHeight.constant = self.showReviewCell ? - (self.defaultPreferences.count+1)*55+40 : self.defaultPreferences.count*55 + 30; - - if (self.defaultPreferences.count == 1) { - self.futureSlider.hidden = YES; - } - else - { - self.futureSlider.hidden = NO; - } + [super updateDefaultPreferences]; } #pragma mark - Public accessors @@ -417,15 +334,6 @@ -(NSView*)tableView:(NSTableView *)tableView viewForTableColumn:(NSTableColumn * #pragma mark NSTableview Drag and Drop #pragma mark - -- (BOOL)tableView:(NSTableView *)tableView writeRowsWithIndexes:(NSIndexSet *)rowIndexes toPasteboard:(NSPasteboard *)pboard -{ - NSData *data = [NSKeyedArchiver archivedDataWithRootObject:rowIndexes]; - [pboard declareTypes:[NSArray arrayWithObject:CLDragSessionKey] owner:self]; - [pboard setData:data forType:CLDragSessionKey]; - return YES; -} - - -(void)tableView:(NSTableView *)tableView setObjectValue:(id)object forTableColumn:(NSTableColumn *)tableColumn row:(NSInteger)row { if ([object isKindOfClass:[NSString class]]) @@ -444,137 +352,4 @@ -(void)tableView:(NSTableView *)tableView setObjectValue:(id)object forTableColu } } - --(BOOL)tableView:(NSTableView *)tableView acceptDrop:(id)info row:(NSInteger)row dropOperation:(NSTableViewDropOperation)dropOperation -{ - NSPasteboard *pBoard = [info draggingPasteboard]; - - NSData *data = [pBoard dataForType:CLDragSessionKey]; - - NSIndexSet *rowIndexes = [NSKeyedUnarchiver unarchiveObjectWithData:data]; - - [self.defaultPreferences exchangeObjectAtIndex:rowIndexes.firstIndex - withObjectAtIndex:row]; - - [[NSUserDefaults standardUserDefaults] setObject:self.defaultPreferences - forKey:CLDefaultPreferenceKey]; - - - [[NSApplication sharedApplication].windows enumerateObjectsUsingBlock:^(NSWindow * _Nonnull window, NSUInteger idx, BOOL * _Nonnull stop) { - if ([window.windowController isMemberOfClass:[CLOneWindowController class]]) { - CLOneWindowController *ref = (CLOneWindowController *) window.windowController; - [ref.preferencesView refereshTimezoneTableView]; - } - - }]; - - [self.mainTableview reloadData]; - - return YES; -} - --(NSDragOperation)tableView:(NSTableView *)tableView validateDrop:(id)info proposedRow:(NSInteger)row proposedDropOperation:(NSTableViewDropOperation)dropOperation -{ - return NSDragOperationEvery; -} - -#pragma mark - -#pragma mark Preferences Target-Action -#pragma mark - - -- (IBAction)openPreferences:(id)sender -{ - self.oneWindow = [CLOneWindowController sharedWindow]; - [self.oneWindow 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) - { - value = YES; - } - - dispatch_async(dispatch_get_main_queue(), ^{ - self.shutdownButton.hidden = !value; - self.preferencesButton.hidden = !value; - - }); - -} - -- (IBAction)sliderMoved:(id)sender -{ - NSCalendar *currentCalendar = [NSCalendar autoupdatingCurrentCalendar]; - NSDate *newDate = [currentCalendar dateByAddingUnit:NSCalendarUnitMinute - value:self.futureSliderValue - toDate:[NSDate date] - options:kNilOptions]; - - self.dateFormatter.dateStyle = kCFDateFormatterNoStyle; - self.dateFormatter.timeStyle = kCFDateFormatterShortStyle; - - NSString *relativeDate = [currentCalendar isDateInToday:newDate] ? @"Today" : @"Tomorrow"; - - NSString *helper = [self.dateFormatter stringFromDate:newDate]; - - NSHelpManager *helpManager = [NSHelpManager sharedHelpManager]; - - NSPoint pointInScreen = [NSEvent mouseLocation]; - pointInScreen.y -= 5; - NSAttributedString *attributedString = [[NSAttributedString alloc] initWithString:[NSString stringWithFormat:@"%@ %@", relativeDate, helper]]; - [NSHelpManager setContextHelpModeActive:YES]; - [helpManager setContextHelp:attributedString forObject:self.futureSlider]; - [helpManager showContextHelpForObject:self.futureSlider locationHint:pointInScreen]; - - [self.mainTableview reloadData]; -} - -- (void)removeContextHelpForSlider -{ - NSEvent *newEvent = [NSEvent mouseEventWithType:NSLeftMouseDown - location:self.window.mouseLocationOutsideOfEventStream - modifierFlags:0 - timestamp:0 - windowNumber:self.window.windowNumber - context:self.window.graphicsContext - eventNumber:0 - clickCount:1 - pressure:0]; - [NSApp postEvent:newEvent atStart:NO]; - newEvent = [NSEvent mouseEventWithType:NSLeftMouseUp - location:self.window.mouseLocationOutsideOfEventStream - modifierFlags:0 - timestamp:0 - windowNumber:self.window.windowNumber - context:self.window.graphicsContext - eventNumber:0 - clickCount:1 - pressure:0]; - - [NSApp postEvent:newEvent atStart:NO]; -} - -- (void)updatePanelColor -{ - NSNumber *theme = [[NSUserDefaults standardUserDefaults] objectForKey:CLThemeKey]; - if (theme.integerValue) - { - [self.mainTableview setBackgroundColor:[NSColor blackColor]]; - self.window.alphaValue = 0.90; - } - else - { - [self.mainTableview setBackgroundColor:[NSColor whiteColor]]; - self.window.alphaValue = 1; - } -} - @end diff --git a/Clocker/Preferences/CLPreferencesViewController.m b/Clocker/Preferences/CLPreferencesViewController.m index c95bf327..23918f84 100644 --- a/Clocker/Preferences/CLPreferencesViewController.m +++ b/Clocker/Preferences/CLPreferencesViewController.m @@ -530,6 +530,26 @@ - (void)refreshMainTableview [panelController.mainTableview reloadData]; + //Get the current display mode + NSNumber *displayMode = [[NSUserDefaults standardUserDefaults] objectForKey:CLShowAppInForeground]; + + if (displayMode.integerValue == 1) + { + //Get the Floating window instance + for (NSWindow *window in [NSApplication sharedApplication].windows) + { + if ([window.windowController isKindOfClass:[CLFloatingWindowController class]]) + { + CLFloatingWindowController *currentInstance = (CLFloatingWindowController *)window.windowController; + + [currentInstance updateDefaultPreferences]; + + [currentInstance.mainTableview reloadData]; + } + } + } + + }); } diff --git a/Clocker/en.lproj/Localizable.strings b/Clocker/en.lproj/Localizable.strings index 958b9533..2dc72118 100644 --- a/Clocker/en.lproj/Localizable.strings +++ b/Clocker/en.lproj/Localizable.strings @@ -13,4 +13,6 @@ "iRateCancelButton" = "No, Thanks"; "iRateRateButton" = "Rate It Now"; "iRateRemindButton" = "Remind Me Later"; -"iRateUpdateMessage" = "Update now?"; \ No newline at end of file +"iRateUpdateMessage" = "Update now?"; +"ClockerVersion" = "Version %@"; +"CLFeedbackAlertTitle" = "Thank you for helping make Clocker even better!"; \ No newline at end of file diff --git a/Clocker/en.lproj/Panel.xib b/Clocker/en.lproj/Panel.xib index c2e17e20..5c228c9a 100755 --- a/Clocker/en.lproj/Panel.xib +++ b/Clocker/en.lproj/Panel.xib @@ -57,7 +57,7 @@ - + @@ -72,7 +72,7 @@ - + @@ -84,7 +84,7 @@ - + @@ -120,7 +120,7 @@ - +