From e1c2d7bd2c98a1dc472d466f7215e65d9388e466 Mon Sep 17 00:00:00 2001 From: Reinhard Pointner Date: Fri, 25 Mar 2016 08:16:15 +0000 Subject: [PATCH] Include "Where is FileBot Subtitles?" help link for MAS users --- source/net/filebot/Settings.java | 23 --------------- source/net/filebot/ui/FileBotMenuBar.java | 34 ++++++++++++++++++----- 2 files changed, 27 insertions(+), 30 deletions(-) diff --git a/source/net/filebot/Settings.java b/source/net/filebot/Settings.java index 9b1275e2..55219da3 100644 --- a/source/net/filebot/Settings.java +++ b/source/net/filebot/Settings.java @@ -5,9 +5,7 @@ import static net.filebot.util.FileUtilities.*; import java.awt.GraphicsEnvironment; import java.io.File; -import java.util.LinkedHashMap; import java.util.Locale; -import java.util.Map; import java.util.MissingResourceException; import java.util.ResourceBundle; import java.util.logging.Level; @@ -162,27 +160,6 @@ public final class Settings { return getApplicationProperty("link.app.help") + '#' + getApplicationDeployment(); } - public static Map getHelpURIs() { - Map links = new LinkedHashMap(); - - links.put("Getting Started", getApplicationProperty("link.intro")); - links.put("FAQ", getApplicationProperty("link.faq")); - links.put("Forums", getApplicationProperty("link.forums")); - - if (isMacSandbox()) { - links.put("Report Bugs", getApplicationProperty("link.help.mas")); - links.put("Request Help", getApplicationProperty("link.help.mas")); - } else { - links.put("Report Bugs", getApplicationProperty("link.bugs")); - links.put("Request Help", getApplicationProperty("link.help")); - } - - links.put("Contact us on Twitter", getApplicationProperty("link.twitter")); - links.put("Contact us on Facebook", getApplicationProperty("link.facebook")); - - return links; - } - public static String getApplicationIdentifier() { return String.format("%s %s (r%d)", getApplicationName(), getApplicationVersion(), getApplicationRevisionNumber()); } diff --git a/source/net/filebot/ui/FileBotMenuBar.java b/source/net/filebot/ui/FileBotMenuBar.java index 018cb8dc..88d98f2e 100644 --- a/source/net/filebot/ui/FileBotMenuBar.java +++ b/source/net/filebot/ui/FileBotMenuBar.java @@ -1,6 +1,7 @@ package net.filebot.ui; import static net.filebot.Logging.*; +import static net.filebot.Settings.*; import static net.filebot.util.ui.SwingUI.*; import java.awt.Desktop; @@ -11,25 +12,44 @@ import javax.swing.Action; import javax.swing.JMenu; import javax.swing.JMenuBar; -import net.filebot.Settings; - public class FileBotMenuBar { public static JMenuBar createHelp() { JMenu help = new JMenu("Help"); - Settings.getHelpURIs().forEach((title, uri) -> { - help.add(createLink(title, URI.create(uri))); - }); + + help.add(createLink("Getting Started", getApplicationProperty("link.intro"))); + help.add(createLink("FAQ", getApplicationProperty("link.faq"))); + help.add(createLink("Forums", getApplicationProperty("link.forums"))); + + help.addSeparator(); + + if (isMacSandbox()) { + help.add(createLink("Report Bugs", getApplicationProperty("link.help.mas"))); + help.add(createLink("Request Help", getApplicationProperty("link.help.mas"))); + } else { + help.add(createLink("Report Bugs", getApplicationProperty("link.bugs"))); + help.add(createLink("Request Help", getApplicationProperty("link.help"))); + } + + help.addSeparator(); + + help.add(createLink("Contact us on Twitter", getApplicationProperty("link.twitter"))); + help.add(createLink("Contact us on Facebook", getApplicationProperty("link.facebook"))); + + if (isMacSandbox()) { + help.addSeparator(); + help.add(createLink("Where is FileBot Subtitles?", "https://bit.ly/filebot-subtitles")); + } JMenuBar menuBar = new JMenuBar(); menuBar.add(help); return menuBar; } - private static Action createLink(final String title, final URI uri) { + private static Action createLink(final String title, final String uri) { return newAction(title, null, evt -> { try { - Desktop.getDesktop().browse(uri); + Desktop.getDesktop().browse(URI.create(uri)); } catch (Exception e) { debug.log(Level.SEVERE, "Failed to open URI: " + uri, e); }