Browse Source

Fix-ups.

v1.2.1
Abhishek Banthia 9 years ago
parent
commit
01f1a3b446
  1. BIN
      Clocker.xcodeproj/project.xcworkspace/xcuserdata/abhishekbanthia.xcuserdatad/UserInterfaceState.xcuserstate
  2. 10
      Clocker/ApplicationDelegate.m
  3. 2
      Clocker/ApptentiveConnect/ApptentiveConnect/xibs/ATFeedbackWindow.xib
  4. 6
      Clocker/BackgroundView.m
  5. 2
      Clocker/Custom Table Cell Views/CLTimezoneCellView.h
  6. 16
      Clocker/Custom Table Cell Views/CLTimezoneCellView.m
  7. BIN
      Clocker/Images/PowerIcon-White.png
  8. 19
      Clocker/Panel.xib
  9. 1
      Clocker/PanelController.h
  10. 43
      Clocker/PanelController.m
  11. 8
      Clocker/Preferences/CLPreferencesView.xib
  12. 48
      Clocker/Preferences/CLPreferencesViewController.m
  13. 21
      Media.xcassets/PowerIcon-White.imageset/Contents.json
  14. BIN
      Media.xcassets/PowerIcon-White.imageset/PowerIcon-White.png
  15. BIN
      Screenshots/Screenshot1.png
  16. BIN
      Screenshots/Screenshot2.png
  17. BIN
      Screenshots/Screenshot3.png

BIN
Clocker.xcodeproj/project.xcworkspace/xcuserdata/abhishekbanthia.xcuserdatad/UserInterfaceState.xcuserstate generated

Binary file not shown.

10
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

2
Clocker/ApptentiveConnect/ApptentiveConnect/xibs/ATFeedbackWindow.xib

@ -20,7 +20,7 @@
</connections>
</customObject>
<customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/>
<customObject id="-3" userLabel="Application"/>
<customObject id="-3" userLabel="Application" customClass="NSObject"/>
<window title="Send Feedback" allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" oneShot="NO" animationBehavior="default" id="1">
<windowStyleMask key="styleMask" titled="YES" closable="YES" miniaturizable="YES"/>
<windowPositionMask key="initialPositionMask" leftStrut="YES" rightStrut="YES" topStrut="YES" bottomStrut="YES"/>

6
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];

2
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

16
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

BIN
Clocker/Images/PowerIcon-White.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 79 KiB

19
Clocker/Panel.xib

@ -11,6 +11,7 @@
<outlet property="preferencesButton" destination="OFy-u1-TnH" id="SId-Ih-ssT"/>
<outlet property="scrollViewHeight" destination="QcT-N0-G4s" id="EHr-Co-L0Z"/>
<outlet property="shutdownButton" destination="nTt-pf-Hw2" id="gCK-0D-gnK"/>
<outlet property="titleField" destination="HR1-ZK-Ey0" id="L0G-91-jZx"/>
<outlet property="window" destination="5" id="7"/>
</connections>
</customObject>
@ -58,9 +59,9 @@
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<textField verticalHuggingPriority="750" horizontalCompressionResistancePriority="250" tag="100" translatesAutoresizingMaskIntoConstraints="NO" id="etF-33-bCB">
<rect key="frame" x="8" y="29" width="179" height="23"/>
<rect key="frame" x="8" y="29" width="134" height="23"/>
<constraints>
<constraint firstAttribute="width" constant="175" id="32b-h6-joo"/>
<constraint firstAttribute="width" constant="130" id="32b-h6-joo"/>
<constraint firstAttribute="height" constant="23" id="vod-YN-iNX"/>
</constraints>
<textFieldCell key="cell" lineBreakMode="truncatingTail" selectable="YES" editable="YES" sendsActionOnEndEditing="YES" placeholderString="Timezone Name" id="rnh-AP-ooc">
@ -85,13 +86,13 @@
</textFieldCell>
</textField>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" tag="101" translatesAutoresizingMaskIntoConstraints="NO" id="vnv-J2-7r1">
<rect key="frame" x="169" y="8" width="104" height="45"/>
<rect key="frame" x="139" y="12" width="141" height="40"/>
<constraints>
<constraint firstAttribute="height" constant="45" id="3WU-de-OQL"/>
<constraint firstAttribute="width" constant="100" id="cQV-gJ-zMz"/>
<constraint firstAttribute="height" constant="40" id="3WU-de-OQL"/>
<constraint firstAttribute="width" constant="137" id="cQV-gJ-zMz"/>
</constraints>
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" alignment="right" placeholderString="23:46" id="g8s-EU-UHx">
<font key="font" size="31" name="Helvetica-Light"/>
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" alignment="left" placeholderString="23:46 AM" id="g8s-EU-UHx">
<font key="font" size="27" name="Helvetica-Light"/>
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
@ -100,10 +101,10 @@
<constraints>
<constraint firstItem="QUd-7D-q14" firstAttribute="leading" secondItem="qbN-ba-fho" secondAttribute="leading" constant="10" id="0Qz-Ev-efP"/>
<constraint firstItem="etF-33-bCB" firstAttribute="top" secondItem="qbN-ba-fho" secondAttribute="top" constant="8" id="Lct-kG-usb"/>
<constraint firstItem="vnv-J2-7r1" firstAttribute="centerY" secondItem="qbN-ba-fho" secondAttribute="centerY" constant="-0.5" id="TuQ-gE-ZUh"/>
<constraint firstItem="vnv-J2-7r1" firstAttribute="centerY" secondItem="qbN-ba-fho" secondAttribute="centerY" constant="-2" id="TuQ-gE-ZUh"/>
<constraint firstItem="QUd-7D-q14" firstAttribute="top" secondItem="etF-33-bCB" secondAttribute="bottom" constant="-5" id="VO6-Zn-eA3"/>
<constraint firstItem="etF-33-bCB" firstAttribute="leading" secondItem="qbN-ba-fho" secondAttribute="leading" constant="10" id="ueW-ow-ZRq"/>
<constraint firstAttribute="trailing" secondItem="vnv-J2-7r1" secondAttribute="trailing" constant="8" id="zXo-eA-0bQ"/>
<constraint firstAttribute="trailing" secondItem="vnv-J2-7r1" secondAttribute="trailing" constant="1" id="zXo-eA-0bQ"/>
</constraints>
<connections>
<outlet property="customName" destination="etF-33-bCB" id="6Yz-qc-WmD"/>

