From a8cf657e4c7de2a31ef130fe321930e307dbfbb4 Mon Sep 17 00:00:00 2001 From: sdburns1998 <49877861+sdburns1998@users.noreply.github.com> Date: Fri, 5 Jul 2019 20:27:51 +0200 Subject: [PATCH] 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 --- .../java/net/runelite/client/RuneLite.java | 4 +-- .../client/plugins/info/InfoPanel.java | 30 +++++++++++++++--- .../client/plugins/info/folder_icon.png | Bin 0 -> 673 bytes .../client/plugins/info/wiki_icon.png | Bin 894 -> 0 bytes 4 files changed, 28 insertions(+), 6 deletions(-) create mode 100644 runelite-client/src/main/resources/net/runelite/client/plugins/info/folder_icon.png delete mode 100644 runelite-client/src/main/resources/net/runelite/client/plugins/info/wiki_icon.png diff --git a/runelite-client/src/main/java/net/runelite/client/RuneLite.java b/runelite-client/src/main/java/net/runelite/client/RuneLite.java index f4626b10a0..862ddd2981 100644 --- a/runelite-client/src/main/java/net/runelite/client/RuneLite.java +++ b/runelite-client/src/main/java/net/runelite/client/RuneLite.java @@ -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; diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/info/InfoPanel.java b/runelite-client/src/main/java/net/runelite/client/plugins/info/InfoPanel.java index c3157b9b85..6b71f552a6 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/info/InfoPanel.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/info/InfoPanel.java @@ -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. */ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/info/folder_icon.png b/runelite-client/src/main/resources/net/runelite/client/plugins/info/folder_icon.png new file mode 100644 index 0000000000000000000000000000000000000000..41aa88c301441011d8c5771b1636eefdf1932b54 GIT binary patch literal 673 zcmV;S0$%-zP)Px#1ZP1_K>z@;j|==^1poj532;bRa{vGf5&!@T5&_cPe*6Fc02p*dSaefwW^{L9 za%BK;VQFr3E^cLXAT%y9E;VFFSW*B00uo6?K~zXf?Uv0h1VI#q$Nx{TU?mbuvGWAN zLU;t>L0DtK){b}qds`tP#8U_xo`KEyPUqBgRZsWm8Dut2@+Eao-Fr*7n(Au&t4hsg za|!m~8s6Z;Xe>{2OHTi}XtoA-@Cqle0rM~d6R-%Ya0Jhw+%=bXFN(+E3|?RdhCEd% zat2}BHL4x=R6S8J3y*LGGqy7kmlBJ38dR$uv$i{n#7TI9Qy8?JiMS)Ni1qa9p4nw- z!npd#l#~qm%cg8)BCbtQcvGOB>$b{8!Z{?LMTz)Zioy$@#dBNLBB}BsAmO!9Cj9O$ z0uqUHE@->@)Dbn|>Z2ZWw(E%k-5}%3Ufa_bMUFmy%2kbO>pf|iDAtC10NqTEVH0!; z>3S{AEj#^R1vMI9i4o-ZMpb5@00000NkvXX Hu0mjfJlq{^ literal 0 HcmV?d00001 diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/info/wiki_icon.png b/runelite-client/src/main/resources/net/runelite/client/plugins/info/wiki_icon.png deleted file mode 100644 index ece6eea18efa998c9fc452cd0620d8a9d301e81e..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 894 zcmV-^1A+XBP)CmQP3&VHn1rZ+BfsadmN2B$Yy>ETk?GbTHF{3tkEj zk>bTehrQ@ci13&O5)lQZUF>2C5=sXtf{k=#I+jw~A94(|)zy?$bQiIw!+t~K?&$7n zcJYOQo%hf4`)22z?|XrxW+K%@k|zON1yB#*3;Op-YyD@l4}?7PgZIS5c8`Iw|mvWcWUg&Moe)n%=cE;OIyB*_;fbN8`m zm#m#6nV)J=Hc5@-eUi3xp(Y)h)X+#~$HxKgb+9OT4jxFBA4MC9v=46WZ`i5 zhtKD`?eTcrEiEl2nx;M2*w_e}a|Q+mu9-Al@}2MAa3se`HXHX{U0v1jV8b*`dpJ8g z`^GBP*VotB+1YvCq}xn#+|06>g69B~0T?oTZEbBs*u`uyv+Q)I)2Xz#w?8$xh5(dF z#!fJRMgW6Ch;75+a5xg0B2~-C$jC8%OU*&aNB~y@@a-3rg82YkvI18Em_9`CG=Ni9 zU=_epswzT=bieTs{_gKM$OiFyzqRq;WdH>S5ldo)l92!o0H``da20^hR^V{}wTB3< zl?(uY!xVT9V3g!7<6Cw(9LoIsygoBC^IB1q+^noD)$MkdBW{l;xxKQo@+}gHtVE;H zwe|J&a9rF5;5vXShA&=V9Ka(X#DKi#;^N}_U@-V05{ay>uCD%ESXj`75H=x%P*wF< zFc{RGPG@FuadElJYin!6D#!2l-;mtgK6zHb@Go)w?HDCjXZ~V7DSw794c+(MYPvD|QxVap$m?^y!&6?Ctw>GaAk> zCzEc*#@iB-8S*NTzHY|GTYu65hc`0m3qs Uhggg5>i_@%07*qoM6N<$f`>Voy8r+H