1
0
mirror of https://github.com/mitb-archive/filebot synced 2024-12-24 16:58:51 -05:00

Include "Where is FileBot Subtitles?" help link for MAS users

This commit is contained in:
Reinhard Pointner 2016-03-25 08:16:15 +00:00
parent bcec36bf79
commit e1c2d7bd2c
2 changed files with 27 additions and 30 deletions

View File

@ -5,9 +5,7 @@ import static net.filebot.util.FileUtilities.*;
import java.awt.GraphicsEnvironment; import java.awt.GraphicsEnvironment;
import java.io.File; import java.io.File;
import java.util.LinkedHashMap;
import java.util.Locale; import java.util.Locale;
import java.util.Map;
import java.util.MissingResourceException; import java.util.MissingResourceException;
import java.util.ResourceBundle; import java.util.ResourceBundle;
import java.util.logging.Level; import java.util.logging.Level;
@ -162,27 +160,6 @@ public final class Settings {
return getApplicationProperty("link.app.help") + '#' + getApplicationDeployment(); return getApplicationProperty("link.app.help") + '#' + getApplicationDeployment();
} }
public static Map<String, String> getHelpURIs() {
Map<String, String> links = new LinkedHashMap<String, String>();
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() { public static String getApplicationIdentifier() {
return String.format("%s %s (r%d)", getApplicationName(), getApplicationVersion(), getApplicationRevisionNumber()); return String.format("%s %s (r%d)", getApplicationName(), getApplicationVersion(), getApplicationRevisionNumber());
} }

View File

@ -1,6 +1,7 @@
package net.filebot.ui; package net.filebot.ui;
import static net.filebot.Logging.*; import static net.filebot.Logging.*;
import static net.filebot.Settings.*;
import static net.filebot.util.ui.SwingUI.*; import static net.filebot.util.ui.SwingUI.*;
import java.awt.Desktop; import java.awt.Desktop;
@ -11,25 +12,44 @@ import javax.swing.Action;
import javax.swing.JMenu; import javax.swing.JMenu;
import javax.swing.JMenuBar; import javax.swing.JMenuBar;
import net.filebot.Settings;
public class FileBotMenuBar { public class FileBotMenuBar {
public static JMenuBar createHelp() { public static JMenuBar createHelp() {
JMenu help = new JMenu("Help"); 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(); JMenuBar menuBar = new JMenuBar();
menuBar.add(help); menuBar.add(help);
return menuBar; 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 -> { return newAction(title, null, evt -> {
try { try {
Desktop.getDesktop().browse(uri); Desktop.getDesktop().browse(URI.create(uri));
} catch (Exception e) { } catch (Exception e) {
debug.log(Level.SEVERE, "Failed to open URI: " + uri, e); debug.log(Level.SEVERE, "Failed to open URI: " + uri, e);
} }