Skip to content

Commit

Permalink
Simplify how users can open the log file when we need it
Browse files Browse the repository at this point in the history
  • Loading branch information
tehdiplomat committed Jan 22, 2024
1 parent 4888e01 commit 0fd9961
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 7 deletions.
22 changes: 18 additions & 4 deletions forge-gui-desktop/src/main/java/forge/menus/HelpMenu.java
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,7 @@ public void actionPerformed(ActionEvent e) {
private static JMenu getMenu_Troubleshooting() {
final Localizer localizer = Localizer.getInstance();
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.addSeparator();
mnu.add(getMenuItem_OpenLogFile());
mnu.add(getMenuItem_ReadMeFile());
return mnu;
}
Expand All @@ -76,8 +75,8 @@ private static JMenu getMenu_GettingStarted() {
JMenu mnu = new JMenu(localizer.getMessage("lblGettingStarted"));
mnu.add(getMenuItem_HowToPlayFile());
mnu.addSeparator();
mnu.add(getMenuItem_UrlLink("Forge Wiki", "http://www.slightlymagic.net/wiki/Forge", 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("Forge Wiki", "https://github.com/Card-Forge/forge/wiki", KeyStroke.getKeyStroke(KeyEvent.VK_F1, 0)));
mnu.add(getMenuItem_UrlLink("What is Forge?", "https://github.com/Card-Forge/forge/wiki#what-is-forge"));
return mnu;
}

Expand All @@ -94,6 +93,13 @@ private static JMenuItem getMenuItem_ReadMeFile() {
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() {
final Localizer localizer = Localizer.getInstance();
JMenuItem menuItem = new JMenuItem(localizer.getMessage("lblForgeLicense"));
Expand Down Expand Up @@ -132,6 +138,14 @@ protected static File getFile(String filename) {
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
*/
Expand Down
3 changes: 2 additions & 1 deletion forge-gui/res/languages/en-US.properties
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ lblYoureRunning=You''re running
lblYouNeedAtLeastJavaVersion=You need at least version 1.8.0_101.
lblImportPictures=Import data from a local directory.
lblReportBug=Something broken?
lblHowToPlay=Rules of the Game.
lblHowToPlay=How to Play
lblLicensing=Forge legal.
ContentDownloaders=Content Downloaders
ReleaseNotes=Release Notes
Expand Down Expand Up @@ -344,6 +344,7 @@ lblTroubleshooting=Troubleshooting
lblArticles=Articles
lblGettingStarted=Getting Started
lblHowtoPlay=How to Play
lblOpenLogFile=Open Log File
lblForgeLicense=Forge License
lblReleaseNotes=Release Notes
#GameMenu.java
Expand Down
5 changes: 3 additions & 2 deletions forge-gui/src/main/java/forge/model/FModel.java
Original file line number Diff line number Diff line change
Expand Up @@ -110,9 +110,10 @@ public static void initialize(final IProgressBar progressBar, Function<ForgePref
//Device
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() + ")");
else
else {
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(
ForgeConstants.CACHE_CARD_PICS_DIR, ForgeConstants.CACHE_CARD_PICS_SUBDIR,
ForgeConstants.CACHE_TOKEN_PICS_DIR, ForgeConstants.CACHE_ICON_PICS_DIR,
Expand Down

0 comments on commit 0fd9961

Please sign in to comment.