From 930ca94e1eb717ff11d7ea9ed04e45db9870c9b8 Mon Sep 17 00:00:00 2001 From: Scoppio Date: Mon, 10 Feb 2025 21:11:30 -0300 Subject: [PATCH] feat: hide acar on the front of the megamek lounge --- megamek/i18n/megamek/client/messages.properties | 2 ++ .../megamek/client/ui/swing/CommonSettingsDialog.java | 5 ++++- .../src/megamek/client/ui/swing/lobby/ChatLounge.java | 11 +++++++++-- .../megamek/common/preference/ClientPreferences.java | 10 ++++++++++ 4 files changed, 25 insertions(+), 3 deletions(-) diff --git a/megamek/i18n/megamek/client/messages.properties b/megamek/i18n/megamek/client/messages.properties index b3856643e30..2f7d3f60337 100644 --- a/megamek/i18n/megamek/client/messages.properties +++ b/megamek/i18n/megamek/client/messages.properties @@ -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= @@ -1373,6 +1374,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. diff --git a/megamek/src/megamek/client/ui/swing/CommonSettingsDialog.java b/megamek/src/megamek/client/ui/swing/CommonSettingsDialog.java index 0671ae9e07c..7f01b7db12d 100644 --- a/megamek/src/megamek/client/ui/swing/CommonSettingsDialog.java +++ b/megamek/src/megamek/client/ui/swing/CommonSettingsDialog.java @@ -236,6 +236,7 @@ private void moveElement(DefaultListModel 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 displayLocale; private final JCheckBox showIPAddressesInChat = new JCheckBox( Messages.getString("CommonSettingsDialog.showIPAddressesInChat")); @@ -732,6 +733,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"))); @@ -2048,6 +2050,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")) { @@ -2542,12 +2545,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()); diff --git a/megamek/src/megamek/client/ui/swing/lobby/ChatLounge.java b/megamek/src/megamek/client/ui/swing/lobby/ChatLounge.java index 3136dd28914..f2bf7bd5889 100644 --- a/megamek/src/megamek/client/ui/swing/lobby/ChatLounge.java +++ b/megamek/src/megamek/client/ui/swing/lobby/ChatLounge.java @@ -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; @@ -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(). */ @@ -648,7 +649,7 @@ private void setupAutoResolveConfig() { panAutoResolveInfo.add(row3); panAutoResolveInfo.add(row4); panAutoResolveInfo.add(row5); - + panAutoResolveInfo.setVisible(CLIENT_PREFERENCES.getShowAutoResolvePanel()); refreshPlayerTable(); } @@ -1286,6 +1287,10 @@ private void refreshGameSettings() { refreshDoneButton(); } + public void refreshAcar() { + panAutoResolveInfo.setVisible(CLIENT_PREFERENCES.getShowAutoResolvePanel()); + } + /** * Refreshes the Mek Table contents */ @@ -3139,6 +3144,8 @@ public void preferenceChange(PreferenceChangeEvent e) { mekModel.refreshCells(); refreshTree(); break; + case ClientPreferences.SHOW_AUTO_RESOLVE_PANEL: + refreshAcar(); default: break; } diff --git a/megamek/src/megamek/common/preference/ClientPreferences.java b/megamek/src/megamek/common/preference/ClientPreferences.java index 6c2083fb247..d1de3987062 100644 --- a/megamek/src/megamek/common/preference/ClientPreferences.java +++ b/megamek/src/megamek/common/preference/ClientPreferences.java @@ -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 @@ -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(); } @@ -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); + } }