-rw-r--r-- | noncore/net/wellenreiter/gui/configbase.ui | 2 | ||||
-rw-r--r-- | noncore/net/wellenreiter/gui/gps.cpp | 2 | ||||
-rw-r--r-- | noncore/net/wellenreiter/gui/mainwindow.cpp | 9 |
3 files changed, 8 insertions, 5 deletions
diff --git a/noncore/net/wellenreiter/gui/configbase.ui b/noncore/net/wellenreiter/gui/configbase.ui index de6abfc..469effe 100644 --- a/noncore/net/wellenreiter/gui/configbase.ui +++ b/noncore/net/wellenreiter/gui/configbase.ui | |||
@@ -1203,308 +1203,308 @@ | |||
1203 | <class>QComboBox</class> | 1203 | <class>QComboBox</class> |
1204 | <item> | 1204 | <item> |
1205 | <property> | 1205 | <property> |
1206 | <name>text</name> | 1206 | <name>text</name> |
1207 | <string>192.168.125.1</string> | 1207 | <string>192.168.125.1</string> |
1208 | </property> | 1208 | </property> |
1209 | </item> | 1209 | </item> |
1210 | <item> | 1210 | <item> |
1211 | <property> | 1211 | <property> |
1212 | <name>text</name> | 1212 | <name>text</name> |
1213 | <string><automatic></string> | 1213 | <string><automatic></string> |
1214 | </property> | 1214 | </property> |
1215 | </item> | 1215 | </item> |
1216 | <property stdset="1"> | 1216 | <property stdset="1"> |
1217 | <name>name</name> | 1217 | <name>name</name> |
1218 | <cstring>fakeIP</cstring> | 1218 | <cstring>fakeIP</cstring> |
1219 | </property> | 1219 | </property> |
1220 | <property stdset="1"> | 1220 | <property stdset="1"> |
1221 | <name>sizePolicy</name> | 1221 | <name>sizePolicy</name> |
1222 | <sizepolicy> | 1222 | <sizepolicy> |
1223 | <hsizetype>7</hsizetype> | 1223 | <hsizetype>7</hsizetype> |
1224 | <vsizetype>0</vsizetype> | 1224 | <vsizetype>0</vsizetype> |
1225 | </sizepolicy> | 1225 | </sizepolicy> |
1226 | </property> | 1226 | </property> |
1227 | <property stdset="1"> | 1227 | <property stdset="1"> |
1228 | <name>editable</name> | 1228 | <name>editable</name> |
1229 | <bool>true</bool> | 1229 | <bool>true</bool> |
1230 | </property> | 1230 | </property> |
1231 | <property stdset="1"> | 1231 | <property stdset="1"> |
1232 | <name>currentItem</name> | 1232 | <name>currentItem</name> |
1233 | <number>0</number> | 1233 | <number>0</number> |
1234 | </property> | 1234 | </property> |
1235 | </widget> | 1235 | </widget> |
1236 | </grid> | 1236 | </grid> |
1237 | </widget> | 1237 | </widget> |
1238 | </grid> | 1238 | </grid> |
1239 | </widget> | 1239 | </widget> |
1240 | <widget> | 1240 | <widget> |
1241 | <class>QWidget</class> | 1241 | <class>QWidget</class> |
1242 | <property stdset="1"> | 1242 | <property stdset="1"> |
1243 | <name>name</name> | 1243 | <name>name</name> |
1244 | <cstring>tab</cstring> | 1244 | <cstring>tab</cstring> |
1245 | </property> | 1245 | </property> |
1246 | <attribute> | 1246 | <attribute> |
1247 | <name>title</name> | 1247 | <name>title</name> |
1248 | <string>GPS</string> | 1248 | <string>GPS</string> |
1249 | </attribute> | 1249 | </attribute> |
1250 | <grid> | 1250 | <grid> |
1251 | <property stdset="1"> | 1251 | <property stdset="1"> |
1252 | <name>margin</name> | 1252 | <name>margin</name> |
1253 | <number>5</number> | 1253 | <number>5</number> |
1254 | </property> | 1254 | </property> |
1255 | <property stdset="1"> | 1255 | <property stdset="1"> |
1256 | <name>spacing</name> | 1256 | <name>spacing</name> |
1257 | <number>4</number> | 1257 | <number>4</number> |
1258 | </property> | 1258 | </property> |
1259 | <widget row="0" column="0" > | 1259 | <widget row="0" column="0" > |
1260 | <class>QLayoutWidget</class> | 1260 | <class>QLayoutWidget</class> |
1261 | <property stdset="1"> | 1261 | <property stdset="1"> |
1262 | <name>name</name> | 1262 | <name>name</name> |
1263 | <cstring>Layout6</cstring> | 1263 | <cstring>Layout6</cstring> |
1264 | </property> | 1264 | </property> |
1265 | <vbox> | 1265 | <vbox> |
1266 | <property stdset="1"> | 1266 | <property stdset="1"> |
1267 | <name>margin</name> | 1267 | <name>margin</name> |
1268 | <number>0</number> | 1268 | <number>0</number> |
1269 | </property> | 1269 | </property> |
1270 | <property stdset="1"> | 1270 | <property stdset="1"> |
1271 | <name>spacing</name> | 1271 | <name>spacing</name> |
1272 | <number>6</number> | 1272 | <number>6</number> |
1273 | </property> | 1273 | </property> |
1274 | <widget> | 1274 | <widget> |
1275 | <class>QCheckBox</class> | 1275 | <class>QCheckBox</class> |
1276 | <property stdset="1"> | 1276 | <property stdset="1"> |
1277 | <name>name</name> | 1277 | <name>name</name> |
1278 | <cstring>enableGPS</cstring> | 1278 | <cstring>enableGPS</cstring> |
1279 | </property> | 1279 | </property> |
1280 | <property stdset="1"> | 1280 | <property stdset="1"> |
1281 | <name>text</name> | 1281 | <name>text</name> |
1282 | <string>Enable GPS logging w/ gpsd</string> | 1282 | <string>Enable GPS logging w/ gpsd</string> |
1283 | </property> | 1283 | </property> |
1284 | </widget> | 1284 | </widget> |
1285 | <widget> | 1285 | <widget> |
1286 | <class>QLayoutWidget</class> | 1286 | <class>QLayoutWidget</class> |
1287 | <property stdset="1"> | 1287 | <property stdset="1"> |
1288 | <name>name</name> | 1288 | <name>name</name> |
1289 | <cstring>Layout1</cstring> | 1289 | <cstring>Layout1</cstring> |
1290 | </property> | 1290 | </property> |
1291 | <hbox> | 1291 | <hbox> |
1292 | <property stdset="1"> | 1292 | <property stdset="1"> |
1293 | <name>margin</name> | 1293 | <name>margin</name> |
1294 | <number>0</number> | 1294 | <number>0</number> |
1295 | </property> | 1295 | </property> |
1296 | <property stdset="1"> | 1296 | <property stdset="1"> |
1297 | <name>spacing</name> | 1297 | <name>spacing</name> |
1298 | <number>6</number> | 1298 | <number>6</number> |
1299 | </property> | 1299 | </property> |
1300 | <widget> | 1300 | <widget> |
1301 | <class>QLabel</class> | 1301 | <class>QLabel</class> |
1302 | <property stdset="1"> | 1302 | <property stdset="1"> |
1303 | <name>name</name> | 1303 | <name>name</name> |
1304 | <cstring>TextLabel1_4</cstring> | 1304 | <cstring>TextLabel1_4</cstring> |
1305 | </property> | 1305 | </property> |
1306 | <property stdset="1"> | 1306 | <property stdset="1"> |
1307 | <name>text</name> | 1307 | <name>text</name> |
1308 | <string>Host</string> | 1308 | <string>Host</string> |
1309 | </property> | 1309 | </property> |
1310 | </widget> | 1310 | </widget> |
1311 | <widget> | 1311 | <widget> |
1312 | <class>QComboBox</class> | 1312 | <class>QComboBox</class> |
1313 | <item> | 1313 | <item> |
1314 | <property> | 1314 | <property> |
1315 | <name>text</name> | 1315 | <name>text</name> |
1316 | <string>localhost</string> | 1316 | <string>localhost</string> |
1317 | </property> | 1317 | </property> |
1318 | </item> | 1318 | </item> |
1319 | <property stdset="1"> | 1319 | <property stdset="1"> |
1320 | <name>name</name> | 1320 | <name>name</name> |
1321 | <cstring>gpsdHost</cstring> | 1321 | <cstring>gpsdHost</cstring> |
1322 | </property> | 1322 | </property> |
1323 | <property stdset="1"> | 1323 | <property stdset="1"> |
1324 | <name>enabled</name> | 1324 | <name>enabled</name> |
1325 | <bool>false</bool> | 1325 | <bool>false</bool> |
1326 | </property> | 1326 | </property> |
1327 | <property stdset="1"> | 1327 | <property stdset="1"> |
1328 | <name>editable</name> | 1328 | <name>editable</name> |
1329 | <bool>true</bool> | 1329 | <bool>true</bool> |
1330 | </property> | 1330 | </property> |
1331 | <property stdset="1"> | 1331 | <property stdset="1"> |
1332 | <name>currentItem</name> | 1332 | <name>currentItem</name> |
1333 | <number>0</number> | 1333 | <number>0</number> |
1334 | </property> | 1334 | </property> |
1335 | </widget> | 1335 | </widget> |
1336 | <widget> | 1336 | <widget> |
1337 | <class>QLabel</class> | 1337 | <class>QLabel</class> |
1338 | <property stdset="1"> | 1338 | <property stdset="1"> |
1339 | <name>name</name> | 1339 | <name>name</name> |
1340 | <cstring>TextLabel2_2</cstring> | 1340 | <cstring>TextLabel2_2</cstring> |
1341 | </property> | 1341 | </property> |
1342 | <property stdset="1"> | 1342 | <property stdset="1"> |
1343 | <name>text</name> | 1343 | <name>text</name> |
1344 | <string>:</string> | 1344 | <string>:</string> |
1345 | </property> | 1345 | </property> |
1346 | </widget> | 1346 | </widget> |
1347 | <widget> | 1347 | <widget> |
1348 | <class>QSpinBox</class> | 1348 | <class>QSpinBox</class> |
1349 | <property stdset="1"> | 1349 | <property stdset="1"> |
1350 | <name>name</name> | 1350 | <name>name</name> |
1351 | <cstring>gpsdPort</cstring> | 1351 | <cstring>gpsdPort</cstring> |
1352 | </property> | 1352 | </property> |
1353 | <property stdset="1"> | 1353 | <property stdset="1"> |
1354 | <name>enabled</name> | 1354 | <name>enabled</name> |
1355 | <bool>false</bool> | 1355 | <bool>false</bool> |
1356 | </property> | 1356 | </property> |
1357 | <property stdset="1"> | 1357 | <property stdset="1"> |
1358 | <name>maxValue</name> | 1358 | <name>maxValue</name> |
1359 | <number>65535</number> | 1359 | <number>65535</number> |
1360 | </property> | 1360 | </property> |
1361 | <property stdset="1"> | 1361 | <property stdset="1"> |
1362 | <name>minValue</name> | 1362 | <name>minValue</name> |
1363 | <number>1024</number> | 1363 | <number>1024</number> |
1364 | </property> | 1364 | </property> |
1365 | <property stdset="1"> | 1365 | <property stdset="1"> |
1366 | <name>value</name> | 1366 | <name>value</name> |
1367 | <number>2947</number> | 1367 | <number>2947</number> |
1368 | </property> | 1368 | </property> |
1369 | </widget> | 1369 | </widget> |
1370 | </hbox> | 1370 | </hbox> |
1371 | </widget> | 1371 | </widget> |
1372 | <widget> | 1372 | <widget> |
1373 | <class>QCheckBox</class> | 1373 | <class>QCheckBox</class> |
1374 | <property stdset="1"> | 1374 | <property stdset="1"> |
1375 | <name>name</name> | 1375 | <name>name</name> |
1376 | <cstring>startGPS</cstring> | 1376 | <cstring>startGPS</cstring> |
1377 | </property> | 1377 | </property> |
1378 | <property stdset="1"> | 1378 | <property stdset="1"> |
1379 | <name>text</name> | 1379 | <name>text</name> |
1380 | <string>Start gpsd on localhost</string> | 1380 | <string>Start gpsd on localhost</string> |
1381 | </property> | 1381 | </property> |
1382 | </widget> | 1382 | </widget> |
1383 | <widget> | 1383 | <widget> |
1384 | <class>QLineEdit</class> | 1384 | <class>QLineEdit</class> |
1385 | <property stdset="1"> | 1385 | <property stdset="1"> |
1386 | <name>name</name> | 1386 | <name>name</name> |
1387 | <cstring>commandGPS</cstring> | 1387 | <cstring>commandGPS</cstring> |
1388 | </property> | 1388 | </property> |
1389 | <property stdset="1"> | 1389 | <property stdset="1"> |
1390 | <name>enabled</name> | 1390 | <name>enabled</name> |
1391 | <bool>false</bool> | 1391 | <bool>false</bool> |
1392 | </property> | 1392 | </property> |
1393 | <property stdset="1"> | 1393 | <property stdset="1"> |
1394 | <name>text</name> | 1394 | <name>text</name> |
1395 | <string>gpsd -p /dev/ttyS3 -s 57600</string> | 1395 | <string>gpsd -p /dev/ttyS3 -s 4800</string> |
1396 | </property> | 1396 | </property> |
1397 | </widget> | 1397 | </widget> |
1398 | <spacer> | 1398 | <spacer> |
1399 | <property> | 1399 | <property> |
1400 | <name>name</name> | 1400 | <name>name</name> |
1401 | <cstring>Spacer4_2</cstring> | 1401 | <cstring>Spacer4_2</cstring> |
1402 | </property> | 1402 | </property> |
1403 | <property stdset="1"> | 1403 | <property stdset="1"> |
1404 | <name>orientation</name> | 1404 | <name>orientation</name> |
1405 | <enum>Vertical</enum> | 1405 | <enum>Vertical</enum> |
1406 | </property> | 1406 | </property> |
1407 | <property stdset="1"> | 1407 | <property stdset="1"> |
1408 | <name>sizeType</name> | 1408 | <name>sizeType</name> |
1409 | <enum>Expanding</enum> | 1409 | <enum>Expanding</enum> |
1410 | </property> | 1410 | </property> |
1411 | <property> | 1411 | <property> |
1412 | <name>sizeHint</name> | 1412 | <name>sizeHint</name> |
1413 | <size> | 1413 | <size> |
1414 | <width>20</width> | 1414 | <width>20</width> |
1415 | <height>20</height> | 1415 | <height>20</height> |
1416 | </size> | 1416 | </size> |
1417 | </property> | 1417 | </property> |
1418 | </spacer> | 1418 | </spacer> |
1419 | </vbox> | 1419 | </vbox> |
1420 | </widget> | 1420 | </widget> |
1421 | </grid> | 1421 | </grid> |
1422 | </widget> | 1422 | </widget> |
1423 | </widget> | 1423 | </widget> |
1424 | </grid> | 1424 | </grid> |
1425 | </widget> | 1425 | </widget> |
1426 | <customwidgets> | 1426 | <customwidgets> |
1427 | <customwidget> | 1427 | <customwidget> |
1428 | <class>ProtocolListView</class> | 1428 | <class>ProtocolListView</class> |
1429 | <header location="local">protolistview.h</header> | 1429 | <header location="local">protolistview.h</header> |
1430 | <sizehint> | 1430 | <sizehint> |
1431 | <width>100</width> | 1431 | <width>100</width> |
1432 | <height>100</height> | 1432 | <height>100</height> |
1433 | </sizehint> | 1433 | </sizehint> |
1434 | <container>0</container> | 1434 | <container>0</container> |
1435 | <sizepolicy> | 1435 | <sizepolicy> |
1436 | <hordata>3</hordata> | 1436 | <hordata>3</hordata> |
1437 | <verdata>3</verdata> | 1437 | <verdata>3</verdata> |
1438 | </sizepolicy> | 1438 | </sizepolicy> |
1439 | <pixmap>image0</pixmap> | 1439 | <pixmap>image0</pixmap> |
1440 | </customwidget> | 1440 | </customwidget> |
1441 | </customwidgets> | 1441 | </customwidgets> |
1442 | <images> | 1442 | <images> |
1443 | <image> | 1443 | <image> |
1444 | <name>image0</name> | 1444 | <name>image0</name> |
1445 | <data format="XPM.GZ" length="646">789c6dd2c10ac2300c00d07bbf2234b7229d1be245fc04c5a3201e4615f430059d0711ff5ddb2e6bb236ec90eed134cb5a19d8ef36602af5ecdbfeeac05dda0798d3abebde87e3faa374d3807fa0d633a52d38d8de6f679fe33fc776e196f53cd010188256a3600a292882096246517815ca99884606e18044a3a40d91824820924265a7923a2e8bcd05f33db1173e002913175f2a6be6d3294871a2d95fa00e8a94ee017b69d339d90df1e77c57ea072ede6758</data> | 1445 | <data format="XPM.GZ" length="646">789c6dd2c10ac2300c00d07bbf2234b7229d1be245fc04c5a3201e4615f430059d0711ff5ddb2e6bb236ec90eed134cb5a19d8ef36602af5ecdbfeeac05dda0798d3abebde87e3faa374d3807fa0d633a52d38d8de6f679fe33fc776e196f53cd010188256a3600a292882096246517815ca99884606e18044a3a40d91824820924265a7923a2e8bcd05f33db1173e002913175f2a6be6d3294871a2d95fa00e8a94ee017b69d339d90df1e77c57ea072ede6758</data> |
1446 | </image> | 1446 | </image> |
1447 | </images> | 1447 | </images> |
1448 | <connections> | 1448 | <connections> |
1449 | <connection> | 1449 | <connection> |
1450 | <sender>hopChannels</sender> | 1450 | <sender>hopChannels</sender> |
1451 | <signal>toggled(bool)</signal> | 1451 | <signal>toggled(bool)</signal> |
1452 | <receiver>hopInterval</receiver> | 1452 | <receiver>hopInterval</receiver> |
1453 | <slot>setEnabled(bool)</slot> | 1453 | <slot>setEnabled(bool)</slot> |
1454 | </connection> | 1454 | </connection> |
1455 | <connection> | 1455 | <connection> |
1456 | <sender>hopChannels</sender> | 1456 | <sender>hopChannels</sender> |
1457 | <signal>toggled(bool)</signal> | 1457 | <signal>toggled(bool)</signal> |
1458 | <receiver>TextLabel1</receiver> | 1458 | <receiver>TextLabel1</receiver> |
1459 | <slot>setEnabled(bool)</slot> | 1459 | <slot>setEnabled(bool)</slot> |
1460 | </connection> | 1460 | </connection> |
1461 | <connection> | 1461 | <connection> |
1462 | <sender>enableActiveScanning</sender> | 1462 | <sender>enableActiveScanning</sender> |
1463 | <signal>toggled(bool)</signal> | 1463 | <signal>toggled(bool)</signal> |
1464 | <receiver>GroupBox3</receiver> | 1464 | <receiver>GroupBox3</receiver> |
1465 | <slot>setEnabled(bool)</slot> | 1465 | <slot>setEnabled(bool)</slot> |
1466 | </connection> | 1466 | </connection> |
1467 | <connection> | 1467 | <connection> |
1468 | <sender>enableActiveScanning</sender> | 1468 | <sender>enableActiveScanning</sender> |
1469 | <signal>toggled(bool)</signal> | 1469 | <signal>toggled(bool)</signal> |
1470 | <receiver>GroupBox4</receiver> | 1470 | <receiver>GroupBox4</receiver> |
1471 | <slot>setEnabled(bool)</slot> | 1471 | <slot>setEnabled(bool)</slot> |
1472 | </connection> | 1472 | </connection> |
1473 | <connection> | 1473 | <connection> |
1474 | <sender>writeCaptureFile</sender> | 1474 | <sender>writeCaptureFile</sender> |
1475 | <signal>toggled(bool)</signal> | 1475 | <signal>toggled(bool)</signal> |
1476 | <receiver>getCaptureFileName</receiver> | 1476 | <receiver>getCaptureFileName</receiver> |
1477 | <slot>setEnabled(bool)</slot> | 1477 | <slot>setEnabled(bool)</slot> |
1478 | </connection> | 1478 | </connection> |
1479 | <connection> | 1479 | <connection> |
1480 | <sender>writeCaptureFile</sender> | 1480 | <sender>writeCaptureFile</sender> |
1481 | <signal>toggled(bool)</signal> | 1481 | <signal>toggled(bool)</signal> |
1482 | <receiver>captureFileName</receiver> | 1482 | <receiver>captureFileName</receiver> |
1483 | <slot>setEnabled(bool)</slot> | 1483 | <slot>setEnabled(bool)</slot> |
1484 | </connection> | 1484 | </connection> |
1485 | <connection> | 1485 | <connection> |
1486 | <sender>writeCaptureFile</sender> | 1486 | <sender>writeCaptureFile</sender> |
1487 | <signal>toggled(bool)</signal> | 1487 | <signal>toggled(bool)</signal> |
1488 | <receiver>capturePackets</receiver> | 1488 | <receiver>capturePackets</receiver> |
1489 | <slot>setEnabled(bool)</slot> | 1489 | <slot>setEnabled(bool)</slot> |
1490 | </connection> | 1490 | </connection> |
1491 | <connection> | 1491 | <connection> |
1492 | <sender>enableGPS</sender> | 1492 | <sender>enableGPS</sender> |
1493 | <signal>toggled(bool)</signal> | 1493 | <signal>toggled(bool)</signal> |
1494 | <receiver>gpsdHost</receiver> | 1494 | <receiver>gpsdHost</receiver> |
1495 | <slot>setEnabled(bool)</slot> | 1495 | <slot>setEnabled(bool)</slot> |
1496 | </connection> | 1496 | </connection> |
1497 | <connection> | 1497 | <connection> |
1498 | <sender>enableGPS</sender> | 1498 | <sender>enableGPS</sender> |
1499 | <signal>toggled(bool)</signal> | 1499 | <signal>toggled(bool)</signal> |
1500 | <receiver>gpsdPort</receiver> | 1500 | <receiver>gpsdPort</receiver> |
1501 | <slot>setEnabled(bool)</slot> | 1501 | <slot>setEnabled(bool)</slot> |
1502 | </connection> | 1502 | </connection> |
1503 | <connection> | 1503 | <connection> |
1504 | <sender>startGPS</sender> | 1504 | <sender>startGPS</sender> |
1505 | <signal>toggled(bool)</signal> | 1505 | <signal>toggled(bool)</signal> |
1506 | <receiver>commandGPS</receiver> | 1506 | <receiver>commandGPS</receiver> |
1507 | <slot>setEnabled(bool)</slot> | 1507 | <slot>setEnabled(bool)</slot> |
1508 | </connection> | 1508 | </connection> |
1509 | </connections> | 1509 | </connections> |
1510 | </UI> | 1510 | </UI> |
diff --git a/noncore/net/wellenreiter/gui/gps.cpp b/noncore/net/wellenreiter/gui/gps.cpp index 5b1b4a4..b845aa1 100644 --- a/noncore/net/wellenreiter/gui/gps.cpp +++ b/noncore/net/wellenreiter/gui/gps.cpp | |||
@@ -1,127 +1,127 @@ | |||
1 | /********************************************************************** | 1 | /********************************************************************** |
2 | ** Copyright (C) 2003 Michael 'Mickey' Lauer. All rights reserved. | 2 | ** Copyright (C) 2003 Michael 'Mickey' Lauer. All rights reserved. |
3 | ** | 3 | ** |
4 | ** This file is part of Opie Environment. | 4 | ** This file is part of Opie Environment. |
5 | ** | 5 | ** |
6 | ** This file may be distributed and/or modified under the terms of the | 6 | ** This file may be distributed and/or modified under the terms of the |
7 | ** GNU General Public License version 2 as published by the Free Software | 7 | ** GNU General Public License version 2 as published by the Free Software |
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | 8 | ** Foundation and appearing in the file LICENSE.GPL included in the |
9 | ** packaging of this file. | 9 | ** packaging of this file. |
10 | ** | 10 | ** |
11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
13 | ** | 13 | ** |
14 | **********************************************************************/ | 14 | **********************************************************************/ |
15 | 15 | ||
16 | #include "gps.h" | 16 | #include "gps.h" |
17 | 17 | ||
18 | /* QT */ | 18 | /* QT */ |
19 | #include <qtextstream.h> | 19 | #include <qtextstream.h> |
20 | 20 | ||
21 | /* STD */ | 21 | /* STD */ |
22 | #include <stdlib.h> | 22 | #include <stdlib.h> |
23 | #include <unistd.h> | 23 | #include <unistd.h> |
24 | 24 | ||
25 | GPS::GPS( QObject* parent, const char * name ) | 25 | GPS::GPS( QObject* parent, const char * name ) |
26 | :QObject( parent, name ) | 26 | :QObject( parent, name ) |
27 | { | 27 | { |
28 | qDebug( "GPS::GPS()" ); | 28 | qDebug( "GPS::GPS()" ); |
29 | _socket = new QSocket( this, "gpsd commsock" ); | 29 | _socket = new QSocket( this, "gpsd commsock" ); |
30 | } | 30 | } |
31 | 31 | ||
32 | 32 | ||
33 | GPS::~GPS() | 33 | GPS::~GPS() |
34 | { | 34 | { |
35 | qDebug( "GPS::~GPS()" ); | 35 | qDebug( "GPS::~GPS()" ); |
36 | } | 36 | } |
37 | 37 | ||
38 | 38 | ||
39 | bool GPS::open( const QString& host, int port ) | 39 | bool GPS::open( const QString& host, int port ) |
40 | { | 40 | { |
41 | _socket->connectToHost( host, port ); | 41 | _socket->connectToHost( host, port ); |
42 | } | 42 | } |
43 | 43 | ||
44 | 44 | ||
45 | GpsLocation GPS::position() const | 45 | GpsLocation GPS::position() const |
46 | { | 46 | { |
47 | char buf[256]; | 47 | char buf[256]; |
48 | double lat = -111.0; | 48 | double lat = -111.0; |
49 | double lon = -111.0; | 49 | double lon = -111.0; |
50 | 50 | ||
51 | int result = _socket->writeBlock( "p\r\n", 3 ); | 51 | int result = _socket->writeBlock( "p\r\n", 3 ); |
52 | _socket->flush(); | 52 | _socket->flush(); |
53 | if ( result ) | 53 | if ( result ) |
54 | { | 54 | { |
55 | int numAvail = _socket->bytesAvailable(); | 55 | int numAvail = _socket->bytesAvailable(); |
56 | qDebug( "GPS write succeeded, %d bytes available for reading...", numAvail ); | 56 | qDebug( "GPS write succeeded, %d bytes available for reading...", numAvail ); |
57 | if ( numAvail ) | 57 | if ( numAvail ) |
58 | { | 58 | { |
59 | int numRead = _socket->readBlock( &buf[0], sizeof buf ); | 59 | int numRead = _socket->readBlock( &buf[0], sizeof buf ); |
60 | int numScan = sscanf( &buf[0], "GPSD,P=%lg %lg", &lat, &lon); | 60 | int numScan = ::sscanf( &buf[0], "GPSD,P=%lg %lg", &lat, &lon); |
61 | 61 | ||
62 | if ( numRead < 7 || numScan != 2 ) | 62 | if ( numRead < 7 || numScan != 2 ) |
63 | { | 63 | { |
64 | qDebug( "GPS read %d bytes succeeded, invalid response: '%s'", numRead, &buf[0] ); | 64 | qDebug( "GPS read %d bytes succeeded, invalid response: '%s'", numRead, &buf[0] ); |
65 | return GpsLocation( -111, -111 ); | 65 | return GpsLocation( -111, -111 ); |
66 | } | 66 | } |
67 | else | 67 | else |
68 | { | 68 | { |
69 | return GpsLocation( lat, lon ); | 69 | return GpsLocation( lat, lon ); |
70 | } | 70 | } |
71 | } | 71 | } |
72 | } | 72 | } |
73 | return GpsLocation( -111, -111 ); | 73 | return GpsLocation( -111, -111 ); |
74 | } | 74 | } |
75 | 75 | ||
76 | 76 | ||
77 | QString GpsLocation::dmsPosition() const | 77 | QString GpsLocation::dmsPosition() const |
78 | { | 78 | { |
79 | if ( _latitude == -111 || _longitude == -111 ) | 79 | if ( _latitude == -111 || _longitude == -111 ) |
80 | return "N/A"; | 80 | return "N/A"; |
81 | if ( _latitude == 0.0 && _longitude == 0.0 ) | 81 | if ( _latitude == 0.0 && _longitude == 0.0 ) |
82 | return "NULL"; | 82 | return "NULL"; |
83 | 83 | ||
84 | /* compute latitude */ | 84 | /* compute latitude */ |
85 | 85 | ||
86 | QString dms = "N"; | 86 | QString dms = "N"; |
87 | if ( _latitude >= 0 ) dms.append( "+" ); | 87 | if ( _latitude >= 0 ) dms.append( "+" ); |
88 | 88 | ||
89 | int trunc = int( _latitude ); | 89 | int trunc = int( _latitude ); |
90 | float rest = _latitude - trunc; | 90 | float rest = _latitude - trunc; |
91 | 91 | ||
92 | float minf = rest * 60; | 92 | float minf = rest * 60; |
93 | int minutes = int( minf ); | 93 | int minutes = int( minf ); |
94 | 94 | ||
95 | rest = minf - minutes; | 95 | rest = minf - minutes; |
96 | int seconds = int( rest * 60 ); | 96 | int seconds = int( rest * 60 ); |
97 | 97 | ||
98 | dms.append( QString::number( trunc ) ); | 98 | dms.append( QString::number( trunc ) ); |
99 | dms.append( "° " ); | 99 | dms.append( "° " ); |
100 | dms.append( QString::number( ::abs( minutes ) ) ); | 100 | dms.append( QString::number( ::abs( minutes ) ) ); |
101 | dms.append( "' " ); | 101 | dms.append( "' " ); |
102 | dms.append( QString::number( ::abs( seconds ) ) ); | 102 | dms.append( QString::number( ::abs( seconds ) ) ); |
103 | dms.append( "'' " ); | 103 | dms.append( "'' " ); |
104 | 104 | ||
105 | /* compute longitude */ | 105 | /* compute longitude */ |
106 | 106 | ||
107 | dms.append( " | W" ); | 107 | dms.append( " | W" ); |
108 | if ( _longitude > 0 ) dms.append( "+" ); | 108 | if ( _longitude > 0 ) dms.append( "+" ); |
109 | 109 | ||
110 | trunc = int( _longitude ); | 110 | trunc = int( _longitude ); |
111 | rest = _longitude - trunc; | 111 | rest = _longitude - trunc; |
112 | 112 | ||
113 | minf = rest * 60; | 113 | minf = rest * 60; |
114 | minutes = int( minf ); | 114 | minutes = int( minf ); |
115 | 115 | ||
116 | rest = minf - minutes; | 116 | rest = minf - minutes; |
117 | seconds = int( rest * 60 ); | 117 | seconds = int( rest * 60 ); |
118 | 118 | ||
119 | dms.append( QString::number( trunc ) ); | 119 | dms.append( QString::number( trunc ) ); |
120 | dms.append( "° " ); | 120 | dms.append( "° " ); |
121 | dms.append( QString::number( ::abs( minutes ) ) ); | 121 | dms.append( QString::number( ::abs( minutes ) ) ); |
122 | dms.append( "' " ); | 122 | dms.append( "' " ); |
123 | dms.append( QString::number( ::abs( seconds ) ) ); | 123 | dms.append( QString::number( ::abs( seconds ) ) ); |
124 | dms.append( "'' " ); | 124 | dms.append( "'' " ); |
125 | 125 | ||
126 | return dms; | 126 | return dms; |
127 | } | 127 | } |
diff --git a/noncore/net/wellenreiter/gui/mainwindow.cpp b/noncore/net/wellenreiter/gui/mainwindow.cpp index 72624f7..3729ed0 100644 --- a/noncore/net/wellenreiter/gui/mainwindow.cpp +++ b/noncore/net/wellenreiter/gui/mainwindow.cpp | |||
@@ -1,437 +1,440 @@ | |||
1 | /********************************************************************** | 1 | /********************************************************************** |
2 | ** Copyright (C) 2002 Michael 'Mickey' Lauer. All rights reserved. | 2 | ** Copyright (C) 2002 Michael 'Mickey' Lauer. All rights reserved. |
3 | ** | 3 | ** |
4 | ** This file is part of Opie Environment. | 4 | ** This file is part of Opie Environment. |
5 | ** | 5 | ** |
6 | ** This file may be distributed and/or modified under the terms of the | 6 | ** This file may be distributed and/or modified under the terms of the |
7 | ** GNU General Public License version 2 as published by the Free Software | 7 | ** GNU General Public License version 2 as published by the Free Software |
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | 8 | ** Foundation and appearing in the file LICENSE.GPL included in the |
9 | ** packaging of this file. | 9 | ** packaging of this file. |
10 | ** | 10 | ** |
11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
13 | ** | 13 | ** |
14 | **********************************************************************/ | 14 | **********************************************************************/ |
15 | 15 | ||
16 | #include "configwindow.h" | 16 | #include "configwindow.h" |
17 | #include "gps.h" | 17 | #include "gps.h" |
18 | #include "logwindow.h" | 18 | #include "logwindow.h" |
19 | #include "hexwindow.h" | 19 | #include "hexwindow.h" |
20 | #include "mainwindow.h" | 20 | #include "mainwindow.h" |
21 | #include "wellenreiter.h" | 21 | #include "wellenreiter.h" |
22 | #include "scanlist.h" | 22 | #include "scanlist.h" |
23 | 23 | ||
24 | #include <qcombobox.h> | 24 | #include <qcombobox.h> |
25 | #include <qdatastream.h> | 25 | #include <qdatastream.h> |
26 | #include <qfile.h> | 26 | #include <qfile.h> |
27 | #include <qfileinfo.h> | 27 | #include <qfileinfo.h> |
28 | #include <qlabel.h> | 28 | #include <qlabel.h> |
29 | #include <qlayout.h> | 29 | #include <qlayout.h> |
30 | #include <qlineedit.h> | 30 | #include <qlineedit.h> |
31 | #include <qiconset.h> | 31 | #include <qiconset.h> |
32 | #include <qmenubar.h> | 32 | #include <qmenubar.h> |
33 | #include <qmessagebox.h> | 33 | #include <qmessagebox.h> |
34 | #include <qpopupmenu.h> | 34 | #include <qpopupmenu.h> |
35 | #include <qpushbutton.h> | 35 | #include <qpushbutton.h> |
36 | #include <qstatusbar.h> | 36 | #include <qstatusbar.h> |
37 | #include <qspinbox.h> | 37 | #include <qspinbox.h> |
38 | #include <qtextstream.h> | 38 | #include <qtextstream.h> |
39 | #include <qtoolbutton.h> | 39 | #include <qtoolbutton.h> |
40 | 40 | ||
41 | #ifdef QWS | 41 | #ifdef QWS |
42 | #include <qpe/resource.h> | 42 | #include <qpe/resource.h> |
43 | #include <opie2/ofiledialog.h> | 43 | #include <opie2/ofiledialog.h> |
44 | using namespace Opie; | 44 | using namespace Opie; |
45 | #else | 45 | #else |
46 | #include "resource.h" | 46 | #include "resource.h" |
47 | #include <qapplication.h> | 47 | #include <qapplication.h> |
48 | #include <qfiledialog.h> | 48 | #include <qfiledialog.h> |
49 | #endif | 49 | #endif |
50 | 50 | ||
51 | #include <unistd.h> | ||
52 | |||
51 | WellenreiterMainWindow::WellenreiterMainWindow( QWidget * parent, const char * name, WFlags f ) | 53 | WellenreiterMainWindow::WellenreiterMainWindow( QWidget * parent, const char * name, WFlags f ) |
52 | :QMainWindow( parent, name, f ) | 54 | :QMainWindow( parent, name, f ) |
53 | { | 55 | { |
54 | cw = new WellenreiterConfigWindow( this ); | 56 | cw = new WellenreiterConfigWindow( this ); |
55 | mw = new Wellenreiter( this ); | 57 | mw = new Wellenreiter( this ); |
56 | mw->setConfigWindow( cw ); | 58 | mw->setConfigWindow( cw ); |
57 | setCentralWidget( mw ); | 59 | setCentralWidget( mw ); |
58 | 60 | ||
59 | // setup application icon | 61 | // setup application icon |
60 | 62 | ||
61 | #ifndef QWS | 63 | #ifndef QWS |
62 | setIcon( Resource::loadPixmap( "wellenreiter/appicon-trans" ) ); | 64 | setIcon( Resource::loadPixmap( "wellenreiter/appicon-trans" ) ); |
63 | setIconText( "Wellenreiter/X11" ); | 65 | setIconText( "Wellenreiter/X11" ); |
64 | #endif | 66 | #endif |
65 | 67 | ||
66 | // setup tool buttons | 68 | // setup tool buttons |
67 | 69 | ||
68 | startButton = new QToolButton( 0 ); | 70 | startButton = new QToolButton( 0 ); |
69 | #ifdef QWS | 71 | #ifdef QWS |
70 | startButton->setAutoRaise( true ); | 72 | startButton->setAutoRaise( true ); |
71 | #endif | 73 | #endif |
72 | startButton->setIconSet( Resource::loadIconSet( "wellenreiter/SearchIcon" ) ); | 74 | startButton->setIconSet( Resource::loadIconSet( "wellenreiter/SearchIcon" ) ); |
73 | startButton->setEnabled( false ); | 75 | startButton->setEnabled( false ); |
74 | connect( startButton, SIGNAL( clicked() ), mw, SLOT( startClicked() ) ); | 76 | connect( startButton, SIGNAL( clicked() ), mw, SLOT( startClicked() ) ); |
75 | 77 | ||
76 | stopButton = new QToolButton( 0 ); | 78 | stopButton = new QToolButton( 0 ); |
77 | #ifdef QWS | 79 | #ifdef QWS |
78 | stopButton->setAutoRaise( true ); | 80 | stopButton->setAutoRaise( true ); |
79 | #endif | 81 | #endif |
80 | stopButton->setIconSet( Resource::loadIconSet( "wellenreiter/CancelIcon" ) ); | 82 | stopButton->setIconSet( Resource::loadIconSet( "wellenreiter/CancelIcon" ) ); |
81 | stopButton->setEnabled( false ); | 83 | stopButton->setEnabled( false ); |
82 | connect( stopButton, SIGNAL( clicked() ), mw, SLOT( stopClicked() ) ); | 84 | connect( stopButton, SIGNAL( clicked() ), mw, SLOT( stopClicked() ) ); |
83 | 85 | ||
84 | QToolButton* d = new QToolButton( 0 ); | 86 | QToolButton* d = new QToolButton( 0 ); |
85 | #ifdef QWS | 87 | #ifdef QWS |
86 | d->setAutoRaise( true ); | 88 | d->setAutoRaise( true ); |
87 | #endif | 89 | #endif |
88 | d->setIconSet( Resource::loadIconSet( "wellenreiter/SettingsIcon" ) ); | 90 | d->setIconSet( Resource::loadIconSet( "wellenreiter/SettingsIcon" ) ); |
89 | connect( d, SIGNAL( clicked() ), this, SLOT( showConfigure() ) ); | 91 | connect( d, SIGNAL( clicked() ), this, SLOT( showConfigure() ) ); |
90 | 92 | ||
91 | uploadButton = new QToolButton( 0 ); | 93 | uploadButton = new QToolButton( 0 ); |
92 | #ifdef QWS | 94 | #ifdef QWS |
93 | uploadButton->setAutoRaise( true ); | 95 | uploadButton->setAutoRaise( true ); |
94 | #endif | 96 | #endif |
95 | uploadButton->setIconSet( Resource::loadIconSet( "up" ) ); | 97 | uploadButton->setIconSet( Resource::loadIconSet( "up" ) ); |
96 | uploadButton->setEnabled( false ); | 98 | uploadButton->setEnabled( false ); |
97 | //uploadButton->setEnabled( true ); // DEBUGGING | 99 | //uploadButton->setEnabled( true ); // DEBUGGING |
98 | connect( uploadButton, SIGNAL( clicked() ), this, SLOT( uploadSession() ) ); | 100 | connect( uploadButton, SIGNAL( clicked() ), this, SLOT( uploadSession() ) ); |
99 | 101 | ||
100 | // setup menu bar | 102 | // setup menu bar |
101 | 103 | ||
102 | int id; | 104 | int id; |
103 | 105 | ||
104 | QMenuBar* mb = menuBar(); | 106 | QMenuBar* mb = menuBar(); |
105 | 107 | ||
106 | QPopupMenu* fileSave = new QPopupMenu( mb ); | 108 | QPopupMenu* fileSave = new QPopupMenu( mb ); |
107 | fileSave->insertItem( tr( "&Session..." ), this, SLOT( fileSaveSession() ) ); | 109 | fileSave->insertItem( tr( "&Session..." ), this, SLOT( fileSaveSession() ) ); |
108 | fileSave->insertItem( tr( "&Text Log..." ), this, SLOT( fileSaveLog() ) ); | 110 | fileSave->insertItem( tr( "&Text Log..." ), this, SLOT( fileSaveLog() ) ); |
109 | fileSave->insertItem( tr( "&Hex Log..." ), this, SLOT( fileSaveHex() ) ); | 111 | fileSave->insertItem( tr( "&Hex Log..." ), this, SLOT( fileSaveHex() ) ); |
110 | 112 | ||
111 | QPopupMenu* fileLoad = new QPopupMenu( mb ); | 113 | QPopupMenu* fileLoad = new QPopupMenu( mb ); |
112 | fileLoad->insertItem( tr( "&Session..." ), this, SLOT( fileLoadSession() ) ); | 114 | fileLoad->insertItem( tr( "&Session..." ), this, SLOT( fileLoadSession() ) ); |
113 | //fileLoad->insertItem( "&Log", this, SLOT( fileLoadLog() ) ); | 115 | //fileLoad->insertItem( "&Log", this, SLOT( fileLoadLog() ) ); |
114 | 116 | ||
115 | QPopupMenu* file = new QPopupMenu( mb ); | 117 | QPopupMenu* file = new QPopupMenu( mb ); |
116 | file->insertItem( tr( "&New" ), this, SLOT( fileNew() ) ); | 118 | file->insertItem( tr( "&New" ), this, SLOT( fileNew() ) ); |
117 | id = file->insertItem( tr( "&Load" ), fileLoad ); | 119 | id = file->insertItem( tr( "&Load" ), fileLoad ); |
118 | file->insertItem( tr( "&Save" ), fileSave ); | 120 | file->insertItem( tr( "&Save" ), fileSave ); |
119 | file->insertSeparator(); | 121 | file->insertSeparator(); |
120 | uploadID = file->insertItem( tr( "&Upload Session" ), this, SLOT( uploadSession() ) ); | 122 | uploadID = file->insertItem( tr( "&Upload Session" ), this, SLOT( uploadSession() ) ); |
121 | file->insertSeparator(); | 123 | file->insertSeparator(); |
122 | file->insertItem( tr( "&Exit" ), qApp, SLOT( quit() ) ); | 124 | file->insertItem( tr( "&Exit" ), qApp, SLOT( quit() ) ); |
123 | 125 | ||
124 | QPopupMenu* view = new QPopupMenu( mb ); | 126 | QPopupMenu* view = new QPopupMenu( mb ); |
125 | view->insertItem( tr( "&Configure..." ) ); | 127 | view->insertItem( tr( "&Configure..." ) ); |
126 | 128 | ||
127 | QPopupMenu* sniffer = new QPopupMenu( mb ); | 129 | QPopupMenu* sniffer = new QPopupMenu( mb ); |
128 | sniffer->insertItem( tr( "&Configure..." ), this, SLOT( showConfigure() ) ); | 130 | sniffer->insertItem( tr( "&Configure..." ), this, SLOT( showConfigure() ) ); |
129 | sniffer->insertSeparator(); | 131 | sniffer->insertSeparator(); |
130 | startID = sniffer->insertItem( tr( "&Start" ), mw, SLOT( startClicked() ) ); | 132 | startID = sniffer->insertItem( tr( "&Start" ), mw, SLOT( startClicked() ) ); |
131 | sniffer->setItemEnabled( startID, false ); | 133 | sniffer->setItemEnabled( startID, false ); |
132 | stopID = sniffer->insertItem( tr( "Sto&p" ), mw, SLOT( stopClicked() ) ); | 134 | stopID = sniffer->insertItem( tr( "Sto&p" ), mw, SLOT( stopClicked() ) ); |
133 | sniffer->setItemEnabled( stopID, false ); | 135 | sniffer->setItemEnabled( stopID, false ); |
134 | 136 | ||
135 | QPopupMenu* demo = new QPopupMenu( mb ); | 137 | QPopupMenu* demo = new QPopupMenu( mb ); |
136 | demo->insertItem( tr( "&Add something" ), this, SLOT( demoAddStations() ) ); | 138 | demo->insertItem( tr( "&Add something" ), this, SLOT( demoAddStations() ) ); |
137 | demo->insertItem( tr( "&Read from GPSd" ), this, SLOT( demoReadFromGps() ) ); | 139 | //demo->insertItem( tr( "&Read from GPSd" ), this, SLOT( demoReadFromGps() ) ); |
138 | 140 | ||
139 | id = mb->insertItem( tr( "&File" ), file ); | 141 | id = mb->insertItem( tr( "&File" ), file ); |
140 | //id = mb->insertItem( tr( "&View" ), view ); | 142 | //id = mb->insertItem( tr( "&View" ), view ); |
141 | //mb->setItemEnabled( id, false ); | 143 | //mb->setItemEnabled( id, false ); |
142 | id = mb->insertItem( tr( "&Sniffer" ), sniffer ); | 144 | id = mb->insertItem( tr( "&Sniffer" ), sniffer ); |
143 | 145 | ||
144 | id = mb->insertItem( tr( "&Demo" ), demo ); | 146 | id = mb->insertItem( tr( "&Demo" ), demo ); |
145 | mb->setItemEnabled( id, true ); | 147 | mb->setItemEnabled( id, true ); |
146 | mb->setItemEnabled( uploadID, false ); | 148 | mb->setItemEnabled( uploadID, false ); |
147 | 149 | ||
148 | #ifdef QWS | 150 | #ifdef QWS |
149 | mb->insertItem( startButton ); | 151 | mb->insertItem( startButton ); |
150 | mb->insertItem( stopButton ); | 152 | mb->insertItem( stopButton ); |
151 | mb->insertItem( uploadButton ); | 153 | mb->insertItem( uploadButton ); |
152 | mb->insertItem( d ); | 154 | mb->insertItem( d ); |
153 | #else // Qt3 changed the insertion order. It's now totally random :( | 155 | #else // Qt3 changed the insertion order. It's now totally random :( |
154 | mb->insertItem( d ); | 156 | mb->insertItem( d ); |
155 | mb->insertItem( uploadButton ); | 157 | mb->insertItem( uploadButton ); |
156 | mb->insertItem( stopButton ); | 158 | mb->insertItem( stopButton ); |
157 | mb->insertItem( startButton ); | 159 | mb->insertItem( startButton ); |
158 | #endif | 160 | #endif |
159 | 161 | ||
160 | updateToolButtonState(); | 162 | updateToolButtonState(); |
161 | 163 | ||
162 | // setup status bar (for now only on X11) | 164 | // setup status bar (for now only on X11) |
163 | 165 | ||
164 | #ifndef QWS | 166 | #ifndef QWS |
165 | statusBar()->message( tr( "Ready." ) ); | 167 | statusBar()->message( tr( "Ready." ) ); |
166 | #endif | 168 | #endif |
167 | 169 | ||
168 | connect( mw, SIGNAL( startedSniffing() ), this, SLOT( changedSniffingState() ) ); | 170 | connect( mw, SIGNAL( startedSniffing() ), this, SLOT( changedSniffingState() ) ); |
169 | connect( mw, SIGNAL( stoppedSniffing() ), this, SLOT( changedSniffingState() ) ); | 171 | connect( mw, SIGNAL( stoppedSniffing() ), this, SLOT( changedSniffingState() ) ); |
170 | }; | 172 | }; |
171 | 173 | ||
172 | 174 | ||
173 | 175 | ||
174 | void WellenreiterMainWindow::showConfigure() | 176 | void WellenreiterMainWindow::showConfigure() |
175 | { | 177 | { |
176 | qDebug( "show configure..." ); | 178 | qDebug( "show configure..." ); |
177 | cw->setCaption( tr( "Configure" ) ); | 179 | cw->setCaption( tr( "Configure" ) ); |
178 | #ifdef QWS | 180 | #ifdef QWS |
179 | cw->showMaximized(); | 181 | cw->showMaximized(); |
180 | #endif | 182 | #endif |
181 | int result = cw->exec(); | 183 | int result = cw->exec(); |
182 | 184 | ||
183 | if ( result ) updateToolButtonState(); | 185 | if ( result ) updateToolButtonState(); |
184 | } | 186 | } |
185 | 187 | ||
186 | 188 | ||
187 | void WellenreiterMainWindow::updateToolButtonState() | 189 | void WellenreiterMainWindow::updateToolButtonState() |
188 | { | 190 | { |
189 | const QString& interface = cw->interfaceName->currentText(); | 191 | const QString& interface = cw->interfaceName->currentText(); |
190 | const int cardtype = cw->driverType(); | 192 | const int cardtype = cw->driverType(); |
191 | 193 | ||
192 | if ( ( interface != "<select>" ) && ( cardtype != 0 ) ) | 194 | if ( ( interface != "<select>" ) && ( cardtype != 0 ) ) |
193 | { | 195 | { |
194 | startButton->setEnabled( true ); | 196 | startButton->setEnabled( true ); |
195 | menuBar()->setItemEnabled( startID, true ); | 197 | menuBar()->setItemEnabled( startID, true ); |
196 | } | 198 | } |
197 | else | 199 | else |
198 | { | 200 | { |
199 | startButton->setEnabled( false ); | 201 | startButton->setEnabled( false ); |
200 | menuBar()->setItemEnabled( startID, false ); | 202 | menuBar()->setItemEnabled( startID, false ); |
201 | } | 203 | } |
202 | } | 204 | } |
203 | 205 | ||
204 | 206 | ||
205 | void WellenreiterMainWindow::changedSniffingState() | 207 | void WellenreiterMainWindow::changedSniffingState() |
206 | { | 208 | { |
207 | startButton->setEnabled( !mw->sniffing ); | 209 | startButton->setEnabled( !mw->sniffing ); |
208 | menuBar()->setItemEnabled( startID, !mw->sniffing ); | 210 | menuBar()->setItemEnabled( startID, !mw->sniffing ); |
209 | stopButton->setEnabled( mw->sniffing ); | 211 | stopButton->setEnabled( mw->sniffing ); |
210 | menuBar()->setItemEnabled( stopID, mw->sniffing ); | 212 | menuBar()->setItemEnabled( stopID, mw->sniffing ); |
211 | 213 | ||
212 | if ( !mw->sniffing ) | 214 | if ( !mw->sniffing ) |
213 | { | 215 | { |
214 | menuBar()->setItemEnabled( uploadID, true ); | 216 | menuBar()->setItemEnabled( uploadID, true ); |
215 | uploadButton->setEnabled( true ); | 217 | uploadButton->setEnabled( true ); |
216 | } | 218 | } |
217 | } | 219 | } |
218 | 220 | ||
219 | 221 | ||
220 | WellenreiterMainWindow::~WellenreiterMainWindow() | 222 | WellenreiterMainWindow::~WellenreiterMainWindow() |
221 | { | 223 | { |
222 | qDebug( "Wellenreiter:: bye." ); | 224 | qDebug( "Wellenreiter: bye." ); |
223 | }; | 225 | }; |
224 | 226 | ||
225 | 227 | ||
226 | void WellenreiterMainWindow::demoAddStations() | 228 | void WellenreiterMainWindow::demoAddStations() |
227 | { | 229 | { |
228 | //mw = 0; // test SIGSEGV handling | 230 | //mw = 0; // test SIGSEGV handling |
229 | 231 | ||
230 | mw->netView()->addNewItem( "managed", "Vanille", OMacAddress::fromString("00:00:20:EF:A6:43"), true, 6, 80, GpsLocation( 39.8794, -94.0936) ); | 232 | mw->netView()->addNewItem( "managed", "Vanille", OMacAddress::fromString("00:00:20:EF:A6:43"), true, 6, 80, GpsLocation( 39.8794, -94.0936) ); |
231 | mw->netView()->addNewItem( "managed", "Vanille", OMacAddress::fromString("00:30:6D:EF:A6:23"), true, 11, 10, GpsLocation( 0.0, 0.0 ) ); | 233 | mw->netView()->addNewItem( "managed", "Vanille", OMacAddress::fromString("00:30:6D:EF:A6:23"), true, 11, 10, GpsLocation( 0.0, 0.0 ) ); |
232 | mw->netView()->addNewItem( "adhoc", "ELAN", OMacAddress::fromString("00:03:F8:E7:16:22"), false, 3, 10, GpsLocation( 5.5, 2.3 ) ); | 234 | mw->netView()->addNewItem( "adhoc", "ELAN", OMacAddress::fromString("00:03:F8:E7:16:22"), false, 3, 10, GpsLocation( 5.5, 2.3 ) ); |
233 | mw->netView()->addNewItem( "adhoc", "ELAN", OMacAddress::fromString("00:04:01:E7:56:62"), false, 3, 15, GpsLocation( 2.3, 5.5 ) ); | 235 | mw->netView()->addNewItem( "adhoc", "ELAN", OMacAddress::fromString("00:04:01:E7:56:62"), false, 3, 15, GpsLocation( 2.3, 5.5 ) ); |
234 | mw->netView()->addNewItem( "adhoc", "ELAN", OMacAddress::fromString("00:05:8E:E7:56:E2"), false, 3, 20, GpsLocation( -10.0, -20.5 ) ); | 236 | mw->netView()->addNewItem( "adhoc", "ELAN", OMacAddress::fromString("00:05:8E:E7:56:E2"), false, 3, 20, GpsLocation( -10.0, -20.5 ) ); |
235 | } | 237 | } |
236 | 238 | ||
237 | 239 | ||
238 | void WellenreiterMainWindow::demoReadFromGps() | 240 | void WellenreiterMainWindow::demoReadFromGps() |
239 | { | 241 | { |
240 | WellenreiterConfigWindow* configwindow = WellenreiterConfigWindow::instance(); | 242 | WellenreiterConfigWindow* configwindow = WellenreiterConfigWindow::instance(); |
241 | GPS* gps = new GPS( this ); | 243 | GPS* gps = new GPS( this ); |
244 | qDebug( "Wellenreiter::demoReadFromGps(): url=gps://%s:%d/", (const char*) configwindow->gpsdHost->currentText(), configwindow->gpsdPort->value() ); | ||
242 | gps->open( configwindow->gpsdHost->currentText(), configwindow->gpsdPort->value() ); | 245 | gps->open( configwindow->gpsdHost->currentText(), configwindow->gpsdPort->value() ); |
243 | GpsLocation loc = gps->position(); | 246 | GpsLocation loc = gps->position(); |
244 | |||
245 | QMessageBox::information( this, "Wellenreiter/Opie", tr( "GPS said:\n%1" ).arg( loc.dmsPosition() ) ); | 247 | QMessageBox::information( this, "Wellenreiter/Opie", tr( "GPS said:\n%1" ).arg( loc.dmsPosition() ) ); |
248 | delete gps; | ||
246 | } | 249 | } |
247 | 250 | ||
248 | 251 | ||
249 | QString WellenreiterMainWindow::getFileName( bool save ) | 252 | QString WellenreiterMainWindow::getFileName( bool save ) |
250 | { | 253 | { |
251 | QMap<QString, QStringList> map; | 254 | QMap<QString, QStringList> map; |
252 | map.insert( tr("All"), QStringList() ); | 255 | map.insert( tr("All"), QStringList() ); |
253 | QStringList text; | 256 | QStringList text; |
254 | text << "text/*"; | 257 | text << "text/*"; |
255 | map.insert( tr("Text"), text ); | 258 | map.insert( tr("Text"), text ); |
256 | text << "*"; | 259 | text << "*"; |
257 | map.insert( tr("All"), text ); | 260 | map.insert( tr("All"), text ); |
258 | 261 | ||
259 | QString str; | 262 | QString str; |
260 | if ( save ) | 263 | if ( save ) |
261 | { | 264 | { |
262 | #ifdef QWS | 265 | #ifdef QWS |
263 | str = OFileDialog::getSaveFileName( 2, "/", QString::null, map ); | 266 | str = OFileDialog::getSaveFileName( 2, "/", QString::null, map ); |
264 | #else | 267 | #else |
265 | str = QFileDialog::getSaveFileName(); | 268 | str = QFileDialog::getSaveFileName(); |
266 | #endif | 269 | #endif |
267 | if ( str.isEmpty() /*|| QFileInfo(str).isDir()*/ ) | 270 | if ( str.isEmpty() /*|| QFileInfo(str).isDir()*/ ) |
268 | return ""; | 271 | return ""; |
269 | } | 272 | } |
270 | else | 273 | else |
271 | { | 274 | { |
272 | #ifdef QWS | 275 | #ifdef QWS |
273 | str = OFileDialog::getOpenFileName( 2, "/", QString::null, map ); | 276 | str = OFileDialog::getOpenFileName( 2, "/", QString::null, map ); |
274 | #else | 277 | #else |
275 | str = QFileDialog::getOpenFileName(); | 278 | str = QFileDialog::getOpenFileName(); |
276 | #endif | 279 | #endif |
277 | if ( str.isEmpty() || !QFile(str).exists() || QFileInfo(str).isDir() ) | 280 | if ( str.isEmpty() || !QFile(str).exists() || QFileInfo(str).isDir() ) |
278 | return ""; | 281 | return ""; |
279 | } | 282 | } |
280 | return str; | 283 | return str; |
281 | } | 284 | } |
282 | 285 | ||
283 | 286 | ||
284 | void WellenreiterMainWindow::fileSaveLog() | 287 | void WellenreiterMainWindow::fileSaveLog() |
285 | { | 288 | { |
286 | QString fname = getFileName( true ); | 289 | QString fname = getFileName( true ); |
287 | if ( !fname.isEmpty() ) | 290 | if ( !fname.isEmpty() ) |
288 | { | 291 | { |
289 | QFile f( fname ); | 292 | QFile f( fname ); |
290 | if ( f.open(IO_WriteOnly) ) | 293 | if ( f.open(IO_WriteOnly) ) |
291 | { | 294 | { |
292 | QTextStream t( &f ); | 295 | QTextStream t( &f ); |
293 | t << mw->logWindow()->getLog(); | 296 | t << mw->logWindow()->getLog(); |
294 | f.close(); | 297 | f.close(); |
295 | qDebug( "Saved log to file '%s'", (const char*) fname ); | 298 | qDebug( "Saved log to file '%s'", (const char*) fname ); |
296 | } | 299 | } |
297 | else | 300 | else |
298 | { | 301 | { |
299 | qDebug( "Problem saving log to file '%s'", (const char*) fname ); | 302 | qDebug( "Problem saving log to file '%s'", (const char*) fname ); |
300 | } | 303 | } |
301 | } | 304 | } |
302 | } | 305 | } |
303 | 306 | ||
304 | void WellenreiterMainWindow::fileSaveSession() | 307 | void WellenreiterMainWindow::fileSaveSession() |
305 | { | 308 | { |
306 | QString fname = getFileName( true ); | 309 | QString fname = getFileName( true ); |
307 | if ( !fname.isEmpty() ) | 310 | if ( !fname.isEmpty() ) |
308 | { | 311 | { |
309 | 312 | ||
310 | QFile f( fname ); | 313 | QFile f( fname ); |
311 | if ( f.open(IO_WriteOnly) ) | 314 | if ( f.open(IO_WriteOnly) ) |
312 | { | 315 | { |
313 | QDataStream t( &f ); | 316 | QDataStream t( &f ); |
314 | t << *mw->netView(); | 317 | t << *mw->netView(); |
315 | f.close(); | 318 | f.close(); |
316 | qDebug( "Saved session to file '%s'", (const char*) fname ); | 319 | qDebug( "Saved session to file '%s'", (const char*) fname ); |
317 | } | 320 | } |
318 | else | 321 | else |
319 | { | 322 | { |
320 | qDebug( "Problem saving session to file '%s'", (const char*) fname ); | 323 | qDebug( "Problem saving session to file '%s'", (const char*) fname ); |
321 | } | 324 | } |
322 | } | 325 | } |
323 | } | 326 | } |
324 | 327 | ||
325 | void WellenreiterMainWindow::fileSaveHex() | 328 | void WellenreiterMainWindow::fileSaveHex() |
326 | { | 329 | { |
327 | QString fname = getFileName( true ); | 330 | QString fname = getFileName( true ); |
328 | if ( !fname.isEmpty() ) | 331 | if ( !fname.isEmpty() ) |
329 | { | 332 | { |
330 | QFile f( fname ); | 333 | QFile f( fname ); |
331 | if ( f.open(IO_WriteOnly) ) | 334 | if ( f.open(IO_WriteOnly) ) |
332 | { | 335 | { |
333 | QTextStream t( &f ); | 336 | QTextStream t( &f ); |
334 | t << mw->hexWindow()->getLog(); | 337 | t << mw->hexWindow()->getLog(); |
335 | f.close(); | 338 | f.close(); |
336 | qDebug( "Saved hex log to file '%s'", (const char*) fname ); | 339 | qDebug( "Saved hex log to file '%s'", (const char*) fname ); |
337 | } | 340 | } |
338 | else | 341 | else |
339 | { | 342 | { |
340 | qDebug( "Problem saving hex log to file '%s'", (const char*) fname ); | 343 | qDebug( "Problem saving hex log to file '%s'", (const char*) fname ); |
341 | } | 344 | } |
342 | } | 345 | } |
343 | } | 346 | } |
344 | 347 | ||
345 | void WellenreiterMainWindow::fileLoadSession() | 348 | void WellenreiterMainWindow::fileLoadSession() |
346 | { | 349 | { |
347 | QString fname = getFileName( false ); | 350 | QString fname = getFileName( false ); |
348 | if ( !fname.isEmpty() ) | 351 | if ( !fname.isEmpty() ) |
349 | { | 352 | { |
350 | QFile f( fname ); | 353 | QFile f( fname ); |
351 | if ( f.open(IO_ReadOnly) ) | 354 | if ( f.open(IO_ReadOnly) ) |
352 | { | 355 | { |
353 | QDataStream t( &f ); | 356 | QDataStream t( &f ); |
354 | t >> *mw->netView(); | 357 | t >> *mw->netView(); |
355 | f.close(); | 358 | f.close(); |
356 | qDebug( "Loaded session from file '%s'", (const char*) fname ); | 359 | qDebug( "Loaded session from file '%s'", (const char*) fname ); |
357 | } | 360 | } |
358 | else | 361 | else |
359 | { | 362 | { |
360 | qDebug( "Problem loading session from file '%s'", (const char*) fname ); | 363 | qDebug( "Problem loading session from file '%s'", (const char*) fname ); |
361 | } | 364 | } |
362 | } | 365 | } |
363 | } | 366 | } |
364 | 367 | ||
365 | 368 | ||
366 | void WellenreiterMainWindow::fileNew() | 369 | void WellenreiterMainWindow::fileNew() |
367 | { | 370 | { |
368 | mw->netView()->clear(); | 371 | mw->netView()->clear(); |
369 | mw->logWindow()->clear(); | 372 | mw->logWindow()->clear(); |
370 | mw->hexWindow()->clear(); | 373 | mw->hexWindow()->clear(); |
371 | } | 374 | } |
372 | 375 | ||
373 | 376 | ||
374 | void WellenreiterMainWindow::closeEvent( QCloseEvent* e ) | 377 | void WellenreiterMainWindow::closeEvent( QCloseEvent* e ) |
375 | { | 378 | { |
376 | if ( mw->isDaemonRunning() ) | 379 | if ( mw->isDaemonRunning() ) |
377 | { | 380 | { |
378 | QMessageBox::warning( this, "Wellenreiter/Opie", | 381 | QMessageBox::warning( this, "Wellenreiter/Opie", |
379 | tr( "Sniffing in progress!\nPlease stop sniffing before closing." ) ); | 382 | tr( "Sniffing in progress!\nPlease stop sniffing before closing." ) ); |
380 | e->ignore(); | 383 | e->ignore(); |
381 | } | 384 | } |
382 | else | 385 | else |
383 | { | 386 | { |
384 | QMainWindow::closeEvent( e ); | 387 | QMainWindow::closeEvent( e ); |
385 | } | 388 | } |
386 | } | 389 | } |
387 | 390 | ||
388 | static const char* CAP_hostname = "www.vanille.de"; | 391 | static const char* CAP_hostname = "www.vanille.de"; |
389 | 392 | ||
390 | #include <netdb.h> | 393 | #include <netdb.h> |
391 | #include <unistd.h> | 394 | #include <unistd.h> |
392 | #include <sys/types.h> | 395 | #include <sys/types.h> |
393 | #include <sys/socket.h> | 396 | #include <sys/socket.h> |
394 | 397 | ||
395 | void WellenreiterMainWindow::uploadSession() | 398 | void WellenreiterMainWindow::uploadSession() |
396 | { | 399 | { |
397 | QLineEdit* from; | 400 | QLineEdit* from; |
398 | QLineEdit* location; | 401 | QLineEdit* location; |
399 | QLineEdit* comments; | 402 | QLineEdit* comments; |
400 | QPushButton* accept; | 403 | QPushButton* accept; |
401 | QPushButton* reject; | 404 | QPushButton* reject; |
402 | 405 | ||
403 | QDialog* d = new QDialog( 0, "session upload", true ); | 406 | QDialog* d = new QDialog( 0, "session upload", true ); |
404 | d->setCaption( tr( "Upload Session" ) ); | 407 | d->setCaption( tr( "Upload Session" ) ); |
405 | QGridLayout* g = new QGridLayout( d, 4, 2, 3 ); | 408 | QGridLayout* g = new QGridLayout( d, 4, 2, 3 ); |
406 | g->addWidget( new QLabel( tr( "From: " ), d ), 0, 0 ); | 409 | g->addWidget( new QLabel( tr( "From: " ), d ), 0, 0 ); |
407 | g->addWidget( from = new QLineEdit( d ), 0, 1 ); | 410 | g->addWidget( from = new QLineEdit( d ), 0, 1 ); |
408 | g->addWidget( new QLabel( tr( "Location: " ), d ), 1, 0 ); | 411 | g->addWidget( new QLabel( tr( "Location: " ), d ), 1, 0 ); |
409 | g->addWidget( location = new QLineEdit( d ), 1, 1 ); | 412 | g->addWidget( location = new QLineEdit( d ), 1, 1 ); |
410 | g->addWidget( new QLabel( tr( "Comments: " ), d ), 2, 0 ); | 413 | g->addWidget( new QLabel( tr( "Comments: " ), d ), 2, 0 ); |
411 | g->addWidget( comments = new QLineEdit( d ), 2, 1 ); | 414 | g->addWidget( comments = new QLineEdit( d ), 2, 1 ); |
412 | g->addWidget( accept = new QPushButton( tr( "&Ok" ), d ), 3, 0 ); | 415 | g->addWidget( accept = new QPushButton( tr( "&Ok" ), d ), 3, 0 ); |
413 | g->addWidget( reject = new QPushButton( tr( "&Cancel" ), d ), 3, 1 ); | 416 | g->addWidget( reject = new QPushButton( tr( "&Cancel" ), d ), 3, 1 ); |
414 | accept->setDefault( true ); | 417 | accept->setDefault( true ); |
415 | accept->setAutoDefault( true ); | 418 | accept->setAutoDefault( true ); |
416 | from->setText( "WL II User" ); | 419 | from->setText( "WL II User" ); |
417 | location->setText( "WL II Location" ); | 420 | location->setText( "WL II Location" ); |
418 | comments->setText( "No Comments." ); | 421 | comments->setText( "No Comments." ); |
419 | connect( accept, SIGNAL( clicked() ), d, SLOT( accept() ) ); | 422 | connect( accept, SIGNAL( clicked() ), d, SLOT( accept() ) ); |
420 | connect( reject, SIGNAL( clicked() ), d, SLOT( reject() ) ); | 423 | connect( reject, SIGNAL( clicked() ), d, SLOT( reject() ) ); |
421 | int result = d->exec(); | 424 | int result = d->exec(); |
422 | 425 | ||
423 | if ( !result ) | 426 | if ( !result ) |
424 | { | 427 | { |
425 | qDebug( "Session upload cancelled :(" ); | 428 | qDebug( "Session upload cancelled :(" ); |
426 | return; | 429 | return; |
427 | } | 430 | } |
428 | 431 | ||
429 | qDebug( "Starting upload..." ); | 432 | qDebug( "Starting upload..." ); |
430 | 433 | ||
431 | struct sockaddr_in raddr; | 434 | struct sockaddr_in raddr; |
432 | struct hostent *rhost_info; | 435 | struct hostent *rhost_info; |
433 | int sock = -1; | 436 | int sock = -1; |
434 | bool ok = false; | 437 | bool ok = false; |
435 | 438 | ||
436 | rhost_info = (struct hostent *) ::gethostbyname( CAP_hostname ); | 439 | rhost_info = (struct hostent *) ::gethostbyname( CAP_hostname ); |
437 | if ( rhost_info ) | 440 | if ( rhost_info ) |