Skip to content

fix(ui): refine PromptDialogPane #3693

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ public class PromptDialogPane extends DialogPane {
public PromptDialogPane(Builder builder) {
this.builder = builder;
setTitle(builder.title);
setPrefWidth(560);
Copy link
Member

Choose a reason for hiding this comment

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

请避免使用魔数。可使用 org.jackhuang.hmcl.ui.Controllers#MIN_HEIGHT 的计算和 org.jackhuang.hmcl.ui.Controllers.getStage().widthProperty() 的绑定


GridPane body = new GridPane();
body.setVgap(8);
Expand All @@ -72,13 +73,13 @@ public PromptDialogPane(Builder builder) {
if (StringUtils.isNotBlank(question.question.get())) {
body.addRow(rowIndex++, new Label(question.question.get()), textField);
} else {
GridPane.setColumnSpan(textField, 2);
GridPane.setColumnSpan(textField, 1);
body.addRow(rowIndex++, textField);
}
GridPane.setMargin(textField, new Insets(0, 0, 20, 0));
} else if (question instanceof Builder.BooleanQuestion) {
HBox hBox = new HBox();
GridPane.setColumnSpan(hBox, 2);
GridPane.setColumnSpan(hBox, 1);
JFXCheckBox checkBox = new JFXCheckBox();
hBox.getChildren().setAll(checkBox);
HBox.setMargin(checkBox, new Insets(0, 0, 0, -10));
Expand All @@ -95,12 +96,12 @@ public PromptDialogPane(Builder builder) {
if (StringUtils.isNotBlank(question.question.get())) {
body.addRow(rowIndex++, new Label(question.question.get()), comboBox);
} else {
GridPane.setColumnSpan(comboBox, 2);
GridPane.setColumnSpan(comboBox, 1);
body.addRow(rowIndex++, comboBox);
}
} else if (question instanceof Builder.HintQuestion) {
HintPane pane = new HintPane();
GridPane.setColumnSpan(pane, 2);
GridPane.setColumnSpan(pane, 1);
pane.textProperty().bind(question.question);
body.addRow(rowIndex++, pane);
}
Expand Down