From cc1fc1e4be0cc2316deef46e3b717621f0ea174b Mon Sep 17 00:00:00 2001 From: huanghongxun Date: Sat, 3 Sep 2022 22:21:19 +0800 Subject: [PATCH] fix(ui): some text overflow. Closes #1694. --- .editorconfig | 2 +- .../hmcl/ui/account/CreateAccountPane.java | 3 +- .../hmcl/ui/construct/OptionToggleButton.java | 3 +- .../hmcl/ui/main/DownloadSettingsPage.java | 41 ++++++++----------- .../ui/multiplayer/MultiplayerPageSkin.java | 1 - HMCL/src/main/resources/assets/css/root.css | 2 +- .../resources/assets/lang/I18N.properties | 5 ++- 7 files changed, 25 insertions(+), 32 deletions(-) diff --git a/.editorconfig b/.editorconfig index 25b8a952f..9a49455b3 100644 --- a/.editorconfig +++ b/.editorconfig @@ -1,6 +1,6 @@ [*] charset = utf-8 -end_of_line = crlf +end_of_line = lf indent_size = 4 indent_style = space insert_final_newline = false diff --git a/HMCL/src/main/java/org/jackhuang/hmcl/ui/account/CreateAccountPane.java b/HMCL/src/main/java/org/jackhuang/hmcl/ui/account/CreateAccountPane.java index eae5bc90b..d2b741ece 100644 --- a/HMCL/src/main/java/org/jackhuang/hmcl/ui/account/CreateAccountPane.java +++ b/HMCL/src/main/java/org/jackhuang/hmcl/ui/account/CreateAccountPane.java @@ -286,7 +286,8 @@ public class CreateAccountPane extends JFXDialogLayout implements DialogAware { holder.add(Accounts.OAUTH_CALLBACK.onGrantDeviceCode.registerWeak(value -> { runInFX(() -> deviceCode.set(value)); })); - HBox box = new HBox(8); + FlowPane box = new FlowPane(); + box.setHgap(8); JFXHyperlink birthLink = new JFXHyperlink(i18n("account.methods.microsoft.birth")); birthLink.setOnAction(e -> FXUtils.openLink("https://support.microsoft.com/account-billing/837badbc-999e-54d2-2617-d19206b9540a")); JFXHyperlink profileLink = new JFXHyperlink(i18n("account.methods.microsoft.profile")); diff --git a/HMCL/src/main/java/org/jackhuang/hmcl/ui/construct/OptionToggleButton.java b/HMCL/src/main/java/org/jackhuang/hmcl/ui/construct/OptionToggleButton.java index a60d5c7d5..fd9a6359d 100644 --- a/HMCL/src/main/java/org/jackhuang/hmcl/ui/construct/OptionToggleButton.java +++ b/HMCL/src/main/java/org/jackhuang/hmcl/ui/construct/OptionToggleButton.java @@ -50,8 +50,9 @@ public class OptionToggleButton extends StackPane { titleLabel.textProperty().bind(title); Label subtitleLabel = new Label(); subtitleLabel.setMouseTransparent(true); + subtitleLabel.setWrapText(true); subtitleLabel.textProperty().bind(subtitle); - pane.setLeft(left); + pane.setCenter(left); left.setAlignment(Pos.CENTER_LEFT); JFXToggleButton toggleButton = new JFXToggleButton(); diff --git a/HMCL/src/main/java/org/jackhuang/hmcl/ui/main/DownloadSettingsPage.java b/HMCL/src/main/java/org/jackhuang/hmcl/ui/main/DownloadSettingsPage.java index 1ec72753c..2d246750e 100644 --- a/HMCL/src/main/java/org/jackhuang/hmcl/ui/main/DownloadSettingsPage.java +++ b/HMCL/src/main/java/org/jackhuang/hmcl/ui/main/DownloadSettingsPage.java @@ -53,10 +53,9 @@ public class DownloadSettingsPage extends StackPane { getChildren().setAll(scrollPane); { - ComponentList downloadSource = new ComponentList(); - + VBox downloadSource = new VBox(8); + downloadSource.getStyleClass().add("card-non-transparent"); { - VBox pane = new VBox(8); VBox chooseWrapper = new VBox(); chooseWrapper.setPadding(new Insets(8, 0, 8, 0)); @@ -75,7 +74,7 @@ public class DownloadSettingsPage extends StackPane { JFXComboBox cboVersionListSource = new JFXComboBox<>(); cboVersionListSource.setConverter(stringConverter(key -> i18n("download.provider." + key))); versionListSourcePane.setRight(cboVersionListSource); - FXUtils.setLimitWidth(cboVersionListSource, 420); + FXUtils.setLimitWidth(cboVersionListSource, 400); cboVersionListSource.getItems().setAll(DownloadProviders.providersById.keySet()); selectedItemPropertyFor(cboVersionListSource).bindBidirectional(config().versionListSourceProperty()); @@ -91,31 +90,28 @@ public class DownloadSettingsPage extends StackPane { JFXComboBox cboDownloadSource = new JFXComboBox<>(); cboDownloadSource.setConverter(stringConverter(key -> i18n("download.provider." + key))); - downloadSourcePane.setRight(cboDownloadSource); + downloadSourcePane.setCenter(cboDownloadSource); FXUtils.setLimitWidth(cboDownloadSource, 420); cboDownloadSource.getItems().setAll(DownloadProviders.rawProviders.keySet()); selectedItemPropertyFor(cboDownloadSource).bindBidirectional(config().downloadTypeProperty()); } - pane.getChildren().setAll(chooseWrapper, versionListSourcePane, downloadSourcePane); - downloadSource.getContent().add(pane); + downloadSource.getChildren().setAll(chooseWrapper, versionListSourcePane, downloadSourcePane); } content.getChildren().addAll(ComponentList.createComponentListTitle(i18n("settings.launcher.version_list_source")), downloadSource); } { - ComponentList downloadThreads = new ComponentList(); - + VBox downloadThreads = new VBox(16); + downloadThreads.getStyleClass().add("card-non-transparent"); { - VBox pane = new VBox(16); - pane.setPadding(new Insets(8, 0, 8, 0)); - { JFXCheckBox chkAutoDownloadThreads = new JFXCheckBox(i18n("settings.launcher.download.threads.auto")); + VBox.setMargin(chkAutoDownloadThreads, new Insets(8, 0, 0, 0)); chkAutoDownloadThreads.selectedProperty().bindBidirectional(config().autoDownloadThreadsProperty()); - pane.getChildren().add(chkAutoDownloadThreads); + downloadThreads.getChildren().add(chkAutoDownloadThreads); chkAutoDownloadThreads.selectedProperty().addListener((a, b, newValue) -> { if (newValue) { @@ -150,7 +146,7 @@ public class DownloadSettingsPage extends StackPane { }); hbox.getChildren().setAll(label, slider, threadsField); - pane.getChildren().add(hbox); + downloadThreads.getChildren().add(hbox); } { @@ -158,26 +154,22 @@ public class DownloadSettingsPage extends StackPane { VBox.setMargin(hintPane, new Insets(0, 0, 0, 30)); hintPane.disableProperty().bind(config().autoDownloadThreadsProperty()); hintPane.setText(i18n("settings.launcher.download.threads.hint")); - pane.getChildren().add(hintPane); + downloadThreads.getChildren().add(hintPane); } - - downloadThreads.getContent().add(pane); } content.getChildren().addAll(ComponentList.createComponentListTitle(i18n("download")), downloadThreads); } { - ComponentList proxyList = new ComponentList(); - - VBox proxyWrapper = new VBox(); - proxyWrapper.setPadding(new Insets(8, 0, 8, 0)); - proxyWrapper.setSpacing(10); + VBox proxyList = new VBox(10); + proxyList.getStyleClass().add("card-non-transparent"); VBox proxyPane = new VBox(); { JFXCheckBox chkDisableProxy = new JFXCheckBox(i18n("settings.launcher.proxy.disable")); - proxyWrapper.getChildren().add(chkDisableProxy); + VBox.setMargin(chkDisableProxy, new Insets(8, 0, 0, 0)); + proxyList.getChildren().add(chkDisableProxy); reversedSelectedPropertyFor(chkDisableProxy).bindBidirectional(config().hasProxyProperty()); proxyPane.disableProperty().bind(chkDisableProxy.selectedProperty()); } @@ -310,9 +302,8 @@ public class DownloadSettingsPage extends StackPane { proxyPane.getChildren().add(authPane); } - proxyWrapper.getChildren().add(proxyPane); + proxyList.getChildren().add(proxyPane); } - proxyList.getContent().add(proxyWrapper); content.getChildren().addAll(ComponentList.createComponentListTitle(i18n("settings.launcher.proxy")), proxyList); } diff --git a/HMCL/src/main/java/org/jackhuang/hmcl/ui/multiplayer/MultiplayerPageSkin.java b/HMCL/src/main/java/org/jackhuang/hmcl/ui/multiplayer/MultiplayerPageSkin.java index 04bad3f58..567c5b641 100644 --- a/HMCL/src/main/java/org/jackhuang/hmcl/ui/multiplayer/MultiplayerPageSkin.java +++ b/HMCL/src/main/java/org/jackhuang/hmcl/ui/multiplayer/MultiplayerPageSkin.java @@ -146,7 +146,6 @@ public class MultiplayerPageSkin extends DecoratorAnimatedPage.DecoratorAnimated content.setFillWidth(true); ScrollPane scrollPane = new ScrollPane(content); scrollPane.setFitToWidth(true); - scrollPane.setFitToHeight(true); setCenter(scrollPane); ComponentList roomPane = new ComponentList(); diff --git a/HMCL/src/main/resources/assets/css/root.css b/HMCL/src/main/resources/assets/css/root.css index edc234367..6b3f8b313 100644 --- a/HMCL/src/main/resources/assets/css/root.css +++ b/HMCL/src/main/resources/assets/css/root.css @@ -885,7 +885,7 @@ -fx-background-radius: 4; -fx-padding: 8px; - -fx-effect: dropshadow(gaussian, rgba(0, 0, 0, 0.26), 10, 0.12, -1, 2); + -fx-effect: dropshadow(gaussian, rgba(0, 0, 0, 0.26), 5, 0.06, -0.5, 1); } .card:selected { diff --git a/HMCL/src/main/resources/assets/lang/I18N.properties b/HMCL/src/main/resources/assets/lang/I18N.properties index a842ea981..994887220 100644 --- a/HMCL/src/main/resources/assets/lang/I18N.properties +++ b/HMCL/src/main/resources/assets/lang/I18N.properties @@ -76,7 +76,8 @@ account.failed.server_disconnected=Cannot access authentication server. You can account.failed.server_response_malformed=Invalid server response, the authentication server may not be working. account.failed.wrong_account=You have logged in to the wrong account. account.hmcl.hint=You need to click on "Login" and complete the process in the opened tab in your browser. -account.injector.add=Add an Authentication Server +# avoid too long sequence. +account.injector.add=New Auth Server account.injector.empty=None (You can click on the plus button on the right to add one) account.injector.http=Warning\: This server uses the unsafe HTTP protocol, anyone between your connection will be able to see your credentials in cleartext. account.injector.link.homepage=Homepage @@ -572,7 +573,7 @@ input.number=The input must be a number. input.not_empty=This is a required field. input.url=The input must be a valid URL. -install=Add a New Instance +install=New Instance install.change_version=Change Version install.change_version.confirm=Are you sure you want to switch %s from version %s to %s? install.failed=Installation Failed