Skip to content

Commit

Permalink
Merge branch 'dev' into service_api_key_config
Browse files Browse the repository at this point in the history
  • Loading branch information
phlpsong authored Feb 3, 2024
2 parents 91b216d + 35e600b commit 2f88560
Showing 1 changed file with 27 additions and 19 deletions.
46 changes: 27 additions & 19 deletions Easydict/Feature/PerferenceWindow/EZSettingViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -495,14 +495,16 @@ - (void)setupUI {
self.hideMenuBarIconButton = [NSButton checkboxWithTitle:hideMenuBarIcon target:self action:@selector(hideMenuBarIconButtonClicked:)];
[self.contentView addSubview:self.hideMenuBarIconButton];

NSTextField *betaNewAppLabel = [NSTextField labelWithString:NSLocalizedString(@"beta_new_app", nil)];
betaNewAppLabel.font = font;
[self.contentView addSubview:betaNewAppLabel];
self.betaNewAppLabel = betaNewAppLabel;

NSString *enableBetaNewApp = NSLocalizedString(@"enable_beta_new_app", nil);
self.enableBetaNewAppButton = [NSButton checkboxWithTitle:enableBetaNewApp target:self action:@selector(enableBetaNewAppButtonClicked:)];
[self.contentView addSubview:self.enableBetaNewAppButton];
if (@available(macOS 13.0, *)) {
NSTextField *betaNewAppLabel = [NSTextField labelWithString:NSLocalizedString(@"beta_new_app", nil)];
betaNewAppLabel.font = font;
[self.contentView addSubview:betaNewAppLabel];
self.betaNewAppLabel = betaNewAppLabel;

NSString *enableBetaNewApp = NSLocalizedString(@"enable_beta_new_app", nil);
self.enableBetaNewAppButton = [NSButton checkboxWithTitle:enableBetaNewApp target:self action:@selector(enableBetaNewAppButtonClicked:)];
[self.contentView addSubview:self.enableBetaNewAppButton];
}

NSTextField *fontSizeLabel = [NSTextField labelWithString:NSLocalizedString(@"font_size", nil)];
fontSizeLabel.font = font;
Expand Down Expand Up @@ -556,7 +558,9 @@ - (void)setupUI {
self.showEudicQuickLinkButton.mm_isOn = self.config.showEudicQuickLink;
self.showAppleDictionaryQuickLinkButton.mm_isOn = self.config.showAppleDictionaryQuickLink;
self.hideMenuBarIconButton.mm_isOn = self.config.hideMenuBarIcon;
self.enableBetaNewAppButton.mm_isOn = self.config.enableBetaNewApp;
if (@available(macOS 13.0, *)) {
self.enableBetaNewAppButton.mm_isOn = self.config.enableBetaNewApp;
}
}

- (void)updateViewConstraints {
Expand Down Expand Up @@ -863,18 +867,22 @@ - (void)updateViewConstraints {
make.left.equalTo(self.menuBarIconLabel.mas_right).offset(self.horizontalPadding);
make.centerY.equalTo(self.menuBarIconLabel);
}];

[self.betaNewAppLabel mas_remakeConstraints:^(MASConstraintMaker *make) {
make.right.equalTo(self.autoGetSelectedTextLabel);
make.top.equalTo(self.hideMenuBarIconButton.mas_bottom).offset(self.verticalPadding);
}];
[self.enableBetaNewAppButton mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(self.betaNewAppLabel.mas_right).offset(self.horizontalPadding);
make.centerY.equalTo(self.betaNewAppLabel);
}];

if (@available(macOS 13.0, *)) {
[self.betaNewAppLabel mas_remakeConstraints:^(MASConstraintMaker *make) {
make.right.equalTo(self.autoGetSelectedTextLabel);
make.top.equalTo(self.hideMenuBarIconButton.mas_bottom).offset(self.verticalPadding);
}];
[self.enableBetaNewAppButton mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(self.betaNewAppLabel.mas_right).offset(self.horizontalPadding);
make.centerY.equalTo(self.betaNewAppLabel);
}];
self.bottommostView = self.enableBetaNewAppButton;
} else {
self.bottommostView = self.hideMenuBarIconButton;
}

self.topmostView = self.inputLabel;
self.bottommostView = self.enableBetaNewAppButton;

if ([EZLanguageManager.shared isSystemChineseFirstLanguage]) {
self.leftmostView = self.adjustQueryIconPostionLabel;
Expand Down

0 comments on commit 2f88560

Please sign in to comment.