* provide in-app help links
This commit is contained in:
parent
a2722d22f4
commit
474b7a6e20
|
@ -54,6 +54,7 @@ import net.filebot.cli.ArgumentProcessor;
|
||||||
import net.filebot.cli.CmdlineOperations;
|
import net.filebot.cli.CmdlineOperations;
|
||||||
import net.filebot.format.ExpressionFormat;
|
import net.filebot.format.ExpressionFormat;
|
||||||
import net.filebot.mac.MacAppUtilities;
|
import net.filebot.mac.MacAppUtilities;
|
||||||
|
import net.filebot.ui.FileBotMenuBar;
|
||||||
import net.filebot.ui.MainFrame;
|
import net.filebot.ui.MainFrame;
|
||||||
import net.filebot.ui.PanelBuilder;
|
import net.filebot.ui.PanelBuilder;
|
||||||
import net.filebot.ui.SinglePanelFrame;
|
import net.filebot.ui.SinglePanelFrame;
|
||||||
|
@ -263,6 +264,7 @@ public class Main {
|
||||||
// Mac OS X specific configuration
|
// Mac OS X specific configuration
|
||||||
MacAppUtilities.initializeApplication();
|
MacAppUtilities.initializeApplication();
|
||||||
MacAppUtilities.setWindowCanFullScreen(frame);
|
MacAppUtilities.setWindowCanFullScreen(frame);
|
||||||
|
MacAppUtilities.setDefaultMenuBar(FileBotMenuBar.createHelp());
|
||||||
} else {
|
} else {
|
||||||
// Windows / Linux specific configuration
|
// Windows / Linux specific configuration
|
||||||
List<Image> images = new ArrayList<Image>(3);
|
List<Image> images = new ArrayList<Image>(3);
|
||||||
|
@ -271,9 +273,9 @@ public class Main {
|
||||||
}
|
}
|
||||||
frame.setIconImages(images);
|
frame.setIconImages(images);
|
||||||
}
|
}
|
||||||
frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
|
|
||||||
|
|
||||||
// start application
|
// start application
|
||||||
|
frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
|
||||||
frame.setVisible(true);
|
frame.setVisible(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,9 @@ import static net.filebot.util.StringUtilities.*;
|
||||||
import java.awt.GraphicsEnvironment;
|
import java.awt.GraphicsEnvironment;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.net.URI;
|
import java.net.URI;
|
||||||
|
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;
|
||||||
|
@ -204,6 +206,16 @@ public final class Settings {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static Map<String, URI> getHelpURIs() {
|
||||||
|
Map<String, URI> links = new LinkedHashMap<String, URI>();
|
||||||
|
links.put("Getting Started", URI.create("https://www.filebot.net/getting-started/"));
|
||||||
|
links.put("FAQ", URI.create("https://www.filebot.net/forums/viewtopic.php?f=3&t=7"));
|
||||||
|
links.put("Forums", URI.create("https://www.filebot.net/forums/"));
|
||||||
|
links.put("Twitter", URI.create("https://twitter.com/filebot_renamer"));
|
||||||
|
links.put("Request Support", URI.create(isMacApp() ? "https://www.filebot.net/forums/viewforum.php?f=12" : "https://www.filebot.net/forums/viewforum.php?f=8"));
|
||||||
|
return links;
|
||||||
|
}
|
||||||
|
|
||||||
public static Settings forPackage(Class<?> type) {
|
public static Settings forPackage(Class<?> type) {
|
||||||
return new Settings(Preferences.userNodeForPackage(type));
|
return new Settings(Preferences.userNodeForPackage(type));
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,6 +14,7 @@ import java.util.List;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
|
import javax.swing.JMenuBar;
|
||||||
import javax.swing.UIManager;
|
import javax.swing.UIManager;
|
||||||
|
|
||||||
import ca.weblite.objc.Client;
|
import ca.weblite.objc.Client;
|
||||||
|
@ -120,23 +121,38 @@ public class MacAppUtilities {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void initializeApplication() {
|
public static void setDefaultMenuBar(JMenuBar menu) {
|
||||||
// improved UI defaults
|
try {
|
||||||
UIManager.put("TitledBorder.border", UIManager.getBorder("InsetBorder.aquaVariant"));
|
Class<?> application = Class.forName("com.apple.eawt.Application");
|
||||||
|
Object instance = application.getMethod("getApplication").invoke(null);
|
||||||
|
Method setDefaultMenuBar = application.getMethod("setDefaultMenuBar", new Class<?>[] { JMenuBar.class });
|
||||||
|
setDefaultMenuBar.invoke(instance, menu);
|
||||||
|
} catch (Throwable t) {
|
||||||
|
Logger.getLogger(MacAppUtilities.class.getName()).log(Level.WARNING, "setDefaultMenuBar not supported: " + t);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// make sure Application Quit Events get forwarded to normal Window Listeners
|
public static void setQuitStrategy(String field) {
|
||||||
try {
|
try {
|
||||||
Class<?> application = Class.forName("com.apple.eawt.Application");
|
Class<?> application = Class.forName("com.apple.eawt.Application");
|
||||||
Object instance = application.getMethod("getApplication").invoke(null);
|
Object instance = application.getMethod("getApplication").invoke(null);
|
||||||
Class<?> quitStrategy = Class.forName("com.apple.eawt.QuitStrategy");
|
Class<?> quitStrategy = Class.forName("com.apple.eawt.QuitStrategy");
|
||||||
Method setQuitStrategy = application.getMethod("setQuitStrategy", quitStrategy);
|
Method setQuitStrategy = application.getMethod("setQuitStrategy", quitStrategy);
|
||||||
Object closeAllWindows = quitStrategy.getField("CLOSE_ALL_WINDOWS").get(null);
|
Object closeAllWindows = quitStrategy.getField(field).get(null);
|
||||||
setQuitStrategy.invoke(instance, closeAllWindows);
|
setQuitStrategy.invoke(instance, closeAllWindows);
|
||||||
} catch (Throwable t) {
|
} catch (Throwable t) {
|
||||||
Logger.getLogger(MacAppUtilities.class.getName()).log(Level.WARNING, "setQuitStrategy not supported: " + t);
|
Logger.getLogger(MacAppUtilities.class.getName()).log(Level.WARNING, "setQuitStrategy not supported: " + t);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void initializeApplication() {
|
||||||
|
// improved UI defaults
|
||||||
|
UIManager.put("TitledBorder.border", UIManager.getBorder("InsetBorder.aquaVariant"));
|
||||||
|
|
||||||
|
// make sure Application Quit Events get forwarded to normal Window Listeners
|
||||||
|
setQuitStrategy("CLOSE_ALL_WINDOWS");
|
||||||
|
}
|
||||||
|
|
||||||
public static boolean isLockedFolder(File folder) {
|
public static boolean isLockedFolder(File folder) {
|
||||||
// write permissions my not be available even after sandbox has granted permission (e.g. when accessing files of another user)
|
// write permissions my not be available even after sandbox has granted permission (e.g. when accessing files of another user)
|
||||||
return folder.isDirectory() && !folder.canRead();
|
return folder.isDirectory() && !folder.canRead();
|
||||||
|
|
Loading…
Reference in New Issue