Diffstat (limited to 'noncore/settings/networksettings2/cable') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/settings/networksettings2/cable/cable.pro | 18 | ||||
-rw-r--r-- | noncore/settings/networksettings2/cable/cableGUI.ui | 545 | ||||
-rw-r--r-- | noncore/settings/networksettings2/cable/cable_NN.cpp | 59 | ||||
-rw-r--r-- | noncore/settings/networksettings2/cable/cable_NN.h | 44 | ||||
-rw-r--r-- | noncore/settings/networksettings2/cable/cable_NNI.cpp | 66 | ||||
-rw-r--r-- | noncore/settings/networksettings2/cable/cable_NNI.h | 43 | ||||
-rw-r--r-- | noncore/settings/networksettings2/cable/cabledata.h | 18 | ||||
-rw-r--r-- | noncore/settings/networksettings2/cable/cableedit.cpp | 68 | ||||
-rw-r--r-- | noncore/settings/networksettings2/cable/cableedit.h | 12 | ||||
-rw-r--r-- | noncore/settings/networksettings2/cable/cablerun.cpp | 26 | ||||
-rw-r--r-- | noncore/settings/networksettings2/cable/cablerun.h | 21 | ||||
-rw-r--r-- | noncore/settings/networksettings2/cable/config.in | 4 |
12 files changed, 924 insertions, 0 deletions
diff --git a/noncore/settings/networksettings2/cable/cable.pro b/noncore/settings/networksettings2/cable/cable.pro new file mode 100644 index 0000000..d902360 --- a/dev/null +++ b/noncore/settings/networksettings2/cable/cable.pro | |||
@@ -0,0 +1,18 @@ | |||
1 | TEMPLATE = lib | ||
2 | CONFIG += qt warn_on release | ||
3 | DESTDIR = $(OPIEDIR)/plugins/networksettings2 | ||
4 | HEADERS = cable_NN.h \ | ||
5 | cable_NNI.h \ | ||
6 | cableedit.h | ||
7 | SOURCES = cable_NN.cpp \ | ||
8 | cable_NNI.cpp \ | ||
9 | cableedit.cpp \ | ||
10 | cablerun.cpp | ||
11 | INCLUDEPATH+= $(OPIEDIR)/include ../ ../networksettings2 | ||
12 | DEPENDPATH+= $(OPIEDIR)/include ../ ../networksettings2 | ||
13 | LIBS += -lqpe | ||
14 | INTERFACES= cableGUI.ui | ||
15 | TARGET = cable | ||
16 | VERSION = 1.0.0 | ||
17 | |||
18 | include ( $(OPIEDIR)/include.pro ) | ||
diff --git a/noncore/settings/networksettings2/cable/cableGUI.ui b/noncore/settings/networksettings2/cable/cableGUI.ui new file mode 100644 index 0000000..2431861 --- a/dev/null +++ b/noncore/settings/networksettings2/cable/cableGUI.ui | |||
@@ -0,0 +1,545 @@ | |||
1 | <!DOCTYPE UI><UI> | ||
2 | <class>CableGUI</class> | ||
3 | <widget> | ||
4 | <class>QWidget</class> | ||
5 | <property stdset="1"> | ||
6 | <name>name</name> | ||
7 | <cstring>Cable_FRM</cstring> | ||
8 | </property> | ||
9 | <property stdset="1"> | ||
10 | <name>geometry</name> | ||
11 | <rect> | ||
12 | <x>0</x> | ||
13 | <y>0</y> | ||
14 | <width>235</width> | ||
15 | <height>194</height> | ||
16 | </rect> | ||
17 | </property> | ||
18 | <property stdset="1"> | ||
19 | <name>caption</name> | ||
20 | <string>Cable</string> | ||
21 | </property> | ||
22 | <property> | ||
23 | <name>layoutMargin</name> | ||
24 | </property> | ||
25 | <property> | ||
26 | <name>layoutSpacing</name> | ||
27 | </property> | ||
28 | <vbox> | ||
29 | <property stdset="1"> | ||
30 | <name>margin</name> | ||
31 | <number>2</number> | ||
32 | </property> | ||
33 | <property stdset="1"> | ||
34 | <name>spacing</name> | ||
35 | <number>2</number> | ||
36 | </property> | ||
37 | <widget> | ||
38 | <class>QLayoutWidget</class> | ||
39 | <property stdset="1"> | ||
40 | <name>name</name> | ||
41 | <cstring>Layout3</cstring> | ||
42 | </property> | ||
43 | <grid> | ||
44 | <property stdset="1"> | ||
45 | <name>margin</name> | ||
46 | <number>0</number> | ||
47 | </property> | ||
48 | <property stdset="1"> | ||
49 | <name>spacing</name> | ||
50 | <number>6</number> | ||
51 | </property> | ||
52 | <widget row="1" column="0" > | ||
53 | <class>QLabel</class> | ||
54 | <property stdset="1"> | ||
55 | <name>name</name> | ||
56 | <cstring>TextLabel1_2</cstring> | ||
57 | </property> | ||
58 | <property stdset="1"> | ||
59 | <name>text</name> | ||
60 | <string>Lock file</string> | ||
61 | </property> | ||
62 | </widget> | ||
63 | <widget row="0" column="0" > | ||
64 | <class>QLabel</class> | ||
65 | <property stdset="1"> | ||
66 | <name>name</name> | ||
67 | <cstring>TextLabel1</cstring> | ||
68 | </property> | ||
69 | <property stdset="1"> | ||
70 | <name>text</name> | ||
71 | <string>Device</string> | ||
72 | </property> | ||
73 | </widget> | ||
74 | <widget row="1" column="1" > | ||
75 | <class>QLineEdit</class> | ||
76 | <property stdset="1"> | ||
77 | <name>name</name> | ||
78 | <cstring>LockFile_LE</cstring> | ||
79 | </property> | ||
80 | </widget> | ||
81 | <widget row="0" column="1" > | ||
82 | <class>QLineEdit</class> | ||
83 | <property stdset="1"> | ||
84 | <name>name</name> | ||
85 | <cstring>DeviceFile_LE</cstring> | ||
86 | </property> | ||
87 | </widget> | ||
88 | </grid> | ||
89 | </widget> | ||
90 | <widget> | ||
91 | <class>QGroupBox</class> | ||
92 | <property stdset="1"> | ||
93 | <name>name</name> | ||
94 | <cstring>GroupBox1</cstring> | ||
95 | </property> | ||
96 | <property stdset="1"> | ||
97 | <name>title</name> | ||
98 | <string>Serial settings</string> | ||
99 | </property> | ||
100 | <property> | ||
101 | <name>layoutMargin</name> | ||
102 | </property> | ||
103 | <property> | ||
104 | <name>layoutSpacing</name> | ||
105 | </property> | ||
106 | <vbox> | ||
107 | <property stdset="1"> | ||
108 | <name>margin</name> | ||
109 | <number>2</number> | ||
110 | </property> | ||
111 | <property stdset="1"> | ||
112 | <name>spacing</name> | ||
113 | <number>2</number> | ||
114 | </property> | ||
115 | <widget> | ||
116 | <class>QLayoutWidget</class> | ||
117 | <property stdset="1"> | ||
118 | <name>name</name> | ||
119 | <cstring>Layout13</cstring> | ||
120 | </property> | ||
121 | <property> | ||
122 | <name>layoutSpacing</name> | ||
123 | </property> | ||
124 | <grid> | ||
125 | <property stdset="1"> | ||
126 | <name>margin</name> | ||
127 | <number>0</number> | ||
128 | </property> | ||
129 | <property stdset="1"> | ||
130 | <name>spacing</name> | ||
131 | <number>2</number> | ||
132 | </property> | ||
133 | <widget row="0" column="1" > | ||
134 | <class>QComboBox</class> | ||
135 | <item> | ||
136 | <property> | ||
137 | <name>text</name> | ||
138 | <string>2400</string> | ||
139 | </property> | ||
140 | </item> | ||
141 | <item> | ||
142 | <property> | ||
143 | <name>text</name> | ||
144 | <string>9600</string> | ||
145 | </property> | ||
146 | </item> | ||
147 | <item> | ||
148 | <property> | ||
149 | <name>text</name> | ||
150 | <string>19200</string> | ||
151 | </property> | ||
152 | </item> | ||
153 | <item> | ||
154 | <property> | ||
155 | <name>text</name> | ||
156 | <string>38400</string> | ||
157 | </property> | ||
158 | </item> | ||
159 | <item> | ||
160 | <property> | ||
161 | <name>text</name> | ||
162 | <string>57600</string> | ||
163 | </property> | ||
164 | </item> | ||
165 | <item> | ||
166 | <property> | ||
167 | <name>text</name> | ||
168 | <string>115200</string> | ||
169 | </property> | ||
170 | </item> | ||
171 | <item> | ||
172 | <property> | ||
173 | <name>text</name> | ||
174 | <string>230400</string> | ||
175 | </property> | ||
176 | </item> | ||
177 | <item> | ||
178 | <property> | ||
179 | <name>text</name> | ||
180 | <string>460800</string> | ||
181 | </property> | ||
182 | </item> | ||
183 | <item> | ||
184 | <property> | ||
185 | <name>text</name> | ||
186 | <string>500000</string> | ||
187 | </property> | ||
188 | </item> | ||
189 | <item> | ||
190 | <property> | ||
191 | <name>text</name> | ||
192 | <string>921600</string> | ||
193 | </property> | ||
194 | </item> | ||
195 | <item> | ||
196 | <property> | ||
197 | <name>text</name> | ||
198 | <string>1000000</string> | ||
199 | </property> | ||
200 | </item> | ||
201 | <item> | ||
202 | <property> | ||
203 | <name>text</name> | ||
204 | <string>1152000</string> | ||
205 | </property> | ||
206 | </item> | ||
207 | <item> | ||
208 | <property> | ||
209 | <name>text</name> | ||
210 | <string>1500000</string> | ||
211 | </property> | ||
212 | </item> | ||
213 | <item> | ||
214 | <property> | ||
215 | <name>text</name> | ||
216 | <string>2000000</string> | ||
217 | </property> | ||
218 | </item> | ||
219 | <item> | ||
220 | <property> | ||
221 | <name>text</name> | ||
222 | <string>2500000</string> | ||
223 | </property> | ||
224 | </item> | ||
225 | <item> | ||
226 | <property> | ||
227 | <name>text</name> | ||
228 | <string>3000000</string> | ||
229 | </property> | ||
230 | </item> | ||
231 | <item> | ||
232 | <property> | ||
233 | <name>text</name> | ||
234 | <string>3500000</string> | ||
235 | </property> | ||
236 | </item> | ||
237 | <item> | ||
238 | <property> | ||
239 | <name>text</name> | ||
240 | <string>4000000</string> | ||
241 | </property> | ||
242 | </item> | ||
243 | <property stdset="1"> | ||
244 | <name>name</name> | ||
245 | <cstring>Speed_CB</cstring> | ||
246 | </property> | ||
247 | <property stdset="1"> | ||
248 | <name>currentItem</name> | ||
249 | <number>5</number> | ||
250 | </property> | ||
251 | </widget> | ||
252 | <widget row="1" column="0" > | ||
253 | <class>QLabel</class> | ||
254 | <property stdset="1"> | ||
255 | <name>name</name> | ||
256 | <cstring>TextLabel2_2</cstring> | ||
257 | </property> | ||
258 | <property stdset="1"> | ||
259 | <name>sizePolicy</name> | ||
260 | <sizepolicy> | ||
261 | <hsizetype>0</hsizetype> | ||
262 | <vsizetype>1</vsizetype> | ||
263 | </sizepolicy> | ||
264 | </property> | ||
265 | <property stdset="1"> | ||
266 | <name>text</name> | ||
267 | <string>Parity</string> | ||
268 | </property> | ||
269 | </widget> | ||
270 | <widget row="0" column="2" > | ||
271 | <class>QLabel</class> | ||
272 | <property stdset="1"> | ||
273 | <name>name</name> | ||
274 | <cstring>TextLabel2_2_3</cstring> | ||
275 | </property> | ||
276 | <property stdset="1"> | ||
277 | <name>sizePolicy</name> | ||
278 | <sizepolicy> | ||
279 | <hsizetype>0</hsizetype> | ||
280 | <vsizetype>1</vsizetype> | ||
281 | </sizepolicy> | ||
282 | </property> | ||
283 | <property stdset="1"> | ||
284 | <name>text</name> | ||
285 | <string>Data bits</string> | ||
286 | </property> | ||
287 | </widget> | ||
288 | <widget row="0" column="0" > | ||
289 | <class>QLabel</class> | ||
290 | <property stdset="1"> | ||
291 | <name>name</name> | ||
292 | <cstring>TextLabel2</cstring> | ||
293 | </property> | ||
294 | <property stdset="1"> | ||
295 | <name>text</name> | ||
296 | <string>Speed</string> | ||
297 | </property> | ||
298 | </widget> | ||
299 | <widget row="1" column="2" > | ||
300 | <class>QLabel</class> | ||
301 | <property stdset="1"> | ||
302 | <name>name</name> | ||
303 | <cstring>TextLabel2_2_3_2</cstring> | ||
304 | </property> | ||
305 | <property stdset="1"> | ||
306 | <name>sizePolicy</name> | ||
307 | <sizepolicy> | ||
308 | <hsizetype>0</hsizetype> | ||
309 | <vsizetype>1</vsizetype> | ||
310 | </sizepolicy> | ||
311 | </property> | ||
312 | <property stdset="1"> | ||
313 | <name>text</name> | ||
314 | <string>Stop bits</string> | ||
315 | </property> | ||
316 | </widget> | ||
317 | <widget row="1" column="1" > | ||
318 | <class>QComboBox</class> | ||
319 | <item> | ||
320 | <property> | ||
321 | <name>text</name> | ||
322 | <string>No</string> | ||
323 | </property> | ||
324 | </item> | ||
325 | <item> | ||
326 | <property> | ||
327 | <name>text</name> | ||
328 | <string>Even</string> | ||
329 | </property> | ||
330 | </item> | ||
331 | <item> | ||
332 | <property> | ||
333 | <name>text</name> | ||
334 | <string>Odd</string> | ||
335 | </property> | ||
336 | </item> | ||
337 | <item> | ||
338 | <property> | ||
339 | <name>text</name> | ||
340 | <string>Mark</string> | ||
341 | </property> | ||
342 | </item> | ||
343 | <item> | ||
344 | <property> | ||
345 | <name>text</name> | ||
346 | <string>Space</string> | ||
347 | </property> | ||
348 | </item> | ||
349 | <property stdset="1"> | ||
350 | <name>name</name> | ||
351 | <cstring>Parity_CB</cstring> | ||
352 | </property> | ||
353 | <property stdset="1"> | ||
354 | <name>sizePolicy</name> | ||
355 | <sizepolicy> | ||
356 | <hsizetype>7</hsizetype> | ||
357 | <vsizetype>0</vsizetype> | ||
358 | </sizepolicy> | ||
359 | </property> | ||
360 | <property stdset="1"> | ||
361 | <name>currentItem</name> | ||
362 | <number>0</number> | ||
363 | </property> | ||
364 | </widget> | ||
365 | <widget row="0" column="3" > | ||
366 | <class>QSpinBox</class> | ||
367 | <property stdset="1"> | ||
368 | <name>name</name> | ||
369 | <cstring>DataBits_SB</cstring> | ||
370 | </property> | ||
371 | <property stdset="1"> | ||
372 | <name>sizePolicy</name> | ||
373 | <sizepolicy> | ||
374 | <hsizetype>7</hsizetype> | ||
375 | <vsizetype>0</vsizetype> | ||
376 | </sizepolicy> | ||
377 | </property> | ||
378 | <property stdset="1"> | ||
379 | <name>maxValue</name> | ||
380 | <number>8</number> | ||
381 | </property> | ||
382 | <property stdset="1"> | ||
383 | <name>minValue</name> | ||
384 | <number>5</number> | ||
385 | </property> | ||
386 | <property stdset="1"> | ||
387 | <name>value</name> | ||
388 | <number>8</number> | ||
389 | </property> | ||
390 | </widget> | ||
391 | <widget row="1" column="3" > | ||
392 | <class>QComboBox</class> | ||
393 | <item> | ||
394 | <property> | ||
395 | <name>text</name> | ||
396 | <string>1</string> | ||
397 | </property> | ||
398 | </item> | ||
399 | <item> | ||
400 | <property> | ||
401 | <name>text</name> | ||
402 | <string>2</string> | ||
403 | </property> | ||
404 | </item> | ||
405 | <property stdset="1"> | ||
406 | <name>name</name> | ||
407 | <cstring>StopBits_CB</cstring> | ||
408 | </property> | ||
409 | <property stdset="1"> | ||
410 | <name>sizePolicy</name> | ||
411 | <sizepolicy> | ||
412 | <hsizetype>7</hsizetype> | ||
413 | <vsizetype>0</vsizetype> | ||
414 | </sizepolicy> | ||
415 | </property> | ||
416 | </widget> | ||
417 | </grid> | ||
418 | </widget> | ||
419 | <widget> | ||
420 | <class>QLayoutWidget</class> | ||
421 | <property stdset="1"> | ||
422 | <name>name</name> | ||
423 | <cstring>Layout17</cstring> | ||
424 | </property> | ||
425 | <property> | ||
426 | <name>layoutSpacing</name> | ||
427 | </property> | ||
428 | <hbox> | ||
429 | <property stdset="1"> | ||
430 | <name>margin</name> | ||
431 | <number>0</number> | ||
432 | </property> | ||
433 | <property stdset="1"> | ||
434 | <name>spacing</name> | ||
435 | <number>2</number> | ||
436 | </property> | ||
437 | <widget> | ||
438 | <class>QLabel</class> | ||
439 | <property stdset="1"> | ||
440 | <name>name</name> | ||
441 | <cstring>TextLabel3</cstring> | ||
442 | </property> | ||
443 | <property stdset="1"> | ||
444 | <name>sizePolicy</name> | ||
445 | <sizepolicy> | ||
446 | <hsizetype>0</hsizetype> | ||
447 | <vsizetype>1</vsizetype> | ||
448 | </sizepolicy> | ||
449 | </property> | ||
450 | <property stdset="1"> | ||
451 | <name>text</name> | ||
452 | <string>Flow control :</string> | ||
453 | </property> | ||
454 | <property stdset="1"> | ||
455 | <name>alignment</name> | ||
456 | <set>AlignTop|AlignLeft</set> | ||
457 | </property> | ||
458 | <property> | ||
459 | <name>vAlign</name> | ||
460 | </property> | ||
461 | </widget> | ||
462 | <widget> | ||
463 | <class>QLayoutWidget</class> | ||
464 | <property stdset="1"> | ||
465 | <name>name</name> | ||
466 | <cstring>Layout16</cstring> | ||
467 | </property> | ||
468 | <property> | ||
469 | <name>layoutSpacing</name> | ||
470 | </property> | ||
471 | <vbox> | ||
472 | <property stdset="1"> | ||
473 | <name>margin</name> | ||
474 | <number>0</number> | ||
475 | </property> | ||
476 | <property stdset="1"> | ||
477 | <name>spacing</name> | ||
478 | <number>2</number> | ||
479 | </property> | ||
480 | <widget> | ||
481 | <class>QCheckBox</class> | ||
482 | <property stdset="1"> | ||
483 | <name>name</name> | ||
484 | <cstring>HardwareFC_CB</cstring> | ||
485 | </property> | ||
486 | <property stdset="1"> | ||
487 | <name>sizePolicy</name> | ||
488 | <sizepolicy> | ||
489 | <hsizetype>7</hsizetype> | ||
490 | <vsizetype>0</vsizetype> | ||
491 | </sizepolicy> | ||
492 | </property> | ||
493 | <property stdset="1"> | ||
494 | <name>text</name> | ||
495 | <string>Hardware</string> | ||
496 | </property> | ||
497 | </widget> | ||
498 | <widget> | ||
499 | <class>QCheckBox</class> | ||
500 | <property stdset="1"> | ||
501 | <name>name</name> | ||
502 | <cstring>SoftwareFC_CB</cstring> | ||
503 | </property> | ||
504 | <property stdset="1"> | ||
505 | <name>sizePolicy</name> | ||
506 | <sizepolicy> | ||
507 | <hsizetype>7</hsizetype> | ||
508 | <vsizetype>0</vsizetype> | ||
509 | </sizepolicy> | ||
510 | </property> | ||
511 | <property stdset="1"> | ||
512 | <name>text</name> | ||
513 | <string>Software</string> | ||
514 | </property> | ||
515 | </widget> | ||
516 | </vbox> | ||
517 | </widget> | ||
518 | </hbox> | ||
519 | </widget> | ||
520 | </vbox> | ||
521 | </widget> | ||
522 | <spacer> | ||
523 | <property> | ||
524 | <name>name</name> | ||
525 | <cstring>Spacer6</cstring> | ||
526 | </property> | ||
527 | <property stdset="1"> | ||
528 | <name>orientation</name> | ||
529 | <enum>Vertical</enum> | ||
530 | </property> | ||
531 | <property stdset="1"> | ||
532 | <name>sizeType</name> | ||
533 | <enum>Expanding</enum> | ||
534 | </property> | ||
535 | <property> | ||
536 | <name>sizeHint</name> | ||
537 | <size> | ||
538 | <width>20</width> | ||
539 | <height>20</height> | ||
540 | </size> | ||
541 | </property> | ||
542 | </spacer> | ||
543 | </vbox> | ||
544 | </widget> | ||
545 | </UI> | ||
diff --git a/noncore/settings/networksettings2/cable/cable_NN.cpp b/noncore/settings/networksettings2/cable/cable_NN.cpp new file mode 100644 index 0000000..756903e --- a/dev/null +++ b/noncore/settings/networksettings2/cable/cable_NN.cpp | |||
@@ -0,0 +1,59 @@ | |||
1 | #include "cable_NN.h" | ||
2 | #include "cable_NNI.h" | ||
3 | |||
4 | static const char * CableNeeds[] = | ||
5 | { 0 | ||
6 | }; | ||
7 | |||
8 | /** | ||
9 | * Constructor, find all of the possible interfaces | ||
10 | */ | ||
11 | CableNetNode::CableNetNode() : ANetNode() { | ||
12 | } | ||
13 | |||
14 | /** | ||
15 | * Delete any interfaces that we own. | ||
16 | */ | ||
17 | CableNetNode::~CableNetNode(){ | ||
18 | } | ||
19 | |||
20 | const QString CableNetNode::nodeDescription(){ | ||
21 | return tr("\ | ||
22 | <p>Sets up a wired serial or parallel.</p>\ | ||
23 | " | ||
24 | ); | ||
25 | } | ||
26 | |||
27 | ANetNodeInstance * CableNetNode::createInstance( void ) { | ||
28 | return new ACable( this ); | ||
29 | } | ||
30 | |||
31 | const char ** CableNetNode::needs( void ) { | ||
32 | return CableNeeds; | ||
33 | } | ||
34 | |||
35 | const char * CableNetNode::provides( void ) { | ||
36 | return "line"; | ||
37 | } | ||
38 | |||
39 | bool CableNetNode::generateProperFilesFor( | ||
40 | ANetNodeInstance * ) { | ||
41 | return 1; | ||
42 | } | ||
43 | |||
44 | bool CableNetNode::hasDataFor( const QString & ) { | ||
45 | return 0; | ||
46 | } | ||
47 | |||
48 | bool CableNetNode::generateDataForCommonFile( | ||
49 | SystemFile & , | ||
50 | long , | ||
51 | ANetNodeInstance * ) { | ||
52 | return 1; | ||
53 | } | ||
54 | |||
55 | extern "C" { | ||
56 | void create_plugin( QList<ANetNode> & PNN ) { | ||
57 | PNN.append( new CableNetNode() ); | ||
58 | } | ||
59 | } | ||
diff --git a/noncore/settings/networksettings2/cable/cable_NN.h b/noncore/settings/networksettings2/cable/cable_NN.h new file mode 100644 index 0000000..401317b --- a/dev/null +++ b/noncore/settings/networksettings2/cable/cable_NN.h | |||
@@ -0,0 +1,44 @@ | |||
1 | #ifndef CABLE_NETNODE_H | ||
2 | #define CABLE_NETNODE_H | ||
3 | |||
4 | #include "netnode.h" | ||
5 | |||
6 | class ACable; | ||
7 | |||
8 | class CableNetNode : public ANetNode { | ||
9 | |||
10 | Q_OBJECT | ||
11 | |||
12 | public: | ||
13 | |||
14 | CableNetNode(); | ||
15 | virtual ~CableNetNode(); | ||
16 | |||
17 | virtual const QString pixmapName() | ||
18 | { return "cable"; } | ||
19 | |||
20 | virtual const QString nodeName() | ||
21 | { return tr("Cable Connection"); } | ||
22 | |||
23 | virtual const QString nodeDescription() ; | ||
24 | |||
25 | virtual ANetNodeInstance * createInstance( void ); | ||
26 | |||
27 | virtual const char ** needs( void ); | ||
28 | virtual const char * provides( void ); | ||
29 | |||
30 | virtual bool generateProperFilesFor( ANetNodeInstance * NNI ); | ||
31 | virtual bool hasDataFor( const QString & S ); | ||
32 | virtual bool generateDataForCommonFile( | ||
33 | SystemFile & SF, long DevNr, ANetNodeInstance * NNI ); | ||
34 | |||
35 | private: | ||
36 | |||
37 | }; | ||
38 | |||
39 | extern "C" | ||
40 | { | ||
41 | void create_plugin( QList<ANetNode> & PNN ); | ||
42 | }; | ||
43 | |||
44 | #endif | ||
diff --git a/noncore/settings/networksettings2/cable/cable_NNI.cpp b/noncore/settings/networksettings2/cable/cable_NNI.cpp new file mode 100644 index 0000000..d26afd1 --- a/dev/null +++ b/noncore/settings/networksettings2/cable/cable_NNI.cpp | |||
@@ -0,0 +1,66 @@ | |||
1 | #include "cableedit.h" | ||
2 | #include "cable_NNI.h" | ||
3 | #include "cable_NN.h" | ||
4 | |||
5 | ACable::ACable( CableNetNode * PNN ) : ANetNodeInstance( PNN ) { | ||
6 | // default values | ||
7 | Data.Device = "/dev/ttyS0"; | ||
8 | Data.LockFile = "/var/Lock"; | ||
9 | Data.Speed = 115200; | ||
10 | Data.DataBits = 8; | ||
11 | Data.Parity = 0; | ||
12 | Data.StopBits = 1; | ||
13 | Data.HardwareControl = 0; | ||
14 | Data.SoftwareControl = 0; | ||
15 | GUI = 0; | ||
16 | RT = 0; | ||
17 | } | ||
18 | |||
19 | void ACable::setSpecificAttribute( QString & A, QString & V) { | ||
20 | if( A == "device" ) { | ||
21 | Data.Device = V; | ||
22 | } else if ( A == "lockfile" ) { | ||
23 | Data.LockFile = V; | ||
24 | } else if ( A == "speed" ) { | ||
25 | Data.Speed = V.toLong(); | ||
26 | } else if ( A == "parity" ) { | ||
27 | Data.Parity = V.toShort(); | ||
28 | } else if ( A == "databits" ) { | ||
29 | Data.DataBits = V.toShort(); | ||
30 | } else if ( A == "stopbits" ) { | ||
31 | Data.StopBits = V.toShort(); | ||
32 | } else if ( A == "hardwarecontrol" ) { | ||
33 | Data.HardwareControl = ( V == "yes" ); | ||
34 | } else if ( A == "softwarecontrol" ) { | ||
35 | Data.SoftwareControl = ( V == "yes" ); | ||
36 | } | ||
37 | } | ||
38 | |||
39 | void ACable::saveSpecificAttribute( QTextStream & TS ) { | ||
40 | TS << "device=" << quote( Data.Device ) << endl; | ||
41 | TS << "lockfile=" << quote( Data.LockFile ) << endl; | ||
42 | TS << "speed=" << Data.Speed << endl; | ||
43 | TS << "parity=" << Data.Parity << endl; | ||
44 | TS << "databits=" << Data.DataBits << endl; | ||
45 | TS << "stopbits=" << Data.StopBits << endl; | ||
46 | TS << "hardwarecontrol=" << | ||
47 | ((Data.HardwareControl) ? "yes" : "no") << endl; | ||
48 | TS << "softwarecontrol=" << | ||
49 | ((Data.SoftwareControl) ? "yes" : "no") << endl; | ||
50 | } | ||
51 | |||
52 | QWidget * ACable::edit( QWidget * parent ) { | ||
53 | GUI = new CableEdit( parent ); | ||
54 | GUI->showData( Data ); | ||
55 | return GUI; | ||
56 | } | ||
57 | |||
58 | QString ACable::acceptable( void ) { | ||
59 | return ( GUI ) ? GUI->acceptable( ) : QString(); | ||
60 | } | ||
61 | |||
62 | void ACable::commit( void ) { | ||
63 | if( GUI && GUI->commit( Data ) ) { | ||
64 | setModified( 1 ); | ||
65 | } | ||
66 | } | ||
diff --git a/noncore/settings/networksettings2/cable/cable_NNI.h b/noncore/settings/networksettings2/cable/cable_NNI.h new file mode 100644 index 0000000..0654a5d --- a/dev/null +++ b/noncore/settings/networksettings2/cable/cable_NNI.h | |||
@@ -0,0 +1,43 @@ | |||
1 | #ifndef CABLE_H | ||
2 | #define CABLE_H | ||
3 | |||
4 | #include <netnode.h> | ||
5 | #include "cabledata.h" | ||
6 | #include "cablerun.h" | ||
7 | |||
8 | class CableNetNode; | ||
9 | class CableEdit; | ||
10 | |||
11 | class ACable : public ANetNodeInstance { | ||
12 | |||
13 | public : | ||
14 | |||
15 | ACable( CableNetNode * PNN ); | ||
16 | |||
17 | QWidget * edit( QWidget * parent ); | ||
18 | QString acceptable( void ); | ||
19 | void commit( void ); | ||
20 | |||
21 | RuntimeInfo * runtime( void ) | ||
22 | { if( RT == 0 ) | ||
23 | RT = new CableRun( this, Data ); | ||
24 | return RT; | ||
25 | } | ||
26 | |||
27 | virtual void * data( void ) | ||
28 | { return (void *)&Data; } | ||
29 | |||
30 | protected : | ||
31 | |||
32 | virtual void setSpecificAttribute( QString & Attr, QString & Value ); | ||
33 | virtual void saveSpecificAttribute( QTextStream & TS ); | ||
34 | |||
35 | private : | ||
36 | |||
37 | CableEdit * GUI; | ||
38 | CableData_t Data; | ||
39 | CableRun * RT; | ||
40 | |||
41 | }; | ||
42 | |||
43 | #endif | ||
diff --git a/noncore/settings/networksettings2/cable/cabledata.h b/noncore/settings/networksettings2/cable/cabledata.h new file mode 100644 index 0000000..c449d96 --- a/dev/null +++ b/noncore/settings/networksettings2/cable/cabledata.h | |||
@@ -0,0 +1,18 @@ | |||
1 | #ifndef CABLE_DATA_H | ||
2 | #define CABLE_DATA_H | ||
3 | |||
4 | #include <qstring.h> | ||
5 | |||
6 | typedef struct CableData { | ||
7 | QString Device; | ||
8 | QString LockFile; | ||
9 | long Speed; | ||
10 | short Parity; | ||
11 | short DataBits; | ||
12 | short StopBits; | ||
13 | bool HardwareControl; | ||
14 | bool SoftwareControl; | ||
15 | |||
16 | } CableData_t; | ||
17 | |||
18 | #endif | ||
diff --git a/noncore/settings/networksettings2/cable/cableedit.cpp b/noncore/settings/networksettings2/cable/cableedit.cpp new file mode 100644 index 0000000..6e1a13b --- a/dev/null +++ b/noncore/settings/networksettings2/cable/cableedit.cpp | |||
@@ -0,0 +1,68 @@ | |||
1 | #include <GUIUtils.h> | ||
2 | #include <stdio.h> | ||
3 | #include <qlineedit.h> | ||
4 | #include <qcombobox.h> | ||
5 | #include <qspinbox.h> | ||
6 | #include <qcheckbox.h> | ||
7 | #include "cabledata.h" | ||
8 | #include "cableedit.h" | ||
9 | |||
10 | static long SpeedTable[] = { | ||
11 | 2400, 9600, 19200, 38400, 57600, 115200, | ||
12 | 230400, 460800, 500000, 921600, 1000000, | ||
13 | 1152000, 1500000, 2000000, 2500000, 3000000, | ||
14 | 3500000, 4000000, -1 | ||
15 | }; | ||
16 | |||
17 | CableEdit::CableEdit( QWidget * Parent ) : CableGUI( Parent ) { | ||
18 | } | ||
19 | |||
20 | void CableEdit::showData( CableData_t & D ) { | ||
21 | DeviceFile_LE->setText( D.Device ); | ||
22 | LockFile_LE->setText( D.LockFile ); | ||
23 | for( long * Run = SpeedTable; *Run != -1; *Run ++ ) { | ||
24 | if( *Run == D.Speed ) { | ||
25 | Speed_CB->setCurrentItem( | ||
26 | ((long)(Run)-(long)(SpeedTable))/sizeof(long) ); | ||
27 | break; | ||
28 | } | ||
29 | } | ||
30 | Parity_CB->setCurrentItem( D.Parity ); | ||
31 | DataBits_SB->setValue( D.DataBits ); | ||
32 | StopBits_CB->setCurrentItem( D.StopBits ); | ||
33 | HardwareFC_CB->setChecked( D.HardwareControl ); | ||
34 | SoftwareFC_CB->setChecked( D.SoftwareControl ); | ||
35 | } | ||
36 | |||
37 | QString CableEdit::acceptable( void ) { | ||
38 | if( DeviceFile_LE->text().isEmpty() ) | ||
39 | return tr("Device filename needed"); | ||
40 | return QString(); | ||
41 | } | ||
42 | |||
43 | bool CableEdit::commit( CableData_t & D ) { | ||
44 | bool SM = 0; | ||
45 | |||
46 | TXTM( D.Device, DeviceFile_LE, SM ); | ||
47 | TXTM( D.LockFile, LockFile_LE, SM ); | ||
48 | |||
49 | for( long * Run = SpeedTable; *Run != -1; *Run ++ ) { | ||
50 | if( *Run == D.Speed ) { | ||
51 | if( D.Speed != Speed_CB->currentText().toLong() ) { | ||
52 | SM = 1; | ||
53 | D.Speed = Speed_CB->currentText().toLong(); | ||
54 | } | ||
55 | break; | ||
56 | } | ||
57 | } | ||
58 | |||
59 | CIM(D.Parity, Parity_CB, SM ); | ||
60 | |||
61 | SBM(D.DataBits, DataBits_SB, SM ); | ||
62 | CIM(D.StopBits, StopBits_CB, SM ); | ||
63 | |||
64 | CBM( D.HardwareControl, HardwareFC_CB, SM ); | ||
65 | CBM( D.SoftwareControl, SoftwareFC_CB, SM ); | ||
66 | |||
67 | return SM; | ||
68 | } | ||
diff --git a/noncore/settings/networksettings2/cable/cableedit.h b/noncore/settings/networksettings2/cable/cableedit.h new file mode 100644 index 0000000..ffacc61 --- a/dev/null +++ b/noncore/settings/networksettings2/cable/cableedit.h | |||
@@ -0,0 +1,12 @@ | |||
1 | #include "cabledata.h" | ||
2 | #include "cableGUI.h" | ||
3 | |||
4 | class CableEdit : public CableGUI { | ||
5 | |||
6 | public : | ||
7 | |||
8 | CableEdit( QWidget * parent ); | ||
9 | QString acceptable( void ); | ||
10 | bool commit( CableData_t & D ); | ||
11 | void showData( CableData_t & D ); | ||
12 | }; | ||
diff --git a/noncore/settings/networksettings2/cable/cablerun.cpp b/noncore/settings/networksettings2/cable/cablerun.cpp new file mode 100644 index 0000000..edb4b01 --- a/dev/null +++ b/noncore/settings/networksettings2/cable/cablerun.cpp | |||
@@ -0,0 +1,26 @@ | |||
1 | #include <fcntl.h> | ||
2 | #include <unistd.h> | ||
3 | #include "cablerun.h" | ||
4 | |||
5 | void CableRun::detectState( NodeCollection * NC ) { | ||
6 | |||
7 | int fd = open( D->Device.latin1(), O_RDWR ); | ||
8 | |||
9 | if( fd < 0 ) { | ||
10 | NC->setCurrentState( Unavailable ); | ||
11 | } | ||
12 | close( fd ); | ||
13 | NC->setCurrentState( Available ); | ||
14 | } | ||
15 | |||
16 | bool CableRun::setState( NodeCollection * NC, Action_t A ) { | ||
17 | if( A == Activate ) { | ||
18 | detectState(NC); | ||
19 | return (NC->currentState() == Available); | ||
20 | } | ||
21 | return 1; | ||
22 | } | ||
23 | |||
24 | bool CableRun::canSetState( State_t , Action_t ) { | ||
25 | return 1; | ||
26 | } | ||
diff --git a/noncore/settings/networksettings2/cable/cablerun.h b/noncore/settings/networksettings2/cable/cablerun.h new file mode 100644 index 0000000..36ee640 --- a/dev/null +++ b/noncore/settings/networksettings2/cable/cablerun.h | |||
@@ -0,0 +1,21 @@ | |||
1 | #include <asline.h> | ||
2 | #include "cabledata.h" | ||
3 | |||
4 | class CableRun : public AsLine { | ||
5 | |||
6 | public : | ||
7 | |||
8 | CableRun( ANetNodeInstance * NNI, | ||
9 | CableData & Data ) : AsLine( NNI ) | ||
10 | { D = &Data; } | ||
11 | |||
12 | protected : | ||
13 | |||
14 | void detectState( NodeCollection * NC ); | ||
15 | bool setState( NodeCollection * NC, Action_t A ); | ||
16 | bool canSetState( State_t Curr, Action_t A ); | ||
17 | |||
18 | private : | ||
19 | |||
20 | CableData_t * D; | ||
21 | }; | ||
diff --git a/noncore/settings/networksettings2/cable/config.in b/noncore/settings/networksettings2/cable/config.in new file mode 100644 index 0000000..4453107 --- a/dev/null +++ b/noncore/settings/networksettings2/cable/config.in | |||
@@ -0,0 +1,4 @@ | |||
1 | config NS2CABLE | ||
2 | boolean "opie-networksettings2plugin-cable (set up Cable)" | ||
3 | default "n" if NS2 | ||
4 | depends ( LIBQPE || LIBQPE-X11 ) && LIBOPIE && NS2 && NS2CORE | ||