diff --git a/MekHQ/resources/mekhq/resources/GUI.properties b/MekHQ/resources/mekhq/resources/GUI.properties index e3dae29a9d..b83c81ecc7 100644 --- a/MekHQ/resources/mekhq/resources/GUI.properties +++ b/MekHQ/resources/mekhq/resources/GUI.properties @@ -640,6 +640,8 @@ chkCompanyGeneratorStartup.text=Company Generator Startup outside AtB (Unimpleme chkCompanyGeneratorStartup.toolTipText=Adds the ability to use the company generator on startup outside of AtB campaigns. chkShowCompanyGenerator.text=Show Company Generator chkShowCompanyGenerator.toolTipText=Add a company generator menu item under the Manage Campaign header on the menu bar to allow one to generate a company after startup. +chkShowUnitPicturesOnTOE.text=Show Unit Icons in TO&E Instead of Portraits +chkShowUnitPicturesOnTOE.toolTipText=Make the TO&E Unit List display pictures of the units themselves rather than portraits of the pilots/drivers/leaders. labelCommandCenterDisplay.text=Command Center Display Options optionCommandCenterUseUnitMarket.text=Find Units Links to Unit Market (if enabled) optionCommandCenterUseUnitMarket.toolTipText=The Find Units button on the Command Center will link to the Unit Market provided the Unit Market is enabled. diff --git a/MekHQ/src/mekhq/MHQConstants.java b/MekHQ/src/mekhq/MHQConstants.java index 717c3a1bb1..5f2f654bdb 100644 --- a/MekHQ/src/mekhq/MHQConstants.java +++ b/MekHQ/src/mekhq/MHQConstants.java @@ -60,6 +60,7 @@ public final class MHQConstants extends SuiteConstants { // also used as a limit in the UI public static final String COMPANY_GENERATOR_STARTUP = "companyGeneratorStartup"; public static final String SHOW_COMPANY_GENERATOR = "showCompanyGenerator"; + public static final String SHOW_UNIT_PICTURES_ON_TOE = "showUnitPicturesOnTOE"; // region Command Center Tab public static final String COMMAND_CENTER_USE_UNIT_MARKET = "commandCenterUseUnitMarket"; diff --git a/MekHQ/src/mekhq/MHQOptions.java b/MekHQ/src/mekhq/MHQOptions.java index b07659c907..2fc40fda34 100644 --- a/MekHQ/src/mekhq/MHQOptions.java +++ b/MekHQ/src/mekhq/MHQOptions.java @@ -90,6 +90,14 @@ public void setShowCompanyGenerator(final boolean value) { userPreferences.node(MHQConstants.DISPLAY_NODE).putBoolean(MHQConstants.SHOW_COMPANY_GENERATOR, value); } + public boolean getShowUnitPicturesOnTOE() { + return userPreferences.node(MHQConstants.DISPLAY_NODE).getBoolean(MHQConstants.SHOW_UNIT_PICTURES_ON_TOE, true); + } + + public void setShowUnitPicturesOnTOE(final boolean value) { + userPreferences.node(MHQConstants.DISPLAY_NODE).putBoolean(MHQConstants.SHOW_UNIT_PICTURES_ON_TOE, value); + } + // region Command Center Tab public boolean getCommandCenterUseUnitMarket() { return userPreferences.node(MHQConstants.DISPLAY_NODE).getBoolean(MHQConstants.COMMAND_CENTER_USE_UNIT_MARKET, diff --git a/MekHQ/src/mekhq/gui/ForceRenderer.java b/MekHQ/src/mekhq/gui/ForceRenderer.java index 55672eb04c..a8b7f55cfe 100644 --- a/MekHQ/src/mekhq/gui/ForceRenderer.java +++ b/MekHQ/src/mekhq/gui/ForceRenderer.java @@ -21,6 +21,7 @@ import java.awt.Component; import javax.swing.Icon; +import javax.swing.ImageIcon; import javax.swing.JTree; import javax.swing.tree.DefaultTreeCellRenderer; @@ -160,8 +161,12 @@ public Component getTreeCellRendererComponent(JTree tree, Object value, boolean protected Icon getIcon(Object node) { if (node instanceof Unit) { - final Person person = ((Unit) node).getCommander(); - return (person == null) ? null : person.getPortrait().getImageIcon(58); + if (MekHQ.getMHQOptions().getShowUnitPicturesOnTOE()) { + return new ImageIcon(((Unit) node).getImage(this)); + } else { + final Person person = ((Unit) node).getCommander(); + return (person == null) ? null : person.getPortrait().getImageIcon(58); + } } else if (node instanceof Force) { return ((Force) node).getForceIcon().getImageIcon(58); } else { diff --git a/MekHQ/src/mekhq/gui/dialog/MHQOptionsDialog.java b/MekHQ/src/mekhq/gui/dialog/MHQOptionsDialog.java index 8282bf0906..ba2f65c182 100644 --- a/MekHQ/src/mekhq/gui/dialog/MHQOptionsDialog.java +++ b/MekHQ/src/mekhq/gui/dialog/MHQOptionsDialog.java @@ -71,10 +71,11 @@ public class MHQOptionsDialog extends AbstractMHQButtonDialog { // region Display private JTextField optionDisplayDateFormat; private JTextField optionLongDisplayDateFormat; + private final JSlider guiScale = new JSlider(); private JCheckBox optionHistoricalDailyLog; private JCheckBox chkCompanyGeneratorStartup; private JCheckBox chkShowCompanyGenerator; - private final JSlider guiScale = new JSlider(); + private JCheckBox chkShowUnitPicturesOnTOE; // region Command Center Tab private JCheckBox optionCommandCenterUseUnitMarket; @@ -280,6 +281,10 @@ private JPanel createDisplayTab() { chkShowCompanyGenerator.setToolTipText(resources.getString("chkShowCompanyGenerator.toolTipText")); chkShowCompanyGenerator.setName("chkShowCompanyGenerator"); + chkShowUnitPicturesOnTOE = new JCheckBox(resources.getString("chkShowUnitPicturesOnTOE.text")); + chkShowUnitPicturesOnTOE.setToolTipText(resources.getString("chkShowUnitPicturesOnTOE.toolTipText")); + chkShowUnitPicturesOnTOE.setName("chkShowUnitPicturesOnTOE"); + // region Command Center Tab JLabel labelCommandCenterDisplay = new JLabel(resources.getString("labelCommandCenterDisplay.text")); @@ -436,6 +441,7 @@ public Component getListCellRendererComponent(final JList list, final Object .addComponent(optionHistoricalDailyLog) .addComponent(chkCompanyGeneratorStartup) .addComponent(chkShowCompanyGenerator) + .addComponent(chkShowUnitPicturesOnTOE) .addComponent(labelCommandCenterDisplay) .addComponent(optionCommandCenterUseUnitMarket) .addComponent(optionCommandCenterMRMS) @@ -476,6 +482,7 @@ public Component getListCellRendererComponent(final JList list, final Object .addComponent(optionHistoricalDailyLog) .addComponent(chkCompanyGeneratorStartup) .addComponent(chkShowCompanyGenerator) + .addComponent(chkShowUnitPicturesOnTOE) .addComponent(labelCommandCenterDisplay) .addComponent(optionCommandCenterUseUnitMarket) .addComponent(optionCommandCenterMRMS) @@ -1292,6 +1299,7 @@ protected void okAction() { MekHQ.getMHQOptions().setHistoricalDailyLog(optionHistoricalDailyLog.isSelected()); MekHQ.getMHQOptions().setCompanyGeneratorStartup(chkCompanyGeneratorStartup.isSelected()); MekHQ.getMHQOptions().setShowCompanyGenerator(chkShowCompanyGenerator.isSelected()); + MekHQ.getMHQOptions().setShowUnitPicturesOnTOE(chkShowUnitPicturesOnTOE.isSelected()); // Command Center Tab MekHQ.getMHQOptions().setCommandCenterUseUnitMarket(optionCommandCenterUseUnitMarket.isSelected()); @@ -1433,6 +1441,7 @@ private void setInitialState() { optionHistoricalDailyLog.setSelected(MekHQ.getMHQOptions().getHistoricalDailyLog()); chkCompanyGeneratorStartup.setSelected(MekHQ.getMHQOptions().getCompanyGeneratorStartup()); chkShowCompanyGenerator.setSelected(MekHQ.getMHQOptions().getShowCompanyGenerator()); + chkShowUnitPicturesOnTOE.setSelected(MekHQ.getMHQOptions().getShowUnitPicturesOnTOE()); // Command Center Tab optionCommandCenterUseUnitMarket.setSelected(MekHQ.getMHQOptions().getCommandCenterUseUnitMarket());