Skip to content

Refactor: OfflineAccountSkinPane#6231

Open
KSSJW wants to merge 7 commits into
HMCL-dev:mainfrom
KSSJW-Contribution:offline-account-skin-pane-dialog
Open

Refactor: OfflineAccountSkinPane#6231
KSSJW wants to merge 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 完善后合并。

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.

3 participants