loot tracker: remove import notice
This commit is contained in:
@@ -52,7 +52,6 @@ import javax.swing.JPanel;
|
|||||||
import javax.swing.JPopupMenu;
|
import javax.swing.JPopupMenu;
|
||||||
import javax.swing.JRadioButton;
|
import javax.swing.JRadioButton;
|
||||||
import javax.swing.JToggleButton;
|
import javax.swing.JToggleButton;
|
||||||
import javax.swing.SwingUtilities;
|
|
||||||
import javax.swing.border.EmptyBorder;
|
import javax.swing.border.EmptyBorder;
|
||||||
import javax.swing.plaf.basic.BasicButtonUI;
|
import javax.swing.plaf.basic.BasicButtonUI;
|
||||||
import javax.swing.plaf.basic.BasicToggleButtonUI;
|
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 INVISIBLE_ICON_HOVER;
|
||||||
private static final ImageIcon COLLAPSE_ICON;
|
private static final ImageIcon COLLAPSE_ICON;
|
||||||
private static final ImageIcon EXPAND_ICON;
|
private static final ImageIcon EXPAND_ICON;
|
||||||
private static final ImageIcon IMPORT_ICON;
|
|
||||||
|
|
||||||
private static final String HTML_LABEL_TEMPLATE =
|
private static final String HTML_LABEL_TEMPLATE =
|
||||||
"<html><body style='color:%s'>%s<span style='color:white'>%s</span></body></html>";
|
"<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 JRadioButton groupedLootBtn = new JRadioButton();
|
||||||
private final JButton collapseBtn = new JButton();
|
private final JButton collapseBtn = new JButton();
|
||||||
|
|
||||||
private final JPanel importNoticePanel;
|
|
||||||
|
|
||||||
// Aggregate of all kills
|
// Aggregate of all kills
|
||||||
private final List<LootTrackerRecord> aggregateRecords = new ArrayList<>();
|
private final List<LootTrackerRecord> aggregateRecords = new ArrayList<>();
|
||||||
// Individual records for the individual kills this session
|
// Individual records for the individual kills this session
|
||||||
@@ -163,8 +159,6 @@ class LootTrackerPanel extends PluginPanel
|
|||||||
|
|
||||||
COLLAPSE_ICON = new ImageIcon(collapseImg);
|
COLLAPSE_ICON = new ImageIcon(collapseImg);
|
||||||
EXPAND_ICON = new ImageIcon(expandedImg);
|
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)
|
LootTrackerPanel(final LootTrackerPlugin plugin, final ItemManager itemManager, final LootTrackerConfig config)
|
||||||
@@ -185,12 +179,10 @@ class LootTrackerPanel extends PluginPanel
|
|||||||
|
|
||||||
actionsPanel = buildActionsPanel();
|
actionsPanel = buildActionsPanel();
|
||||||
overallPanel = buildOverallPanel();
|
overallPanel = buildOverallPanel();
|
||||||
importNoticePanel = createImportNoticePanel();
|
|
||||||
|
|
||||||
// Create loot boxes wrapper
|
// Create loot boxes wrapper
|
||||||
logsContainer.setLayout(new BoxLayout(logsContainer, BoxLayout.Y_AXIS));
|
logsContainer.setLayout(new BoxLayout(logsContainer, BoxLayout.Y_AXIS));
|
||||||
layoutPanel.add(actionsPanel);
|
layoutPanel.add(actionsPanel);
|
||||||
layoutPanel.add(importNoticePanel);
|
|
||||||
layoutPanel.add(overallPanel);
|
layoutPanel.add(overallPanel);
|
||||||
layoutPanel.add(logsContainer);
|
layoutPanel.add(logsContainer);
|
||||||
|
|
||||||
@@ -354,30 +346,6 @@ class LootTrackerPanel extends PluginPanel
|
|||||||
return overallPanel;
|
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()
|
void updateCollapseText()
|
||||||
{
|
{
|
||||||
collapseBtn.setSelected(isAllCollapsed());
|
collapseBtn.setSelected(isAllCollapsed());
|
||||||
@@ -735,9 +703,4 @@ class LootTrackerPanel extends PluginPanel
|
|||||||
final String valueStr = QuantityFormatter.quantityToStackSize(value);
|
final String valueStr = QuantityFormatter.quantityToStackSize(value);
|
||||||
return String.format(HTML_LABEL_TEMPLATE, ColorUtil.toHexColor(ColorScheme.LIGHT_GRAY_COLOR), key, valueStr);
|
return String.format(HTML_LABEL_TEMPLATE, ColorUtil.toHexColor(ColorScheme.LIGHT_GRAY_COLOR), key, valueStr);
|
||||||
}
|
}
|
||||||
|
|
||||||
void toggleImportNotice(boolean on)
|
|
||||||
{
|
|
||||||
SwingUtilities.invokeLater(() -> importNoticePanel.setVisible(on));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -83,6 +83,7 @@ import net.runelite.api.SpriteID;
|
|||||||
import net.runelite.api.WorldType;
|
import net.runelite.api.WorldType;
|
||||||
import net.runelite.api.coords.WorldPoint;
|
import net.runelite.api.coords.WorldPoint;
|
||||||
import net.runelite.api.events.ChatMessage;
|
import net.runelite.api.events.ChatMessage;
|
||||||
|
import net.runelite.api.events.CommandExecuted;
|
||||||
import net.runelite.api.events.GameStateChanged;
|
import net.runelite.api.events.GameStateChanged;
|
||||||
import net.runelite.api.events.ItemContainerChanged;
|
import net.runelite.api.events.ItemContainerChanged;
|
||||||
import net.runelite.api.events.MenuOptionClicked;
|
import net.runelite.api.events.MenuOptionClicked;
|
||||||
@@ -489,8 +490,6 @@ public class LootTrackerPlugin extends Plugin
|
|||||||
panel.addRecords(records);
|
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)
|
private static boolean isItemOp(MenuAction menuAction)
|
||||||
{
|
{
|
||||||
final int id = menuAction.getId();
|
final int id = menuAction.getId();
|
||||||
@@ -1384,7 +1392,6 @@ public class LootTrackerPlugin extends Plugin
|
|||||||
}
|
}
|
||||||
|
|
||||||
clearImported();
|
clearImported();
|
||||||
panel.toggleImportNotice(true);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void importLoot()
|
void importLoot()
|
||||||
@@ -1456,7 +1463,6 @@ public class LootTrackerPlugin extends Plugin
|
|||||||
SwingUtilities.invokeLater(() -> JOptionPane.showMessageDialog(panel, "Imported " + lootRecords.size() + " loot entries."));
|
SwingUtilities.invokeLater(() -> JOptionPane.showMessageDialog(panel, "Imported " + lootRecords.size() + " loot entries."));
|
||||||
|
|
||||||
setHasImported();
|
setHasImported();
|
||||||
panel.toggleImportNotice(false);
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Binary file not shown.
|
Before Width: | Height: | Size: 420 B |
Reference in New Issue
Block a user