Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 2 commits into from
Jan 22, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@ -254,7 +254,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 @@ -342,6 +342,7 @@ lblTroubleshooting=Troubleshooting
lblArticles=Articles
lblGettingStarted=Getting Started
lblHowtoPlay=How to Play
lblOpenLogFile=Open Log File
tehdiplomat marked this conversation as resolved.
Show resolved Hide resolved
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