fix: clicking global game settings should be navigated to launcher settings page.

This commit is contained in:
huanghongxun
2021-08-29 05:27:45 +08:00
parent b778d0a014
commit 038cc97ecf
5 changed files with 16 additions and 6 deletions

View File

@@ -78,6 +78,8 @@ public class AccountAdvancedListItem extends AdvancedListItem {
setLeftGraphic(view.getKey()); setLeftGraphic(view.getKey());
imageView = view.getValue(); imageView = view.getValue();
setActionButtonVisible(false);
setOnScroll(event -> { setOnScroll(event -> {
Account current = account.get(); Account current = account.get();
if (current == null) return; if (current == null) return;

View File

@@ -20,6 +20,7 @@ package org.jackhuang.hmcl.ui.main;
import javafx.beans.property.ReadOnlyObjectProperty; import javafx.beans.property.ReadOnlyObjectProperty;
import javafx.beans.property.ReadOnlyObjectWrapper; import javafx.beans.property.ReadOnlyObjectWrapper;
import javafx.scene.layout.BorderPane; import javafx.scene.layout.BorderPane;
import org.jackhuang.hmcl.setting.Profile;
import org.jackhuang.hmcl.setting.Profiles; import org.jackhuang.hmcl.setting.Profiles;
import org.jackhuang.hmcl.ui.FXUtils; import org.jackhuang.hmcl.ui.FXUtils;
import org.jackhuang.hmcl.ui.SVG; import org.jackhuang.hmcl.ui.SVG;
@@ -66,11 +67,12 @@ public class LauncherSettingsPage extends BorderPane implements DecoratorPage {
{ {
AdvancedListBox sideBar = new AdvancedListBox() AdvancedListBox sideBar = new AdvancedListBox()
.addNavigationDrawerItem(settingsItem -> { .addNavigationDrawerItem(settingsItem -> {
settingsItem.setTitle(i18n("settings.game")); settingsItem.setTitle(i18n("settings.type.global.manage"));
settingsItem.setLeftGraphic(wrap(SVG.gamepad(null, 20, 20))); settingsItem.setLeftGraphic(wrap(SVG.gamepad(null, 20, 20)));
settingsItem.activeProperty().bind(tab.getSelectionModel().selectedItemProperty().isEqualTo(gameTab)); settingsItem.activeProperty().bind(tab.getSelectionModel().selectedItemProperty().isEqualTo(gameTab));
settingsItem.setOnAction(e -> tab.getSelectionModel().select(gameTab)); settingsItem.setOnAction(e -> tab.getSelectionModel().select(gameTab));
}) })
.startCategory(i18n("settings.launcher"))
.addNavigationDrawerItem(settingsItem -> { .addNavigationDrawerItem(settingsItem -> {
settingsItem.setTitle(i18n("settings.launcher")); settingsItem.setTitle(i18n("settings.launcher"));
settingsItem.setLeftGraphic(wrap(SVG.applicationOutline(null, 20, 20))); settingsItem.setLeftGraphic(wrap(SVG.applicationOutline(null, 20, 20)));
@@ -114,6 +116,11 @@ public class LauncherSettingsPage extends BorderPane implements DecoratorPage {
setCenter(transitionPane); setCenter(transitionPane);
} }
public void showGameSettings(Profile profile) {
gameTab.getNode().loadVersion(profile, null);
tab.getSelectionModel().select(gameTab);
}
@Override @Override
public ReadOnlyObjectProperty<State> stateProperty() { public ReadOnlyObjectProperty<State> stateProperty() {
return state.getReadOnlyProperty(); return state.getReadOnlyProperty();

View File

@@ -182,7 +182,6 @@ public class RootPage extends DecoratorTabPage {
.startCategory(i18n("version").toUpperCase()) .startCategory(i18n("version").toUpperCase())
.add(gameListItem) .add(gameListItem)
.add(gameItem) .add(gameItem)
.startCategory(i18n("launcher").toUpperCase())
.add(launcherSettingsItem); .add(launcherSettingsItem);
// the root page, with the sidebar in left, navigator in center. // the root page, with the sidebar in left, navigator in center.

View File

@@ -226,9 +226,11 @@ public final class Versions {
} }
public static void modifyGlobalSettings(Profile profile) { public static void modifyGlobalSettings(Profile profile) {
VersionSettingsPage page = new VersionSettingsPage(); Controllers.getSettingsPage().showGameSettings(profile);
page.loadVersion(profile, null); Controllers.navigate(Controllers.getSettingsPage());
Controllers.navigate(page); // VersionSettingsPage page = new VersionSettingsPage();
// page.loadVersion(profile, null);
// Controllers.navigate(page);
} }
public static void modifyGameSettings(Profile profile, String version) { public static void modifyGameSettings(Profile profile, String version) {

View File

@@ -493,7 +493,7 @@ settings.game.java_directory=Java 路径
settings.game.java_directory.bit=%s 位 settings.game.java_directory.bit=%s 位
settings.game.java_directory.choose=选择 Java 路径 settings.game.java_directory.choose=选择 Java 路径
settings.game.management=管理 settings.game.management=管理
settings.game.working_directory=运行路径(版本隔离修改后请自行移动相关游戏文件,如存档模组配置等) settings.game.working_directory=版本隔离修改后请自行移动相关游戏文件,如存档模组配置等)
settings.game.working_directory.choose=选择运行路径 settings.game.working_directory.choose=选择运行路径
settings.icon=游戏图标 settings.icon=游戏图标