Skip to content

Refactor: OfflineAccountSkinPane#6231

Merged
Glavo merged 7 commits into
HMCL-dev:mainfrom
KSSJW-Contribution:offline-account-skin-pane-dialog
Jun 30, 2026
Merged

Refactor: OfflineAccountSkinPane#6231
Glavo merged 7 commits into
HMCL-dev:mainfrom
KSSJW-Contribution:offline-account-skin-pane-dialog

Conversation

@KSSJW

@KSSJW KSSJW commented Jun 26, 2026

Copy link
Copy Markdown
Contributor

重构OfflineAccountSkinPane

缘由

  • OfflineAccountSkinPaneControllers.dialog()进行调用,在其内容过多的情况下,可能占满整个窗口的高度。

更改

  • 减低了OfflineAccountSkinPane的高度。
  • 拆分了面板。
  • 整理了语句。

实况

更改前 更改后
A1 B1
A2 B2

@KSSJW

KSSJW commented Jun 26, 2026

Copy link
Copy Markdown
Contributor Author

/gemini review

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request scales the OfflineAccountSkinPane to 85% on both axes before displaying it in a dialog. The review feedback correctly identifies that using setScaleX and setScaleY is a JavaFX anti-pattern because it does not affect layout bounds and can cause blurry rendering, and suggests using layout constraints like setMaxHeight instead.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment thread HMCL/src/main/java/org/jackhuang/hmcl/ui/account/AccountListItem.java Outdated
@KSSJW KSSJW marked this pull request as draft June 27, 2026 05:13
@KSSJW KSSJW changed the title Fix: Limit offline account skin dialog height Refactor: OfflineAccountSkinPane Jun 27, 2026
@KSSJW

KSSJW commented Jun 27, 2026

Copy link
Copy Markdown
Contributor Author

/gemini review

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request refactors the layout of the offline account skin pane, adjusting the dimensions of the skin canvas and restructuring the options layout using HBox and VBox containers. The review feedback points out that the configured canvasPane is currently orphaned and should be set as the center of the pane. Additionally, it suggests optimizing the selection change listener by declaring layout containers outside of it to prevent redundant configurations and inefficient re-parenting of JavaFX nodes.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment thread HMCL/src/main/java/org/jackhuang/hmcl/ui/account/OfflineAccountSkinPane.java Outdated
Comment thread HMCL/src/main/java/org/jackhuang/hmcl/ui/account/OfflineAccountSkinPane.java Outdated
@KSSJW

KSSJW commented Jun 27, 2026

Copy link
Copy Markdown
Contributor Author

/gemini review

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request refactors the layout of OfflineAccountSkinPane by adjusting the skin canvas dimensions, wrapping it in a StackPane, and dynamically restructuring the options pane using an HBox and GridPane based on the selected skin type. Feedback points out a potential memory leak and performance issue: recreating layout containers inside the property change listener prevents unused shared controls and dynamically created labels from being garbage collected. It is recommended to instantiate the layout containers once outside the listener and clear/repopulate them dynamically.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment thread HMCL/src/main/java/org/jackhuang/hmcl/ui/account/OfflineAccountSkinPane.java Outdated
@KSSJW

KSSJW commented Jun 27, 2026

Copy link
Copy Markdown
Contributor Author

/gemini review

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request refactors the layout of the offline account skin pane in OfflineAccountSkinPane.java, which includes reducing the SkinCanvas size and restructuring the right-side options pane using an HBox containing the skin item and a nested GridPane inside a VBox. The reviewer suggests simplifying this layout by replacing the nested GridPane with a single VBox, which would eliminate unnecessary layout complexity and redundant GridPane.setHgrow calls.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment thread HMCL/src/main/java/org/jackhuang/hmcl/ui/account/OfflineAccountSkinPane.java Outdated
Comment thread HMCL/src/main/java/org/jackhuang/hmcl/ui/account/OfflineAccountSkinPane.java Outdated
@KSSJW

KSSJW commented Jun 27, 2026

Copy link
Copy Markdown
Contributor Author

/gemini review

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request refactors the layout of OfflineAccountSkinPane by replacing the GridPane inside skinOptionPane with an HBox and VBox structure, adjusting the canvas size, and allowing components to expand horizontally. The review feedback highlights three key improvements: preventing a potential NullPointerException by adding a null check before switching on selectedData, removing redundant GridPane.setHgrow calls since the components are no longer in a GridPane, and cleaning up the unused gridPane variable.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment thread HMCL/src/main/java/org/jackhuang/hmcl/ui/account/OfflineAccountSkinPane.java Outdated
Comment thread HMCL/src/main/java/org/jackhuang/hmcl/ui/account/OfflineAccountSkinPane.java Outdated
@KSSJW KSSJW marked this pull request as ready for review June 27, 2026 08:04
@Minecraft269

Minecraft269 commented Jun 27, 2026

Copy link
Copy Markdown

Duplicate of #6037 或者说是和 #6037 冲突 我就说好像有个PR重构了这里 刚好有新提交给顶上来了 或者说保留这个PR看看Glavo想要哪个

@3gf8jv4dv

Copy link
Copy Markdown
Contributor

Duplicate of #6037 或者说是和 #6037 冲突 我就说好像有个PR重构了这里 刚好有新提交给顶上来了 或者说保留这个PR看看Glavo想要哪个

这个 PR 可以看作是对现有 UI 的改进,而 #6037 是完全重构了。

我认为得按实际情况来。如果说 #6037 进展较慢的话,完全可以先把这个 PR 完善后合并。

@3gf8jv4dv 3gf8jv4dv left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

做梦都没想到过,还能有这种排版。太美了,完全解决了之前三番五次提起的 UI 问题。

@Glavo

Glavo commented Jun 30, 2026

Copy link
Copy Markdown
Member

/gemini review

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request refactors the layout of the offline account skin pane by replacing the GridPane with a combination of HBox and VBox containers, resizing the skin canvas, and setting the maximum width of the controls to Double.MAX_VALUE. The reviewer suggested grouping each label and its corresponding control into nested VBox containers with tighter spacing to improve the visual hierarchy and readability of the layout.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment on lines +214 to +230
case LOCAL_FILE:
right.getChildren().addAll(
new Label(i18n("account.skin.model")),
modelCombobox,
new Label(i18n("account.skin")),
skinSelector,
new Label(i18n("account.cape")),
capeSelector
);
break;

case CUSTOM_SKIN_LOADER_API:
right.getChildren().addAll(
new Label(i18n("account.skin.type.csl_api.location")),
cslApiField
);
break;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

Grouping each label and its corresponding control inside a small VBox with tighter spacing (e.g., 4px) improves the visual hierarchy. Currently, because all elements are added directly to the parent VBox with a uniform spacing of 12px, the labels are equally spaced from the controls above and below them, which reduces readability.

                    case LOCAL_FILE:
                        right.getChildren().addAll(
                            new VBox(4, new Label(i18n("account.skin.model")), modelCombobox),
                            new VBox(4, new Label(i18n("account.skin")), skinSelector),
                            new VBox(4, new Label(i18n("account.cape")), capeSelector)
                        );
                        break;

                    case CUSTOM_SKIN_LOADER_API:
                        right.getChildren().add(
                            new VBox(4, new Label(i18n("account.skin.type.csl_api.location")), cslApiField)
                        );
                        break;

@Glavo Glavo merged commit 31642f9 into HMCL-dev:main Jun 30, 2026
2 checks passed
@KSSJW KSSJW deleted the offline-account-skin-pane-dialog branch June 30, 2026 12:45
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.

4 participants