|
Lines 23-31
Link Here
|
| 23 |
|
23 |
|
| 24 |
package com.panayotis.jubler.os; |
24 |
package com.panayotis.jubler.os; |
| 25 |
|
25 |
|
|
|
26 |
/* |
| 26 |
import com.apple.eawt.Application; |
27 |
import com.apple.eawt.Application; |
| 27 |
import com.apple.eawt.ApplicationAdapter; |
28 |
import com.apple.eawt.ApplicationAdapter; |
| 28 |
import com.apple.eawt.ApplicationEvent; |
29 |
import com.apple.eawt.ApplicationEvent; |
|
|
30 |
*/ |
| 29 |
|
31 |
|
| 30 |
|
32 |
|
| 31 |
import static com.panayotis.jubler.i18n.I18N._; |
33 |
import static com.panayotis.jubler.i18n.I18N._; |
|
Lines 50-55
Link Here
|
| 50 |
OS = props.getProperty("os.name").toLowerCase(); |
52 |
OS = props.getProperty("os.name").toLowerCase(); |
| 51 |
} |
53 |
} |
| 52 |
|
54 |
|
|
|
55 |
/* |
| 53 |
private static boolean isLinux() { |
56 |
private static boolean isLinux() { |
| 54 |
return OS.toLowerCase().indexOf("linux") >= 0; |
57 |
return OS.toLowerCase().indexOf("linux") >= 0; |
| 55 |
} |
58 |
} |
|
Lines 60-65
Link Here
|
| 60 |
private static boolean isMacOSX() { |
63 |
private static boolean isMacOSX() { |
| 61 |
return OS.toLowerCase().indexOf("mac") >= 0; |
64 |
return OS.toLowerCase().indexOf("mac") >= 0; |
| 62 |
} |
65 |
} |
|
|
66 |
*/ |
| 63 |
|
67 |
|
| 64 |
public static int getSliderLOffset() { |
68 |
public static int getSliderLOffset() { |
| 65 |
return 7; |
69 |
return 7; |
|
Lines 73-78
Link Here
|
| 73 |
public static String getDefaultMPlayerArgs() { |
77 |
public static String getDefaultMPlayerArgs() { |
| 74 |
String fontconfig = "-fontconfig "; |
78 |
String fontconfig = "-fontconfig "; |
| 75 |
String fontname = "%f"; |
79 |
String fontname = "%f"; |
|
|
80 |
/* |
| 76 |
if (!isLinux()) { |
81 |
if (!isLinux()) { |
| 77 |
fontconfig = ""; |
82 |
fontconfig = ""; |
| 78 |
if (isWindows()) { |
83 |
if (isWindows()) { |
|
Lines 81-93
Link Here
|
| 81 |
fontname = "%j/lib/freesans.ttf"; |
86 |
fontname = "%j/lib/freesans.ttf"; |
| 82 |
} |
87 |
} |
| 83 |
} |
88 |
} |
|
|
89 |
*/ |
| 84 |
return "%p -slave -identify -ontop -utf8 -noquiet -nofs "+fontconfig+"-subfont-autoscale 0 -volstep 10"+ |
90 |
return "%p -slave -identify -ontop -utf8 -noquiet -nofs "+fontconfig+"-subfont-autoscale 0 -volstep 10"+ |
| 85 |
" -sub %s -ss %t -geometry +%x+%y -font "+fontname+" -subfont-text-scale %z %v"; |
91 |
" -sub %s -ss %t -geometry +%x+%y -font "+fontname+" -subfont-text-scale %z %v"; |
| 86 |
} |
92 |
} |
| 87 |
|
93 |
|
| 88 |
/* Force ASpell to use UTF-8 encoding - broken on Windows */ |
94 |
/* Force ASpell to use UTF-8 encoding - broken on Windows */ |
| 89 |
public static boolean forceASpellEncoding() { |
95 |
public static boolean forceASpellEncoding() { |
| 90 |
return !isWindows(); |
96 |
return true; |
| 91 |
} |
97 |
} |
| 92 |
|
98 |
|
| 93 |
public static String getRealExecFilename( String fname ) { |
99 |
public static String getRealExecFilename( String fname ) { |
|
Lines 99-117
Link Here
|
| 99 |
|
105 |
|
| 100 |
|
106 |
|
| 101 |
public static void hideSystemMenus(JMenuItem about, JMenuItem prefs, JMenuItem quit) { |
107 |
public static void hideSystemMenus(JMenuItem about, JMenuItem prefs, JMenuItem quit) { |
|
|
108 |
/* |
| 102 |
if (isMacOSX()) { |
109 |
if (isMacOSX()) { |
| 103 |
about.setVisible(false); |
110 |
about.setVisible(false); |
| 104 |
prefs.setVisible(false); |
111 |
prefs.setVisible(false); |
| 105 |
quit.setVisible(false); |
112 |
quit.setVisible(false); |
| 106 |
} |
113 |
} |
|
|
114 |
*/ |
| 107 |
} |
115 |
} |
| 108 |
|
116 |
|
| 109 |
|
117 |
|
| 110 |
public static void initApplication() { |
118 |
public static void initApplication() { |
| 111 |
/* In Linux this is a dummy function */ |
119 |
/* In Linux this is a dummy function |
| 112 |
if (isMacOSX()) { |
120 |
if (isMacOSX()) { |
| 113 |
JublerApp japp = new JublerApp(); |
121 |
JublerApp japp = new JublerApp(); |
| 114 |
} |
122 |
}*/ |
| 115 |
} |
123 |
} |
| 116 |
|
124 |
|
| 117 |
|
125 |
|
|
Lines 119-124
Link Here
|
| 119 |
return 4; |
127 |
return 4; |
| 120 |
} |
128 |
} |
| 121 |
public static String getKeyMods(boolean [] mods) { |
129 |
public static String getKeyMods(boolean [] mods) { |
|
|
130 |
/* |
| 122 |
if (isMacOSX()) { |
131 |
if (isMacOSX()) { |
| 123 |
StringBuffer res = new StringBuffer(); |
132 |
StringBuffer res = new StringBuffer(); |
| 124 |
if (mods[0]) res.append("\u2318"); |
133 |
if (mods[0]) res.append("\u2318"); |
|
Lines 128-133
Link Here
|
| 128 |
if (res.length()>0) res.append(' '); |
137 |
if (res.length()>0) res.append(' '); |
| 129 |
return res.toString(); |
138 |
return res.toString(); |
| 130 |
} |
139 |
} |
|
|
140 |
*/ |
| 131 |
|
141 |
|
| 132 |
StringBuffer res = new StringBuffer(); |
142 |
StringBuffer res = new StringBuffer(); |
| 133 |
if (mods[0]) res.append("+Meta"); |
143 |
if (mods[0]) res.append("+Meta"); |
|
Lines 142-165
Link Here
|
| 142 |
} |
152 |
} |
| 143 |
|
153 |
|
| 144 |
public static int getDefaultKeyModifier() { |
154 |
public static int getDefaultKeyModifier() { |
| 145 |
if (isMacOSX()) return 0; |
155 |
//if (isMacOSX()) return 0; |
| 146 |
return 2; |
156 |
return 2; |
| 147 |
} |
157 |
} |
| 148 |
|
158 |
|
| 149 |
public static String getCanonicalFilename(String filename) { |
159 |
public static String getCanonicalFilename(String filename) { |
| 150 |
if (isWindows()) return filename.toLowerCase()+".exe"; |
160 |
//if (isWindows()) return filename.toLowerCase()+".exe"; |
| 151 |
return filename.toLowerCase(); |
161 |
return filename.toLowerCase(); |
| 152 |
} |
162 |
} |
| 153 |
|
163 |
|
| 154 |
public static void openURL(String url) { |
164 |
public static void openURL(String url) { |
| 155 |
try { |
165 |
try { |
| 156 |
if (isMacOSX()) { |
166 |
/*if (isMacOSX()) { |
| 157 |
Class fileMgr = Class.forName("com.apple.eio.FileManager"); |
167 |
Class fileMgr = Class.forName("com.apple.eio.FileManager"); |
| 158 |
Method openURL = fileMgr.getDeclaredMethod("openURL", new Class[] {String.class}); |
168 |
Method openURL = fileMgr.getDeclaredMethod("openURL", new Class[] {String.class}); |
| 159 |
openURL.invoke(null, new Object[] {url}); |
169 |
openURL.invoke(null, new Object[] {url}); |
| 160 |
} else if (isWindows()) |
170 |
} else if (isWindows()) |
| 161 |
Runtime.getRuntime().exec("rundll32 url.dll,FileProtocolHandler " + url); |
171 |
Runtime.getRuntime().exec("rundll32 url.dll,FileProtocolHandler " + url); |
| 162 |
else { //assume Unix or Linux |
172 |
else {*/ //assume Unix or Linux |
| 163 |
String[] browsers = { |
173 |
String[] browsers = { |
| 164 |
"firefox", "konqueror", "opera", "epiphany", "mozilla", "netscape" }; |
174 |
"firefox", "konqueror", "opera", "epiphany", "mozilla", "netscape" }; |
| 165 |
String browser = null; |
175 |
String browser = null; |
|
Lines 171-177
Link Here
|
| 171 |
throw new Exception("Could not find web browser"); |
181 |
throw new Exception("Could not find web browser"); |
| 172 |
else |
182 |
else |
| 173 |
Runtime.getRuntime().exec(new String[] {browser, url}); |
183 |
Runtime.getRuntime().exec(new String[] {browser, url}); |
| 174 |
} |
184 |
//} |
| 175 |
} catch (Exception e) { |
185 |
} catch (Exception e) { |
| 176 |
DEBUG.warning("URL selected: " + url); |
186 |
DEBUG.warning("URL selected: " + url); |
| 177 |
} |
187 |
} |
|
Lines 182-187
Link Here
|
| 182 |
|
192 |
|
| 183 |
|
193 |
|
| 184 |
|
194 |
|
|
|
195 |
/* |
| 185 |
class JublerApp extends Application { |
196 |
class JublerApp extends Application { |
| 186 |
public JublerApp() { |
197 |
public JublerApp() { |
| 187 |
setEnabledPreferencesMenu(true); |
198 |
setEnabledPreferencesMenu(true); |
|
Lines 208-210
Link Here
|
| 208 |
event.setHandled(false); |
219 |
event.setHandled(false); |
| 209 |
} |
220 |
} |
| 210 |
} |
221 |
} |
|
|
222 |
*/ |