Skip to content

Commit

Permalink
Configure and use external user dir: add a file chooser for choosing …
Browse files Browse the repository at this point in the history
…the user dir
  • Loading branch information
SJuliez committed Dec 16, 2023
1 parent ab69cc9 commit 684eeca
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ ConfigurationDialog.chkUnofficialIgnoreYear.text=Ignore intro/extinct years on U
ConfigurationDialog.chkUnofficialIgnoreYear.tooltip=If the tech level is set to unofficial, the intro/extinct year will be ignored.
ConfigurationDialog.userDir.text=User Files Directory:
ConfigurationDialog.userDir.tooltip=<html>Use this directory for resources you want to share between different installs or versions of MegaMek, MegaMekLab and MekHQ. Fonts, units, camos, portraits and fluff images will also be loaded from this directory.<BR>Note: Inside the user directory, use the directory structure of MM/MML/MHQ for camos, portraits and fluff images, i.e. data/images/camo, data/images/portraits and data/images/fluff/. <BR>Fonts and units can be placed anywhere in the user directory.
ConfigurationDialog.userDir.chooser.title=Choose User Data Folder
ConfigurationDialog.cbPaper.text=Paper Size:
ConfigurationDialog.cbPaper.tooltip=<html>The dimensions of the page to use when exporting to PDF.<br/>When printing, this can be changed in the print dialog.</html>
ConfigurationDialog.chkColor.text=Use color
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
*/
package megameklab.ui.dialog.settings;

import megamek.client.ui.Messages;
import megamek.client.ui.swing.CommonSettingsDialog;
import megamek.common.preference.PreferenceManager;
import megameklab.ui.util.SpringUtilities;
import megameklab.util.CConfig;
Expand All @@ -36,19 +38,24 @@ public class MiscSettingsPanel extends JPanel {

private final JCheckBox chkSummaryFormatTRO = new JCheckBox();
private final JCheckBox chkSkipSavePrompts = new JCheckBox();
private final JTextField txtUserDir = new JTextField(40);
private final JTextField txtUserDir = new JTextField(20);

MiscSettingsPanel() {
MiscSettingsPanel(JFrame parent) {
ResourceBundle resourceMap = ResourceBundle.getBundle("megameklab.resources.Dialogs");

JLabel userDirLabel = new JLabel(resourceMap.getString("ConfigurationDialog.userDir.text"));
userDirLabel.setToolTipText(resourceMap.getString("ConfigurationDialog.userDir.tooltip"));
txtUserDir.setToolTipText(resourceMap.getString("ConfigurationDialog.userDir.tooltip"));
txtUserDir.setText(PreferenceManager.getClientPreferences().getUserDir());
JButton userDirChooser = new JButton("...");
userDirChooser.addActionListener(e -> CommonSettingsDialog.fileChooseUserDir(txtUserDir, parent));
userDirChooser.setToolTipText(resourceMap.getString("ConfigurationDialog.userDir.chooser.title"));
JPanel userDirLine = new JPanel(new FlowLayout(FlowLayout.LEFT, 0, 0));
userDirLine.add(userDirLabel);
userDirLine.add(Box.createHorizontalStrut(25));
userDirLine.add(txtUserDir);
userDirLine.add(Box.createHorizontalStrut(10));
userDirLine.add(userDirChooser);

chkSummaryFormatTRO.setText(resourceMap.getString("ConfigurationDialog.chkSummaryFormatTRO.text"));
chkSummaryFormatTRO.setToolTipText(resourceMap.getString("ConfigurationDialog.chkSummaryFormatTRO.tooltip"));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,11 @@ public class SettingsDialog extends AbstractMMLButtonDialog {
private final ColorSettingsPanel colorPreferences = new ColorSettingsPanel();
private final TechSettingsPanel techSettings = new TechSettingsPanel();
private final ExportSettingsPanel exportSettingsPanel = new ExportSettingsPanel();
private final MiscSettingsPanel miscSettingsPanel = new MiscSettingsPanel();
private final MiscSettingsPanel miscSettingsPanel;

public SettingsDialog(JFrame frame) {
super(frame, true, "ConfigurationDialog", "ConfigurationDialog.windowName.text");
miscSettingsPanel = new MiscSettingsPanel(frame);
initialize();
}

Expand Down

0 comments on commit 684eeca

Please sign in to comment.