Add a button to the info panel to open the log dir (and fix the discord (#894)

* Add a button to the info panel to open the log dir (and fix the discord
invite link)

* Use user defined font

* Fix versionPanel layout

* Checkstyle
This commit is contained in:
sdburns1998
2019-07-05 20:27:51 +02:00
committed by Lucwousin
parent cce75860f2
commit a8cf657e4c
4 changed files with 28 additions and 6 deletions

View File

@@ -88,8 +88,8 @@ public class RuneLite
public static final File PROFILES_DIR = new File(RUNELITE_DIR, "profiles");
public static final File PLUGIN_DIR = new File(RUNELITE_DIR, "plugins");
public static final File SCREENSHOT_DIR = new File(RUNELITE_DIR, "screenshots");
static final RuneLiteSplashScreen splashScreen = new RuneLiteSplashScreen();
public static final File LOGS_DIR = new File(RUNELITE_DIR, "logs");
private static final RuneLiteSplashScreen splashScreen = new RuneLiteSplashScreen();
@Getter
private static Injector injector;

View File

@@ -30,10 +30,13 @@ import com.google.inject.Inject;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Cursor;
import java.awt.Desktop;
import java.awt.Font;
import java.awt.GridLayout;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.io.File;
import java.io.IOException;
import java.util.concurrent.ScheduledExecutorService;
import javax.annotation.Nullable;
import javax.inject.Singleton;
@@ -45,6 +48,7 @@ import javax.swing.JPanel;
import javax.swing.border.EmptyBorder;
import javax.swing.event.HyperlinkEvent;
import net.runelite.api.Client;
import static net.runelite.client.RuneLite.LOGS_DIR;
import net.runelite.client.RuneLiteProperties;
import net.runelite.client.account.SessionManager;
import net.runelite.client.config.ConfigManager;
@@ -65,9 +69,9 @@ public class InfoPanel extends PluginPanel
private static final ImageIcon ARROW_RIGHT_ICON;
private static final ImageIcon GITHUB_ICON;
private static final ImageIcon FOLDER_ICON;
private static final ImageIcon DISCORD_ICON;
private static final ImageIcon PATREON_ICON;
private static final ImageIcon WIKI_ICON;
private static final ImageIcon IMPORT_ICON;
private final JLabel loggedLabel = new JLabel();
@@ -98,9 +102,9 @@ public class InfoPanel extends PluginPanel
{
ARROW_RIGHT_ICON = new ImageIcon(ImageUtil.getResourceStreamFromClass(InfoPanel.class, "/util/arrow_right.png"));
GITHUB_ICON = new ImageIcon(ImageUtil.getResourceStreamFromClass(InfoPanel.class, "github_icon.png"));
FOLDER_ICON = new ImageIcon(ImageUtil.getResourceStreamFromClass(InfoPanel.class, "folder_icon.png"));
DISCORD_ICON = new ImageIcon(ImageUtil.getResourceStreamFromClass(InfoPanel.class, "discord_icon.png"));
PATREON_ICON = new ImageIcon(ImageUtil.getResourceStreamFromClass(InfoPanel.class, "patreon_icon.png"));
WIKI_ICON = new ImageIcon(ImageUtil.getResourceStreamFromClass(InfoPanel.class, "wiki_icon.png"));
IMPORT_ICON = new ImageIcon(ImageUtil.getResourceStreamFromClass(InfoPanel.class, "import_icon.png"));
}
@@ -161,7 +165,7 @@ public class InfoPanel extends PluginPanel
actionsContainer = new JPanel();
actionsContainer.setBorder(new EmptyBorder(10, 0, 0, 0));
actionsContainer.setLayout(new GridLayout(0, 1, 0, 10));
actionsContainer.setLayout(new GridLayout(5, 1, 0, 10));
syncPanel = buildLinkPanel(IMPORT_ICON, "Import local settings", "to remote RuneLite account", () ->
{
@@ -177,7 +181,8 @@ public 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(DISCORD_ICON, "Talk to us on our", "discord server", "https://discord.gg/s2fzu5U"));
actionsContainer.add(buildLinkPanel(FOLDER_ICON, "Open logs directory", "(for bug reports)", LOGS_DIR));
actionsContainer.add(buildLinkPanel(DISCORD_ICON, "Talk to us on our", "discord server", "https://discord.gg/HN5gf3m"));
actionsContainer.add(buildLinkPanel(PATREON_ICON, "Patreon to support", "the RuneLitePlus devs", runeLiteProperties.getPatreonLink()));
/* actionsContainer.add(buildLinkPanel(WIKI_ICON, "Information about", "RuneLite and plugins", runeLiteProperties.getWikiLink()));*/
@@ -188,6 +193,23 @@ public class InfoPanel extends PluginPanel
eventBus.register(this);
}
/**
* 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, () ->
{
try
{
Desktop.getDesktop().open(dir);
}
catch (IOException ex)
{
}
});
}
/**
* Builds a link panel with a given icon, text and url to redirect to.
*/

Binary file not shown.

After

Width:  |  Height:  |  Size: 673 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 894 B