-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Windows Separation Remastered: Preferences Window #618
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Windows Separation Remastered: Preferences Window #618
Conversation
lolgear
commented
Dec 11, 2019
- Preferences window controller has been encapsulated.
- Preferences window controller has been moved to its own xib.
@lucasderraugh Ready, I guess :) ( except layout, heh. I will add constraints a bit later. ) |
I'll wait until you think it's all done haha. Looks pretty good so far though. |
@lucasderraugh Ok, layout has been added. |
@lucasderraugh |
@lucasderraugh Go-go-go-go-go :) |
Sorry, I merged the text size changes in first as those were changes made based on a branch many years ago. If you get the chance to look over the conflicts we can merge these in as well. I think we can consider bumping later, but for now constraints will work just fine. We already moved to 10.10 this year from 10.8 to get over some dark mode hurtles with older releases. I think perhaps we can consider moving to 10.12 on the next release of macOS. |
@lucasderraugh |
@lucasderraugh |
@lucasderraugh |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A few feedback points, overall seems like it should be ok.
- (void)showWindow:(id)sender { | ||
// sync NSUserDefaults | ||
NSString* theme = [NSUserDefaults.standardUserDefaults stringForKey:kUserDefaultsKey_Theme]; | ||
self.selectedTheme = theme; | ||
NSString* channel = [NSUserDefaults.standardUserDefaults stringForKey:kUserDefaultsKey_ReleaseChannel]; | ||
self.selectedChannel = channel; | ||
[self selectPreferencePane:nil]; | ||
[super showWindow:sender]; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think we need to resync these every time we open the window. They shouldn't be changing other than via the preferences pane. Also, every time you trigger the show preferences window, it is moving it down. Looks like the window frame setup used to be done in awakeFromNib
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@lucasderraugh
Heh, weird.
[self selectPreferencePane:self]; // non-nil sender
fixed it.
Maybe we can remove checks for sender
here:
- (IBAction)selectPreferencePane:(id)sender {
NSWindow *window = self.window;
[_preferencesTabView selectTabViewItemWithIdentifier:_preferencesToolbar.selectedItemIdentifier];
NSSize size = NSSizeFromString(_preferencesTabView.selectedTabViewItem.label);
NSRect rect = [window contentRectForFrameRect:window.frame];
// if (sender) {
rect.origin.y += rect.size.height;
// }
rect.size.width = size.width;
rect.size.height = size.height;
// if (sender) {
rect.origin.y -= rect.size.height;
// }
[window setFrame:[window frameRectForContentRect:rect] display:YES animate:(sender ? YES : NO)];
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure really in what cases there is or isn't a sender? I would assume there always is one. I just want the preference pane to never move itself down haha.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@lucasderraugh Fixed.
extern NSString* const GIViewController_DiffTool; | ||
extern NSString* const GIViewController_MergeTool; | ||
extern NSString* const GIViewController_TerminalTool; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why GIViewController
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@lucasderraugh Legacy, I guess.
GIPreferences_
prefix is better?
// Change
extern NSString *const GIPreferences_DiffTool;
extern NSString *const GIPreferences_MergeTool;
extern NSString *const GIPreferences_TerminalTool;
// DiffTool and MergeTool
extern NSString *const GIPreferences_DiffMergeTool_FileMerge;
extern NSString *const GIPreferences_DiffMergeTool_Kaleidoscope;
extern NSString *const GIPreferences_DiffMergeTool_BeyondCompare;
extern NSString *const GIPreferences_DiffMergeTool_P4Merge;
extern NSString *const GIPreferences_DiffMergeTool_GitTool;
extern NSString *const GIPreferences_DiffMergeTool_DiffMerge;
// TerminalTool
extern NSString *const GIPreferences_TerminalTool_Terminal;
extern NSString *const GIPreferences_TerminalTool_iTerm;
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also I would like to add suffix to distinguish Keys
and DisplayNames
.
extern NSString *const GIPreferences_DiffTool_Key;
extern NSString *const GIPreferences_DiffMergeTool_FileMerge_DisplayName;
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, I see. I think GIPreferences
works well. I think you can shorten up some of these names. If it's just being used as the localized string value, just GIPreferences_FileMerge
would work fine if the string is just going to be "File Merge" anyways.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@lucasderraugh Fixed.
+ (NSString *)bundleIdentifierForDisplayName:(NSString *)displayName { | ||
if ([displayName isEqualToString:GIViewController_TerminalTool_iTerm]) { | ||
return GIViewController_TerminalTool_iTerm_BundleIdentifier; | ||
} | ||
return nil; | ||
} | ||
+ (NSString *)standardDefaultsKeyForDisplayName:(NSString *)displayName { | ||
if ([displayName isEqualToString:GIViewController_TerminalTool_iTerm]) { | ||
return GIViewController_TerminalTool_iTerm_Key; | ||
} | ||
return nil; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Static analysis warning for returning nil when expecting non-nil return.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@lucasderraugh Fixed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I always forget to hit the request changes button...
@property (nonatomic, copy) NSArray <NSString *>*channelTitles; | ||
@property (nonatomic, copy) NSArray <NSString *>*themesTitles; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: Generics right next to type: NSArray<
(no space)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@property (nonatomic, copy) NSArray<NSString *>*themesTitles;
// or
@property (nonatomic, copy) NSArray<NSString*>*themesTitles;
// or
@property (nonatomic, copy) NSArray<NSString*> *themesTitles;
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The style throughout the rest of the project is to have the type and then the identifier after a space so my vote would be NSArray<NSString*>* propertyName
. Not how my personal projects would go, but it's not really my repo 😅.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@lucasderraugh Fixed. :3
… have been fixed.
@lucasderraugh Go-go-go |
Ready? |
* kit: launch services locator has been added. * application: windows preferences window controller has been added. * application: project has been updated. * application: app delegate has been cleaned up. * application: windows xibs main menu preferences window has been removed. * application: common constants have been cleaned up. * application: project has been updated. * application: windows xibs preferences window constraints have been added. * application: preference text size has been fixed. * kit: launch services locator preferences keys have been renamed. Bugs have been fixed. * application: document has been fixed. * application: windows xibs preferences window layout has been updated. * application: windows preferences window controller small bugs have been fixed. * Fix bad merge from master Co-authored-by: Lucas Derraugh <lucas@derraugh.com>