Info: new info (#2129)
* Info: new info new info added: 1) Launcher download 2) Runelite DIR 3) Plugins DIR 4) Screenshots DIR physical path details: 1) Runelite Directory 2) Log Directory 3) Plugins Directory 4) Screenshot Directory added config options to turn on/off: 1) Show the Github info. 2) Show the Launcher info. 3) show the Log Directory. 4) Show the Runelite Directory. 5) Show the Plugins Directory. 6) Show the Screenshot Directory. 6) Show the Physical Directory information.
This commit is contained in:
@@ -93,24 +93,20 @@ public class RuneLite
|
|||||||
public static final File PLUGIN_DIR = new File(RUNELITE_DIR, "plugins");
|
public static final File PLUGIN_DIR = new File(RUNELITE_DIR, "plugins");
|
||||||
public static final File SCREENSHOT_DIR = new File(RUNELITE_DIR, "screenshots");
|
public static final File SCREENSHOT_DIR = new File(RUNELITE_DIR, "screenshots");
|
||||||
public static final File LOGS_DIR = new File(RUNELITE_DIR, "logs");
|
public static final File LOGS_DIR = new File(RUNELITE_DIR, "logs");
|
||||||
|
public static final File PLUGINS_DIR = new File(RUNELITE_DIR, "plugins");
|
||||||
public static final Locale SYSTEM_LOCALE = Locale.getDefault();
|
public static final Locale SYSTEM_LOCALE = Locale.getDefault();
|
||||||
public static boolean allowPrivateServer = false;
|
public static boolean allowPrivateServer = false;
|
||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
private static Injector injector;
|
private static Injector injector;
|
||||||
|
|
||||||
@Inject
|
|
||||||
private PluginManager pluginManager;
|
|
||||||
|
|
||||||
@Inject
|
|
||||||
private ConfigManager configManager;
|
|
||||||
|
|
||||||
@Inject
|
|
||||||
private SessionManager sessionManager;
|
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
public DiscordService discordService;
|
public DiscordService discordService;
|
||||||
|
@Inject
|
||||||
|
private PluginManager pluginManager;
|
||||||
|
@Inject
|
||||||
|
private ConfigManager configManager;
|
||||||
|
@Inject
|
||||||
|
private SessionManager sessionManager;
|
||||||
@Inject
|
@Inject
|
||||||
private ClientSessionManager clientSessionManager;
|
private ClientSessionManager clientSessionManager;
|
||||||
|
|
||||||
@@ -310,6 +306,12 @@ public class RuneLite
|
|||||||
log.info("Client initialization took {}ms. Uptime: {}ms", end - start, uptime);
|
log.info("Client initialization took {}ms. Uptime: {}ms", end - start, uptime);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@VisibleForTesting
|
||||||
|
public static void setInjector(Injector injector)
|
||||||
|
{
|
||||||
|
RuneLite.injector = injector;
|
||||||
|
}
|
||||||
|
|
||||||
private void start() throws Exception
|
private void start() throws Exception
|
||||||
{
|
{
|
||||||
// Load RuneLite or Vanilla client
|
// Load RuneLite or Vanilla client
|
||||||
@@ -405,10 +407,4 @@ public class RuneLite
|
|||||||
clientSessionManager.shutdown();
|
clientSessionManager.shutdown();
|
||||||
discordService.close();
|
discordService.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
@VisibleForTesting
|
|
||||||
public static void setInjector(Injector injector)
|
|
||||||
{
|
|
||||||
RuneLite.injector = injector;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,87 @@
|
|||||||
|
package net.runelite.client.plugins.info;
|
||||||
|
|
||||||
|
import net.runelite.client.config.Config;
|
||||||
|
import net.runelite.client.config.ConfigGroup;
|
||||||
|
import net.runelite.client.config.ConfigItem;
|
||||||
|
|
||||||
|
@ConfigGroup("info")
|
||||||
|
public interface InfoConfig extends Config
|
||||||
|
{
|
||||||
|
@ConfigItem(
|
||||||
|
keyName = "showGithub",
|
||||||
|
name = "Show the OpenOSRS Github",
|
||||||
|
description = "Configures if you want to show the OpenOSRS Github or not.",
|
||||||
|
position = 0
|
||||||
|
)
|
||||||
|
default boolean showGithub()
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@ConfigItem(
|
||||||
|
keyName = "showLauncher",
|
||||||
|
name = "Show the Launcher download",
|
||||||
|
description = "Configures if you want to show the OpenOSRS Launcher download or not.",
|
||||||
|
position = 1
|
||||||
|
)
|
||||||
|
default boolean showLauncher()
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@ConfigItem(
|
||||||
|
keyName = "showLogDir",
|
||||||
|
name = "Show Log Directory",
|
||||||
|
description = "Configures if you want to show the Log Directory or not.",
|
||||||
|
position = 2
|
||||||
|
)
|
||||||
|
default boolean showLogDir()
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@ConfigItem(
|
||||||
|
keyName = "showRuneliteDir",
|
||||||
|
name = "Show Runelite Directory",
|
||||||
|
description = "Configures if you want to show the Runelite directory or not.",
|
||||||
|
position = 3
|
||||||
|
)
|
||||||
|
default boolean showRuneliteDir()
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@ConfigItem(
|
||||||
|
keyName = "showPluginsDir",
|
||||||
|
name = "Show Plugins Directory",
|
||||||
|
description = "Configures if you want to show the Plugins Directory or not.",
|
||||||
|
position = 4
|
||||||
|
)
|
||||||
|
default boolean showPluginsDir()
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@ConfigItem(
|
||||||
|
keyName = "showScreenshotsDir",
|
||||||
|
name = "Show Screenshots Directory",
|
||||||
|
description = "Configures if you want to show the Screenshots Directory or not.",
|
||||||
|
position = 5
|
||||||
|
)
|
||||||
|
default boolean showScreenshotsDir()
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@ConfigItem(
|
||||||
|
keyName = "showPhysicalDir",
|
||||||
|
name = "Show Physical Locations",
|
||||||
|
description = "Configures if you want to show the Physical Directory Locations or not.",
|
||||||
|
position = 6
|
||||||
|
)
|
||||||
|
default boolean showPhysicalDir()
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -43,6 +43,9 @@ import javax.swing.JPanel;
|
|||||||
import javax.swing.border.EmptyBorder;
|
import javax.swing.border.EmptyBorder;
|
||||||
import net.runelite.api.Client;
|
import net.runelite.api.Client;
|
||||||
import static net.runelite.client.RuneLite.LOGS_DIR;
|
import static net.runelite.client.RuneLite.LOGS_DIR;
|
||||||
|
import static net.runelite.client.RuneLite.PLUGINS_DIR;
|
||||||
|
import static net.runelite.client.RuneLite.RUNELITE_DIR;
|
||||||
|
import static net.runelite.client.RuneLite.SCREENSHOT_DIR;
|
||||||
import net.runelite.client.RuneLiteProperties;
|
import net.runelite.client.RuneLiteProperties;
|
||||||
import net.runelite.client.config.ConfigManager;
|
import net.runelite.client.config.ConfigManager;
|
||||||
import net.runelite.client.ui.ColorScheme;
|
import net.runelite.client.ui.ColorScheme;
|
||||||
@@ -60,15 +63,10 @@ class InfoPanel extends PluginPanel
|
|||||||
private static final ImageIcon DISCORD_ICON;
|
private static final ImageIcon DISCORD_ICON;
|
||||||
private static final ImageIcon PATREON_ICON;
|
private static final ImageIcon PATREON_ICON;
|
||||||
private static final ImageIcon IMPORT_ICON;
|
private static final ImageIcon IMPORT_ICON;
|
||||||
|
private static final String RUNELITE_DIRECTORY = System.getProperty("user.home") + "\\.runelite";
|
||||||
private JPanel syncPanel;
|
private static final String LOG_DIRECTORY = RUNELITE_DIRECTORY + "\\logs";
|
||||||
|
private static final String PLUGINS_DIRECTORY = RUNELITE_DIRECTORY + "\\plugins";
|
||||||
@Inject
|
private static final String SCREENSHOT_DIRECTORY = RUNELITE_DIRECTORY + "\\screenshots";
|
||||||
@Nullable
|
|
||||||
private Client client;
|
|
||||||
|
|
||||||
@Inject
|
|
||||||
private ConfigManager configManager;
|
|
||||||
|
|
||||||
static
|
static
|
||||||
{
|
{
|
||||||
@@ -80,8 +78,19 @@ class InfoPanel extends PluginPanel
|
|||||||
IMPORT_ICON = new ImageIcon(ImageUtil.getResourceStreamFromClass(InfoPanel.class, "import_icon.png"));
|
IMPORT_ICON = new ImageIcon(ImageUtil.getResourceStreamFromClass(InfoPanel.class, "import_icon.png"));
|
||||||
}
|
}
|
||||||
|
|
||||||
void init()
|
private JPanel syncPanel;
|
||||||
|
@Inject
|
||||||
|
@Nullable
|
||||||
|
private Client client;
|
||||||
|
@Inject
|
||||||
|
private ConfigManager configManager;
|
||||||
|
@Inject
|
||||||
|
private InfoPlugin plugin;
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
public InfoPanel(final InfoPlugin plugin, final Client client)
|
||||||
{
|
{
|
||||||
|
|
||||||
setLayout(new BorderLayout());
|
setLayout(new BorderLayout());
|
||||||
setBackground(ColorScheme.DARK_GRAY_COLOR);
|
setBackground(ColorScheme.DARK_GRAY_COLOR);
|
||||||
setBorder(new EmptyBorder(10, 10, 10, 10));
|
setBorder(new EmptyBorder(10, 10, 10, 10));
|
||||||
@@ -115,8 +124,8 @@ class InfoPanel extends PluginPanel
|
|||||||
versionPanel.add(revision);
|
versionPanel.add(revision);
|
||||||
|
|
||||||
JPanel actionsContainer = new JPanel();
|
JPanel actionsContainer = new JPanel();
|
||||||
actionsContainer.setBorder(new EmptyBorder(10, 0, 0, 0));
|
actionsContainer.setBorder(new EmptyBorder(10, 0, 10, 0));
|
||||||
actionsContainer.setLayout(new GridLayout(5, 1, 0, 10));
|
actionsContainer.setLayout(new GridLayout(9, 1, 0, 10));
|
||||||
|
|
||||||
syncPanel = buildLinkPanel(IMPORT_ICON, "Import local settings", "to remote RuneLite account", () ->
|
syncPanel = buildLinkPanel(IMPORT_ICON, "Import local settings", "to remote RuneLite account", () ->
|
||||||
{
|
{
|
||||||
@@ -131,22 +140,63 @@ class InfoPanel extends PluginPanel
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
actionsContainer.add(buildLinkPanel(GITHUB_ICON, "License info", "for distribution", "https://github.com/runelite-extended/runelite/blob/master/LICENSE"));
|
actionsContainer.add(buildLinkPanel(GITHUB_ICON, "License info", "for distribution", "https://github.com/open-osrs/runelite/blob/master/LICENSE"));
|
||||||
actionsContainer.add(buildLinkPanel(FOLDER_ICON, "Open logs directory", "(for bug reports)", LOGS_DIR));
|
actionsContainer.add(buildLinkPanel(PATREON_ICON, "Patreon to support", "the OpenOSRS Devs", RuneLiteProperties.getPatreonLink()));
|
||||||
actionsContainer.add(buildLinkPanel(DISCORD_ICON, "Talk to us on our", "discord server", "https://discord.gg/HN5gf3m"));
|
actionsContainer.add(buildLinkPanel(DISCORD_ICON, "Talk to us on our", "Discord Server", "https://discord.gg/OpenOSRS"));
|
||||||
actionsContainer.add(buildLinkPanel(PATREON_ICON, "Patreon to support", "the OpenOSRS devs", RuneLiteProperties.getPatreonLink()));
|
if (plugin.isShowGithub())
|
||||||
/* actionsContainer.add(buildLinkPanel(WIKI_ICON, "Information about", "RuneLite and plugins", runeLiteProperties.getWikiLink()));*/
|
{
|
||||||
|
actionsContainer.add(buildLinkPanel(GITHUB_ICON, "OpenOSRS Github", "", "https://github.com/open-osrs"));
|
||||||
|
}
|
||||||
|
if (plugin.isShowLauncher())
|
||||||
|
{
|
||||||
|
actionsContainer.add(buildLinkPanel(IMPORT_ICON, "Launcher Download", "for the latest launcher", "https://github.com/open-osrs/launcher/releases"));
|
||||||
|
}
|
||||||
|
if (plugin.isShowRuneliteDir())
|
||||||
|
{
|
||||||
|
actionsContainer.add(buildLinkPanel(FOLDER_ICON, "Open Runelite Directory", "for your .properties file", RUNELITE_DIR));
|
||||||
|
}
|
||||||
|
if (plugin.isShowLogDir())
|
||||||
|
{
|
||||||
|
actionsContainer.add(buildLinkPanel(FOLDER_ICON, "Open Logs Directory", "for bug reports", LOGS_DIR));
|
||||||
|
}
|
||||||
|
if (plugin.isShowPluginsDir())
|
||||||
|
{
|
||||||
|
actionsContainer.add(buildLinkPanel(FOLDER_ICON, "Open Plugins Directory", "for external plugins", PLUGINS_DIR));
|
||||||
|
}
|
||||||
|
if (plugin.isShowScreenshotsDir())
|
||||||
|
{
|
||||||
|
actionsContainer.add(buildLinkPanel(FOLDER_ICON, "Open Screenshots Directory", "for your screenshots", SCREENSHOT_DIR));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (plugin.isShowPhysicalDir())
|
||||||
|
{
|
||||||
|
JPanel pathPanel = new JPanel();
|
||||||
|
pathPanel.setBackground(ColorScheme.DARKER_GRAY_COLOR);
|
||||||
|
pathPanel.setBorder(new EmptyBorder(10, 10, 10, 10));
|
||||||
|
pathPanel.setLayout(new GridLayout(0, 1));
|
||||||
|
|
||||||
|
JLabel rldirectory = new JLabel(htmlLabel("Runelite Directory: ", RUNELITE_DIRECTORY));
|
||||||
|
rldirectory.setFont(smallFont);
|
||||||
|
|
||||||
|
JLabel logdirectory = new JLabel(htmlLabel("Log Directory: ", LOG_DIRECTORY));
|
||||||
|
logdirectory.setFont(smallFont);
|
||||||
|
|
||||||
|
JLabel pluginsdirectory = new JLabel(htmlLabel("Plugins Directory: ", PLUGINS_DIRECTORY));
|
||||||
|
pluginsdirectory.setFont(smallFont);
|
||||||
|
|
||||||
|
JLabel screenshotsdirectory = new JLabel(htmlLabel("Screenshot Directory: ", SCREENSHOT_DIRECTORY));
|
||||||
|
screenshotsdirectory.setFont(smallFont);
|
||||||
|
|
||||||
|
pathPanel.add(rldirectory);
|
||||||
|
pathPanel.add(logdirectory);
|
||||||
|
pathPanel.add(pluginsdirectory);
|
||||||
|
pathPanel.add(screenshotsdirectory);
|
||||||
|
|
||||||
|
add(pathPanel, BorderLayout.SOUTH);
|
||||||
|
}
|
||||||
add(versionPanel, BorderLayout.NORTH);
|
add(versionPanel, BorderLayout.NORTH);
|
||||||
add(actionsContainer, BorderLayout.CENTER);
|
add(actionsContainer, BorderLayout.CENTER);
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Builds a link panel with a given icon, text and directory to open.
|
|
||||||
*/
|
|
||||||
private JPanel buildLinkPanel(ImageIcon icon, String topText, String bottomText, File dir)
|
|
||||||
{
|
|
||||||
return buildLinkPanel(icon, topText, bottomText, () -> LinkBrowser.openLocalFile(dir));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -235,4 +285,12 @@ class InfoPanel extends PluginPanel
|
|||||||
{
|
{
|
||||||
return "<html><body style = 'color:#a5a5a5'>" + key + "<span style = 'color:white'>" + value + "</span></body></html>";
|
return "<html><body style = 'color:#a5a5a5'>" + key + "<span style = 'color:white'>" + value + "</span></body></html>";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Builds a link panel with a given icon, text and directory to open.
|
||||||
|
*/
|
||||||
|
private JPanel buildLinkPanel(ImageIcon icon, String topText, String bottomText, File dir)
|
||||||
|
{
|
||||||
|
return buildLinkPanel(icon, topText, bottomText, () -> LinkBrowser.openLocalFile(dir));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -24,9 +24,15 @@
|
|||||||
*/
|
*/
|
||||||
package net.runelite.client.plugins.info;
|
package net.runelite.client.plugins.info;
|
||||||
|
|
||||||
|
import com.google.inject.Provides;
|
||||||
import java.awt.image.BufferedImage;
|
import java.awt.image.BufferedImage;
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
import javax.inject.Singleton;
|
import javax.inject.Singleton;
|
||||||
|
import lombok.AccessLevel;
|
||||||
|
import lombok.Getter;
|
||||||
|
import net.runelite.client.config.ConfigManager;
|
||||||
|
import net.runelite.client.eventbus.Subscribe;
|
||||||
|
import net.runelite.client.events.ConfigChanged;
|
||||||
import net.runelite.client.plugins.Plugin;
|
import net.runelite.client.plugins.Plugin;
|
||||||
import net.runelite.client.plugins.PluginDescriptor;
|
import net.runelite.client.plugins.PluginDescriptor;
|
||||||
import net.runelite.client.ui.ClientToolbar;
|
import net.runelite.client.ui.ClientToolbar;
|
||||||
@@ -36,22 +42,58 @@ import net.runelite.client.util.ImageUtil;
|
|||||||
@PluginDescriptor(
|
@PluginDescriptor(
|
||||||
name = "Info Panel",
|
name = "Info Panel",
|
||||||
description = "Enable the Info panel",
|
description = "Enable the Info panel",
|
||||||
|
tags = {"info", "github", "patreon", "dir", "discord"},
|
||||||
loadWhenOutdated = true
|
loadWhenOutdated = true
|
||||||
)
|
)
|
||||||
@Singleton
|
@Singleton
|
||||||
public class InfoPlugin extends Plugin
|
public class InfoPlugin extends Plugin
|
||||||
{
|
{
|
||||||
|
@Getter(AccessLevel.PACKAGE)
|
||||||
|
private boolean showLogDir;
|
||||||
|
@Getter(AccessLevel.PACKAGE)
|
||||||
|
private boolean showRuneliteDir;
|
||||||
|
@Getter(AccessLevel.PACKAGE)
|
||||||
|
private boolean showPluginsDir;
|
||||||
|
@Getter(AccessLevel.PACKAGE)
|
||||||
|
private boolean showScreenshotsDir;
|
||||||
|
@Getter(AccessLevel.PACKAGE)
|
||||||
|
private boolean showGithub;
|
||||||
|
@Getter(AccessLevel.PACKAGE)
|
||||||
|
private boolean showLauncher;
|
||||||
|
@Getter(AccessLevel.PACKAGE)
|
||||||
|
private boolean showPhysicalDir;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
private ClientToolbar clientToolbar;
|
private ClientToolbar clientToolbar;
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
private InfoConfig config;
|
||||||
|
|
||||||
private NavigationButton navButton;
|
private NavigationButton navButton;
|
||||||
|
|
||||||
|
@Provides
|
||||||
|
InfoConfig provideConfig(ConfigManager configManager)
|
||||||
|
{
|
||||||
|
return configManager.getConfig(InfoConfig.class);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Subscribe
|
||||||
|
private void onConfigChanged(ConfigChanged event)
|
||||||
|
{
|
||||||
|
if (!event.getGroup().equals("info"))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
updateConfig();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void startUp()
|
protected void startUp()
|
||||||
{
|
{
|
||||||
|
updateConfig();
|
||||||
|
|
||||||
InfoPanel panel = injector.getInstance(InfoPanel.class);
|
InfoPanel panel = injector.getInstance(InfoPanel.class);
|
||||||
panel.init();
|
|
||||||
|
|
||||||
final BufferedImage icon = ImageUtil.getResourceStreamFromClass(getClass(), "info_icon.png");
|
final BufferedImage icon = ImageUtil.getResourceStreamFromClass(getClass(), "info_icon.png");
|
||||||
|
|
||||||
@@ -70,4 +112,15 @@ public class InfoPlugin extends Plugin
|
|||||||
{
|
{
|
||||||
clientToolbar.removeNavigation(navButton);
|
clientToolbar.removeNavigation(navButton);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
private void updateConfig()
|
||||||
|
{
|
||||||
|
this.showGithub = config.showGithub();
|
||||||
|
this.showLauncher = config.showLauncher();
|
||||||
|
this.showLogDir = config.showLogDir();
|
||||||
|
this.showRuneliteDir = config.showRuneliteDir();
|
||||||
|
this.showPluginsDir = config.showPluginsDir();
|
||||||
|
this.showScreenshotsDir = config.showScreenshotsDir();
|
||||||
|
this.showPhysicalDir = config.showPhysicalDir();
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user