|
|
| |
package com.panayotis.jubler.os; | package com.panayotis.jubler.os; |
| |
|
/* |
import com.apple.eawt.Application; | import com.apple.eawt.Application; |
import com.apple.eawt.ApplicationAdapter; | import com.apple.eawt.ApplicationAdapter; |
import com.apple.eawt.ApplicationEvent; | import com.apple.eawt.ApplicationEvent; |
|
*/ |
| |
| |
import static com.panayotis.jubler.i18n.I18N._; | import static com.panayotis.jubler.i18n.I18N._; |
|
|
OS = props.getProperty("os.name").toLowerCase(); | OS = props.getProperty("os.name").toLowerCase(); |
} | } |
| |
|
/* |
private static boolean isLinux() { | private static boolean isLinux() { |
return OS.toLowerCase().indexOf("linux") >= 0; | return OS.toLowerCase().indexOf("linux") >= 0; |
} | } |
|
|
private static boolean isMacOSX() { | private static boolean isMacOSX() { |
return OS.toLowerCase().indexOf("mac") >= 0; | return OS.toLowerCase().indexOf("mac") >= 0; |
} | } |
|
*/ |
| |
public static int getSliderLOffset() { | public static int getSliderLOffset() { |
return 7; | return 7; |
|
|
public static String getDefaultMPlayerArgs() { | public static String getDefaultMPlayerArgs() { |
String fontconfig = "-fontconfig "; | String fontconfig = "-fontconfig "; |
String fontname = "%f"; | String fontname = "%f"; |
|
/* |
if (!isLinux()) { | if (!isLinux()) { |
fontconfig = ""; | fontconfig = ""; |
if (isWindows()) { | if (isWindows()) { |
|
|
fontname = "%j/lib/freesans.ttf"; | fontname = "%j/lib/freesans.ttf"; |
} | } |
} | } |
|
*/ |
return "%p -slave -identify -ontop -utf8 -noquiet -nofs "+fontconfig+"-subfont-autoscale 0 -volstep 10"+ | return "%p -slave -identify -ontop -utf8 -noquiet -nofs "+fontconfig+"-subfont-autoscale 0 -volstep 10"+ |
" -sub %s -ss %t -geometry +%x+%y -font "+fontname+" -subfont-text-scale %z %v"; | " -sub %s -ss %t -geometry +%x+%y -font "+fontname+" -subfont-text-scale %z %v"; |
} | } |
| |
/* Force ASpell to use UTF-8 encoding - broken on Windows */ | /* Force ASpell to use UTF-8 encoding - broken on Windows */ |
public static boolean forceASpellEncoding() { | public static boolean forceASpellEncoding() { |
return !isWindows(); |
return true; |
} | } |
| |
public static String getRealExecFilename( String fname ) { | public static String getRealExecFilename( String fname ) { |
|
|
| |
| |
public static void hideSystemMenus(JMenuItem about, JMenuItem prefs, JMenuItem quit) { | public static void hideSystemMenus(JMenuItem about, JMenuItem prefs, JMenuItem quit) { |
|
/* |
if (isMacOSX()) { | if (isMacOSX()) { |
about.setVisible(false); | about.setVisible(false); |
prefs.setVisible(false); | prefs.setVisible(false); |
quit.setVisible(false); | quit.setVisible(false); |
} | } |
|
*/ |
} | } |
| |
| |
public static void initApplication() { | public static void initApplication() { |
/* In Linux this is a dummy function */ |
/* In Linux this is a dummy function |
if (isMacOSX()) { | if (isMacOSX()) { |
JublerApp japp = new JublerApp(); | JublerApp japp = new JublerApp(); |
} |
}*/ |
} | } |
| |
| |
|
|
return 4; | return 4; |
} | } |
public static String getKeyMods(boolean [] mods) { | public static String getKeyMods(boolean [] mods) { |
|
/* |
if (isMacOSX()) { | if (isMacOSX()) { |
StringBuffer res = new StringBuffer(); | StringBuffer res = new StringBuffer(); |
if (mods[0]) res.append("\u2318"); | if (mods[0]) res.append("\u2318"); |
|
|
if (res.length()>0) res.append(' '); | if (res.length()>0) res.append(' '); |
return res.toString(); | return res.toString(); |
} | } |
|
*/ |
| |
StringBuffer res = new StringBuffer(); | StringBuffer res = new StringBuffer(); |
if (mods[0]) res.append("+Meta"); | if (mods[0]) res.append("+Meta"); |
|
|
} | } |
| |
public static int getDefaultKeyModifier() { | public static int getDefaultKeyModifier() { |
if (isMacOSX()) return 0; |
//if (isMacOSX()) return 0; |
return 2; | return 2; |
} | } |
| |
public static String getCanonicalFilename(String filename) { | public static String getCanonicalFilename(String filename) { |
if (isWindows()) return filename.toLowerCase()+".exe"; |
//if (isWindows()) return filename.toLowerCase()+".exe"; |
return filename.toLowerCase(); | return filename.toLowerCase(); |
} | } |
| |
public static void openURL(String url) { | public static void openURL(String url) { |
try { | try { |
if (isMacOSX()) { |
/*if (isMacOSX()) { |
Class fileMgr = Class.forName("com.apple.eio.FileManager"); | Class fileMgr = Class.forName("com.apple.eio.FileManager"); |
Method openURL = fileMgr.getDeclaredMethod("openURL", new Class[] {String.class}); | Method openURL = fileMgr.getDeclaredMethod("openURL", new Class[] {String.class}); |
openURL.invoke(null, new Object[] {url}); | openURL.invoke(null, new Object[] {url}); |
} else if (isWindows()) | } else if (isWindows()) |
Runtime.getRuntime().exec("rundll32 url.dll,FileProtocolHandler " + url); | Runtime.getRuntime().exec("rundll32 url.dll,FileProtocolHandler " + url); |
else { //assume Unix or Linux |
else {*/ //assume Unix or Linux |
String[] browsers = { | String[] browsers = { |
"firefox", "konqueror", "opera", "epiphany", "mozilla", "netscape" }; | "firefox", "konqueror", "opera", "epiphany", "mozilla", "netscape" }; |
String browser = null; | String browser = null; |
|
|
throw new Exception("Could not find web browser"); | throw new Exception("Could not find web browser"); |
else | else |
Runtime.getRuntime().exec(new String[] {browser, url}); | Runtime.getRuntime().exec(new String[] {browser, url}); |
} |
//} |
} catch (Exception e) { | } catch (Exception e) { |
DEBUG.warning("URL selected: " + url); | DEBUG.warning("URL selected: " + url); |
} | } |
|
|
| |
| |
| |
|
/* |
class JublerApp extends Application { | class JublerApp extends Application { |
public JublerApp() { | public JublerApp() { |
setEnabledPreferencesMenu(true); | setEnabledPreferencesMenu(true); |
|
|
event.setHandled(false); | event.setHandled(false); |
} | } |
} | } |
|
*/ |