Add discard prefs checkbox

This commit is contained in:
SiboVG 2023-06-06 18:26:17 +02:00
parent aa154c49da
commit 3b37b078d0
2 changed files with 15 additions and 2 deletions

View File

@ -297,6 +297,7 @@ pref.dlg.tab.Launch = Launch
pref.dlg.tab.Miscellaneousoptions = Miscellaneous options
pref.dlg.lbl.RASAeroWarning = Show warning when saving in RASAero format
pref.dlg.lbl.RockSimWarning = Show warning when saving in RockSim format
pref.dlg.checkbox.ShowDiscardPreferencesConfirmation = Show confirmation dialog when discarding preferences
pref.dlg.but.resetAllPreferences = Reset all preferences
pref.dlg.but.resetAllPreferences.ttip = Reset all the preferences, including cached preferences (UI settings, recent files, etc.)
pref.dlg.but.exportPreferences = Export preferences

View File

@ -3,6 +3,8 @@ package net.sf.openrocket.gui.dialogs.preferences;
import java.awt.Dialog.ModalityType;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;
import java.io.File;
import java.util.ArrayList;
import java.util.Collections;
@ -40,7 +42,6 @@ import net.sf.openrocket.gui.util.PreferencesExporter;
import net.sf.openrocket.gui.util.PreferencesImporter;
import net.sf.openrocket.l10n.L10N;
import net.sf.openrocket.logging.Markers;
import net.sf.openrocket.startup.Application;
import net.sf.openrocket.startup.Preferences;
import net.sf.openrocket.util.BuildProperties;
import net.sf.openrocket.util.Named;
@ -255,6 +256,17 @@ public class GeneralPreferencesPanel extends PreferencesPanel {
});
this.add(rocksimWarningDialogBox,"spanx, wrap");
//// Show confirmation dialog when discarding preferences
final JCheckBox prefsDiscardBox = new JCheckBox(trans.get("pref.dlg.checkbox.ShowDiscardPreferencesConfirmation"));
prefsDiscardBox.setSelected(preferences.isShowDiscardPreferencesConfirmation());
prefsDiscardBox.addItemListener(new ItemListener() {
@Override
public void itemStateChanged(ItemEvent e) {
preferences.setShowDiscardPreferencesConfirmation(e.getStateChange() == ItemEvent.SELECTED);
}
});
this.add(prefsDiscardBox,"spanx, wrap");
// Preference buttons
JPanel buttonPanel = new JPanel(new MigLayout("fillx, ins 0"));
@ -315,7 +327,7 @@ public class GeneralPreferencesPanel extends PreferencesPanel {
}
}
});
buttonPanel.add(resetAllPreferences, "pushx, right, wrap");
buttonPanel.add(resetAllPreferences, "pushx, right, gaptop 20lp, wrap");
this.add(buttonPanel, "spanx, growx, pushy, bottom, wrap");
}