From d7f5109a65226b35ec49bbb3383c38f1bd755a49 Mon Sep 17 00:00:00 2001 From: huanghongxun Date: Sun, 12 Sep 2021 01:02:16 +0800 Subject: [PATCH] fix: cannot display all game versions in some cases of DownloadPage. Closes #1007. --- .../hmcl/ui/account/CreateAccountPane.java | 6 +- .../hmcl/ui/construct/JFXHyperlink.java | 31 +++ .../hmcl/ui/construct/TwoLineListItem.java | 20 +- .../hmcl/ui/versions/DownloadListPage.java | 29 ++- .../hmcl/ui/versions/DownloadPage.java | 33 ++- .../hmcl/ui/versions/ModDownloadListPage.java | 2 + .../hmcl/ui/versions/ModTranslations.java | 2 +- .../hmcl/util/AggregatedObservableList.java | 199 ++++++++++++++++++ HMCL/src/main/resources/assets/css/root.css | 19 +- .../resources/assets/lang/I18N.properties | 7 +- .../resources/assets/lang/I18N_zh.properties | 3 + .../assets/lang/I18N_zh_CN.properties | 3 + .../org/jackhuang/hmcl/mod/ModManager.java | 8 + 13 files changed, 320 insertions(+), 42 deletions(-) create mode 100644 HMCL/src/main/java/org/jackhuang/hmcl/ui/construct/JFXHyperlink.java create mode 100644 HMCL/src/main/java/org/jackhuang/hmcl/util/AggregatedObservableList.java 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 6145bb5c7..781a91771 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 @@ -272,9 +272,9 @@ public class CreateAccountPane extends JFXDialogLayout implements DialogAware { }); HBox box = new HBox(8); - Hyperlink birthLink = new Hyperlink(i18n("account.methods.microsoft.birth")); + JFXHyperlink birthLink = new JFXHyperlink(i18n("account.methods.microsoft.birth")); birthLink.setOnAction(e -> FXUtils.openLink("https://support.microsoft.com/zh-cn/account-billing/如何更改-microsoft-帐户上的出生日期-837badbc-999e-54d2-2617-d19206b9540a")); - Hyperlink profileLink = new Hyperlink(i18n("account.methods.microsoft.profile")); + JFXHyperlink profileLink = new JFXHyperlink(i18n("account.methods.microsoft.profile")); profileLink.setOnAction(e -> FXUtils.openLink("https://account.live.com/editprof.aspx")); box.getChildren().setAll(profileLink, birthLink); GridPane.setColumnSpan(box, 2); @@ -415,7 +415,7 @@ public class CreateAccountPane extends JFXDialogLayout implements DialogAware { if (factory instanceof YggdrasilAccountFactory) { HBox box = new HBox(); - Hyperlink migrationLink = new Hyperlink(i18n("account.methods.yggdrasil.migration")); + JFXHyperlink migrationLink = new JFXHyperlink(i18n("account.methods.yggdrasil.migration")); migrationLink.setOnAction(e -> FXUtils.openLink("https://help.minecraft.net/hc/en-us/articles/360050865492-JAVA-Account-Migration-FAQ")); GridPane.setColumnSpan(box, 2); box.getChildren().setAll(migrationLink); diff --git a/HMCL/src/main/java/org/jackhuang/hmcl/ui/construct/JFXHyperlink.java b/HMCL/src/main/java/org/jackhuang/hmcl/ui/construct/JFXHyperlink.java new file mode 100644 index 000000000..c22be6692 --- /dev/null +++ b/HMCL/src/main/java/org/jackhuang/hmcl/ui/construct/JFXHyperlink.java @@ -0,0 +1,31 @@ +/* + * Hello Minecraft! Launcher + * Copyright (C) 2021 huangyuhui and contributors + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +package org.jackhuang.hmcl.ui.construct; + +import javafx.scene.control.Hyperlink; +import org.jackhuang.hmcl.setting.Theme; +import org.jackhuang.hmcl.ui.SVG; + +public class JFXHyperlink extends Hyperlink { + public JFXHyperlink(String text) { + super(text); + + setGraphic(SVG.launchOutline(Theme.blackFillBinding(), 16, 16)); + } +} + diff --git a/HMCL/src/main/java/org/jackhuang/hmcl/ui/construct/TwoLineListItem.java b/HMCL/src/main/java/org/jackhuang/hmcl/ui/construct/TwoLineListItem.java index c0600fef7..f309e83f1 100644 --- a/HMCL/src/main/java/org/jackhuang/hmcl/ui/construct/TwoLineListItem.java +++ b/HMCL/src/main/java/org/jackhuang/hmcl/ui/construct/TwoLineListItem.java @@ -22,10 +22,14 @@ import javafx.beans.property.SimpleStringProperty; import javafx.beans.property.StringProperty; import javafx.collections.FXCollections; import javafx.collections.ObservableList; +import javafx.geometry.Insets; +import javafx.scene.Node; import javafx.scene.control.Label; +import javafx.scene.layout.FlowPane; import javafx.scene.layout.HBox; import javafx.scene.layout.VBox; import org.jackhuang.hmcl.ui.FXUtils; +import org.jackhuang.hmcl.util.AggregatedObservableList; import org.jackhuang.hmcl.util.javafx.MappedObservableList; public class TwoLineListItem extends VBox { @@ -35,7 +39,8 @@ public class TwoLineListItem extends VBox { private final ObservableList tags = FXCollections.observableArrayList(); private final StringProperty subtitle = new SimpleStringProperty(this, "subtitle"); - private final ObservableList