Skip to content
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import org.quiltmc.enigma.gui.util.ExtensionFileFilter;
import org.quiltmc.enigma.util.I18n;

import javax.swing.JCheckBoxMenuItem;
import javax.swing.JFileChooser;
import javax.swing.JMenuItem;
import javax.swing.JOptionPane;
Expand All @@ -30,6 +31,7 @@ public class FileMenu extends AbstractEnigmaMenu {
private final JMenuItem openMappingsItem = new JMenuItem();
private final JMenuItem maxRecentFilesItem = new JMenuItem();
private final JMenuItem saveMappingsItem = new JMenuItem();
private final JCheckBoxMenuItem autoSaveMappingsItem = new JCheckBoxMenuItem();
private final JMenuItem closeMappingsItem = new JMenuItem();
private final JMenuItem dropMappingsItem = new JMenuItem();
private final JMenuItem reloadMappingsItem = new JMenuItem();
Expand All @@ -56,6 +58,7 @@ public FileMenu(Gui gui) {
this.add(this.openMappingsItem);
this.add(this.saveMappingsItem);
this.add(this.saveMappingsAs);
this.add(this.autoSaveMappingsItem);
this.add(this.closeMappingsItem);
this.add(this.dropMappingsItem);
this.addSeparator();
Expand All @@ -77,6 +80,7 @@ public FileMenu(Gui gui) {
this.jarCloseItem.addActionListener(e -> this.gui.getController().closeJar());
this.maxRecentFilesItem.addActionListener(e -> this.onMaxRecentFilesClicked());
this.saveMappingsItem.addActionListener(e -> this.onSaveMappingsClicked());
this.autoSaveMappingsItem.addActionListener(e -> Config.main().features.autoSaveMappings.setValue(this.autoSaveMappingsItem.getState()));
this.closeMappingsItem.addActionListener(e -> this.onCloseMappingsClicked());
this.dropMappingsItem.addActionListener(e -> this.gui.getController().dropMappings());
this.reloadMappingsItem.addActionListener(e -> this.onReloadMappingsClicked());
Expand Down Expand Up @@ -104,6 +108,8 @@ public void updateState(boolean jarOpen, ConnectionState state) {
this.openRecent.updateState(jarOpen, state);
this.saveMappingsItem.setEnabled(jarOpen && this.gui.mappingsFileChooser.getSelectedFile() != null && this.gui.getConnectionState() != ConnectionState.CONNECTED);
this.saveMappingsAs.updateState();
this.autoSaveMappingsItem.setEnabled(jarOpen);
this.autoSaveMappingsItem.setState(Config.main().features.autoSaveMappings.value());
this.closeMappingsItem.setEnabled(jarOpen);
this.reloadMappingsItem.setEnabled(jarOpen);
this.reloadAllItem.setEnabled(jarOpen);
Expand All @@ -124,6 +130,7 @@ public void retranslate() {
this.openMappingsItem.setText(I18n.translate("menu.file.mappings.open"));
this.saveMappingsItem.setText(I18n.translate("menu.file.mappings.save"));
this.saveMappingsAs.retranslate();
this.autoSaveMappingsItem.setText(I18n.translate("menu.file.mappings.auto_save"));
this.closeMappingsItem.setText(I18n.translate("menu.file.mappings.close"));
this.dropMappingsItem.setText(I18n.translate("menu.file.mappings.drop"));
this.reloadMappingsItem.setText(I18n.translate("menu.file.reload_mappings"));
Expand Down
1 change: 1 addition & 0 deletions enigma/src/main/resources/lang/en_us.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
"menu.file.mappings.open": "Open Mappings...",
"menu.file.mappings.save": "Save Mappings",
"menu.file.mappings.save_as": "Save Mappings As...",
"menu.file.mappings.auto_save": "Auto Save Mappings",
"menu.file.mappings.close": "Close Mappings",
"menu.file.mappings.drop": "Drop Invalid Mappings",
"menu.file.mappings.file_filter": "%s (%s)",
Expand Down