Skip to content

更新更新渠道选择选项#5703

Open
CiiLu wants to merge 6 commits intoHMCL-dev:mainfrom
CiiLu:updatee
Open

更新更新渠道选择选项#5703
CiiLu wants to merge 6 commits intoHMCL-dev:mainfrom
CiiLu:updatee

Conversation

@CiiLu
Copy link
Contributor

@CiiLu CiiLu commented Mar 2, 2026

CiiLu and others added 2 commits March 3, 2026 10:48
@CiiLu CiiLu marked this pull request as ready for review March 21, 2026 12:11
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

该 PR 主要围绕“更新渠道选择”设置项进行 UI 与文案调整,以解决 #5500 中提到的更新按钮与“稳定版”选项发生覆盖的问题,并将更新渠道说明拆分为稳定版/开发版两类更清晰的描述。

Changes:

  • 将设置页中的更新渠道选择从 RadioButton 方案改为 LineSelectButton 下拉选择,并调整“更新”按钮的摆放方式
  • 将原 update.note 文案拆分为 update.note.stable / update.note.dev(中简/中繁/英文)
  • 设置页更新状态(发现更新/检查中/已是最新)改为通过 LineSelectButton 的 title/subtitle 属性更新展示

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 5 comments.

File Description
HMCL/src/main/resources/assets/lang/I18N_zh_CN.properties 拆分更新渠道说明为 stable/dev 两条文案(简中)
HMCL/src/main/resources/assets/lang/I18N_zh.properties 拆分更新渠道说明为 stable/dev 两条文案(繁中)
HMCL/src/main/resources/assets/lang/I18N.properties 拆分更新渠道说明为 stable/dev 两条文案(英文基准)
HMCL/src/main/java/org/jackhuang/hmcl/ui/main/SettingsPage.java LineSelectButton 重做更新渠道选择区域并重排更新按钮,更新更新状态文案写入方式

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +162 to +165
btnUpdate.layoutXProperty().bind(
updatePane.widthProperty()
.subtract(btnUpdate.widthProperty())
.subtract(100)
Copy link

Copilot AI Mar 21, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

btnUpdate positioning relies on a hard-coded subtract(100) offset. This is brittle across window sizes, font scaling, and locales (text length changes) and can still lead to overlap/clipping. Consider positioning via StackPane alignment + right margin based on actual trailing area size, or exposing a dedicated right-side slot in LineComponent/LineButton for auxiliary controls so layout is computed rather than guessed.

Suggested change
btnUpdate.layoutXProperty().bind(
updatePane.widthProperty()
.subtract(btnUpdate.widthProperty())
.subtract(100)
var rightInsetBinding = Bindings.createDoubleBinding(
() -> {
Insets insets = updatePane.getPadding();
return insets == null ? 0.0 : insets.getRight();
},
updatePane.paddingProperty()
);
btnUpdate.layoutXProperty().bind(
updatePane.widthProperty()
.subtract(btnUpdate.widthProperty())
.subtract(rightInsetBinding)

Copilot uses AI. Check for mistakes.
Comment on lines 141 to 153
updateListener = any -> {
btnUpdate.setVisible(UpdateChecker.isOutdated());

if (UpdateChecker.isOutdated()) {
lblUpdateSub.setText(i18n("update.newest_version", UpdateChecker.getLatestVersion().getVersion()));
lblUpdateSub.getStyleClass().setAll("update-label");

lblUpdate.setText(i18n("update.found"));
lblUpdate.getStyleClass().setAll("update-label");
lblUpdateSub.set(i18n("update.newest_version", UpdateChecker.getLatestVersion().getVersion()));
lblUpdate.set(i18n("update.found"));
} else if (UpdateChecker.isCheckingUpdate()) {
lblUpdateSub.setText(i18n("update.checking"));
lblUpdateSub.getStyleClass().setAll("subtitle-label");

lblUpdate.setText(i18n("update"));
lblUpdate.getStyleClass().setAll("title-label");
lblUpdateSub.set(i18n("update.checking"));
lblUpdate.set(i18n("update"));
} else {
lblUpdateSub.setText(i18n("update.latest"));
lblUpdateSub.getStyleClass().setAll("subtitle-label");

lblUpdate.setText(i18n("update"));
lblUpdate.getStyleClass().setAll("title-label");
lblUpdateSub.set(i18n("update.latest"));
lblUpdate.set(i18n("update"));
}
Copy link

Copilot AI Mar 21, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The previous implementation applied the update-label style class when an update is available (to highlight the title/subtitle). After switching to LineSelectButton and writing to titleProperty()/subtitleProperty(), that highlighting is no longer applied, so “发现更新/Update Available” will render with the normal label color. If the highlight is still desired, add a mechanism to style the title/subtitle labels (e.g., a pseudo-class on LineComponent with CSS rules targeting .title-label/.subtitle-label, or an API to add style classes to those labels) and toggle it based on UpdateChecker.isOutdated().

Copilot uses AI. Check for mistakes.
FXUtils.installFastTooltip(btnUpdate, i18n("update.tooltip"));
updatePane.setConverter(channel -> i18n("update.channel." + channel.channelName));
updatePane.setItems(List.of(UpdateChannel.STABLE, UpdateChannel.DEVELOPMENT));
updatePane.setDescriptionConverter(channel -> i18n("update.note." + channel.channelName));
Copy link

Copilot AI Mar 21, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updatePane.setDescriptionConverter(channel -> i18n("update.note." + channel.channelName)) introduces new per-channel keys (update.note.stable / update.note.dev), but most non-Chinese locale bundles still only define the old update.note key. Those locales will now fall back to English for these descriptions, which is a user-visible i18n regression. Either add the new keys to the other I18N_*.properties files or implement a fallback to the old update.note text when the new key is missing.

Suggested change
updatePane.setDescriptionConverter(channel -> i18n("update.note." + channel.channelName));
updatePane.setDescriptionConverter(channel -> {
String key = "update.note." + channel.channelName;
try {
return i18n(key);
} catch (MissingResourceException e) {
return i18n("update.note");
}
});

Copilot uses AI. Check for mistakes.
update.bubble.title=Update Available: %s
update.bubble.subtitle=Click here to update
update.note=Beta and Nightly channels may have more features or fixes, but they also come with more potential problems.
update.note.stable=Suitable for users who prioritize software stability.\nNew features are add into the stable version only after thorough testing.
Copy link

Copilot AI Mar 21, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

English copy has a grammar issue: “New features are add into the stable version…” should be “are added to …” (or similar).

Suggested change
update.note.stable=Suitable for users who prioritize software stability.\nNew features are add into the stable version only after thorough testing.
update.note.stable=Suitable for users who prioritize software stability.\nNew features are added to the stable version only after thorough testing.

Copilot uses AI. Check for mistakes.
update.bubble.title=發現更新:%s
update.bubble.subtitle=點選此處進行升級
update.note=開發版與預覽版包含更多的功能以及錯誤修復,但也可能會包含其他的問題。
update.note.stable=適合優先追求軟體穩定性的使用者使用。\n新功能在經過充分測試後才會被添加到穩定版中
Copy link

Copilot AI Mar 21, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This new Traditional Chinese string is missing ending punctuation (it currently ends with “中” without “。”), unlike the other update-note strings. Consider adding the final “。” for consistency.

Suggested change
update.note.stable=適合優先追求軟體穩定性的使用者使用。\n新功能在經過充分測試後才會被添加到穩定版中
update.note.stable=適合優先追求軟體穩定性的使用者使用。\n新功能在經過充分測試後才會被添加到穩定版中

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] #5469 更新按钮控件还是有点覆盖到了稳定版

3 participants