loot tracker: remove import notice

This commit is contained in:
Adam
2022-03-21 19:00:38 -04:00
parent 3097531564
commit 2654975db7
3 changed files with 10 additions and 41 deletions

View File

@@ -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 =
"<html><body style='color:%s'>%s<span style='color:white'>%s</span></body></html>";
@@ -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<LootTrackerRecord> 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("<html>Missing saved loot? Click the<br>import button to import it.</html>");
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));
}
}

View File

@@ -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);
});
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 420 B