From 2654975db7762e2676c9b83efc8ad5c13fd87a78 Mon Sep 17 00:00:00 2001 From: Adam Date: Mon, 21 Mar 2022 19:00:38 -0400 Subject: [PATCH] loot tracker: remove import notice --- .../plugins/loottracker/LootTrackerPanel.java | 37 ------------------ .../loottracker/LootTrackerPlugin.java | 14 +++++-- .../plugins/loottracker/import_icon.png | Bin 420 -> 0 bytes 3 files changed, 10 insertions(+), 41 deletions(-) delete mode 100644 runelite-client/src/main/resources/net/runelite/client/plugins/loottracker/import_icon.png diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/loottracker/LootTrackerPanel.java b/runelite-client/src/main/java/net/runelite/client/plugins/loottracker/LootTrackerPanel.java index 8dc0edabac..9b5cb7dd9b 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/loottracker/LootTrackerPanel.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/loottracker/LootTrackerPanel.java @@ -52,7 +52,6 @@ import javax.swing.JPanel; import javax.swing.JPopupMenu; import javax.swing.JRadioButton; import javax.swing.JToggleButton; -import javax.swing.SwingUtilities; import javax.swing.border.EmptyBorder; import javax.swing.plaf.basic.BasicButtonUI; import javax.swing.plaf.basic.BasicToggleButtonUI; @@ -85,7 +84,6 @@ class LootTrackerPanel extends PluginPanel private static final ImageIcon INVISIBLE_ICON_HOVER; private static final ImageIcon COLLAPSE_ICON; private static final ImageIcon EXPAND_ICON; - private static final ImageIcon IMPORT_ICON; private static final String HTML_LABEL_TEMPLATE = "%s%s"; @@ -117,8 +115,6 @@ class LootTrackerPanel extends PluginPanel private final JRadioButton groupedLootBtn = new JRadioButton(); private final JButton collapseBtn = new JButton(); - private final JPanel importNoticePanel; - // Aggregate of all kills private final List aggregateRecords = new ArrayList<>(); // Individual records for the individual kills this session @@ -163,8 +159,6 @@ class LootTrackerPanel extends PluginPanel COLLAPSE_ICON = new ImageIcon(collapseImg); EXPAND_ICON = new ImageIcon(expandedImg); - - IMPORT_ICON = new ImageIcon(ImageUtil.loadImageResource(LootTrackerPlugin.class, "import_icon.png")); } LootTrackerPanel(final LootTrackerPlugin plugin, final ItemManager itemManager, final LootTrackerConfig config) @@ -185,12 +179,10 @@ class LootTrackerPanel extends PluginPanel actionsPanel = buildActionsPanel(); overallPanel = buildOverallPanel(); - importNoticePanel = createImportNoticePanel(); // Create loot boxes wrapper logsContainer.setLayout(new BoxLayout(logsContainer, BoxLayout.Y_AXIS)); layoutPanel.add(actionsPanel); - layoutPanel.add(importNoticePanel); layoutPanel.add(overallPanel); layoutPanel.add(logsContainer); @@ -354,30 +346,6 @@ class LootTrackerPanel extends PluginPanel return overallPanel; } - private JPanel createImportNoticePanel() - { - JPanel panel = new JPanel(); - panel.setBackground(ColorScheme.DARKER_GRAY_COLOR); - panel.setBorder(BorderFactory.createCompoundBorder( - BorderFactory.createMatteBorder(5, 0, 0, 0, ColorScheme.DARK_GRAY_COLOR), - BorderFactory.createEmptyBorder(8, 10, 8, 10) - )); - panel.setLayout(new BorderLayout()); - - final JLabel importLabel = new JLabel("Missing saved loot? Click the
import button to import it."); - importLabel.setForeground(Color.YELLOW); - panel.add(importLabel, BorderLayout.WEST); - - JButton importButton = new JButton(); - SwingUtil.removeButtonDecorations(importButton); - importButton.setIcon(IMPORT_ICON); - importButton.setToolTipText("Import old loot tracker data to current profile"); - importButton.addActionListener(l -> plugin.importLoot()); - panel.add(importButton, BorderLayout.EAST); - - return panel; - } - void updateCollapseText() { collapseBtn.setSelected(isAllCollapsed()); @@ -735,9 +703,4 @@ class LootTrackerPanel extends PluginPanel final String valueStr = QuantityFormatter.quantityToStackSize(value); return String.format(HTML_LABEL_TEMPLATE, ColorUtil.toHexColor(ColorScheme.LIGHT_GRAY_COLOR), key, valueStr); } - - void toggleImportNotice(boolean on) - { - SwingUtilities.invokeLater(() -> importNoticePanel.setVisible(on)); - } } diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/loottracker/LootTrackerPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/loottracker/LootTrackerPlugin.java index dd8c4d1aee..793b357fde 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/loottracker/LootTrackerPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/loottracker/LootTrackerPlugin.java @@ -83,6 +83,7 @@ import net.runelite.api.SpriteID; import net.runelite.api.WorldType; import net.runelite.api.coords.WorldPoint; import net.runelite.api.events.ChatMessage; +import net.runelite.api.events.CommandExecuted; import net.runelite.api.events.GameStateChanged; import net.runelite.api.events.ItemContainerChanged; import net.runelite.api.events.MenuOptionClicked; @@ -489,8 +490,6 @@ public class LootTrackerPlugin extends Plugin panel.addRecords(records); }); }); - - panel.toggleImportNotice(!hasImported()); }); } @@ -1006,6 +1005,15 @@ public class LootTrackerPlugin extends Plugin } } + @Subscribe + public void onCommandExecuted(CommandExecuted commandExecuted) + { + if (commandExecuted.getCommand().equals("importloot")) + { + SwingUtilities.invokeLater(this::importLoot); + } + } + private static boolean isItemOp(MenuAction menuAction) { final int id = menuAction.getId(); @@ -1384,7 +1392,6 @@ public class LootTrackerPlugin extends Plugin } clearImported(); - panel.toggleImportNotice(true); } void importLoot() @@ -1456,7 +1463,6 @@ public class LootTrackerPlugin extends Plugin SwingUtilities.invokeLater(() -> JOptionPane.showMessageDialog(panel, "Imported " + lootRecords.size() + " loot entries.")); setHasImported(); - panel.toggleImportNotice(false); }); } diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/loottracker/import_icon.png b/runelite-client/src/main/resources/net/runelite/client/plugins/loottracker/import_icon.png deleted file mode 100644 index 5402cd593e9b7c02a90b5551d91bb9c19f3428a5..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 420 zcmV;V0bBlwP)Px#1ZP1_K>z@;j|==^1poj532;bRa{vGf6951U69E94oEQKA0Xa!TK~y+TwbQ#w zLqQP6@!gn!pxDI9Mr>_tZF~wveFDMOMlA#p1hGh?l~~$oZ6gvdq!6@HlS1$b6l}Ec zcKm;v899*1vCt2GFgv?v&V?lWd$KHZ70lrn4|u{A<`I$36~+z@;2g>=cCn478l(>0 zuz08)+QS