Author: jerome
Date: 2008-08-17 17:32:55 +0200 (Sun, 17 Aug 2008)
New Revision: 1543
Modified:
software_suite_v2/software/tools/chatterTux/trunk/Chatter_tux/src/ConfInterface.java
software_suite_v2/software/tools/chatterTux/trunk/Chatter_tux/src/IniFile.java
software_suite_v2/software/tools/chatterTux/trunk/Chatter_tux/src/IniWriter.java
Log:
Modified:
software_suite_v2/software/tools/chatterTux/trunk/Chatter_tux/src/ConfInterface.java
===================================================================
---
software_suite_v2/software/tools/chatterTux/trunk/Chatter_tux/src/ConfInterface.java
2008-08-17 15:06:29 UTC (rev 1542)
+++
software_suite_v2/software/tools/chatterTux/trunk/Chatter_tux/src/ConfInterface.java
2008-08-17 15:32:55 UTC (rev 1543)
@@ -176,7 +176,7 @@
}
frame = new JFrame("Chatter Tux configuration");
- frame.setSize(new Dimension(390, 550));
+ frame.setSize(new Dimension(400, 550));
frame.setPreferredSize(frame.getSize());
frame.setResizable(false);
frame.add(this.getJContentPane());
@@ -612,13 +612,46 @@
return this.addPanel;
}
+
// TODO Store to ini file.
public void storeAsIni(String key){
-
+ if((!key.equals("")) &&
(!this.ini.getHashtable().containsKey(key))){
+ //then adding new value.
+ String action =
this.addAction.getSelectedItem().toString();
+ if(action.equals("Tux TTS")){
+ action = "tts";
+ }
+ else if(action.equals("Tux movement")){
+ action = "api";
+ }
+
+ String command = "";
+ if(this.addTtsText.isVisible()){ //then tts parameter.
+ command = this.addTtsText.getText();
+ }
+ else if(this.addTuxBody.isVisible()){ //then it's an
api command.
+ command =
this.addTuxBody.getSelectedItem().toString();
+ //then reverting command to be right with api.
+ command = this.revertParsedCommand(command,
this.addMany);
+ }
+ Vector<String> values = new Vector<String>();
+ values.add("action = " + action);
+ values.add("cmd = " + command);
+ if(!command.equals("")){
+ this.writer.add(key, values);
+
this.properties.updateHashTable(this.ini.getHashtable());
+ this.updateValues();
+ }else{
+ //TODO display error message.
+ }
+ }else{
+ //TODO display error message.
+ System.out.println("Cannot be blank or be the same as
one entry.");
+ }
}
- //Stor modifications.
+ //Store modifications.
public void storeModificationsToIni(String key){
String action = this.actionType.getSelectedItem().toString();
if(action.equals("Tux TTS")){
@@ -635,7 +668,7 @@
else if(this.tuxBody.isVisible()){ //then it's an api command.
command = this.tuxBody.getSelectedItem().toString();
//then reverting command to be right with api.
- command = this.revertParsedCommand(command);
+ command = this.revertParsedCommand(command,
this.manyValue);
}
Vector<String> values = new Vector<String>();
values.add("action = " + action);
@@ -787,7 +820,7 @@
}
//Return reverted parsed command.
- public String revertParsedCommand(String command){
+ public String revertParsedCommand(String command, JSpinner spinner){
StringBuffer result = new StringBuffer();
result.append("tux.");
if(command.contains("Spin right"))
result.append("spinning.right");
@@ -798,7 +831,7 @@
else if(command.contains("Flippers")) result.append("flippers");
else if(command.contains("Mouth")) result.append("mouth");
else if(command.contains("Eyes")) result.append("eyes");
- result.append(String.format(".onAsync(%s, SSV_NDEF)",
this.manyValue.getValue().toString()));
+ result.append(String.format(".onAsync(%s, SSV_NDEF)",
spinner.getValue().toString()));
return result.toString();
}
Modified:
software_suite_v2/software/tools/chatterTux/trunk/Chatter_tux/src/IniFile.java
===================================================================
---
software_suite_v2/software/tools/chatterTux/trunk/Chatter_tux/src/IniFile.java
2008-08-17 15:06:29 UTC (rev 1542)
+++
software_suite_v2/software/tools/chatterTux/trunk/Chatter_tux/src/IniFile.java
2008-08-17 15:32:55 UTC (rev 1543)
@@ -136,7 +136,6 @@
public void add(String key, Vector<String> values){
this.keys.put(key, values);
- System.out.println("Given index: " +
Integer.valueOf(this.keys.size()));
this.indexes.put(Integer.valueOf(this.keys.size()), key);
}
Modified:
software_suite_v2/software/tools/chatterTux/trunk/Chatter_tux/src/IniWriter.java
===================================================================
---
software_suite_v2/software/tools/chatterTux/trunk/Chatter_tux/src/IniWriter.java
2008-08-17 15:06:29 UTC (rev 1542)
+++
software_suite_v2/software/tools/chatterTux/trunk/Chatter_tux/src/IniWriter.java
2008-08-17 15:32:55 UTC (rev 1543)
@@ -65,8 +65,7 @@
}
public void add(String keyName, Vector<String> datas){
- System.out.println("Adding \n -------------------------");
- //this.ini(keyName, datas);
+ this.ini.add(keyName, datas);
this.write();
ChatterTuxServer.reset();
}
@@ -106,7 +105,6 @@
System.out.println("Error writing file");
//TODO displaying errorBox instead.
e.printStackTrace();
}
- //TODO make a copy to be able to restore values in case
of error writing file.
}
try {
-------------------------------------------------------------------------
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