Rev 219 | Rev 221 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 219 | Rev 220 | ||
---|---|---|---|
Line 10... | Line 10... | ||
10 | 10 | ||
Line 11... | Line 11... | ||
11 | import javax.microedition.rms.*; |
11 | import javax.microedition.rms.*; |
Line 12... | Line 12... | ||
12 | 12 | ||
- | 13 | import java.io.*; |
|
13 | import java.io.*; |
14 | |
14 | 15 | public class DUBwiseSettings |
|
15 | public class DUBwiseSettings |
16 | extends org.ligi.ufo.ParamsClass |
16 | implements org.ligi.ufo.DUBwiseDefinitions,DUBwiseUIDefinitions |
17 | implements org.ligi.ufo.DUBwiseDefinitions,DUBwiseUIDefinitions |
Line 17... | Line 18... | ||
17 | { |
18 | { |
18 | // name/handle for the recordStore to memorize some stuff |
19 | // name/handle for the recordStore to memorize some stuff |
19 | private final static String RECORD_STORE_NAME="DUBSETT_V3"; |
20 | private final static String RECORD_STORE_NAME="DUBSETT_V4"; |
Line 34... | Line 35... | ||
34 | 35 | ||
35 | public byte gps_format=GPS_FORMAT_DECIMAL; |
36 | public byte gps_format=GPS_FORMAT_DECIMAL; |
Line -... | Line 37... | ||
- | 37 | public byte speed_format=SPEED_FORMAT_KMH; |
|
- | 38 | ||
- | 39 | ||
- | 40 | int[] settings_field; |
|
- | 41 | ||
- | 42 | public int get_field_from_act(int pos) { return settings_field[pos];} |
|
- | 43 | public void set_field_from_act(int pos,int val){ |
|
- | 44 | ||
- | 45 | settings_field[pos]=val; |
|
- | 46 | field2setting(pos,val); |
|
- | 47 | } |
|
- | 48 | ||
- | 49 | public void toggle_fullscreen() |
|
- | 50 | { |
|
- | 51 | // fullscreen=!fullscreen; |
|
- | 52 | set_field_from_act(1,settings_field[1]^1); |
|
- | 53 | // if (fullscreen)canvas.setFullScreenMode(true); |
|
- | 54 | } |
|
- | 55 | public void field2setting(int pos,int val) |
|
- | 56 | { |
|
- | 57 | ||
- | 58 | if (pos==0) |
|
- | 59 | { |
|
- | 60 | act_skin=(byte)val; |
|
- | 61 | canvas.load_images(); |
|
- | 62 | } |
|
- | 63 | ||
- | 64 | if ((pos==1)&&((val&1)==1)&&(!fullscreen)) |
|
- | 65 | { |
|
- | 66 | fullscreen=true; |
|
- | 67 | canvas.setFullScreenMode(fullscreen); |
|
- | 68 | } |
|
- | 69 | ||
- | 70 | if ((pos==1)&&((val&1)==0)&&(fullscreen)) |
|
- | 71 | { |
|
- | 72 | fullscreen=false; |
|
- | 73 | canvas.setFullScreenMode(fullscreen); |
|
- | 74 | } |
|
- | 75 | ||
- | 76 | if ((pos==1)&&((val&2)==2)&&(!do_scrollbg)) |
|
- | 77 | { |
|
- | 78 | do_scrollbg=true; |
|
- | 79 | canvas.load_images(); |
|
- | 80 | } |
|
- | 81 | ||
- | 82 | if ((pos==1)&&((val&2)==0)&&(do_scrollbg)) |
|
- | 83 | { |
|
- | 84 | do_scrollbg=false; |
|
- | 85 | canvas.load_images(); |
|
- | 86 | } |
|
- | 87 | ||
- | 88 | if (pos==1) |
|
- | 89 | do_sound=((val&4)!=0); |
|
- | 90 | ||
- | 91 | if (pos==1) |
|
- | 92 | do_vibra=((val&8)!=0); |
|
- | 93 | ||
- | 94 | if (pos==1) |
|
- | 95 | expert_mode=((val&16)!=0); |
|
- | 96 | ||
- | 97 | if (pos==2) |
|
- | 98 | gps_format=(byte)val; |
|
- | 99 | ||
- | 100 | if (pos==3) |
|
- | 101 | speed_format=(byte)val; |
|
- | 102 | ||
- | 103 | if (pos==4) |
|
- | 104 | default_extern_control[EXTERN_CONTROL_NICK]=(byte)val; |
|
- | 105 | ||
- | 106 | if (pos==5) |
|
- | 107 | default_extern_control[EXTERN_CONTROL_ROLL]=(byte)val; |
|
- | 108 | ||
- | 109 | if (pos==6) |
|
- | 110 | default_extern_control[EXTERN_CONTROL_GIER]=(byte)val; |
|
- | 111 | ||
- | 112 | if (pos==7) |
|
- | 113 | default_extern_control[EXTERN_CONTROL_GAS]=(byte)val; |
|
- | 114 | ||
- | 115 | if (pos==8) |
|
- | 116 | default_extern_control[EXTERN_CONTROL_HIGHT]=(byte)val; |
|
36 | public byte speed_format=SPEED_FORMAT_KMH; |
117 | } |
Line 37... | Line 118... | ||
37 | 118 | ||
38 | 119 | ||
39 | public byte[] default_extern_control=default_extern_keycontrol ; |
120 | public byte[] default_extern_control;//=default_extern_keycontrol ; |
Line 40... | Line 121... | ||
40 | 121 | ||
41 | //#if devicecontrol=="on" |
122 | //#if devicecontrol=="on" |
Line 42... | Line 123... | ||
42 | public boolean keep_lighton=false; |
123 | public boolean keep_lighton=false; |
Line -... | Line 124... | ||
- | 124 | //#endif |
|
- | 125 | ||
- | 126 | int[] act_proxy_ip=default_ip; // { ip , ip , ip , ip , port } |
|
- | 127 | int[] act_conn_ip=default_ip; // { ip , ip , ip , ip , port } |
|
- | 128 | ||
- | 129 | /* end of all settings hold here */ |
|
43 | //#endif |
130 | |
- | 131 | public String[] _tab_names={"User Interface","GPS","Keycontrol","Special Keys","Other" }; |
|
- | 132 | ||
- | 133 | public String[][] _field_names={ { "Skin","Fullscreen","Scroll Background" } , {"GPS Format","Speed Format"},{"Nick","Roll","Gier","Gas Increase","Height Increase"},{"Back","Fullscreen","Clear"},{"Sound","Vibra","Expert-Mode"} }; |
|
- | 134 | ||
- | 135 | public String[][] _choice_strings={ { "Dark","Light" } , {"mp/h","km/h","cm/s"},{"decimal","min sec"}} ; |
|
- | 136 | public int[][] _field_positions={ {0,8,9} , {2,3} , {4,5,6,7,8} , {13,14,15}, {10,11,12}}; |
|
- | 137 | public int[][] _field_types={ {PARAMTYPE_CHOICE+0,PARAMTYPE_BITSWITCH,PARAMTYPE_BITSWITCH} , {PARAMTYPE_CHOICE+1,PARAMTYPE_CHOICE+2} , {PARAMTYPE_BYTE,PARAMTYPE_BYTE,PARAMTYPE_BYTE,PARAMTYPE_BYTE,PARAMTYPE_BYTE}, {PARAMTYPE_KEY,PARAMTYPE_KEY,PARAMTYPE_KEY} , {PARAMTYPE_BITSWITCH,PARAMTYPE_BITSWITCH,PARAMTYPE_BITSWITCH}}; |
|
- | 138 | DUBwiseCanvas canvas; |
|
- | 139 | ||
- | 140 | ||
- | 141 | public final static int SETTINGS_FIELD_LENGTH=42; |
|
- | 142 | public DUBwiseSettings(DUBwiseCanvas _canvas) |
|
- | 143 | { |
|
- | 144 | canvas= _canvas; |
|
- | 145 | settings_field=new int[SETTINGS_FIELD_LENGTH]; |
|
- | 146 | default_extern_control=new byte[11]; |
|
- | 147 | // set defaults |
|
- | 148 | settings_field[4]=42; // nick |
|
- | 149 | settings_field[5]=42; // roll |
|
44 | 150 | settings_field[6]=42; // gier |
|
- | 151 | settings_field[7]=1; // fas |
|
- | 152 | settings_field[8]=1; // hight |
|
- | 153 | ||
- | 154 | } |
|
- | 155 | ||
- | 156 | public void load() |
|
45 | int[] act_proxy_ip=default_ip; // { ip , ip , ip , ip , port } |
157 | { |
46 | int[] act_conn_ip=default_ip; // { ip , ip , ip , ip , port } |
158 | |
47 | 159 | tab_names=_tab_names; |
|
Line 48... | Line 160... | ||
48 | /* end of all settings hold here */ |
160 | field_names=_field_names; |
Line 59... | Line 171... | ||
59 | DataInputStream din = new DataInputStream( bin ); |
171 | DataInputStream din = new DataInputStream( bin ); |
Line 60... | Line 172... | ||
60 | 172 | ||
61 | 173 | ||
62 | connection_url=din.readUTF(); |
- | |
63 | connection_name=din.readUTF(); |
- | |
64 | act_skin=din.readByte(); |
- | |
65 | - | ||
66 | do_sound=din.readBoolean(); |
- | |
67 | do_vibra=din.readBoolean(); |
- | |
68 | do_scrollbg=din.readBoolean(); |
- | |
69 | fullscreen=din.readBoolean(); |
- | |
70 | //#if devicecontrol=="on" |
- | |
71 | keep_lighton=din.readBoolean(); |
- | |
72 | //#else |
- | |
73 | din.readBoolean(); |
- | |
74 | //#endif |
- | |
75 | - | ||
76 | - | ||
77 | gps_format=din.readByte(); |
- | |
78 | speed_format=din.readByte(); |
- | |
79 | 174 | connection_url=din.readUTF(); |
|
80 | expert_mode=din.readBoolean(); |
- | |
81 | // reserve |
- | |
82 | - | ||
83 | din.readBoolean(); |
- | |
84 | din.readBoolean(); |
- | |
85 | din.readByte(); |
- | |
86 | din.readByte(); |
175 | connection_name=din.readUTF(); |
87 | din.readByte(); |
176 | // reserve utf's |
88 | din.readUTF(); |
177 | din.readUTF(); |
Line -... | Line 178... | ||
- | 178 | din.readUTF(); |
|
- | 179 | din.readUTF(); |
|
- | 180 | ||
- | 181 | ||
- | 182 | ||
89 | din.readUTF(); |
183 | for ( int i=0;i<SETTINGS_FIELD_LENGTH;i++) |
- | 184 | settings_field[i]=din.readInt(); |
|
90 | din.readUTF(); |
185 | |
91 | 186 | for ( int i=0;i<5;i++) |
|
92 | for ( int i=0;i<5;i++) |
187 | |
93 | { |
188 | { |
Line 99... | Line 194... | ||
99 | recStore.closeRecordStore(); |
194 | recStore.closeRecordStore(); |
100 | } |
195 | } |
101 | catch (Exception e) |
196 | catch (Exception e) |
102 | { } |
197 | { } |
Line -... | Line 198... | ||
- | 198 | ||
- | 199 | ||
- | 200 | for ( int i=0;i<SETTINGS_FIELD_LENGTH;i++) |
|
- | 201 | field2setting(i,settings_field[i]); |
|
103 | 202 | ||
104 | } |
- | |
Line 105... | Line 203... | ||
105 | 203 | } |
|
106 | 204 | ||
107 | 205 | ||
Line 120... | Line 218... | ||
120 | ByteArrayOutputStream bout = new ByteArrayOutputStream(); |
218 | ByteArrayOutputStream bout = new ByteArrayOutputStream(); |
121 | DataOutputStream dout = new DataOutputStream( bout ); |
219 | DataOutputStream dout = new DataOutputStream( bout ); |
Line 122... | Line 220... | ||
122 | 220 | ||
123 | dout.writeUTF(connection_url); |
221 | dout.writeUTF(connection_url); |
124 | dout.writeUTF(connection_name); |
- | |
125 | dout.writeByte(act_skin); |
- | |
126 | dout.writeBoolean(do_sound); |
- | |
127 | dout.writeBoolean(do_vibra); |
- | |
128 | dout.writeBoolean(do_scrollbg); |
- | |
129 | dout.writeBoolean(fullscreen); |
- | |
130 | //#if devicecontrol=="on" |
- | |
131 | dout.writeBoolean(keep_lighton); |
- | |
132 | //#else |
- | |
133 | dout.writeBoolean(false); |
- | |
134 | //#endif |
222 | dout.writeUTF(connection_name); |
135 | - | ||
136 | dout.writeByte(gps_format); |
- | |
137 | dout.writeByte(speed_format); |
- | |
138 | - | ||
139 | dout.writeBoolean( expert_mode); |
- | |
140 | dout.writeBoolean(false); |
- | |
141 | dout.writeBoolean(false); |
- | |
142 | dout.writeByte(0); |
- | |
143 | dout.writeByte(0); |
- | |
144 | dout.writeByte(0); |
223 | |
145 | dout.writeUTF(""); |
224 | dout.writeUTF(""); |
146 | dout.writeUTF(""); |
225 | dout.writeUTF(""); |
Line 147... | Line -... | ||
147 | dout.writeUTF(""); |
- | |
- | 226 | dout.writeUTF(""); |
|
- | 227 | ||
148 | 228 | ||
149 | 229 | for ( int i=0;i<SETTINGS_FIELD_LENGTH;i++) |
|
150 | 230 | dout.writeInt(settings_field[i]); |
|
151 | for ( int i=0;i<5;i++) |
231 | for ( int i=0;i<5;i++) |
152 | { |
232 | { |