Conversation
Co-authored-by: 3gf8jv4dv <3gf8jv4dv@gmail.com>
There was a problem hiding this comment.
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.
| btnUpdate.layoutXProperty().bind( | ||
| updatePane.widthProperty() | ||
| .subtract(btnUpdate.widthProperty()) | ||
| .subtract(100) |
There was a problem hiding this comment.
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.
| 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) |
| 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")); | ||
| } |
There was a problem hiding this comment.
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().
| 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)); |
There was a problem hiding this comment.
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.
| 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"); | |
| } | |
| }); |
| 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. |
There was a problem hiding this comment.
English copy has a grammar issue: “New features are add into the stable version…” should be “are added to …” (or similar).
| 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. |
| update.bubble.title=發現更新:%s | ||
| update.bubble.subtitle=點選此處進行升級 | ||
| update.note=開發版與預覽版包含更多的功能以及錯誤修復,但也可能會包含其他的問題。 | ||
| update.note.stable=適合優先追求軟體穩定性的使用者使用。\n新功能在經過充分測試後才會被添加到穩定版中 |
There was a problem hiding this comment.
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.
| update.note.stable=適合優先追求軟體穩定性的使用者使用。\n新功能在經過充分測試後才會被添加到穩定版中 | |
| update.note.stable=適合優先追求軟體穩定性的使用者使用。\n新功能在經過充分測試後才會被添加到穩定版中。 |
resolves #5500

版本介绍改自 https://github.com/HMCL-dev/HMCL/blob/main/docs/ReleaseSchedule_zh.md