refactor: single settings page; hide inherit-from-global toggles, drop global game settings tab
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
095d71fea7
commit
21fcac1b0c
5 files changed
+7
-22
No files matched your search
@@ -48,6 +48,9 @@ public final class LineInheritableSwitch extends LineButtonBase {
|
||||
this.inheritButton = new JFXButton();
|
||||
inheritButton.getStyleClass().add(INHERIT_BUTTON_STYLE_CLASS);
|
||||
inheritButton.setContentDisplay(ContentDisplay.GRAPHIC_ONLY);
|
||||
// Hidden: the launcher has a single settings page, so there is no inherited/overridden choice to make.
|
||||
inheritButton.setVisible(false);
|
||||
inheritButton.setManaged(false);
|
||||
inheritButton.setGraphic(SVG.PUBLIC.createIcon(INHERIT_BUTTON_ICON_SIZE));
|
||||
this.inheritTooltip = new Tooltip();
|
||||
FXUtils.installFastTooltip(inheritButton, inheritTooltip);
|
||||
|
||||
@@ -1348,6 +1348,9 @@ public final class GameSettingsPage<S extends GameSettings> extends StackPane
|
||||
var button = new JFXButton();
|
||||
button.getStyleClass().add(INHERIT_BUTTON_STYLE_CLASS);
|
||||
button.setContentDisplay(ContentDisplay.GRAPHIC_ONLY);
|
||||
// The launcher has a single settings page, so players never choose between inheriting and overriding.
|
||||
button.setVisible(false);
|
||||
button.setManaged(false);
|
||||
Tooltip tooltip = new Tooltip();
|
||||
button.getProperties().put(INHERIT_BUTTON_TOOLTIP_KEY, tooltip);
|
||||
FXUtils.installFastTooltip(button, tooltip);
|
||||
|
||||
@@ -380,7 +380,6 @@ public final class Instances {
|
||||
}
|
||||
|
||||
public static void modifyGlobalSettings(HMCLGameRepository repository) {
|
||||
Controllers.getSettingsPage().showGameSettings(repository);
|
||||
Controllers.navigate(Controllers.getSettingsPage());
|
||||
}
|
||||
|
||||
|
||||
@@ -4,18 +4,12 @@ package org.jackhuang.hmcl.ui.main;
|
||||
|
||||
import javafx.beans.property.ReadOnlyObjectProperty;
|
||||
import javafx.beans.property.ReadOnlyObjectWrapper;
|
||||
import org.jackhuang.hmcl.game.HMCLGameRepository;
|
||||
import org.jackhuang.hmcl.game.HMCLGameInstance;
|
||||
import org.jackhuang.hmcl.setting.GameSettings;
|
||||
import org.jackhuang.hmcl.setting.GameDirectoryManager;
|
||||
import org.jackhuang.hmcl.ui.SVG;
|
||||
import org.jackhuang.hmcl.ui.animation.TransitionPane;
|
||||
import org.jackhuang.hmcl.ui.construct.*;
|
||||
import org.jackhuang.hmcl.ui.decorator.DecoratorAnimatedPage;
|
||||
import org.jackhuang.hmcl.ui.decorator.DecoratorPage;
|
||||
import org.jackhuang.hmcl.ui.game.GameSettingsPage;
|
||||
|
||||
import java.util.Locale;
|
||||
|
||||
import static org.jackhuang.hmcl.util.i18n.I18n.i18n;
|
||||
|
||||
@@ -23,8 +17,6 @@ public class LauncherSettingsPage extends DecoratorAnimatedPage implements Decor
|
||||
private final ReadOnlyObjectWrapper<State> state = new ReadOnlyObjectWrapper<>(State.fromTitle(i18n("settings")));
|
||||
/// Manages tab selection and content transitions independently of the sidebar.
|
||||
private final TabController tabController;
|
||||
/// The tab for editing game settings presets.
|
||||
private final TabItem<GameSettingsPage<GameSettings.Preset>> gameTab;
|
||||
/// The tab whose content manages installed Java runtimes.
|
||||
private final TabItem<JavaManagementPage> javaManagementTab;
|
||||
/// The tab for general launcher settings.
|
||||
@@ -37,28 +29,22 @@ public class LauncherSettingsPage extends DecoratorAnimatedPage implements Decor
|
||||
|
||||
/// Creates the settings tabs and fills the shared navigation sidebar.
|
||||
public LauncherSettingsPage() {
|
||||
gameTab = new TabItem<>(() -> new GameSettingsPage<>(GameSettings.Preset.class, null));
|
||||
javaManagementTab = new TabItem<>(JavaManagementPage::new);
|
||||
settingsTab = new TabItem<>(SettingsPage::new);
|
||||
downloadTab = new TabItem<>(DownloadSettingsPage::new);
|
||||
aboutTab = new TabItem<>(AboutPage::new);
|
||||
tabController = new TabController(transitionPane,
|
||||
gameTab,
|
||||
javaManagementTab,
|
||||
settingsTab,
|
||||
downloadTab,
|
||||
aboutTab);
|
||||
|
||||
tabController.selectTab(gameTab);
|
||||
addEventHandler(Navigator.NavigationEvent.NAVIGATED, event -> gameTab.getNode().loadInstance(HMCLGameInstance.Optional.empty(GameDirectoryManager.getSelectedRepository())));
|
||||
tabController.selectTab(settingsTab);
|
||||
|
||||
getSidebar()
|
||||
.addNavigationDrawerTab(tabController, gameTab, i18n("settings.type.global.manage"), SVG.STADIA_CONTROLLER, SVG.STADIA_CONTROLLER_FILL)
|
||||
.addNavigationDrawerTab(tabController, javaManagementTab, i18n("java.management"), SVG.LOCAL_CAFE, SVG.LOCAL_CAFE_FILL)
|
||||
.startCategory(i18n("launcher").toUpperCase(Locale.ROOT))
|
||||
.addNavigationDrawerTab(tabController, settingsTab, i18n("settings.launcher.general"), SVG.TUNE)
|
||||
.addNavigationDrawerTab(tabController, downloadTab, i18n("download"), SVG.DOWNLOAD)
|
||||
.startCategory(i18n("about").toUpperCase(Locale.ROOT))
|
||||
.addNavigationDrawerTab(tabController, aboutTab, i18n("about"), SVG.INFO, SVG.INFO_FILL);
|
||||
|
||||
setContent(transitionPane);
|
||||
@@ -74,11 +60,6 @@ public class LauncherSettingsPage extends DecoratorAnimatedPage implements Decor
|
||||
tabController.onPageHidden();
|
||||
}
|
||||
|
||||
public void showGameSettings(HMCLGameRepository repository) {
|
||||
gameTab.getNode().loadInstance(HMCLGameInstance.Optional.empty(repository));
|
||||
tabController.selectTab(gameTab, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ReadOnlyObjectProperty<State> stateProperty() {
|
||||
return state.getReadOnlyProperty();
|
||||
|
||||
@@ -72,7 +72,6 @@ public class RootPage extends DecoratorAnimatedPage implements DecoratorPage {
|
||||
launcherSettingsItem.setLeftIcon(SVG.SETTINGS);
|
||||
launcherSettingsItem.setTitle(i18n("settings"));
|
||||
launcherSettingsItem.setOnAction(e -> {
|
||||
Controllers.getSettingsPage().showGameSettings(GameDirectoryManager.getSelectedRepository());
|
||||
Controllers.navigate(Controllers.getSettingsPage());
|
||||
});
|
||||
|
||||
|
||||
Reference in new issue
Block a user