diff --git a/HMCL/src/main/java/org/jackhuang/hmcl/ui/construct/MessageDialogPane.java b/HMCL/src/main/java/org/jackhuang/hmcl/ui/construct/MessageDialogPane.java index dd70b735b..a709305f1 100644 --- a/HMCL/src/main/java/org/jackhuang/hmcl/ui/construct/MessageDialogPane.java +++ b/HMCL/src/main/java/org/jackhuang/hmcl/ui/construct/MessageDialogPane.java @@ -166,6 +166,16 @@ public final class MessageDialogPane extends HBox { return this; } + public Builder addAction(String text, @Nullable Runnable action) { + JFXButton btnAction = new JFXButton(text); + btnAction.getStyleClass().add("dialog-accept"); + if (action != null) { + btnAction.setOnAction(e -> action.run()); + } + dialog.addButton(btnAction); + return this; + } + public Builder ok(@Nullable Runnable ok) { JFXButton btnOk = new JFXButton(i18n("button.ok")); btnOk.getStyleClass().add("dialog-accept"); diff --git a/HMCL/src/main/java/org/jackhuang/hmcl/ui/main/MainPage.java b/HMCL/src/main/java/org/jackhuang/hmcl/ui/main/MainPage.java index f0e651e30..d97a0a9aa 100644 --- a/HMCL/src/main/java/org/jackhuang/hmcl/ui/main/MainPage.java +++ b/HMCL/src/main/java/org/jackhuang/hmcl/ui/main/MainPage.java @@ -237,10 +237,13 @@ public final class MainPage extends StackPane implements DecoratorPage { doAnimation(show); if (show && getLatestVersion() != null && !Objects.equals(config().getPromptedVersion(), getLatestVersion().getVersion())) { - Controllers.confirm("", i18n("update.bubble.title", getLatestVersion().getVersion()), MessageDialogPane.MessageType.INFO, () -> { - config().setPromptedVersion(getLatestVersion().getVersion()); - onUpgrade(); - }, null); + Controllers.dialog(new MessageDialogPane.Builder("", i18n("update.bubble.title", getLatestVersion().getVersion()), MessageDialogPane.MessageType.INFO) + .addAction(i18n("button.view"), () -> { + config().setPromptedVersion(getLatestVersion().getVersion()); + onUpgrade(); + }) + .addCancel(null) + .build()); } } diff --git a/HMCL/src/main/resources/assets/lang/I18N.properties b/HMCL/src/main/resources/assets/lang/I18N.properties index 195c93500..cb911a30d 100644 --- a/HMCL/src/main/resources/assets/lang/I18N.properties +++ b/HMCL/src/main/resources/assets/lang/I18N.properties @@ -183,6 +183,7 @@ button.retry=Retry button.save=Save button.save_as=Save As button.select_all=Select All +button.view=View button.yes=Yes chat=Join Group Chat diff --git a/HMCL/src/main/resources/assets/lang/I18N_zh.properties b/HMCL/src/main/resources/assets/lang/I18N_zh.properties index a8c474fdd..e8abf4f47 100644 --- a/HMCL/src/main/resources/assets/lang/I18N_zh.properties +++ b/HMCL/src/main/resources/assets/lang/I18N_zh.properties @@ -192,6 +192,7 @@ button.retry=重試 button.save=儲存 button.save_as=另存為 button.select_all=全選 +button.view=查看 button.yes=是 chat=官方群組 diff --git a/HMCL/src/main/resources/assets/lang/I18N_zh_CN.properties b/HMCL/src/main/resources/assets/lang/I18N_zh_CN.properties index 442513ab2..42a448e23 100644 --- a/HMCL/src/main/resources/assets/lang/I18N_zh_CN.properties +++ b/HMCL/src/main/resources/assets/lang/I18N_zh_CN.properties @@ -193,6 +193,7 @@ button.retry=重试 button.save=保存 button.save_as=另存为 button.select_all=全选 +button.view=查看 button.yes=是 chat=官方群组