fix: change "Joystick" to "controller" in the UI

This commit is contained in:
lantzelot-swe 2023-11-12 21:29:09 +01:00
parent 5667ab5e1c
commit 0710ba4ea3
4 changed files with 19 additions and 16 deletions

View File

@ -21,7 +21,7 @@ public class CombinedJoystickPanel extends JPanel
public CombinedJoystickPanel(MainViewModel model) public CombinedJoystickPanel(MainViewModel model)
{ {
setBorder(new TitledBorder(null, "Joystick configuration", TitledBorder.LEADING, TitledBorder.TOP, null, null)); setBorder(new TitledBorder(null, "Controller configuration", TitledBorder.LEADING, TitledBorder.TOP, null, null));
this.model = model; this.model = model;
GridBagLayout gridBagLayout = new GridBagLayout(); GridBagLayout gridBagLayout = new GridBagLayout();
setLayout(gridBagLayout); setLayout(gridBagLayout);

View File

@ -11,18 +11,17 @@ import java.awt.event.FocusListener;
import java.beans.Beans; import java.beans.Beans;
import javax.swing.ImageIcon; import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JCheckBox; import javax.swing.JCheckBox;
import javax.swing.JLabel; import javax.swing.JLabel;
import javax.swing.JPanel; import javax.swing.JPanel;
import javax.swing.JTextField; import javax.swing.JTextField;
import javax.swing.SwingConstants; import javax.swing.SwingConstants;
import se.lantz.gui.exports.ExportGamesDialog;
import se.lantz.gui.gamepad.GamePadDialog; import se.lantz.gui.gamepad.GamePadDialog;
import se.lantz.model.JoystickModel; import se.lantz.model.JoystickModel;
import se.lantz.util.CustomUndoPlainDocument; import se.lantz.util.CustomUndoPlainDocument;
import se.lantz.util.TextComponentSupport; import se.lantz.util.TextComponentSupport;
import javax.swing.JButton;
public class JoystickPanel extends JPanel public class JoystickPanel extends JPanel
{ {
@ -151,13 +150,14 @@ public class JoystickPanel extends JPanel
getConfigTextField().setText(model.getConfigString()); getConfigTextField().setText(model.getConfigString());
} }
getImageLabel().setIcon(model.isMouse() ? mouseImage : joyImage); getImageLabel().setIcon(model.isMouse() ? mouseImage : joyImage);
getGamepadButton().setEnabled(!model.isMouse());
} }
private JCheckBox getPrimaryJoyCheckBox() private JCheckBox getPrimaryJoyCheckBox()
{ {
if (primaryJoyCheckBox == null) if (primaryJoyCheckBox == null)
{ {
String text = "Use port " + portnumber + " as Primary joystick"; String text = "Use port " + portnumber + " as primary controller";
primaryJoyCheckBox = new JCheckBox(text); primaryJoyCheckBox = new JCheckBox(text);
primaryJoyCheckBox.addItemListener((e) -> model.setPrimary(primaryJoyCheckBox.isSelected())); primaryJoyCheckBox.addItemListener((e) -> model.setPrimary(primaryJoyCheckBox.isSelected()));
} }
@ -344,7 +344,10 @@ public class JoystickPanel extends JPanel
{ {
String text = "Use mouse"; String text = "Use mouse";
mouseCheckBox = new JCheckBox(text); mouseCheckBox = new JCheckBox(text);
mouseCheckBox.addItemListener((e) -> model.setMouse(mouseCheckBox.isSelected())); mouseCheckBox.addItemListener((e) -> {
model.setMouse(mouseCheckBox.isSelected());
getGamepadButton().setEnabled(!mouseCheckBox.isSelected());
});
} }
return mouseCheckBox; return mouseCheckBox;
} }

View File

@ -943,9 +943,9 @@ public class MenuManager
{ {
if (resetJoystickConfigItem == null) if (resetJoystickConfigItem == null)
{ {
resetJoystickConfigItem = new JMenuItem("Reset joystick configs for current gamelist view"); resetJoystickConfigItem = new JMenuItem("Reset controller configs for current gamelist view");
resetJoystickConfigItem.setMnemonic('j'); resetJoystickConfigItem.setMnemonic('j');
resetJoystickConfigItem.addActionListener(e -> resetJoystickConfigs()); resetJoystickConfigItem.addActionListener(e -> resetControllerConfigs());
} }
return resetJoystickConfigItem; return resetJoystickConfigItem;
} }
@ -1528,23 +1528,23 @@ public class MenuManager
} }
private void resetJoystickConfigs() private void resetControllerConfigs()
{ {
String message = "Do you want to reset the joystick configurations for all games in the current gamelist view?\n" + String message = "Do you want to reset the controller configurations for all games in the current gamelist view?\n" +
"Only the mappings are reset to the default (defined in preferences), primary joystick is preserved.\n" + "Only the mappings are reset to the default (defined in preferences), primary controller port is preserved.\n" +
"The second joystick is also reset with the default mappings."; "The second controller is also reset with the default mappings.";
int option = JOptionPane.showConfirmDialog(MainWindow.getInstance().getMainPanel(), int option = JOptionPane.showConfirmDialog(MainWindow.getInstance().getMainPanel(),
message, message,
"Reset joystick configurations", "Reset controller configurations",
JOptionPane.YES_NO_OPTION, JOptionPane.YES_NO_OPTION,
JOptionPane.QUESTION_MESSAGE); JOptionPane.QUESTION_MESSAGE);
if (option == JOptionPane.YES_OPTION) if (option == JOptionPane.YES_OPTION)
{ {
uiModel.resetJoystickConfigsForCurrentView(); uiModel.resetJoystickConfigsForCurrentView();
JOptionPane.showMessageDialog(MainWindow.getInstance().getMainPanel(), JOptionPane.showMessageDialog(MainWindow.getInstance().getMainPanel(),
"Joystick configurations updated.", "Controller configurations updated.",
"Reset joystick configurations", "Reset controller configurations",
JOptionPane.INFORMATION_MESSAGE); JOptionPane.INFORMATION_MESSAGE);
MainWindow.getInstance().reloadCurrentGameView(); MainWindow.getInstance().reloadCurrentGameView();
} }

View File

@ -44,7 +44,7 @@ public class PreferencesTabPanel extends JPanel
tabbedPane = new JTabbedPane(JTabbedPane.TOP); tabbedPane = new JTabbedPane(JTabbedPane.TOP);
tabbedPane.addTab("Misc.", null, getMiscPanel(), null); tabbedPane.addTab("Misc.", null, getMiscPanel(), null);
tabbedPane.addTab("Favorites", null, getFavPanel(), null); tabbedPane.addTab("Favorites", null, getFavPanel(), null);
tabbedPane.addTab("Joystick", null, getJoystickBackgroundPanel(), null); tabbedPane.addTab("Controller", null, getJoystickBackgroundPanel(), null);
tabbedPane.addTab("Infoslot", null, getInfoSlotBackgroundPanel(), null); tabbedPane.addTab("Infoslot", null, getInfoSlotBackgroundPanel(), null);
} }
return tabbedPane; return tabbedPane;
@ -148,7 +148,7 @@ public class PreferencesTabPanel extends JPanel
if (infoLabel == null) if (infoLabel == null)
{ {
infoLabel = infoLabel =
new JLabel("<html>Specify the default joystick configuration to use when adding new games. Port 1 and Port 2 uses the same mapping.</html>"); new JLabel("<html>Specify the default controller configuration to use when adding new games. Port 1 and Port 2 uses the same mapping.</html>");
} }
return infoLabel; return infoLabel;
} }