clientui: remember sidebar state across restarts
Co-authored-by: Adam <Adam@sigterm.info>
This commit is contained in:
@@ -107,6 +107,7 @@ public class ClientUI
|
||||
private static final String CONFIG_GROUP = "runelite";
|
||||
private static final String CONFIG_CLIENT_BOUNDS = "clientBounds";
|
||||
private static final String CONFIG_CLIENT_MAXIMIZED = "clientMaximized";
|
||||
private static final String CONFIG_CLIENT_SIDEBAR_CLOSED = "clientSidebarClosed";
|
||||
private static final int CLIENT_WELL_HIDDEN_MARGIN = 160;
|
||||
private static final int CLIENT_WELL_HIDDEN_MARGIN_TOP = 10;
|
||||
public static final BufferedImage ICON = ImageUtil.getResourceStreamFromClass(ClientUI.class, "/runelite.png");
|
||||
@@ -477,7 +478,8 @@ public class ClientUI
|
||||
sidebarNavigationButton = NavigationButton
|
||||
.builder()
|
||||
.priority(100)
|
||||
.icon(sidebarClosedIcon)
|
||||
.icon(sidebarOpenIcon)
|
||||
.tooltip("Open SideBar")
|
||||
.onClick(this::toggleSidebar)
|
||||
.build();
|
||||
|
||||
@@ -487,7 +489,12 @@ public class ClientUI
|
||||
null);
|
||||
|
||||
titleToolbar.addComponent(sidebarNavigationButton, sidebarNavigationJButton);
|
||||
toggleSidebar();
|
||||
|
||||
// Open sidebar if the config closed state is unset
|
||||
if (configManager.getConfiguration(CONFIG_GROUP, CONFIG_CLIENT_SIDEBAR_CLOSED) == null)
|
||||
{
|
||||
toggleSidebar();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -875,6 +882,7 @@ public class ClientUI
|
||||
{
|
||||
sidebarNavigationJButton.setIcon(new ImageIcon(sidebarOpenIcon));
|
||||
sidebarNavigationJButton.setToolTipText("Open SideBar");
|
||||
configManager.setConfiguration(CONFIG_GROUP, CONFIG_CLIENT_SIDEBAR_CLOSED, true);
|
||||
|
||||
contract();
|
||||
|
||||
@@ -885,6 +893,7 @@ public class ClientUI
|
||||
{
|
||||
sidebarNavigationJButton.setIcon(new ImageIcon(sidebarClosedIcon));
|
||||
sidebarNavigationJButton.setToolTipText("Close SideBar");
|
||||
configManager.unsetConfiguration(CONFIG_GROUP, CONFIG_CLIENT_SIDEBAR_CLOSED);
|
||||
|
||||
// Try to restore last panel
|
||||
expand(currentNavButton);
|
||||
@@ -1097,15 +1106,8 @@ public class ClientUI
|
||||
}
|
||||
else
|
||||
{
|
||||
// Try to expand sidebar
|
||||
if (!sidebarOpen)
|
||||
{
|
||||
bounds.width += pluginToolbar.getWidth();
|
||||
}
|
||||
|
||||
if (config.automaticResizeType() == ExpandResizeType.KEEP_GAME_SIZE)
|
||||
{
|
||||
|
||||
// Try to contract plugin panel
|
||||
if (pluginPanel != null)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user