1 | #ifndef PANEL_SETTINGS_AUTOSTART_H |
---|
2 | #define PANEL_SETTINGS_AUTOSTART_H |
---|
3 | |
---|
4 | // mode 0 = Defaults |
---|
5 | // mode 1 = Audio/Video/Sat |
---|
6 | // mode 2 = USB Device |
---|
7 | // mode 3 = Cam/Emu |
---|
8 | // mode 4 = Network |
---|
9 | // mode 5 = Child safety |
---|
10 | |
---|
11 | void screenpanel_settings_autostart(int mode) |
---|
12 | { |
---|
13 | int rcret = 0; |
---|
14 | struct skin* panel_config = getscreen("panel_config"); |
---|
15 | struct skin* listbox = getscreennode(panel_config, "listbox"); |
---|
16 | struct skin* node = NULL; |
---|
17 | struct skin* tmp = NULL; |
---|
18 | |
---|
19 | addscreenrc(panel_config, listbox); |
---|
20 | listbox->aktline = 1; |
---|
21 | listbox->aktpage = 1; |
---|
22 | |
---|
23 | if (mode == 0){ |
---|
24 | int i = 0; |
---|
25 | |
---|
26 | changetitle(panel_config, _("Autostart Defaults")); |
---|
27 | |
---|
28 | if(file_exist("/etc/.usbimage")) |
---|
29 | { |
---|
30 | node = addlistbox(panel_config, listbox, node, 1); |
---|
31 | if(node != NULL) |
---|
32 | { |
---|
33 | node->type = CHOICEBOX; |
---|
34 | changetext(node, _("fsckroot")); changename(node, "fsckroot"); |
---|
35 | addchoicebox(node, "n", _("no")); addchoicebox(node, "y", _("yes")); |
---|
36 | setchoiceboxselection(node, getownconfig(node->name)); |
---|
37 | } |
---|
38 | } |
---|
39 | |
---|
40 | node = addlistbox(panel_config, listbox, node, 1); |
---|
41 | if(node != NULL) |
---|
42 | { |
---|
43 | node->type = CHOICEBOX; |
---|
44 | changetext(node, _("bootstop")); changename(node, "bootstop"); |
---|
45 | for(i=0; i <= 20; i++) |
---|
46 | { |
---|
47 | char* tmpnr = NULL; |
---|
48 | tmpnr = oitoa(i); |
---|
49 | addchoicebox(node, tmpnr, _(tmpnr)); |
---|
50 | free(tmpnr); tmpnr = NULL; |
---|
51 | } |
---|
52 | setchoiceboxselection(node, getownconfig(node->name)); |
---|
53 | } |
---|
54 | |
---|
55 | node = addlistbox(panel_config, listbox, node, 1); |
---|
56 | if(node != NULL) |
---|
57 | { |
---|
58 | node->type = CHOICEBOX; |
---|
59 | changetext(node, _("debug")); changename(node, "debug"); |
---|
60 | addchoicebox(node, "high", _("high")); addchoicebox(node, "low", _("low")); |
---|
61 | addchoicebox(node, "off", _("off")); |
---|
62 | setchoiceboxselection(node, getownconfig(node->name)); |
---|
63 | } |
---|
64 | |
---|
65 | node = addlistbox(panel_config, listbox, node, 1); |
---|
66 | if(node != NULL) |
---|
67 | { |
---|
68 | node->type = CHOICEBOX; |
---|
69 | changetext(node, _("showip")); changename(node, "showip"); |
---|
70 | addchoicebox(node, "status", _("Status")); addchoicebox(node, "ip", _("ip")); |
---|
71 | setchoiceboxselection(node, getownconfig(node->name)); |
---|
72 | } |
---|
73 | |
---|
74 | node = addlistbox(panel_config, listbox, node, 1); |
---|
75 | if(node != NULL) |
---|
76 | { |
---|
77 | node->type = CHOICEBOX; |
---|
78 | changetext(node, _("updatelist")); changename(node, "updatelist"); |
---|
79 | for(i=0; i <= 20; i++) |
---|
80 | { |
---|
81 | char* tmpnr = NULL; |
---|
82 | tmpnr = oitoa(i); |
---|
83 | addchoicebox(node, tmpnr, _(tmpnr)); |
---|
84 | free(tmpnr); tmpnr = NULL; |
---|
85 | } |
---|
86 | setchoiceboxselection(node, getownconfig(node->name)); |
---|
87 | } |
---|
88 | |
---|
89 | if(checkbox("UFS910") == 1) |
---|
90 | { |
---|
91 | node = addlistbox(panel_config, listbox, node, 1); |
---|
92 | if(node != NULL) |
---|
93 | { |
---|
94 | node->type = CHOICEBOX; |
---|
95 | changetext(node, _("useUnknown910")); changename(node, "useUnknown910"); |
---|
96 | addchoicebox(node, "1", _("yes")); addchoicebox(node, "0", _("no")); |
---|
97 | setchoiceboxselection(node, getownconfig(node->name)); |
---|
98 | } |
---|
99 | } |
---|
100 | } |
---|
101 | |
---|
102 | if (mode == 1){ |
---|
103 | |
---|
104 | changetitle(panel_config, _("Autostart Defaults")); |
---|
105 | |
---|
106 | if(isfile("/var/bin/audio.elf") || isfile("/boot/audio.old.elf")) |
---|
107 | { |
---|
108 | node = addlistbox(panel_config, listbox, node, 1); |
---|
109 | if(node != NULL) |
---|
110 | { |
---|
111 | node->type = CHOICEBOX; |
---|
112 | changetext(node, _("Old Audiofw")); changename(node, "oldaudiofw"); |
---|
113 | addchoicebox(node, "n", _("no")); addchoicebox(node, "y", _("yes")); |
---|
114 | setchoiceboxselection(node, getownconfig(node->name)); |
---|
115 | } |
---|
116 | } |
---|
117 | |
---|
118 | node = addlistbox(panel_config, listbox, node, 1); |
---|
119 | if(node != NULL) |
---|
120 | { |
---|
121 | node->type = CHOICEBOX; |
---|
122 | changetext(node, _("No Audiosync")); changename(node, "noaudiosync"); |
---|
123 | addchoicebox(node, "n", _("no")); addchoicebox(node, "y", _("yes")); |
---|
124 | setchoiceboxselection(node, getownconfig(node->name)); |
---|
125 | } |
---|
126 | |
---|
127 | node = addlistbox(panel_config, listbox, node, 1); |
---|
128 | if(node != NULL) |
---|
129 | { |
---|
130 | node->type = CHOICEBOX; |
---|
131 | changetext(node, _("Boot Resolution")); changename(node, "BootResolution"); |
---|
132 | addchoicebox(node, "low", _("low")); addchoicebox(node, "high", _("high")); |
---|
133 | setchoiceboxselection(node, getownconfig(node->name)); |
---|
134 | } |
---|
135 | |
---|
136 | node = addlistbox(panel_config, listbox, node, 1); |
---|
137 | if(node != NULL) |
---|
138 | { |
---|
139 | node->type = CHOICEBOX; |
---|
140 | changetext(node, _("Bootlogo")); changename(node, "bootlogo"); |
---|
141 | addchoicebox(node, "y", _("yes")); addchoicebox(node, "n", _("no")); |
---|
142 | setchoiceboxselection(node, getownconfig(node->name)); |
---|
143 | } |
---|
144 | |
---|
145 | node = addlistbox(panel_config, listbox, node, 1); |
---|
146 | if(node != NULL) |
---|
147 | { |
---|
148 | node->type = CHOICEBOX; |
---|
149 | changetext(node, _("Poweroff")); changename(node, "poweroff"); |
---|
150 | addchoicebox(node, "y", _("yes")); addchoicebox(node, "n", _("no")); |
---|
151 | setchoiceboxselection(node, getownconfig(node->name)); |
---|
152 | } |
---|
153 | |
---|
154 | node = addlistbox(panel_config, listbox, node, 1); |
---|
155 | if(node != NULL) |
---|
156 | { |
---|
157 | node->type = CHOICEBOX; |
---|
158 | changetext(node, _("Scart On Standby")); changename(node, "scartonstandby"); |
---|
159 | addchoicebox(node, "n", _("no")); addchoicebox(node, "y", _("yes")); |
---|
160 | setchoiceboxselection(node, getownconfig(node->name)); |
---|
161 | } |
---|
162 | |
---|
163 | node = addlistbox(panel_config, listbox, node, 1); |
---|
164 | if(node != NULL) |
---|
165 | { |
---|
166 | node->type = CHOICEBOX; |
---|
167 | changetext(node, _("HighSR")); changename(node, "HighSR"); |
---|
168 | addchoicebox(node, "n", _("no")); addchoicebox(node, "y", _("yes")); |
---|
169 | setchoiceboxselection(node, getownconfig(node->name)); |
---|
170 | } |
---|
171 | |
---|
172 | node = addlistbox(panel_config, listbox, node, 1); |
---|
173 | if(node != NULL) |
---|
174 | { |
---|
175 | node->type = CHOICEBOX; |
---|
176 | changetext(node, _("Boot RGB Fix")); changename(node, "bootrgbfix"); |
---|
177 | addchoicebox(node, "n", _("no")); addchoicebox(node, "y", _("yes")); |
---|
178 | setchoiceboxselection(node, getownconfig(node->name)); |
---|
179 | } |
---|
180 | } |
---|
181 | |
---|
182 | if (mode == 2){ |
---|
183 | int i = 0; |
---|
184 | int tmpsize = 0; |
---|
185 | |
---|
186 | changetitle(panel_config, _("Autostart USB")); |
---|
187 | |
---|
188 | node = addlistbox(panel_config, listbox, node, 1); |
---|
189 | if(node != NULL) |
---|
190 | { |
---|
191 | node->type = CHOICEBOX; |
---|
192 | changetext(node, _("Load Partition")); changename(node, "loadpartition"); |
---|
193 | addchoicebox(node, "n", _("no")); addchoicebox(node, "y", _("yes")); |
---|
194 | setchoiceboxselection(node, getownconfig(node->name)); |
---|
195 | } |
---|
196 | |
---|
197 | node = addlistbox(panel_config, listbox, node, 1); |
---|
198 | if(node != NULL) |
---|
199 | { |
---|
200 | node->type = CHOICEBOX; |
---|
201 | changetext(node, _("Fsck Record")); changename(node, "fsckrecord"); |
---|
202 | addchoicebox(node, "n", _("no")); addchoicebox(node, "y", _("yes")); |
---|
203 | setchoiceboxselection(node, getownconfig(node->name)); |
---|
204 | } |
---|
205 | |
---|
206 | node = addlistbox(panel_config, listbox, node, 1); |
---|
207 | if(node != NULL) |
---|
208 | { |
---|
209 | node->type = CHOICEBOX; |
---|
210 | changetext(node, _("Swap")); changename(node, "swap"); |
---|
211 | addchoicebox(node, "y", _("yes")); addchoicebox(node, "n", _("no")); |
---|
212 | setchoiceboxselection(node, getownconfig(node->name)); |
---|
213 | } |
---|
214 | |
---|
215 | node = addlistbox(panel_config, listbox, node, 1); |
---|
216 | if(node != NULL) |
---|
217 | { |
---|
218 | node->type = CHOICEBOX; |
---|
219 | changetext(node, _("Swap Size")); changename(node, "swapsize"); |
---|
220 | tmpsize = 16384; |
---|
221 | for(i=0; i < 7; i++) |
---|
222 | { |
---|
223 | char* tmpnr = NULL; |
---|
224 | tmpnr = oitoa(tmpsize); |
---|
225 | addchoicebox(node, tmpnr, _(tmpnr)); |
---|
226 | free(tmpnr); tmpnr = NULL; |
---|
227 | tmpsize = tmpsize * 2; |
---|
228 | } |
---|
229 | setchoiceboxselection(node, getownconfig(node->name)); |
---|
230 | } |
---|
231 | |
---|
232 | node = addlistbox(panel_config, listbox, node, 1); |
---|
233 | if(node != NULL) |
---|
234 | { |
---|
235 | node->type = CHOICEBOX; |
---|
236 | changetext(node, _("Fsck Swap")); changename(node, "fsckswap"); |
---|
237 | addchoicebox(node, "n", _("no")); addchoicebox(node, "y", _("yes")); |
---|
238 | setchoiceboxselection(node, getownconfig(node->name)); |
---|
239 | } |
---|
240 | |
---|
241 | node = addlistbox(panel_config, listbox, node, 1); |
---|
242 | if(node != NULL) |
---|
243 | { |
---|
244 | node->type = CHOICEBOX; |
---|
245 | changetext(node, _("Record Max Sectors")); changename(node, "RecordMaxSectors"); |
---|
246 | tmpsize = 80; |
---|
247 | for(i=0; i < 13; i++) |
---|
248 | { |
---|
249 | char* tmpnr = NULL; |
---|
250 | tmpnr = oitoa(tmpsize); |
---|
251 | addchoicebox(node, tmpnr, _(tmpnr)); |
---|
252 | free(tmpnr); tmpnr = NULL; |
---|
253 | tmpsize = tmpsize + 80; |
---|
254 | } |
---|
255 | setchoiceboxselection(node, getownconfig(node->name)); |
---|
256 | } |
---|
257 | |
---|
258 | node = addlistbox(panel_config, listbox, node, 1); |
---|
259 | if(node != NULL) |
---|
260 | { |
---|
261 | node->type = CHOICEBOX; |
---|
262 | changetext(node, _("Swap Max Sectors")); changename(node, "SwapMaxSectors"); |
---|
263 | tmpsize = 80; |
---|
264 | for(i=0; i < 13; i++) |
---|
265 | { |
---|
266 | char* tmpnr = NULL; |
---|
267 | tmpnr = oitoa(tmpsize); |
---|
268 | addchoicebox(node, tmpnr, _(tmpnr)); |
---|
269 | free(tmpnr); tmpnr = NULL; |
---|
270 | tmpsize = tmpsize + 80; |
---|
271 | } |
---|
272 | setchoiceboxselection(node, getownconfig(node->name)); |
---|
273 | } |
---|
274 | |
---|
275 | } |
---|
276 | |
---|
277 | if (mode == 3){ |
---|
278 | |
---|
279 | changetitle(panel_config, _("Autostart EMU")); |
---|
280 | |
---|
281 | node = addlistbox(panel_config, listbox, node, 1); |
---|
282 | if(node != NULL) |
---|
283 | { |
---|
284 | node->type = CHOICEBOX; |
---|
285 | changetext(node, _("Emu Control")); changename(node, "emucontrol"); |
---|
286 | addchoicebox(node, "n", _("no")); addchoicebox(node, "y", _("yes")); |
---|
287 | setchoiceboxselection(node, getownconfig(node->name)); |
---|
288 | } |
---|
289 | |
---|
290 | node = addlistbox(panel_config, listbox, node, 1); |
---|
291 | if(node != NULL) |
---|
292 | { |
---|
293 | node->type = CHOICEBOX; |
---|
294 | changetext(node, _("ftdi")); changename(node, "ftdi"); |
---|
295 | addchoicebox(node, "n", _("no")); addchoicebox(node, "y", _("yes")); |
---|
296 | setchoiceboxselection(node, getownconfig(node->name)); |
---|
297 | } |
---|
298 | |
---|
299 | node = addlistbox(panel_config, listbox, node, 1); |
---|
300 | if(node != NULL) |
---|
301 | { |
---|
302 | node->type = CHOICEBOX; |
---|
303 | changetext(node, _("pl2303")); changename(node, "pl2303"); |
---|
304 | addchoicebox(node, "n", _("no")); addchoicebox(node, "y", _("yes")); |
---|
305 | setchoiceboxselection(node, getownconfig(node->name)); |
---|
306 | } |
---|
307 | |
---|
308 | } |
---|
309 | |
---|
310 | if (mode == 4){ |
---|
311 | |
---|
312 | changetitle(panel_config, "Autostart NETWORK"); |
---|
313 | |
---|
314 | node = addlistbox(panel_config, listbox, node, 1); |
---|
315 | if(node != NULL) |
---|
316 | { |
---|
317 | node->type = CHOICEBOX; |
---|
318 | changetext(node, _("nfs server")); changename(node, "nfsserver"); |
---|
319 | addchoicebox(node, "n", _("no")); addchoicebox(node, "y", _("yes")); |
---|
320 | setchoiceboxselection(node, getownconfig(node->name)); |
---|
321 | } |
---|
322 | |
---|
323 | node = addlistbox(panel_config, listbox, node, 1); |
---|
324 | if(node != NULL) |
---|
325 | { |
---|
326 | node->type = CHOICEBOX; |
---|
327 | changetext(node, _("Samba Server")); changename(node, "sambaserver"); |
---|
328 | addchoicebox(node, "n", _("no")); addchoicebox(node, "y", _("yes")); |
---|
329 | setchoiceboxselection(node, getownconfig(node->name)); |
---|
330 | } |
---|
331 | |
---|
332 | node = addlistbox(panel_config, listbox, node, 1); |
---|
333 | if(node != NULL) |
---|
334 | { |
---|
335 | node->type = CHOICEBOX; |
---|
336 | changetext(node, _("scan wlan")); changename(node, "wlan"); |
---|
337 | addchoicebox(node, "n", _("no")); addchoicebox(node, "y", _("yes")); |
---|
338 | setchoiceboxselection(node, getownconfig(node->name)); |
---|
339 | } |
---|
340 | } |
---|
341 | |
---|
342 | if (mode == 5){ |
---|
343 | |
---|
344 | changetitle(panel_config, _("Autostart Child Safety")); |
---|
345 | |
---|
346 | node = addlistbox(panel_config, listbox, node, 1); |
---|
347 | if(node != NULL) |
---|
348 | { |
---|
349 | node->type = CHOICEBOX; |
---|
350 | changetext(node, _("Parental")); changename(node, "Parental"); |
---|
351 | addchoicebox(node, "n", _("no")); addchoicebox(node, "y", _("yes")); |
---|
352 | setchoiceboxselection(node, getownconfig(node->name)); |
---|
353 | } |
---|
354 | |
---|
355 | node = addlistbox(panel_config, listbox, node, 1); |
---|
356 | if(node != NULL) |
---|
357 | { |
---|
358 | node->type = INPUTBOXNUM; |
---|
359 | changetext(node, _("Pin")); changename(node, "Pin"); |
---|
360 | addchoicebox(node, "n", _("no")); |
---|
361 | if(getownconfig(node->name) != NULL) |
---|
362 | changeinput(node, getownconfig(node->name)); |
---|
363 | else |
---|
364 | changeinput(node, "0000"); |
---|
365 | } |
---|
366 | |
---|
367 | } |
---|
368 | |
---|
369 | drawscreen(panel_config, 0, 0); |
---|
370 | tmp = listbox->select; |
---|
371 | |
---|
372 | while(1) |
---|
373 | { |
---|
374 | addscreenrc(panel_config, tmp); |
---|
375 | rcret = waitrc(panel_config, 0, 0); |
---|
376 | tmp = listbox->select; |
---|
377 | |
---|
378 | if(listbox->select != NULL) |
---|
379 | { |
---|
380 | addownconfigscreentmp(listbox->select->name, listbox->select); |
---|
381 | } |
---|
382 | |
---|
383 | if(rcret == getrcconfigint("rcexit", NULL)) { |
---|
384 | |
---|
385 | break; |
---|
386 | } |
---|
387 | if(rcret == getrcconfigint("rcgreen", NULL)) { |
---|
388 | writeownconfigtmp(); |
---|
389 | writeallconfig(1); |
---|
390 | break; |
---|
391 | } |
---|
392 | } |
---|
393 | |
---|
394 | delownconfigtmpall(); |
---|
395 | delmarkedscreennodes(panel_config, 1); |
---|
396 | delownerrc(panel_config); |
---|
397 | clearscreen(panel_config); |
---|
398 | } |
---|
399 | |
---|
400 | #endif |
---|