Skip to content
Open
Show file tree
Hide file tree
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
16 changes: 12 additions & 4 deletions HMCL/src/main/java/org/jackhuang/hmcl/ui/GameCrashWindow.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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<Log> logs;

Expand Down Expand Up @@ -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"));
Expand Down Expand Up @@ -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());
}
Expand Down Expand Up @@ -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());
Expand All @@ -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);
Expand Down
16 changes: 13 additions & 3 deletions HMCL/src/main/java/org/jackhuang/hmcl/ui/main/SettingsPage.java
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,8 @@ public final class SettingsPage extends ScrollPane {
@SuppressWarnings("FieldCanBeLocal")
private final InvalidationListener updateListener;

private final SpinnerPane spinnerPane = new SpinnerPane();
Copy link

Copilot AI Mar 7, 2026

Choose a reason for hiding this comment

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

The small-spinner-pane style class is missing on the spinnerPane in SettingsPage. Every other usage of SpinnerPane wrapping a button in the codebase adds spinnerPane.getStyleClass().add("small-spinner-pane") to reduce the spinner size (radius 10, stroke 3) to match the button. Without it, the default (larger) spinner will appear when loading, which will look out of place next to the small border button.

See examples: GameCrashWindow.java:119, AccountListItemSkin.java:95,130,165,170, CreateAccountPane.java:135, DialogPane.java:58, InputDialogPane.java:61, MicrosoftAccountLoginPane.java:108, AddAuthlibInjectorServerPane.java:79.

Copilot uses AI. Check for mistakes.

public SettingsPage() {
this.setFitToWidth(true);

Expand Down Expand Up @@ -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);

Expand Down Expand Up @@ -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<Path> recentLogFiles = LOG.findRecentLogFiles(5);
Expand Down Expand Up @@ -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.hideSpinner();
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.hideSpinner();
Controllers.dialog(i18n("settings.launcher.launcher_log.export.success", outputFile));
});
FXUtils.showFileInExplorer(outputFile);
});
}
Expand Down