Simplify how users can open the log file when we need it

This commit is contained in:
friarsol
2024-01-07 23:16:10 -05:00
committed by Chris H
parent 4888e016e9
commit 0fd99618c1
3 changed files with 23 additions and 7 deletions

View File

@@ -57,8 +57,7 @@ public final class HelpMenu {
private static JMenu getMenu_Troubleshooting() { private static JMenu getMenu_Troubleshooting() {
final Localizer localizer = Localizer.getInstance(); final Localizer localizer = Localizer.getInstance();
JMenu mnu = new JMenu(localizer.getMessage("lblTroubleshooting")); JMenu mnu = new JMenu(localizer.getMessage("lblTroubleshooting"));
mnu.add(getMenuItem_UrlLink("How to Provide a Useful Bug Report", "http://www.slightlymagic.net/forum/viewtopic.php?f=26&t=9621")); mnu.add(getMenuItem_OpenLogFile());
mnu.addSeparator();
mnu.add(getMenuItem_ReadMeFile()); mnu.add(getMenuItem_ReadMeFile());
return mnu; return mnu;
} }
@@ -76,8 +75,8 @@ public final class HelpMenu {
JMenu mnu = new JMenu(localizer.getMessage("lblGettingStarted")); JMenu mnu = new JMenu(localizer.getMessage("lblGettingStarted"));
mnu.add(getMenuItem_HowToPlayFile()); mnu.add(getMenuItem_HowToPlayFile());
mnu.addSeparator(); mnu.addSeparator();
mnu.add(getMenuItem_UrlLink("Forge Wiki", "http://www.slightlymagic.net/wiki/Forge", KeyStroke.getKeyStroke(KeyEvent.VK_F1, 0))); mnu.add(getMenuItem_UrlLink("Forge Wiki", "https://github.com/Card-Forge/forge/wiki", KeyStroke.getKeyStroke(KeyEvent.VK_F1, 0)));
mnu.add(getMenuItem_UrlLink("What is Forge?", "http://www.slightlymagic.net/forum/viewtopic.php?f=26&t=468")); mnu.add(getMenuItem_UrlLink("What is Forge?", "https://github.com/Card-Forge/forge/wiki#what-is-forge"));
return mnu; return mnu;
} }
@@ -94,6 +93,13 @@ public final class HelpMenu {
return menuItem; return menuItem;
} }
private static JMenuItem getMenuItem_OpenLogFile() {
final Localizer localizer = Localizer.getInstance();
JMenuItem menuItem = new JMenuItem(localizer.getMessage("lblOpenLogFile"));
menuItem.addActionListener(getOpenFileAction(getAbsoluteFile(ForgeConstants.LOG_FILE)));
return menuItem;
}
private static JMenuItem getMenuItem_License() { private static JMenuItem getMenuItem_License() {
final Localizer localizer = Localizer.getInstance(); final Localizer localizer = Localizer.getInstance();
JMenuItem menuItem = new JMenuItem(localizer.getMessage("lblForgeLicense")); JMenuItem menuItem = new JMenuItem(localizer.getMessage("lblForgeLicense"));
@@ -132,6 +138,14 @@ public final class HelpMenu {
return file; return file;
} }
protected static File getAbsoluteFile(String filename) {
File file = null;
if (FileUtil.doesFileExist(filename)) {
file = new File(filename);
}
return file;
}
/** /**
* @see http://stackoverflow.com/questions/6273221/open-a-text-file-in-the-default-text-editor-via-java * @see http://stackoverflow.com/questions/6273221/open-a-text-file-in-the-default-text-editor-via-java
*/ */

View File

@@ -256,7 +256,7 @@ lblYoureRunning=You''re running
lblYouNeedAtLeastJavaVersion=You need at least version 1.8.0_101. lblYouNeedAtLeastJavaVersion=You need at least version 1.8.0_101.
lblImportPictures=Import data from a local directory. lblImportPictures=Import data from a local directory.
lblReportBug=Something broken? lblReportBug=Something broken?
lblHowToPlay=Rules of the Game. lblHowToPlay=How to Play
lblLicensing=Forge legal. lblLicensing=Forge legal.
ContentDownloaders=Content Downloaders ContentDownloaders=Content Downloaders
ReleaseNotes=Release Notes ReleaseNotes=Release Notes
@@ -344,6 +344,7 @@ lblTroubleshooting=Troubleshooting
lblArticles=Articles lblArticles=Articles
lblGettingStarted=Getting Started lblGettingStarted=Getting Started
lblHowtoPlay=How to Play lblHowtoPlay=How to Play
lblOpenLogFile=Open Log File
lblForgeLicense=Forge License lblForgeLicense=Forge License
lblReleaseNotes=Release Notes lblReleaseNotes=Release Notes
#GameMenu.java #GameMenu.java

View File

@@ -110,9 +110,10 @@ public final class FModel {
//Device //Device
if (GuiBase.isAndroid()) //todo get device on other mobile platforms if (GuiBase.isAndroid()) //todo get device on other mobile platforms
System.out.println(GuiBase.getDeviceName() + " (RAM: " + GuiBase.getDeviceRAM() + "MB, Android " + GuiBase.getAndroidRelease() + " API Level " + GuiBase.getAndroidAPILevel() + ")"); System.out.println(GuiBase.getDeviceName() + " (RAM: " + GuiBase.getDeviceRAM() + "MB, Android " + GuiBase.getAndroidRelease() + " API Level " + GuiBase.getAndroidAPILevel() + ")");
else else {
System.out.println(System.getProperty("os.name") + " (" + System.getProperty("os.version") + " " + System.getProperty("os.arch") + ")"); System.out.println(System.getProperty("os.name") + " (" + System.getProperty("os.version") + " " + System.getProperty("os.arch") + ")");
System.out.println("Java Version - " + RuntimeVersion.of(System.getProperty("java.version")).toString());
}
ImageKeys.initializeDirs( ImageKeys.initializeDirs(
ForgeConstants.CACHE_CARD_PICS_DIR, ForgeConstants.CACHE_CARD_PICS_SUBDIR, ForgeConstants.CACHE_CARD_PICS_DIR, ForgeConstants.CACHE_CARD_PICS_SUBDIR,
ForgeConstants.CACHE_TOKEN_PICS_DIR, ForgeConstants.CACHE_ICON_PICS_DIR, ForgeConstants.CACHE_TOKEN_PICS_DIR, ForgeConstants.CACHE_ICON_PICS_DIR,