Author: jerome
Date: 2008-08-18 08:03:10 +0200 (Mon, 18 Aug 2008)
New Revision: 1545
Added:
software_suite_v2/software/control_center/trunk/control_center/sources/com/tuxdroid/cc/Utils/languages/LangUtils.java
Modified:
software_suite_v2/software/control_center/trunk/control_center/sources/com/tuxdroid/cc/CcInterface.java
software_suite_v2/software/control_center/trunk/control_center/sources/com/tuxdroid/cc/Utils/XMLWriter.java
Log:
* Starting now with installer language.
Modified:
software_suite_v2/software/control_center/trunk/control_center/sources/com/tuxdroid/cc/CcInterface.java
===================================================================
---
software_suite_v2/software/control_center/trunk/control_center/sources/com/tuxdroid/cc/CcInterface.java
2008-08-17 18:50:36 UTC (rev 1544)
+++
software_suite_v2/software/control_center/trunk/control_center/sources/com/tuxdroid/cc/CcInterface.java
2008-08-18 06:03:10 UTC (rev 1545)
@@ -660,9 +660,9 @@
jContentPane.add(playlist);
}
//Set a mouse motion listener to detect pressed actions.
- jContentPane.addMouseMotionListener(new
ResizeWindowListener());
+ //jContentPane.addMouseMotionListener(new
ResizeWindowListener());
//Add a mouseListener to launch resize process.
- jContentPane.addMouseListener(new
ResizeProcessListener());
+ //jContentPane.addMouseListener(new
ResizeProcessListener());
}
return jContentPane;
}
@@ -950,9 +950,11 @@
*/
private JButton getReduireControl() {
if (reduireButtonControl == null) {
- reduireButtonControl = new JButton();
- functions.mask(reduireButtonControl, new Rectangle(652,
4, 32, 16),
+ reduireButtonControl = new JButton();
+ functions.mask(reduireButtonControl, new Rectangle(686,
4, 32, 16),
getClass().getResource("images/buttons/reduire.png"));
+ //functions.mask(reduireButtonControl, new
Rectangle(652, 4, 32, 16),
+
//getClass().getResource("images/buttons/reduire.png"));
reduireButtonControl.addMouseListener(new
ReduireControlListener());
}
return reduireButtonControl;
@@ -1272,7 +1274,7 @@
menuPanel.add(getToolsMenu(), null);
menuPanel.add(getHelpMenu(), null);
menuPanel.add(getReduireControl(), null);
- menuPanel.add(getAgrandirControl(), null);
+ //menuPanel.add(getAgrandirControl(), null);
menuPanel.add(getFermerControl(), null);
menuPanel.add(titleLabel, null);
menuPanel.addMouseListener(new MoveWindowListener());
Modified:
software_suite_v2/software/control_center/trunk/control_center/sources/com/tuxdroid/cc/Utils/XMLWriter.java
===================================================================
---
software_suite_v2/software/control_center/trunk/control_center/sources/com/tuxdroid/cc/Utils/XMLWriter.java
2008-08-17 18:50:36 UTC (rev 1544)
+++
software_suite_v2/software/control_center/trunk/control_center/sources/com/tuxdroid/cc/Utils/XMLWriter.java
2008-08-18 06:03:10 UTC (rev 1545)
@@ -23,6 +23,7 @@
package com.tuxdroid.cc.Utils;
import java.io.File;
+import java.util.Locale;
import java.util.Vector;
import javax.xml.parsers.DocumentBuilder;
@@ -43,6 +44,7 @@
import com.kysoh.tuxdroid.gadget.framework.container.GadgetInstanceParameters;
import com.kysoh.tuxdroid.gadget.framework.container.GadgetParameter;
+import com.tuxdroid.cc.Utils.languages.LangUtils;
public class XMLWriter {
@@ -123,10 +125,19 @@
//Create lang element.
Element language = document.createElement("language");
- Element lang = document.createElement("lang");
- lang.setTextContent("en");
- Element country = document.createElement("country");
- country.setTextContent("US");
+ Element lang = document.createElement("lang");
+ Element country = document.createElement("country");
+
+ if(LangUtils.getInstallerLanguage() != null){
+ String l = LangUtils.getInstallerLanguage();
+ lang.setTextContent(l);
+ if(l.equalsIgnoreCase("fr")) country.setTextContent("FR");
+ else if(l.equalsIgnoreCase("en")) country.setTextContent("US");
+ else if(l.equals("nl")) country.setTextContent("NL");
+ }else{
+ lang.setTextContent("en");
+ country.setTextContent("US");
+ }
//Create ip element.
Element ip = document.createElement("ip");
Added:
software_suite_v2/software/control_center/trunk/control_center/sources/com/tuxdroid/cc/Utils/languages/LangUtils.java
===================================================================
---
software_suite_v2/software/control_center/trunk/control_center/sources/com/tuxdroid/cc/Utils/languages/LangUtils.java
(rev 0)
+++
software_suite_v2/software/control_center/trunk/control_center/sources/com/tuxdroid/cc/Utils/languages/LangUtils.java
2008-08-18 06:03:10 UTC (rev 1545)
@@ -0,0 +1,75 @@
+/* This file is part of "TuxDroid Control Center".
+ * Copyright 2008, kysoh
+ * Author : Conan Jerome
+ * eMail : [EMAIL PROTECTED]
+ * Site : http://www.kysoh.com/
+ *
+ * "TuxDroid Control Center" is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * "TuxDroid Control Center" is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with "TuxDroid Control Center"; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package com.tuxdroid.cc.Utils.languages;
+
+import java.io.*;
+
+public class LangUtils {
+
+ private static final String REGQUERY_UTIL = "reg query ";
+ private static final String REGSTR_TOKEN = "REG_SZ";
+
+ private static final String INSTALLER_LANGUAGE = REGQUERY_UTIL
+ + "\"HKLM\\Software\\Tuxdroid\\TuxdroidSetup\"";
+
+ public static String getInstallerLanguage() {
+ try {
+ Process process =
Runtime.getRuntime().exec(INSTALLER_LANGUAGE);
+ StreamReader reader = new
StreamReader(process.getInputStream());
+
+ reader.start();
+ process.waitFor();
+ reader.join();
+ String result = reader.getResult();
+ int p = result.indexOf(REGSTR_TOKEN);
+ if (p == -1) {
+ return null;
+ }
+ return result.substring(p +
REGSTR_TOKEN.length()).trim().substring(0, 2);
+ } catch (Exception e) {
+ return null;
+ }
+ }
+
+
+ static class StreamReader extends Thread {
+ private InputStream is;
+ private StringWriter sw;
+ StreamReader(InputStream is) {
+ this.is = is;
+ sw = new StringWriter();
+ }
+ public void run() {
+ try {
+ int c;
+ while ((c = is.read()) != -1)
+ sw.write(c);
+ } catch (IOException e) {
+ ;
+ }
+ }
+ String getResult() {
+ return sw.toString();
+ }
+ }
+}
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Tux-droid-svn mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/tux-droid-svn