1
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<PanelControllerDelegate>)delegate;

43
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]];

8
Clocker/Preferences/CLPreferencesView.xib

@ -150,7 +150,7 @@
</menu>
</popUpButtonCell>
<connections>
<action selector="changeFont:" target="-2" id="hsn-H5-o4c"/>
<action selector="changeFont:" target="-2" id="n9a-vp-3p1"/>
<binding destination="-2" name="content" keyPath="self.fontFamilies" id="JZm-hy-Yzo"/>
<binding destination="1Gq-ZQ-IML" name="selectedValue" keyPath="values.defaultFontFamily" previousBinding="JZm-hy-Yzo" id="olU-xe-W4j"/>
</connections>
@ -160,12 +160,12 @@
<constraints>
<constraint firstAttribute="width" constant="174" id="AQn-7i-cfu"/>
</constraints>
<popUpButtonCell key="cell" type="push" title="Default" bezelStyle="rounded" imagePosition="overlaps" alignment="left" lineBreakMode="truncatingTail" state="on" borderStyle="borderAndBezel" imageScaling="proportionallyDown" inset="2" selectedItem="wIH-hb-kKL" id="tDC-SX-9j7">
<popUpButtonCell key="cell" type="push" bezelStyle="rounded" imagePosition="overlaps" alignment="left" lineBreakMode="truncatingTail" borderStyle="borderAndBezel" imageScaling="proportionallyDown" inset="2" id="tDC-SX-9j7">
<behavior key="behavior" lightByBackground="YES" lightByGray="YES"/>
<font key="font" size="12" name="HelveticaNeue-Thin"/>
<menu key="menu" id="A5x-kq-ASo">
<items>
<menuItem title="Default" state="on" id="wIH-hb-kKL"/>
<menuItem title="Default" id="wIH-hb-kKL"/>
<menuItem title="Item 2" id="z5C-7z-5Lv"/>
<menuItem title="Item 3" id="1qC-i0-ODT"/>
</items>
@ -173,6 +173,8 @@
</popUpButtonCell>
<connections>
<action selector="changeTheme:" target="-2" id="EJf-VX-AVu"/>
<binding destination="-2" name="content" keyPath="self.themes" id="sq9-TC-zmI"/>
<binding destination="1Gq-ZQ-IML" name="selectedValue" keyPath="values.defaultTheme" previousBinding="sq9-TC-zmI" id="YII-d7-sWH"/>
</connections>
</popUpButton>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="wtb-He-7BA">

48
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];

21
Media.xcassets/PowerIcon-White.imageset/Contents.json vendored

@ -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"
}
}

BIN
Media.xcassets/PowerIcon-White.imageset/PowerIcon-White.png vendored

Binary file not shown.

After

Width:  |  Height:  |  Size: 79 KiB

BIN
Screenshots/Screenshot1.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 MiB

BIN
Screenshots/Screenshot2.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 MiB

BIN
Screenshots/Screenshot3.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 MiB

Loading…
Cancel
Save