Browse Source

Removing unneeded outlets.

Localization
Abhishek Banthia 9 years ago
parent
commit
12599040a5
  1. BIN
      Clocker.xcodeproj/project.xcworkspace/xcuserdata/abhishekbanthia.xcuserdatad/UserInterfaceState.xcuserstate
  2. 4
      Clocker/Panel.m
  3. 2
      Clocker/Panel.xib
  4. 5
      Clocker/PanelController.h
  5. 28
      Clocker/PanelController.m
  6. 1
      Clocker/PreferencesWindow.xib
  7. 1
      Clocker/PreferencesWindowController.h
  8. 21
      Clocker/PreferencesWindowController.m

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

Binary file not shown.

4
Clocker/Panel.m

@ -41,6 +41,10 @@
return YES; return YES;
} }
#pragma mark -
#pragma mark Handling Keydown events
#pragma mark -
-(void)keyDown:(NSEvent *)theEvent -(void)keyDown:(NSEvent *)theEvent
{ {
[super keyDown:theEvent]; [super keyDown:theEvent];

2
Clocker/Panel.xib

@ -7,10 +7,8 @@
<customObject id="-2" userLabel="File's Owner" customClass="PanelController"> <customObject id="-2" userLabel="File's Owner" customClass="PanelController">
<connections> <connections>
<outlet property="backgroundView" destination="6" id="20"/> <outlet property="backgroundView" destination="6" id="20"/>
<outlet property="logoLabel" destination="HR1-ZK-Ey0" id="5Mh-OP-GqP"/>
<outlet property="mainTableview" destination="dFw-ts-8OZ" id="wwJ-jA-lCy"/> <outlet property="mainTableview" destination="dFw-ts-8OZ" id="wwJ-jA-lCy"/>
<outlet property="preferencesButton" destination="OFy-u1-TnH" id="SId-Ih-ssT"/> <outlet property="preferencesButton" destination="OFy-u1-TnH" id="SId-Ih-ssT"/>
<outlet property="scrollView" destination="4Gd-Nv-fXr" id="mw5-Tt-83x"/>
<outlet property="scrollViewHeight" destination="QcT-N0-G4s" id="EHr-Co-L0Z"/> <outlet property="scrollViewHeight" destination="QcT-N0-G4s" id="EHr-Co-L0Z"/>
<outlet property="shutdownButton" destination="nTt-pf-Hw2" id="gCK-0D-gnK"/> <outlet property="shutdownButton" destination="nTt-pf-Hw2" id="gCK-0D-gnK"/>
<outlet property="window" destination="5" id="7"/> <outlet property="window" destination="5" id="7"/>

5
Clocker/PanelController.h

@ -58,21 +58,18 @@
@property (nonatomic) BOOL hasActivePanel; @property (nonatomic) BOOL hasActivePanel;
@property (nonatomic, unsafe_unretained, readonly) id<PanelControllerDelegate> delegate; @property (nonatomic, unsafe_unretained, readonly) id<PanelControllerDelegate> delegate;
@property (weak) IBOutlet NSTableView *mainTableview; @property (weak) IBOutlet NSTableView *mainTableview;
@property (weak) IBOutlet NSScrollView *scrollView;
@property (weak) IBOutlet NSLayoutConstraint *scrollViewHeight; @property (weak) IBOutlet NSLayoutConstraint *scrollViewHeight;
@property (weak) IBOutlet NSButton *shutdownButton; @property (weak) IBOutlet NSButton *shutdownButton;
@property (weak) IBOutlet NSButton *preferencesButton; @property (weak) IBOutlet NSButton *preferencesButton;
@property (weak) IBOutlet NSTextField *logoLabel;
- (id)initWithDelegate:(id<PanelControllerDelegate>)delegate; - (id)initWithDelegate:(id<PanelControllerDelegate>)delegate;
- (void)openPanel; - (void)openPanel;
- (void)closePanel; - (void)closePanel;
- (void) updateDefaultPreferences; - (void)updateDefaultPreferences;
- (void)showOptions:(BOOL)value; - (void)showOptions:(BOOL)value;
@end @end

28
Clocker/PanelController.m

@ -84,6 +84,10 @@
} }
#pragma mark -
#pragma mark Updating Timezones
#pragma mark -
- (void) updateDefaultPreferences - (void) updateDefaultPreferences
{ {
NSArray *defaultZones = [[NSUserDefaults standardUserDefaults] objectForKey:@"defaultPreferences"]; NSArray *defaultZones = [[NSUserDefaults standardUserDefaults] objectForKey:@"defaultPreferences"];
@ -235,6 +239,10 @@
}); });
} }
#pragma mark -
#pragma mark NSTableview Datasource
#pragma mark -
-(NSInteger)numberOfRowsInTableView:(NSTableView *)tableView -(NSInteger)numberOfRowsInTableView:(NSTableView *)tableView
{ {
return self.defaultPreferences.count; return self.defaultPreferences.count;
@ -261,6 +269,10 @@
return cell; return cell;
} }
#pragma mark -
#pragma mark Datasource formatting
#pragma mark -
- (NSString *)formatStringShouldContainCity:(BOOL)value withTimezoneName:(NSString *)name - (NSString *)formatStringShouldContainCity:(BOOL)value withTimezoneName:(NSString *)name
{ {
if (value) { if (value) {
@ -330,9 +342,6 @@
{ {
return @"Tomorrow"; return @"Tomorrow";
} }
} }
- (NSString *)getDateForTimeZone:(NSString *)timezoneName - (NSString *)getDateForTimeZone:(NSString *)timezoneName
@ -348,6 +357,10 @@
return [self compareSystemDate:[self getLocalCurrentDate] toTimezoneDate:[dateFormatter stringFromDate:currentDate]];; 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 - (BOOL)tableView:(NSTableView *)tableView writeRowsWithIndexes:(NSIndexSet *)rowIndexes toPasteboard:(NSPasteboard *)pboard
{ {
@ -383,17 +396,22 @@
return NSDragOperationEvery; return NSDragOperationEvery;
} }
#pragma mark -
#pragma mark Preferences Target-Action
#pragma mark -
- (IBAction)openPreferences:(id)sender - (IBAction)openPreferences:(id)sender
{ {
self.preferencesWindow = [PreferencesWindowController sharedPreferences]; self.preferencesWindow = [PreferencesWindowController sharedPreferences];
[self.preferencesWindow showWindow:nil]; [self.preferencesWindow showWindow:nil];
[NSApp activateIgnoringOtherApps:YES]; [NSApp activateIgnoringOtherApps:YES];
} }
#pragma mark -
#pragma mark Hiding Buttons on Mouse Exit
#pragma mark -
- (void)showOptions:(BOOL)value - (void)showOptions:(BOOL)value
{ {
if (self.defaultPreferences.count == 0) if (self.defaultPreferences.count == 0)

1
Clocker/PreferencesWindow.xib

@ -10,7 +10,6 @@
<outlet property="is24HourFormatSelected" destination="N47-gw-Pay" id="2MV-F1-uYf"/> <outlet property="is24HourFormatSelected" destination="N47-gw-Pay" id="2MV-F1-uYf"/>
<outlet property="messageLabel" destination="Rty-6T-aPw" id="Qg4-mk-P90"/> <outlet property="messageLabel" destination="Rty-6T-aPw" id="Qg4-mk-P90"/>
<outlet property="openSourceMessage" destination="cso-OX-qzB" id="yJg-DI-SX9"/> <outlet property="openSourceMessage" destination="cso-OX-qzB" id="yJg-DI-SX9"/>
<outlet property="reportBug" destination="psn-eC-m9g" id="zeL-Kw-pBY"/>
<outlet property="searchField" destination="5jL-eb-qdB" id="K6C-JS-ko0"/> <outlet property="searchField" destination="5jL-eb-qdB" id="K6C-JS-ko0"/>
<outlet property="timezonePanel" destination="Z6I-Ny-aGx" id="tXP-KH-Xfi"/> <outlet property="timezonePanel" destination="Z6I-Ny-aGx" id="tXP-KH-Xfi"/>
<outlet property="timezoneTableView" destination="oKD-AN-gPT" id="oD2-n0-4jf"/> <outlet property="timezoneTableView" destination="oKD-AN-gPT" id="oD2-n0-4jf"/>

1
Clocker/PreferencesWindowController.h

@ -38,7 +38,6 @@
@property (strong, nonatomic) NSMutableArray *timeZoneArray; @property (strong, nonatomic) NSMutableArray *timeZoneArray;
@property (strong, nonatomic) NSMutableArray *selectedTimeZones; @property (strong, nonatomic) NSMutableArray *selectedTimeZones;
@property (strong, nonatomic) NSArray *filteredArray; @property (strong, nonatomic) NSArray *filteredArray;
@property (strong, nonatomic) NSArray *fontFamilies;
@property (atomic, assign) BOOL launchOnLogin; @property (atomic, assign) BOOL launchOnLogin;
+ (instancetype)sharedPreferences; + (instancetype)sharedPreferences;

21
Clocker/PreferencesWindowController.m

@ -46,7 +46,6 @@
@property (weak) IBOutlet NSButton *is24HourFormatSelected; @property (weak) IBOutlet NSButton *is24HourFormatSelected;
@property (weak) IBOutlet NSTextField *messageLabel; @property (weak) IBOutlet NSTextField *messageLabel;
@property (weak) IBOutlet NSTextField *openSourceMessage; @property (weak) IBOutlet NSTextField *openSourceMessage;
@property (weak) IBOutlet NSButton *reportBug;
@end @end
@ -62,11 +61,6 @@ static PreferencesWindowController *sharedPreferences = nil;
NSString *credits = @"Clocker v1.0 is open source. You can find the source code <a href=\"https://github.com/Abhishaker17/Clocker\">here!</a>"; NSString *credits = @"Clocker v1.0 is open source. You can find the source code <a href=\"https://github.com/Abhishaker17/Clocker\">here!</a>";
[self.openSourceMessage setAttributedStringValue:[self stringFromHTML:credits withFont:[self.openSourceMessage font]]]; [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"]; NSMutableArray *defaultTimeZones = [[NSUserDefaults standardUserDefaults] objectForKey:@"defaultPreferences"];
@ -77,8 +71,6 @@ static PreferencesWindowController *sharedPreferences = nil;
self.filteredArray = [[NSArray alloc] init]; self.filteredArray = [[NSArray alloc] init];
} }
self.fontFamilies = [[NSArray alloc] initWithArray:[[NSFontManager sharedFontManager] availableFonts]];
self.messageLabel.stringValue = @""; self.messageLabel.stringValue = @"";
[self.timezoneTableView reloadData]; [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]; [self.selectedTimeZones addObject:selectedTimezone];
@ -263,10 +257,7 @@ static PreferencesWindowController *sharedPreferences = nil;
[self.selectedTimeZones removeObjectsInArray:itemsToRemove]; [self.selectedTimeZones removeObjectsInArray:itemsToRemove];
NSMutableArray *newDefaults; NSMutableArray *newDefaults = [[NSMutableArray alloc] initWithArray:self.selectedTimeZones];
newDefaults = [[NSMutableArray alloc] initWithArray:self.selectedTimeZones];
[[NSUserDefaults standardUserDefaults] setObject:newDefaults forKey:@"defaultPreferences"]; [[NSUserDefaults standardUserDefaults] setObject:newDefaults forKey:@"defaultPreferences"];
@ -305,7 +296,9 @@ static PreferencesWindowController *sharedPreferences = nil;
} }
- (IBAction)timeFormatSelectionChanged:(id)sender { - (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]; [self refreshMainTableview];
} }

Loading…
Cancel
Save