从首页打开子页面时应当打开默认标签页 (#4826)

This commit is contained in:
Glavo
2025-11-20 17:40:51 +08:00
committed by GitHub
parent d6ad1cbdf7
commit bed87425e7
3 changed files with 13 additions and 2 deletions

View File

@@ -177,7 +177,10 @@ public class RootPage extends DecoratorAnimatedPage implements DecoratorPage {
downloadItem.setLeftGraphic(wrap(SVG.DOWNLOAD)); downloadItem.setLeftGraphic(wrap(SVG.DOWNLOAD));
downloadItem.setActionButtonVisible(false); downloadItem.setActionButtonVisible(false);
downloadItem.setTitle(i18n("download")); downloadItem.setTitle(i18n("download"));
downloadItem.setOnAction(e -> Controllers.navigate(Controllers.getDownloadPage())); downloadItem.setOnAction(e -> {
Controllers.getDownloadPage().showGameDownloads();
Controllers.navigate(Controllers.getDownloadPage());
});
FXUtils.installFastTooltip(downloadItem, i18n("download.hint")); FXUtils.installFastTooltip(downloadItem, i18n("download.hint"));
if (AnimationUtils.isAnimationEnabled()) { if (AnimationUtils.isAnimationEnabled()) {
FXUtils.prepareOnMouseEnter(downloadItem, Controllers::prepareDownloadPage); FXUtils.prepareOnMouseEnter(downloadItem, Controllers::prepareDownloadPage);
@@ -188,7 +191,10 @@ public class RootPage extends DecoratorAnimatedPage implements DecoratorPage {
launcherSettingsItem.setLeftGraphic(wrap(SVG.SETTINGS)); launcherSettingsItem.setLeftGraphic(wrap(SVG.SETTINGS));
launcherSettingsItem.setActionButtonVisible(false); launcherSettingsItem.setActionButtonVisible(false);
launcherSettingsItem.setTitle(i18n("settings")); launcherSettingsItem.setTitle(i18n("settings"));
launcherSettingsItem.setOnAction(e -> Controllers.navigate(Controllers.getSettingsPage())); launcherSettingsItem.setOnAction(e -> {
Controllers.getSettingsPage().showGameSettings(Profiles.getSelectedProfile());
Controllers.navigate(Controllers.getSettingsPage());
});
if (AnimationUtils.isAnimationEnabled()) { if (AnimationUtils.isAnimationEnabled()) {
FXUtils.prepareOnMouseEnter(launcherSettingsItem, Controllers::prepareSettingsPage); FXUtils.prepareOnMouseEnter(launcherSettingsItem, Controllers::prepareSettingsPage);
} }

View File

@@ -105,6 +105,10 @@ public class VersionPage extends DecoratorAnimatedPage implements DecoratorPage
}; };
} }
public void showInstanceSettings() {
tab.select(versionSettingsTab, false);
}
public void setVersion(String version, Profile profile) { public void setVersion(String version, Profile profile) {
this.version.set(new Profile.ProfileVersion(profile, version)); this.version.set(new Profile.ProfileVersion(profile, version));
} }

View File

@@ -287,6 +287,7 @@ public final class Versions {
public static void modifyGameSettings(Profile profile, String version) { public static void modifyGameSettings(Profile profile, String version) {
Controllers.getVersionPage().setVersion(version, profile); Controllers.getVersionPage().setVersion(version, profile);
Controllers.getVersionPage().showInstanceSettings();
// VersionPage.loadVersion will be invoked after navigation // VersionPage.loadVersion will be invoked after navigation
Controllers.navigate(Controllers.getVersionPage()); Controllers.navigate(Controllers.getVersionPage());
} }