Skip to content

Commit

Permalink
Merge pull request #6533 from Scoppio/feat/hide-acar
Browse files Browse the repository at this point in the history
feat: hide acar on the front of the megamek lounge
  • Loading branch information
HammerGS authored Feb 11, 2025
2 parents 632b0fd + 3e39757 commit 15f0285
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 3 deletions.
2 changes: 2 additions & 0 deletions megamek/i18n/megamek/client/messages.properties
Original file line number Diff line number Diff line change
Expand Up @@ -667,6 +667,7 @@ ChatLounge.butPrintList.printing=Loading print dialog
ChatLounge.butShrink=<
ChatLounge.butSkills=Random Skills...
ChatLounge.butShowUnitID=Show IDs

ChatLounge.butSortableView=Sortable View
ChatLounge.BVplain=BV
ChatLounge.BV=\ BV=
Expand Down Expand Up @@ -1375,6 +1376,7 @@ CommonSettingsDialog.showMapsheets=Show mapsheet borders.
CommonSettingsDialog.showPilotPortraitTT=Show pilot portrait in tooltip.
CommonSettingsDialog.showReportSprites=Show Report Sprites in Report Log
CommonSettingsDialog.showUnitId=Show each unit's unique ID next to its name.
CommonSettingsDialog.showAutoResolvePanel=Show Auto Resolve Panel on the Lounge
CommonSettingsDialog.showWpsinTT=Show unit weapons in the tooltip
CommonSettingsDialog.showWpsLocinTT=Show weapon locations in the tooltip
CommonSettingsDialog.showWrecks=Show wrecks.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,7 @@ private <T> void moveElement(DefaultListModel<T> srcModel, int srcIndex, int trg
Messages.getString("CommonSettingsDialog.useGPinUnitSelection"));
private final JCheckBox generateNames = new JCheckBox(Messages.getString("CommonSettingsDialog.generateNames"));
private final JCheckBox showUnitId = new JCheckBox(Messages.getString("CommonSettingsDialog.showUnitId"));
private final JCheckBox showAutoResolvePanel = new JCheckBox(Messages.getString("CommonSettingsDialog.showAutoResolvePanel"));
private JComboBox<String> displayLocale;
private final JCheckBox showIPAddressesInChat = new JCheckBox(
Messages.getString("CommonSettingsDialog.showIPAddressesInChat"));
Expand Down Expand Up @@ -735,6 +736,7 @@ private JPanel getGameBoardPanel() {
comps.add(checkboxEntry(showDamageLevel, null));
comps.add(checkboxEntry(showDamageDecal, null));
comps.add(checkboxEntry(showUnitId, null));
comps.add(checkboxEntry(showAutoResolvePanel, null));
comps.add(checkboxEntry(entityOwnerColor, Messages.getString("CommonSettingsDialog.entityOwnerColor.tooltip")));
comps.add(checkboxEntry(useSoftCenter, Messages.getString("CommonSettingsDialog.useSoftCenter.tooltip")));
comps.add(checkboxEntry(useAutoCenter, Messages.getString("CommonSettingsDialog.useAutoCenter.tooltip")));
Expand Down Expand Up @@ -2065,6 +2067,7 @@ public void setVisible(boolean visible) {
useGPinUnitSelection.setSelected(CLIENT_PREFERENCES.useGPinUnitSelection());
generateNames.setSelected(CLIENT_PREFERENCES.generateNames());
showUnitId.setSelected(CLIENT_PREFERENCES.getShowUnitId());
showAutoResolvePanel.setSelected(CLIENT_PREFERENCES.getShowAutoResolvePanel());

int index = 0;
if (CLIENT_PREFERENCES.getLocaleString().startsWith("de")) {
Expand Down Expand Up @@ -2563,12 +2566,12 @@ protected void okAction() {
CLIENT_PREFERENCES.setUseGpInUnitSelection(useGPinUnitSelection.isSelected());
CLIENT_PREFERENCES.setGenerateNames(generateNames.isSelected());
CLIENT_PREFERENCES.setShowUnitId(showUnitId.isSelected());
CLIENT_PREFERENCES.setShowAutoResolvePanel(showAutoResolvePanel.isSelected());
if ((clientgui != null) && (clientgui.getBoardView() != null)) {
clientgui.getBoardView().updateEntityLabels();
}

CLIENT_PREFERENCES.setLocale(CommonSettingsDialog.LOCALE_CHOICES[displayLocale.getSelectedIndex()]);

GUIP.setShowMapsheets(showMapsheets.isSelected());
GUIP.setAOHexShadows(aOHexShadows.isSelected());
GUIP.setFloatingIso(floatingIso.isSelected());
Expand Down
11 changes: 9 additions & 2 deletions megamek/src/megamek/client/ui/swing/lobby/ChatLounge.java
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@
import java.awt.image.FilteredImageSource;
import java.awt.image.ImageFilter;
import java.awt.image.ImageProducer;
import java.beans.PropertyChangeListener;
import java.io.*;
import java.text.NumberFormat;
import java.util.List;
Expand Down Expand Up @@ -278,7 +279,7 @@ public class ChatLounge extends AbstractPhaseDisplay implements
private static final String CL_ACTIONCOMMAND_CAMO = "camo";

private static final GUIPreferences GUIP = GUIPreferences.getInstance();

private static final ClientPreferences CLIENT_PREFERENCES = PreferenceManager.getClientPreferences();
private transient ClientGUI clientgui;

/** Creates a new chat lounge for the clientgui.getClient(). */
Expand Down Expand Up @@ -648,7 +649,7 @@ private void setupAutoResolveConfig() {
panAutoResolveInfo.add(row3);
panAutoResolveInfo.add(row4);
panAutoResolveInfo.add(row5);

panAutoResolveInfo.setVisible(CLIENT_PREFERENCES.getShowAutoResolvePanel());
refreshPlayerTable();
}

Expand Down Expand Up @@ -1286,6 +1287,10 @@ private void refreshGameSettings() {
refreshDoneButton();
}

public void refreshAcar() {
panAutoResolveInfo.setVisible(CLIENT_PREFERENCES.getShowAutoResolvePanel());
}

/**
* Refreshes the Mek Table contents
*/
Expand Down Expand Up @@ -3139,6 +3144,8 @@ public void preferenceChange(PreferenceChangeEvent e) {
mekModel.refreshCells();
refreshTree();
break;
case ClientPreferences.SHOW_AUTO_RESOLVE_PANEL:
refreshAcar();
default:
break;
}
Expand Down
10 changes: 10 additions & 0 deletions megamek/src/megamek/common/preference/ClientPreferences.java
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ public class ClientPreferences extends PreferenceStoreProxy {
public static final String START_SEARCHLIGHTS_ON = "StartSearchlightsOn";
public static final String ENABLE_EXPERIMENTAL_BOT_FEATURES = "EnableExperimentalBotFeatures";
public static final String NAG_ASK_FOR_VICTORY_LIST = "AskForVictoryList";
public static final String SHOW_AUTO_RESOLVE_PANEL = "ShowAutoResolvePanel";

/**
* A user-specified directory, typically outside the MM directory, where content
Expand Down Expand Up @@ -120,6 +121,7 @@ public ClientPreferences(IPreferenceStore store) {
store.setDefault(MML_PATH, "");
store.setDefault(NAG_ASK_FOR_VICTORY_LIST, true);
store.setDefault(DATA_LOGGING, false);
store.setDefault(SHOW_AUTO_RESOLVE_PANEL, true);
setLocale(store.getString(LOCALE));
setMekHitLocLog();
}
Expand Down Expand Up @@ -482,4 +484,12 @@ public boolean askForVictoryList() {
public void setAskForVictoryList(boolean value) {
store.setValue(NAG_ASK_FOR_VICTORY_LIST, value);
}

public void setShowAutoResolvePanel(boolean value) {
store.setValue(SHOW_AUTO_RESOLVE_PANEL, value);
}

public boolean getShowAutoResolvePanel() {
return store.getBoolean(SHOW_AUTO_RESOLVE_PANEL);
}
}

0 comments on commit 15f0285

Please sign in to comment.