From f71b2ac864ee4163ab39a79c7ac7ce008a21cad8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=BE=9E=E5=BA=90?= <109708109+Ciilu@users.noreply.github.com> Date: Mon, 2 Mar 2026 12:35:07 +0800 Subject: [PATCH 1/2] update --- .../org/jackhuang/hmcl/ui/GameCrashWindow.java | 16 ++++++++++++---- .../org/jackhuang/hmcl/ui/main/SettingsPage.java | 16 +++++++++++++--- 2 files changed, 25 insertions(+), 7 deletions(-) diff --git a/HMCL/src/main/java/org/jackhuang/hmcl/ui/GameCrashWindow.java b/HMCL/src/main/java/org/jackhuang/hmcl/ui/GameCrashWindow.java index 6cc322ec94..c2de71e0d7 100644 --- a/HMCL/src/main/java/org/jackhuang/hmcl/ui/GameCrashWindow.java +++ b/HMCL/src/main/java/org/jackhuang/hmcl/ui/GameCrashWindow.java @@ -42,6 +42,7 @@ import org.jackhuang.hmcl.task.Task; import org.jackhuang.hmcl.theme.Themes; import org.jackhuang.hmcl.ui.construct.MessageDialogPane; +import org.jackhuang.hmcl.ui.construct.SpinnerPane; import org.jackhuang.hmcl.ui.construct.TwoLineListItem; import org.jackhuang.hmcl.util.Lang; import org.jackhuang.hmcl.util.Log4jLevel; @@ -87,6 +88,7 @@ public class GameCrashWindow extends Stage { private final LaunchOptions launchOptions; private final View view; private final StackPane stackPane; + private final SpinnerPane spinnerPane = new SpinnerPane(); private final List logs; @@ -114,6 +116,8 @@ public GameCrashWindow(ManagedProcess managedProcess, ProcessListener.ExitType e this.stackPane = new StackPane(view); this.feedbackTextFlow.getChildren().addAll(FXUtils.parseSegment(i18n("game.crash.feedback"), Controllers::onHyperlinkAction)); + spinnerPane.getStyleClass().add("small-spinner-pane"); + setScene(new Scene(stackPane, 800, 480)); StyleSheets.init(getScene()); setTitle(i18n("game.crash.title")); @@ -312,7 +316,7 @@ private void exportGameCrashInfo() { var dialog = new MessageDialogPane.Builder(i18n("settings.launcher.launcher_log.export.failed") + "\n" + StringUtils.getStackTrace(exception), i18n("message.error"), MessageDialogPane.MessageType.ERROR).ok(null).build(); DialogUtils.show(stackPane, dialog); } - + spinnerPane.hideSpinner(); return null; }, Schedulers.javafx()); } @@ -444,8 +448,12 @@ private final class View extends VBox { HBox toolBar = new HBox(); VBox.setMargin(toolBar, new Insets(0, 0, 4, 0)); { - JFXButton exportGameCrashInfoButton = FXUtils.newRaisedButton(i18n("logwindow.export_game_crash_logs")); - exportGameCrashInfoButton.setOnAction(e -> exportGameCrashInfo()); + JFXButton exportButton = FXUtils.newRaisedButton(i18n("logwindow.export_game_crash_logs")); + spinnerPane.setContent(exportButton); + exportButton.setOnAction(e -> { + spinnerPane.showSpinner(); + exportGameCrashInfo(); + }); JFXButton logButton = FXUtils.newRaisedButton(i18n("logwindow.title")); logButton.setOnAction(e -> showLogWindow()); @@ -457,7 +465,7 @@ private final class View extends VBox { toolBar.setPadding(new Insets(8)); toolBar.setSpacing(8); toolBar.getStyleClass().add("jfx-tool-bar"); - toolBar.getChildren().setAll(exportGameCrashInfoButton, logButton, helpButton); + toolBar.getChildren().setAll(spinnerPane, logButton, helpButton); } getChildren().setAll(titlePane, infoPane, moddedPane, gameDirPane, toolBar); diff --git a/HMCL/src/main/java/org/jackhuang/hmcl/ui/main/SettingsPage.java b/HMCL/src/main/java/org/jackhuang/hmcl/ui/main/SettingsPage.java index ac7085963a..e17498b93f 100644 --- a/HMCL/src/main/java/org/jackhuang/hmcl/ui/main/SettingsPage.java +++ b/HMCL/src/main/java/org/jackhuang/hmcl/ui/main/SettingsPage.java @@ -77,6 +77,8 @@ public final class SettingsPage extends ScrollPane { @SuppressWarnings("FieldCanBeLocal") private final InvalidationListener updateListener; + private final SpinnerPane spinnerPane = new SpinnerPane(); + public SettingsPage() { this.setFitToWidth(true); @@ -285,11 +287,12 @@ else if (locale.isSameLanguage(currentLocale)) openLogFolderButton.setDisable(true); JFXButton logButton = FXUtils.newBorderButton(i18n("settings.launcher.launcher_log.export")); + spinnerPane.setContent(logButton); logButton.setOnAction(e -> onExportLogs()); HBox buttonBox = new HBox(); buttonBox.setSpacing(10); - buttonBox.getChildren().addAll(openLogFolderButton, logButton); + buttonBox.getChildren().addAll(openLogFolderButton, spinnerPane); BorderPane.setAlignment(buttonBox, Pos.CENTER_RIGHT); debugPane.setRight(buttonBox); @@ -362,6 +365,7 @@ private static boolean exportLogFile(ZipOutputStream output, } private void onExportLogs() { + spinnerPane.showSpinner(); thread(() -> { String nameBase = "hmcl-exported-logs-" + LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH-mm-ss")); List recentLogFiles = LOG.findRecentLogFiles(5); @@ -434,11 +438,17 @@ private void onExportLogs() { } } catch (IOException e) { LOG.warning("Failed to export logs", e); - Platform.runLater(() -> Controllers.dialog(i18n("settings.launcher.launcher_log.export.failed") + "\n" + StringUtils.getStackTrace(e), null, MessageType.ERROR)); + Platform.runLater(() -> { + spinnerPane.showSpinner(); + Controllers.dialog(i18n("settings.launcher.launcher_log.export.failed") + "\n" + StringUtils.getStackTrace(e), null, MessageType.ERROR); + }); return; } - Platform.runLater(() -> Controllers.dialog(i18n("settings.launcher.launcher_log.export.success", outputFile))); + Platform.runLater(() -> { + spinnerPane.showSpinner(); + Controllers.dialog(i18n("settings.launcher.launcher_log.export.success", outputFile)); + }); FXUtils.showFileInExplorer(outputFile); }); } From eb4fc9bb55d7efef3898b5d03c1f5548b7e6b8a9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=BE=9E=E5=BA=90?= <109708109+Ciilu@users.noreply.github.com> Date: Sat, 7 Mar 2026 21:22:40 +0800 Subject: [PATCH 2/2] update --- .../main/java/org/jackhuang/hmcl/ui/main/SettingsPage.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/HMCL/src/main/java/org/jackhuang/hmcl/ui/main/SettingsPage.java b/HMCL/src/main/java/org/jackhuang/hmcl/ui/main/SettingsPage.java index e17498b93f..c011f74798 100644 --- a/HMCL/src/main/java/org/jackhuang/hmcl/ui/main/SettingsPage.java +++ b/HMCL/src/main/java/org/jackhuang/hmcl/ui/main/SettingsPage.java @@ -439,14 +439,14 @@ private void onExportLogs() { } catch (IOException e) { LOG.warning("Failed to export logs", e); Platform.runLater(() -> { - spinnerPane.showSpinner(); + spinnerPane.hideSpinner(); Controllers.dialog(i18n("settings.launcher.launcher_log.export.failed") + "\n" + StringUtils.getStackTrace(e), null, MessageType.ERROR); }); return; } Platform.runLater(() -> { - spinnerPane.showSpinner(); + spinnerPane.hideSpinner(); Controllers.dialog(i18n("settings.launcher.launcher_log.export.success", outputFile)); }); FXUtils.showFileInExplorer(outputFile);