| | 1273 | |
| | 1274 | const int popupw = 438; |
| | 1275 | const int popuph = 158; |
| | 1276 | |
| | 1277 | |
| | 1278 | // English (US) |
| | 1279 | |
| | 1280 | const QString c_eng[] = { |
| | 1281 | "1", "2", "3", "4", "5", "6", "7", "8", "9", "0", "-", "=", "\\", "`", |
| | 1282 | "q", "w", "e", "r", "t", "y", "u", "i", "o", "p", "[", "]", |
| | 1283 | "a", "s", "d", "f", "g", "h", "j", "k", "l", ";", "'", |
| | 1284 | "z", "x", "c", "v", "b", "n", "m", ",", ".", "/", |
| | 1285 | " ", |
| | 1286 | "Shift", "Lock", "<-", "->", "Shift", "Back", "Comp", "Del", "Done" |
| | 1287 | }; |
| | 1288 | |
| | 1289 | const QString c_eng_s[] = { |
| | 1290 | "!", "@", "#", "$", "%", "^", "&&", "*", "(", ")", "_", "+", "|", "~", |
| | 1291 | "Q", "W", "E", "R", "T", "Y", "U", "I", "O", "P", "{", "}", |
| | 1292 | "A", "S", "D", "F", "G", "H", "J", "K", "L", ":", "\"", |
| | 1293 | "Z", "X", "C", "V", "B", "N", "M", "<", ">", "?", |
| | 1294 | " ", |
| | 1295 | "", "", "", "", "", "", "", "", "" |
| | 1296 | }; |
| | 1297 | |
| | 1298 | const int x_eng[] = { |
| | 1299 | 5, 35, 65, 95, 125, 155, 185, 215, 245, 275, 305, 335, 365, 395, |
| | 1300 | 15, 45, 75, 105, 135, 165, 195, 225, 255, 285, 315, 345, |
| | 1301 | 25, 55, 85, 115, 145, 175, 205, 235, 265, 295, 325, |
| | 1302 | 35, 65, 95, 125, 155, 185, 215, 245, 275, 305, |
| | 1303 | 165, |
| | 1304 | 5, 70, 285, 330, 375, 375, 335, 395, 355 |
| | 1305 | }; |
| | 1306 | |
| | 1307 | const int y_eng[] = { |
| | 1308 | 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, |
| | 1309 | 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, |
| | 1310 | 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, |
| | 1311 | 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, |
| | 1312 | 125, |
| | 1313 | 125, 125, 125, 125, 125, 35, 95, 95, 65 |
| | 1314 | }; |
| | 1315 | |
| | 1316 | const int w_eng[] = { |
| | 1317 | 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, |
| | 1318 | 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, |
| | 1319 | 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, |
| | 1320 | 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, |
| | 1321 | 88, |
| | 1322 | 63, 63, 43, 43, 58, 58, 58, 38, 78 |
| | 1323 | }; |
| | 1324 | |
| | 1325 | |
| | 1326 | // Greek |
| | 1327 | |
| | 1328 | const QString c_grk[] = { |
| | 1329 | "1", "2", "3", "4", "5", "6", "7", "8", "9", "0", "-", "=", "\\", "`", |
| | 1330 | "q", "w", "e", "r", "t", "y", "u", "i", "o", "p", "[", "]", |
| | 1331 | "a", "s", "d", "f", "g", "h", "j", "k", "l", ";", "'", |
| | 1332 | "z", "x", "c", "v", "b", "n", "m", ",", ".", "/", |
| | 1333 | " ", |
| | 1334 | "Shift", "Lock", "AltGr", "<-", "->", "Shift", "Back", "Comp", "Del", "Done" |
| | 1335 | }; |
| | 1336 | |
| | 1337 | const QString c_grk_s[] = { |
| | 1338 | "!", "@", "#", "$", "%", "^", "&&", "*", "(", ")", "_", "+", "|", "~", |
| | 1339 | "Q", "W", "E", "R", "T", "Y", "U", "I", "O", "P", "{", "}", |
| | 1340 | "A", "S", "D", "F", "G", "H", "J", "K", "L", ":", "\"", |
| | 1341 | "Z", "X", "C", "V", "B", "N", "M", "<", ">", "?", |
| | 1342 | " ", |
| | 1343 | "", "", "", "", "", "", "", "", "", "" |
| | 1344 | }; |
| | 1345 | |
| | 1346 | const QString c_grk_m[] = { |
| | 1347 | "1", "2", "3", "4", "5", "6", "7", "8", "9", "0", "-", "=", "\\", "`", |
| | 1348 | (QChar)0x03b8, (QChar)0x03c9, (QChar)0x03b5, (QChar)0x03c1, (QChar)0x03c4, (QChar)0x03c8, |
| | 1349 | (QChar)0x03c5, (QChar)0x03b9, (QChar)0x03bf, (QChar)0x03c0, "[", "]", |
| | 1350 | (QChar)0x03b1, (QChar)0x03c3, (QChar)0x03b4, (QChar)0x03c6, (QChar)0x03b3, (QChar)0x03b7, |
| | 1351 | "", (QChar)0x03ba, (QChar)0x03bb, ";", "'", |
| | 1352 | (QChar)0x03b6, (QChar)0x03be, (QChar)0x03c7, "", (QChar)0x03b2, (QChar)0x03bd, |
| | 1353 | (QChar)0x03bc, ",", ".", "/", |
| | 1354 | " ", |
| | 1355 | "", "", "", "", "", "", "", "", "", "" |
| | 1356 | }; |
| | 1357 | |
| | 1358 | const QString c_grk_sm[] = { |
| | 1359 | "!", "@", "#", "$", "%", "^", "&&", "*", "(", ")", "_", "+", "|", "~", |
| | 1360 | (QChar)0x0398, (QChar)0x03a9, (QChar)0x0395, (QChar)0x03a1, (QChar)0x03a4, (QChar)0x03a8, |
| | 1361 | (QChar)0x03a5, (QChar)0x0399, (QChar)0x039f, (QChar)0x03a0, "[", "]", |
| | 1362 | (QChar)0x0391, (QChar)0x03a3, (QChar)0x0394, (QChar)0x03a6, (QChar)0x0393, (QChar)0x0397, |
| | 1363 | "", (QChar)0x039a, (QChar)0x039b, ";", "'", |
| | 1364 | (QChar)0x0396, (QChar)0x039e, (QChar)0x03a7, "", (QChar)0x0392, (QChar)0x039d, |
| | 1365 | (QChar)0x039c, ",", ".", "/", |
| | 1366 | " ", |
| | 1367 | "", "", "", "", "", "", "", "", "", "" |
| | 1368 | }; |
| | 1369 | |
| | 1370 | const int x_grk[] = { |
| | 1371 | 5, 35, 65, 95, 125, 155, 185, 215, 245, 275, 305, 335, 365, 395, |
| | 1372 | 15, 45, 75, 105, 135, 165, 195, 225, 255, 285, 315, 345, |
| | 1373 | 25, 55, 85, 115, 145, 175, 205, 235, 265, 295, 325, |
| | 1374 | 35, 65, 95, 125, 155, 185, 215, 245, 275, 305, |
| | 1375 | 135, |
| | 1376 | 5, 70, 220, 285, 330, 375, 375, 335, 395, 355 |
| | 1377 | }; |
| | 1378 | |
| | 1379 | const int y_grk[] = { |
| | 1380 | 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, |
| | 1381 | 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, |
| | 1382 | 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, |
| | 1383 | 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, |
| | 1384 | 125, |
| | 1385 | 125, 125, 125, 125, 125, 125, 35, 95, 95, 65 |
| | 1386 | }; |
| | 1387 | |
| | 1388 | const int w_grk[] = { |
| | 1389 | 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, |
| | 1390 | 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, |
| | 1391 | 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, |
| | 1392 | 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, |
| | 1393 | 83, |
| | 1394 | 63, 63, 63, 43, 43, 58, 58, 58, 38, 78 |
| | 1395 | }; |
| | 1396 | |
| | 1397 | |
| | 1398 | // German |
| | 1399 | |
| | 1400 | const QString c_ger[] = { |
| | 1401 | "1", "2", "3", "4", "5", "6", "7", "8", "9", "0", "?", "`", "^", "#", |
| | 1402 | "q", "w", "e", "r", "t", "z", "u", "i", "o", "p", (QChar)0xfc, "+", |
| | 1403 | "a", "s", "d", "f", "g", "h", "j", "k", "l", (QChar)0xf6, (QChar)0xe4, |
| | 1404 | "<", "y", "x", "c", "v", "b", "n", "m", ",", ".", "-", |
| | 1405 | " ", |
| | 1406 | "Shift", "Lock", "AltGr", "<-", "->", "Shift", "Back", "Comp", "Del", "Done" |
| | 1407 | }; |
| | 1408 | |
| | 1409 | const QString c_ger_s[] = { |
| | 1410 | "!", "\"", (QChar)0xa7, "$", "%", "&&", "/", "(", ")", "=", (QChar)0xdf, "'", (QChar)0xb0, "|", |
| | 1411 | "Q", "W", "E", "R", "T", "Z", "U", "I", "O", "P", (QChar)0xdc, "*", |
| | 1412 | "A", "S", "D", "F", "G", "H", "J", "K", "L", (QChar)0xd6, (QChar)0xc4, |
| | 1413 | ">", "Y", "X", "C", "V", "B", "N", "M", ";", ":", "_", |
| | 1414 | " ", |
| | 1415 | "", "", "", "", "", "", "", "", "", "" |
| | 1416 | }; |
| | 1417 | |
| | 1418 | const QString c_ger_m[] = { |
| | 1419 | (QChar)0xb9, (QChar)0xb2, (QChar)0xb3, (QChar)0xa3, (QChar)0xac, (QChar)0xa9, "{", "[", "]", "}", |
| | 1420 | "\\", "`", "^", "#", |
| | 1421 | "@", "w", "e", "r", "t", "z", "u", "i", "o", "p", (QChar)0xfc, "~", |
| | 1422 | "a", "s", "d", "f", "g", "h", "j", "k", "l", (QChar)0xf6, (QChar)0xe4, |
| | 1423 | "|", "y", "x", "c", "v", "b", "n", (QChar)0xb5, ",", ".", "_", |
| | 1424 | " ", |
| | 1425 | "", "", "", "", "", "", "", "", "", "" |
| | 1426 | }; |
| | 1427 | |
| | 1428 | const QString c_ger_sm[] = { |
| | 1429 | "!", "\"", (QChar)0xa7, "$", "%", "&&", "/", "(", ")", "=", (QChar)0xdf, "'", (QChar)0xb0, "|", |
| | 1430 | "Q", "W", "E", "R", "T", "Z", "U", "I", "O", "P", (QChar)0xdc, "*", |
| | 1431 | "A", "S", "D", "F", "G", "H", "J", "K", "L", (QChar)0xd6, (QChar)0xc4, |
| | 1432 | ">", "Y", "X", "C", "V", "B", "N", "M", ";", ":", "_", |
| | 1433 | " ", |
| | 1434 | "", "", "", "", "", "", "", "", "", "" |
| | 1435 | }; |
| | 1436 | |
| | 1437 | const int x_ger[] = { |
| | 1438 | 5, 35, 65, 95, 125, 155, 185, 215, 245, 275, 305, 335, 365, 395, |
| | 1439 | 15, 45, 75, 105, 135, 165, 195, 225, 255, 285, 315, 345, |
| | 1440 | 25, 55, 85, 115, 145, 175, 205, 235, 265, 295, 325, |
| | 1441 | 5, 35, 65, 95, 125, 155, 185, 215, 245, 275, 305, |
| | 1442 | 135, |
| | 1443 | 5, 70, 220, 285, 330, 375, 375, 335, 395, 355 |
| | 1444 | }; |
| | 1445 | |
| | 1446 | const int y_ger[] = { |
| | 1447 | 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, |
| | 1448 | 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, |
| | 1449 | 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, |
| | 1450 | 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, |
| | 1451 | 125, |
| | 1452 | 125, 125, 125, 125, 125, 125, 35, 95, 95, 65 |
| | 1453 | }; |
| | 1454 | |
| | 1455 | const int w_ger[] = { |
| | 1456 | 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, |
| | 1457 | 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, |
| | 1458 | 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, |
| | 1459 | 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, |
| | 1460 | 83, |
| | 1461 | 63, 63, 63, 43, 43, 58, 58, 58, 38, 78 |
| | 1462 | }; |
| | 1463 | |
| | 1464 | |
| | 1465 | // French |
| | 1466 | |
| | 1467 | const QString c_frn[] = { |
| | 1468 | "&&", (QChar)0x00e9, "\"", "'", "(", "-", (QChar)0x00e8, "_", (QChar)0x00e7, (QChar)0x00e0, |
| | 1469 | ")", "=", (QChar)0x00b2, "*", |
| | 1470 | "a", "z", "e", "r", "t", "y", "u", "i", "o", "p", "^", "$", |
| | 1471 | "q", "s", "d", "f", "g", "h", "j", "k", "l", "m", (QChar)0x00f9, |
| | 1472 | "<", "w", "x", "c", "v", "b", "n", ",", ";", ":", "!", |
| | 1473 | " ", |
| | 1474 | "Shift", "Lock", "AltGr", "<-", "->", "Shift", "Back", "Comp", "Del", "Done" |
| | 1475 | }; |
| | 1476 | |
| | 1477 | const QString c_frn_s[] = { |
| | 1478 | "1", "2", "3", "4", "5", "6", "7", "8", "9", "0", (QChar)0x00b0, "+", (QChar)0x00b3, (QChar)0x00b5, |
| | 1479 | "A", "Z", "E", "R", "T", "Y", "U", "I", "O", "P", (QChar)0x00a8, (QChar)0x00a3, |
| | 1480 | "Q", "S", "D", "F", "G", "H", "J", "K", "L", "M", "%", |
| | 1481 | ">", "W", "X", "C", "V", "B", "N", "?", ".", "/", (QChar)0x00a7, |
| | 1482 | " ", |
| | 1483 | "", "", "", "", "", "", "", "", "", "" |
| | 1484 | }; |
| | 1485 | |
| | 1486 | const QString c_frn_m[] = { |
| | 1487 | "&&", "~", "#", "{", "[", "|", "`", "\\", "^", "@", "]", "}", (QChar)0x00b2, "*", |
| | 1488 | "a", "z", "e", "r", "t", "y", "u", "i", "o", "p", "^", (QChar)0x00a4, |
| | 1489 | "q", "s", "d", "f", "g", "h", "j", "k", "l", "m", (QChar)0x00f9, |
| | 1490 | "<", "w", "x", "c", "v", "b", "n", ",", ";", ":", "!", |
| | 1491 | " ", |
| | 1492 | "", "", "", "", "", "", "", "", "", "" |
| | 1493 | }; |
| | 1494 | |
| | 1495 | const QString c_frn_sm[] = { |
| | 1496 | "1", "2", "3", "4", "5", "6", "7", "8", "9", "0", (QChar)0x00b0, "+", (QChar)0x00b3, (QChar)0x00b5, |
| | 1497 | "A", "Z", "E", "R", "T", "Y", "U", "I", "O", "P", (QChar)0x00a8, (QChar)0x00a3, |
| | 1498 | "Q", "S", "D", "F", "G", "H", "J", "K", "L", "M", "%", |
| | 1499 | ">", "W", "X", "C", "V", "B", "N", "?", ".", "/", (QChar)0x00a7, |
| | 1500 | " ", |
| | 1501 | "", "", "", "", "", "", "", "", "", "" |
| | 1502 | }; |
| | 1503 | |
| | 1504 | const int x_frn[] = { |
| | 1505 | 5, 35, 65, 95, 125, 155, 185, 215, 245, 275, 305, 335, 365, 395, |
| | 1506 | 15, 45, 75, 105, 135, 165, 195, 225, 255, 285, 315, 345, |
| | 1507 | 25, 55, 85, 115, 145, 175, 205, 235, 265, 295, 325, |
| | 1508 | 5, 35, 65, 95, 125, 155, 185, 215, 245, 275, 305, |
| | 1509 | 135, |
| | 1510 | 5, 70, 220, 285, 330, 375, 375, 335, 395, 355 |
| | 1511 | }; |
| | 1512 | |
| | 1513 | const int y_frn[] = { |
| | 1514 | 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, |
| | 1515 | 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, |
| | 1516 | 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, |
| | 1517 | 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, |
| | 1518 | 125, |
| | 1519 | 125, 125, 125, 125, 125, 125, 35, 95, 95, 65 |
| | 1520 | }; |
| | 1521 | |
| | 1522 | const int w_frn[] = { |
| | 1523 | 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, |
| | 1524 | 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, |
| | 1525 | 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, |
| | 1526 | 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, |
| | 1527 | 83, |
| | 1528 | 63, 63, 63, 43, 43, 58, 58, 58, 38, 78 |
| | 1529 | }; |
| | 1530 | |
| | 1531 | |
| | 1532 | // Spanish |
| | 1533 | |
| | 1534 | const QString c_spa[] = { |
| | 1535 | "1", "2", "3", "4", "5", "6", "7", "8", "9", "0", "'", (QChar)0xbf, (QChar)0xba, (QChar)0xe7, |
| | 1536 | "q", "w", "e", "r", "t", "y", "u", "i", "o", "p", "`", "+", |
| | 1537 | "a", "s", "d", "f", "g", "h", "j", "k", "l", (QChar)0xf1, "'", |
| | 1538 | "<", "z", "x", "c", "v", "b", "n", "m", ",", ".", "-", |
| | 1539 | " ", |
| | 1540 | "Shift", "Lock", "AltGr", "<-", "->", "Shift", "Back", "Comp", "Del", "Done" |
| | 1541 | }; |
| | 1542 | |
| | 1543 | const QString c_spa_s[] = { |
| | 1544 | "!", "\"", (QChar)0xb7, "$", "%", "&&", "/", "(", ")", "=", "?", (QChar)0xa1, (QChar)0xaa, (QChar)0xc7, |
| | 1545 | "Q", "W", "E", "R", "T", "Y", "U", "I", "O", "P", "^", "*", |
| | 1546 | "A", "S", "D", "F", "G", "H", "J", "K", "L", (QChar)0xd1, "~", |
| | 1547 | ">", "Z", "X", "C", "V", "B", "N", "M", ";", ":", "_", |
| | 1548 | " ", |
| | 1549 | "", "", "", "", "", "", "", "", "", "" |
| | 1550 | }; |
| | 1551 | |
| | 1552 | const QString c_spa_m[] = { |
| | 1553 | "|", "@", "#", "4", "5", (QChar)0xac, "7", "8", "9", "0", "'", (QChar)0xbf, "\\", "}", |
| | 1554 | "q", "w", "e", "r", "t", "y", "u", "i", "o", "p", "[", "]", |
| | 1555 | "a", "s", "d", "f", "g", "h", "j", "k", "l", (QChar)0xf1, "{", |
| | 1556 | "<", "z", "x", "c", "v", "b", "n", "m", ",", ".", "-", |
| | 1557 | " ", |
| | 1558 | "Shift", "Lock", "AltGr", "<-", "->", "Shift", "Back", "Comp", "Del", "Done" |
| | 1559 | }; |
| | 1560 | |
| | 1561 | const QString c_spa_sm[] = { |
| | 1562 | "!", "\"", (QChar)0xb7, "$", "%", "&&", "/", "(", ")", "=", "?", (QChar)0xa1, (QChar)0xaa, (QChar)0xc7, |
| | 1563 | "Q", "W", "E", "R", "T", "Y", "U", "I", "O", "P", "^", "*", |
| | 1564 | "A", "S", "D", "F", "G", "H", "J", "K", "L", (QChar)0xd1, "~", |
| | 1565 | ">", "Z", "X", "C", "V", "B", "N", "M", ";", ":", "_", |
| | 1566 | " ", |
| | 1567 | "", "", "", "", "", "", "", "", "", "" |
| | 1568 | }; |
| | 1569 | |
| | 1570 | const int x_spa[] = { |
| | 1571 | 5, 35, 65, 95, 125, 155, 185, 215, 245, 275, 305, 335, 365, 395, |
| | 1572 | 15, 45, 75, 105, 135, 165, 195, 225, 255, 285, 315, 345, |
| | 1573 | 25, 55, 85, 115, 145, 175, 205, 235, 265, 295, 325, |
| | 1574 | 5, 35, 65, 95, 125, 155, 185, 215, 245, 275, 305, |
| | 1575 | 135, |
| | 1576 | 5, 70, 220, 285, 330, 375, 375, 335, 395, 355 |
| | 1577 | }; |
| | 1578 | |
| | 1579 | const int y_spa[] = { |
| | 1580 | 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, |
| | 1581 | 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, |
| | 1582 | 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, |
| | 1583 | 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, |
| | 1584 | 125, |
| | 1585 | 125, 125, 125, 125, 125, 125, 35, 95, 95, 65 |
| | 1586 | }; |
| | 1587 | |
| | 1588 | const int w_spa[] = { |
| | 1589 | 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, |
| | 1590 | 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, |
| | 1591 | 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, |
| | 1592 | 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, |
| | 1593 | 83, |
| | 1594 | 63, 63, 63, 43, 43, 58, 58, 58, 38, 78 |
| | 1595 | }; |
| | 1596 | |
| | 1597 | |
| | 1598 | // Italian |
| | 1599 | |
| | 1600 | const QString c_ita[] = { |
| | 1601 | "1", "2", "3", "4", "5", "6", "7", "8", "9", "0", "'", (QChar)0xec, "\\", (QChar)0xfa, |
| | 1602 | "q", "w", "e", "r", "t", "y", "u", "i", "o", "p", (QChar)0xe8, "+", |
| | 1603 | "a", "s", "d", "f", "g", "h", "j", "k", "l", (QChar)0xf2, (QChar)0xe0, |
| | 1604 | "<", "z", "x", "c", "v", "b", "n", "m", ",", ".", "-", |
| | 1605 | " ", |
| | 1606 | "Shift", "Lock", "AltGr", "<-", "->", "Shift", "Back", "Comp", "Del", "Done" |
| | 1607 | }; |
| | 1608 | |
| | 1609 | const QString c_ita_s[] = { |
| | 1610 | "!", "\"", (QChar)0xa3, "$", "%", "&&", "/", "(", ")", "=", "?", "^", "|", (QChar)0xa7, |
| | 1611 | "Q", "W", "E", "R", "T", "Y", "U", "I", "O", "P", (QChar)0xe9, "*", |
| | 1612 | "A", "S", "D", "F", "G", "H", "J", "K", "L", (QChar)0xe7, (QChar)0xb0, |
| | 1613 | ">", "Z", "X", "C", "V", "B", "N", "M", ";", ":", "_", |
| | 1614 | " ", |
| | 1615 | "", "", "", "", "", "", "", "", "", "" |
| | 1616 | }; |
| | 1617 | |
| | 1618 | const QString c_ita_m[] = { |
| | 1619 | "1", "2", "3", "4", "5", "6", "7", "8", "9", "0", "'", (QChar)0xec, "\\", (QChar)0xfa, |
| | 1620 | "q", "w", "e", "r", "t", "y", "u", "i", "o", "p", "[", "]", |
| | 1621 | "a", "s", "d", "f", "g", "h", "j", "k", "l", "@", "#", |
| | 1622 | "<", "z", "x", "c", "v", "b", "n", "m", ",", ".", "-", |
| | 1623 | " ", |
| | 1624 | "", "", "", "", "", "", "", "", "", "" |
| | 1625 | }; |
| | 1626 | |
| | 1627 | const QString c_ita_sm[] = { |
| | 1628 | "!", "\"", (QChar)0xa3, "$", "%", "&&", "/", "(", ")", "=", "?", "^", "|", (QChar)0xa7, |
| | 1629 | "Q", "W", "E", "R", "T", "Y", "U", "I", "O", "P", (QChar)0xe9, "*", |
| | 1630 | "A", "S", "D", "F", "G", "H", "J", "K", "L", (QChar)0xe7, (QChar)0xb0, |
| | 1631 | ">", "Z", "X", "C", "V", "B", "N", "M", ";", ":", "_", |
| | 1632 | " ", |
| | 1633 | "", "", "", "", "", "", "", "", "", "" |
| | 1634 | }; |
| | 1635 | |
| | 1636 | const int x_ita[] = { |
| | 1637 | 5, 35, 65, 95, 125, 155, 185, 215, 245, 275, 305, 335, 365, 395, |
| | 1638 | 15, 45, 75, 105, 135, 165, 195, 225, 255, 285, 315, 345, |
| | 1639 | 25, 55, 85, 115, 145, 175, 205, 235, 265, 295, 325, |
| | 1640 | 5, 35, 65, 95, 125, 155, 185, 215, 245, 275, 305, |
| | 1641 | 135, |
| | 1642 | 5, 70, 220, 285, 330, 375, 375, 335, 395, 355 |
| | 1643 | }; |
| | 1644 | |
| | 1645 | const int y_ita[] = { |
| | 1646 | 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, |
| | 1647 | 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, |
| | 1648 | 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, |
| | 1649 | 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, |
| | 1650 | 125, |
| | 1651 | 125, 125, 125, 125, 125, 125, 35, 95, 95, 65 |
| | 1652 | }; |
| | 1653 | |
| | 1654 | const int w_ita[] = { |
| | 1655 | 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, |
| | 1656 | 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, |
| | 1657 | 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, |
| | 1658 | 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, |
| | 1659 | 83, |
| | 1660 | 63, 63, 63, 43, 43, 58, 58, 58, 38, 78 |
| | 1661 | }; |
| | 1662 | |
| | 1663 | |
| | 1664 | // English (UK) |
| | 1665 | |
| | 1666 | const QString c_uke[] = { |
| | 1667 | "1", "2", "3", "4", "5", "6", "7", "8", "9", "0", "-", "=", "`", "#", |
| | 1668 | "q", "w", "e", "r", "t", "y", "u", "i", "o", "p", "[", "]", |
| | 1669 | "a", "s", "d", "f", "g", "h", "j", "k", "l", ";", "'", |
| | 1670 | "\\", "z", "x", "c", "v", "b", "n", "m", ",", ".", "/", |
| | 1671 | " ", |
| | 1672 | "Shift", "Lock", "<-", "->", "Shift", "Back", "Comp", "Del", "Done" |
| | 1673 | }; |
| | 1674 | |
| | 1675 | const QString c_uke_s[] = { |
| | 1676 | "!", "\"", (QChar)0xa3, "$", "%", "^", "&&", "=", "(", ")", "_", "+", (QChar)0xac, "~", |
| | 1677 | "Q", "W", "E", "R", "T", "Y", "U", "I", "O", "P", "{", "}", |
| | 1678 | "A", "S", "D", "F", "G", "H", "J", "K", "L", ":", "@", |
| | 1679 | "|", "Z", "X", "C", "V", "B", "N", "M", "<", ">", "?", |
| | 1680 | " ", |
| | 1681 | "", "", "", "", "", "", "", "", "" |
| | 1682 | }; |
| | 1683 | |
| | 1684 | const int x_uke[] = { |
| | 1685 | 5, 35, 65, 95, 125, 155, 185, 215, 245, 275, 305, 335, 365, 395, |
| | 1686 | 15, 45, 75, 105, 135, 165, 195, 225, 255, 285, 315, 345, |
| | 1687 | 25, 55, 85, 115, 145, 175, 205, 235, 265, 295, 325, |
| | 1688 | 5, 35, 65, 95, 125, 155, 185, 215, 245, 275, 305, |
| | 1689 | 165, |
| | 1690 | 5, 70, 285, 330, 375, 375, 335, 395, 355 |
| | 1691 | }; |
| | 1692 | |
| | 1693 | const int y_uke[] = { |
| | 1694 | 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, |
| | 1695 | 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, |
| | 1696 | 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, |
| | 1697 | 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, |
| | 1698 | 125, |
| | 1699 | 125, 125, 125, 125, 125, 35, 95, 95, 65 |
| | 1700 | }; |
| | 1701 | |
| | 1702 | const int w_uke[] = { |
| | 1703 | 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, |
| | 1704 | 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, |
| | 1705 | 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, |
| | 1706 | 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, |
| | 1707 | 88, |
| | 1708 | 63, 63, 43, 43, 58, 58, 58, 38, 78 |
| | 1709 | }; |
| | 1710 | |
| | 1711 | |
| | 1712 | const int numcomps = 95; |
| | 1713 | |
| | 1714 | const QString comps[numcomps][3] = { |
| | 1715 | {"!", "!", (QChar)0xa1}, {"c", "/", (QChar)0xa2}, |
| | 1716 | {"l", "-", (QChar)0xa3}, {"o", "x", (QChar)0xa4}, |
| | 1717 | {"y", "-", (QChar)0xa5}, {"|", "|", (QChar)0xa6}, |
| | 1718 | {"s", "o", (QChar)0xa7}, {"\"", "\"", (QChar)0xa8}, |
| | 1719 | {"c", "o", (QChar)0xa9}, {"-", "a", (QChar)0xaa}, |
| | 1720 | {"<", "<", (QChar)0xab}, {"-", "|", (QChar)0xac}, |
| | 1721 | {"-", "-", (QChar)0xad}, {"r", "o", (QChar)0xae}, |
| | 1722 | {"^", "-", (QChar)0xaf}, {"^", "0", (QChar)0xb0}, |
| | 1723 | {"+", "-", (QChar)0xb1}, {"^", "2", (QChar)0xb2}, |
| | 1724 | {"^", "3", (QChar)0xb3}, {"/", "/", (QChar)0xb4}, |
| | 1725 | {"/", "u", (QChar)0xb5}, {"P", "!", (QChar)0xb6}, |
| | 1726 | {"^", ".", (QChar)0xb7}, {",", ",", (QChar)0xb8}, |
| | 1727 | {"^", "1", (QChar)0xb9}, {"_", "o", (QChar)0xba}, |
| | 1728 | {">", ">", (QChar)0xbb}, {"1", "4", (QChar)0xbc}, |
| | 1729 | {"1", "2", (QChar)0xbd}, {"3", "4", (QChar)0xbe}, |
| | 1730 | {"?", "?", (QChar)0xbf}, {"A", "`", (QChar)0xc0}, |
| | 1731 | {"A", "'", (QChar)0xc1}, {"A", "^", (QChar)0xc2}, |
| | 1732 | {"A", "~", (QChar)0xc3}, {"A", "\"", (QChar)0xc4}, |
| | 1733 | {"A", "*", (QChar)0xc5}, {"A", "E", (QChar)0xc6}, |
| | 1734 | {"C", ",", (QChar)0xc7}, {"E", "`", (QChar)0xc8}, |
| | 1735 | {"E", "'", (QChar)0xc9}, {"E", "^", (QChar)0xca}, |
| | 1736 | {"E", "\"", (QChar)0xcb}, {"I", "`", (QChar)0xcc}, |
| | 1737 | {"I", "'", (QChar)0xcd}, {"I", "^", (QChar)0xce}, |
| | 1738 | {"I", "\"", (QChar)0xcf}, {"D", "-", (QChar)0xd0}, |
| | 1739 | {"N", "~", (QChar)0xd1}, {"O", "`", (QChar)0xd2}, |
| | 1740 | {"O", "'", (QChar)0xd3}, {"O", "^", (QChar)0xd4}, |
| | 1741 | {"O", "~", (QChar)0xd5}, {"O", "\"", (QChar)0xd6}, |
| | 1742 | {"x", "x", (QChar)0xd7}, {"O", "/", (QChar)0xd8}, |
| | 1743 | {"U", "`", (QChar)0xd9}, {"U", "'", (QChar)0xda}, |
| | 1744 | {"U", "^", (QChar)0xdb}, {"U", "\"", (QChar)0xdc}, |
| | 1745 | {"Y", "'", (QChar)0xdd}, {"T", "H", (QChar)0xde}, |
| | 1746 | {"s", "s", (QChar)0xdf}, {"a", "`", (QChar)0xe0}, |
| | 1747 | {"a", "'", (QChar)0xe1}, {"a", "^", (QChar)0xe2}, |
| | 1748 | {"a", "~", (QChar)0xe3}, {"a", "\"", (QChar)0xe4}, |
| | 1749 | {"a", "*", (QChar)0xe5}, {"a", "e", (QChar)0xe6}, |
| | 1750 | {"c", ",", (QChar)0xe7}, {"e", "`", (QChar)0xe8}, |
| | 1751 | {"e", "'", (QChar)0xe9}, {"e", "^", (QChar)0xea}, |
| | 1752 | {"e", "\"", (QChar)0xeb}, {"i", "`", (QChar)0xec}, |
| | 1753 | {"i", "'", (QChar)0xed}, {"i", "^", (QChar)0xee}, |
| | 1754 | {"i", "\"", (QChar)0xef}, {"d", "-", (QChar)0xf0}, |
| | 1755 | {"n", "~", (QChar)0xf1}, {"o", "`", (QChar)0xf2}, |
| | 1756 | {"o", "'", (QChar)0xf3}, {"o", "^", (QChar)0xf4}, |
| | 1757 | {"o", "~", (QChar)0xf5}, {"o", "\"", (QChar)0xf6}, |
| | 1758 | {"-", ":", (QChar)0xf7}, {"o", "/", (QChar)0xf8}, |
| | 1759 | {"u", "`", (QChar)0xf9}, {"u", "'", (QChar)0xfa}, |
| | 1760 | {"u", "^", (QChar)0xfb}, {"u", "\"", (QChar)0xfc}, |
| | 1761 | {"y", "'", (QChar)0xfd}, {"t", "h", (QChar)0xfe}, |
| | 1762 | {"y", "\"", (QChar)0xff} |
| | 1763 | }; |
| | 1764 | |
| | 1765 | |
| | 1766 | VKButton::VKButton(QWidget *parent, const char* name, QString ckey, |
| | 1767 | QString ckey_s, QString ckey_m, QString ckey_sm): |
| | 1768 | QPushButton(name, parent, name) |
| | 1769 | { |
| | 1770 | mykey = ckey; |
| | 1771 | mykey_s = ckey_s; |
| | 1772 | mykey_m = ckey_m; |
| | 1773 | mykey_sm = ckey_sm; |
| | 1774 | setText(name); |
| | 1775 | setShiftState(false, false); |
| | 1776 | highlight(false); |
| | 1777 | if (!mykey_s.isEmpty()) |
| | 1778 | { |
| | 1779 | // Regular keys pass their own text and tell the shift button |
| | 1780 | // they've been pressed. |
| | 1781 | connect (this, SIGNAL( pressed() ), SLOT ( pressKey() ) ); |
| | 1782 | connect (this, SIGNAL( released() ), parent, SLOT( shiftOff() ) ); |
| | 1783 | } |
| | 1784 | } |
| | 1785 | |
| | 1786 | void VKButton::highlight(bool b) |
| | 1787 | { |
| | 1788 | // QnD way to highlight a button when popup doesn't get focus. |
| | 1789 | setFlat(!b); |
| | 1790 | setDefault(b); |
| | 1791 | } |
| | 1792 | |
| | 1793 | bool VKButton::isHighlighted() |
| | 1794 | { |
| | 1795 | return (!isFlat()); |
| | 1796 | } |
| | 1797 | |
| | 1798 | void VKButton::setShiftState(bool sh, bool ag) |
| | 1799 | { |
| | 1800 | if (!mykey.isEmpty()) |
| | 1801 | { |
| | 1802 | if (sh) |
| | 1803 | { |
| | 1804 | if (ag) this->setText(mykey_sm); |
| | 1805 | else this->setText(mykey_s); |
| | 1806 | } |
| | 1807 | else |
| | 1808 | { |
| | 1809 | if (ag) this->setText(mykey_m); |
| | 1810 | else this->setText(mykey); |
| | 1811 | } |
| | 1812 | } |
| | 1813 | } |
| | 1814 | |
| | 1815 | void VKButton::pressKey() |
| | 1816 | { |
| | 1817 | VKPopup *par = (VKPopup *)parentWidget(); |
| | 1818 | if (text().mid(0,1) == "&") // Special treatment for underline character '&' |
| | 1819 | par->makeInsert(text().mid(1,1)); |
| | 1820 | else |
| | 1821 | par->makeInsert(text().mid(0,1)); |
| | 1822 | } |
| | 1823 | |
| | 1824 | |
| | 1825 | VKPopup::VKPopup(QWidget *parent, const char* name, QString lang) |
| | 1826 | : QFrame(parent, name, WType_Popup) |
| | 1827 | { |
| | 1828 | setFrameStyle( WinPanel|Raised ); |
| | 1829 | compTrap = false; |
| | 1830 | iComp = iAltGr = iShiftL = iShiftR = iDone = 0; |
| | 1831 | iLock = iDel = iBack = iLeft = iRight = 0; |
| | 1832 | |
| | 1833 | for (int i=0; i<100; i++) but[i]=0; |
| | 1834 | |
| | 1835 | bool finished=false; |
| | 1836 | for (int i=0; !finished; i++) |
| | 1837 | { |
| | 1838 | QString k, k_s, k_m, k_sm; |
| | 1839 | int x, y, w; |
| | 1840 | if (lang.lower() == "gr") |
| | 1841 | { |
| | 1842 | k = c_grk[i]; |
| | 1843 | k_s = c_grk_s[i]; |
| | 1844 | k_m = c_grk_m[i]; |
| | 1845 | k_sm = c_grk_sm[i]; |
| | 1846 | x = x_grk[i]; |
| | 1847 | y = y_grk[i]; |
| | 1848 | w = w_grk[i]; |
| | 1849 | } |
| | 1850 | else if (lang.lower() == "fr") |
| | 1851 | { |
| | 1852 | k = c_frn[i]; |
| | 1853 | k_s = c_frn_s[i]; |
| | 1854 | k_m = c_frn_m[i]; |
| | 1855 | k_sm = c_frn_sm[i]; |
| | 1856 | x = x_frn[i]; |
| | 1857 | y = y_frn[i]; |
| | 1858 | w = w_frn[i]; |
| | 1859 | } |
| | 1860 | else if (lang.lower() == "de") |
| | 1861 | { |
| | 1862 | k = c_ger[i]; |
| | 1863 | k_s = c_ger_s[i]; |
| | 1864 | k_m = c_ger_m[i]; |
| | 1865 | k_sm = c_ger_sm[i]; |
| | 1866 | x = x_ger[i]; |
| | 1867 | y = y_ger[i]; |
| | 1868 | w = w_ger[i]; |
| | 1869 | } |
| | 1870 | else if (lang.lower() == "es") |
| | 1871 | { |
| | 1872 | k = c_spa[i]; |
| | 1873 | k_s = c_spa_s[i]; |
| | 1874 | k_m = c_spa_m[i]; |
| | 1875 | k_sm = c_spa_sm[i]; |
| | 1876 | x = x_spa[i]; |
| | 1877 | y = y_spa[i]; |
| | 1878 | w = w_spa[i]; |
| | 1879 | } |
| | 1880 | else if (lang.lower() == "it") |
| | 1881 | { |
| | 1882 | k = c_ita[i]; |
| | 1883 | k_s = c_ita_s[i]; |
| | 1884 | k_m = c_ita_m[i]; |
| | 1885 | k_sm = c_ita_sm[i]; |
| | 1886 | x = x_ita[i]; |
| | 1887 | y = y_ita[i]; |
| | 1888 | w = w_ita[i]; |
| | 1889 | } |
| | 1890 | else if (lang.lower() == "en") |
| | 1891 | { |
| | 1892 | QString alang = getenv("LANG"); |
| | 1893 | if (alang.contains("en_uk", false)) |
| | 1894 | { |
| | 1895 | k = c_uke[i]; |
| | 1896 | k_s = c_uke_s[i]; |
| | 1897 | k_m = k; |
| | 1898 | k_sm = k_s; |
| | 1899 | x = x_uke[i]; |
| | 1900 | y = y_uke[i]; |
| | 1901 | w = w_uke[i]; |
| | 1902 | } |
| | 1903 | else |
| | 1904 | { |
| | 1905 | k = c_eng[i]; |
| | 1906 | k_s = c_eng_s[i]; |
| | 1907 | k_m = k; |
| | 1908 | k_sm = k_s; |
| | 1909 | x = x_eng[i]; |
| | 1910 | y = y_eng[i]; |
| | 1911 | w = w_eng[i]; |
| | 1912 | } |
| | 1913 | } |
| | 1914 | else |
| | 1915 | { |
| | 1916 | k = c_eng[i]; |
| | 1917 | k_s = c_eng_s[i]; |
| | 1918 | k_m = k; |
| | 1919 | k_sm = k_s; |
| | 1920 | x = x_eng[i]; |
| | 1921 | y = y_eng[i]; |
| | 1922 | w = w_eng[i]; |
| | 1923 | } |
| | 1924 | |
| | 1925 | if (!k_s.isEmpty()) |
| | 1926 | { |
| | 1927 | QString bname; |
| | 1928 | bname.setNum(i); |
| | 1929 | but[i] = new VKButton(this, "Key"+bname, k, k_s, k_m, k_sm); |
| | 1930 | } |
| | 1931 | else |
| | 1932 | { |
| | 1933 | but[i] = new VKButton(this, k); |
| | 1934 | if (k == "Shift") |
| | 1935 | { |
| | 1936 | if (iShiftL) iShiftR = i; |
| | 1937 | else iShiftL = i; |
| | 1938 | } |
| | 1939 | else if (k == "Lock") iLock = i; |
| | 1940 | else if (k == "AltGr") iAltGr = i; |
| | 1941 | else if (k == "Comp") iComp = i; |
| | 1942 | else if (k == "<-") iLeft = i; |
| | 1943 | else if (k == "->") iRight = i; |
| | 1944 | else if (k == "Back") iBack = i; |
| | 1945 | else if (k == "Del") iDel = i; |
| | 1946 | else if (k == "Done") |
| | 1947 | { |
| | 1948 | iDone = i; |
| | 1949 | but[iDone]->highlight(true); |
| | 1950 | finished = true; |
| | 1951 | } |
| | 1952 | } |
| | 1953 | but[i]->setGeometry(x, y, w, 28); |
| | 1954 | but[i]->setFont(parentWidget()->font()); |
| | 1955 | } |
| | 1956 | |
| | 1957 | if (iAltGr) |
| | 1958 | { |
| | 1959 | but[iAltGr]->setToggleButton(true); |
| | 1960 | but[iAltGr]->setOn(false); |
| | 1961 | } |
| | 1962 | |
| | 1963 | but[iShiftL]->setToggleButton(true); |
| | 1964 | but[iShiftL]->setOn(false); |
| | 1965 | |
| | 1966 | but[iShiftR]->setToggleButton(true); |
| | 1967 | but[iShiftR]->setOn(false); |
| | 1968 | |
| | 1969 | but[iLock]->setToggleButton(true); |
| | 1970 | but[iLock]->setOn(false); |
| | 1971 | |
| | 1972 | connect(but[iDone], SIGNAL( released() ), this, SLOT( close() ) ); |
| | 1973 | connect(but[iShiftL], SIGNAL( released() ), this, SLOT( shiftLOnOff() ) ); |
| | 1974 | connect(but[iShiftR], SIGNAL( released() ), this, SLOT( shiftROnOff() ) ); |
| | 1975 | if (iAltGr) connect(but[iAltGr], SIGNAL( released() ), this, SLOT( altGrOnOff() ) ); |
| | 1976 | connect(but[iComp], SIGNAL( released() ), this, SLOT( compOnOff() ) ); |
| | 1977 | connect(but[iLock], SIGNAL( released() ), this, SLOT( lockOnOff() ) ); |
| | 1978 | connect(but[iLeft], SIGNAL( released() ), this, SLOT( leftCursor() ) ); |
| | 1979 | connect(but[iRight], SIGNAL( released() ), this, SLOT( rightCursor() ) ); |
| | 1980 | connect(but[iBack], SIGNAL( released() ), this, SLOT( backspaceKey() ) ); |
| | 1981 | connect(but[iDel], SIGNAL( released() ), this, SLOT( delKey() ) ); |
| | 1982 | } |
| | 1983 | |
| | 1984 | VKPopup::~VKPopup() |
| | 1985 | { |
| | 1986 | for (int i=0; but[i]; i++) |
| | 1987 | delete but[i]; |
| | 1988 | } |
| | 1989 | |
| | 1990 | void VKPopup::leftCursor() |
| | 1991 | { |
| | 1992 | QLineEdit *par = (QLineEdit *)parentWidget(); |
| | 1993 | par->cursorBackward(but[iShiftL]->isOn()); |
| | 1994 | } |
| | 1995 | |
| | 1996 | void VKPopup::rightCursor() |
| | 1997 | { |
| | 1998 | QLineEdit *par = (QLineEdit *)parentWidget(); |
| | 1999 | par->cursorForward(but[iShiftL]->isOn()); |
| | 2000 | } |
| | 2001 | |
| | 2002 | void VKPopup::backspaceKey() |
| | 2003 | { |
| | 2004 | QLineEdit *par = (QLineEdit *)parentWidget(); |
| | 2005 | par->backspace(); |
| | 2006 | } |
| | 2007 | |
| | 2008 | void VKPopup::delKey() |
| | 2009 | { |
| | 2010 | QLineEdit *par = (QLineEdit *)parentWidget(); |
| | 2011 | par->del(); |
| | 2012 | } |
| | 2013 | |
| | 2014 | void VKPopup::hide() |
| | 2015 | { |
| | 2016 | releaseKeyboard(); |
| | 2017 | parentWidget()->setFocus(); |
| | 2018 | QFrame::hide(); |
| | 2019 | } |
| | 2020 | |
| | 2021 | void VKPopup::show() |
| | 2022 | { |
| | 2023 | QWidget *pw = parentWidget(); |
| | 2024 | QWidget *tlw = pw->topLevelWidget(); |
| | 2025 | QRect pwg = pw->geometry(); |
| | 2026 | QRect tlwg = tlw->frameGeometry(); |
| | 2027 | |
| | 2028 | setPalette(parentWidget()->palette()); |
| | 2029 | QPoint newpos; |
| | 2030 | if (pw->mapTo(tlw, QPoint(0,pwg.height()+popuph+5)).y() |
| | 2031 | < tlwg.height()) |
| | 2032 | { |
| | 2033 | newpos = QPoint(pwg.width()/2-popupw/2, pwg.height() + 5); |
| | 2034 | } |
| | 2035 | else { |
| | 2036 | newpos = QPoint(pwg.width()/2-popupw/2, -5-popuph); |
| | 2037 | } |
| | 2038 | |
| | 2039 | int delx = pw->mapTo(tlw,newpos).x() + popupw-tlwg.width(); |
| | 2040 | newpos = QPoint(newpos.x()-(delx > 0 ? delx : 0), newpos.y()); |
| | 2041 | delx = pw->mapTo(tlw, newpos).x(); |
| | 2042 | newpos = QPoint(newpos.x()-(delx < 0 ? delx : 0), newpos.y()); |
| | 2043 | // TODO: can we blank the cursor? |
| | 2044 | this->resize(popupw,popuph); |
| | 2045 | for (int i=0; but[i]; i++) |
| | 2046 | but[i]->highlight(false); |
| | 2047 | but[iDone]->highlight(true); |
| | 2048 | but[iShiftL]->setOn(false); |
| | 2049 | but[iShiftR]->setOn(false); |
| | 2050 | if (iAltGr) but[iAltGr]->setOn(false); |
| | 2051 | but[iLock]->setOn(false); |
| | 2052 | if (compTrap) compOnOff(); |
| | 2053 | updateButtons(); |
| | 2054 | this->move( pw->mapToGlobal( newpos ) ); |
| | 2055 | grabKeyboard(); |
| | 2056 | QFrame::show(); |
| | 2057 | pw->setFocus(); |
| | 2058 | } |
| | 2059 | |
| | 2060 | void VKPopup::makeInsert(QString c) |
| | 2061 | { |
| | 2062 | QLineEdit *par = (QLineEdit *)parentWidget(); |
| | 2063 | if (!compTrap) |
| | 2064 | { |
| | 2065 | par->insert(c); |
| | 2066 | } |
| | 2067 | else |
| | 2068 | { |
| | 2069 | if (comp1.isEmpty()) comp1 = c; |
| | 2070 | else |
| | 2071 | { |
| | 2072 | // Produce the composed key. |
| | 2073 | for (int i=0; i<numcomps; i++) |
| | 2074 | { |
| | 2075 | if ((comp1 == comps[i][0]) && (c == comps[i][1])) |
| | 2076 | { |
| | 2077 | par->insert(comps[i][2]); |
| | 2078 | break; |
| | 2079 | } |
| | 2080 | } |
| | 2081 | // Reset compTrap. |
| | 2082 | comp1 = ""; |
| | 2083 | compTrap = false; |
| | 2084 | } |
| | 2085 | } |
| | 2086 | } |
| | 2087 | |
| | 2088 | void VKPopup::altGrOnOff() |
| | 2089 | { |
| | 2090 | if (but[iLock]->isOn()) |
| | 2091 | { |
| | 2092 | but[iShiftL]->setOn(false); |
| | 2093 | but[iShiftR]->setOn(false); |
| | 2094 | if (iAltGr) but[iAltGr]->setOn(false); |
| | 2095 | but[iLock]->setOn(false); |
| | 2096 | } |
| | 2097 | updateButtons(); |
| | 2098 | } |
| | 2099 | |
| | 2100 | void VKPopup::compOnOff() |
| | 2101 | { |
| | 2102 | compTrap = !compTrap; |
| | 2103 | comp1 = ""; |
| | 2104 | } |
| | 2105 | |
| | 2106 | void VKPopup::lockOnOff() |
| | 2107 | { |
| | 2108 | if (but[iLock]->isOn()) |
| | 2109 | { |
| | 2110 | if (!(iAltGr && but[iAltGr]->isOn())) |
| | 2111 | { |
| | 2112 | but[iShiftL]->setOn(true); |
| | 2113 | but[iShiftR]->setOn(true); |
| | 2114 | } |
| | 2115 | } |
| | 2116 | else |
| | 2117 | { |
| | 2118 | but[iShiftL]->setOn(false); |
| | 2119 | but[iShiftR]->setOn(false); |
| | 2120 | if (iAltGr) but[iAltGr]->setOn(false); |
| | 2121 | } |
| | 2122 | updateButtons(); |
| | 2123 | } |
| | 2124 | |
| | 2125 | void VKPopup::shiftOff() |
| | 2126 | { |
| | 2127 | if (!but[iLock]->isOn()) |
| | 2128 | { |
| | 2129 | but[iShiftL]->setOn(false); |
| | 2130 | but[iShiftR]->setOn(false); |
| | 2131 | if (iAltGr) but[iAltGr]->setOn(false); |
| | 2132 | } |
| | 2133 | updateButtons(); |
| | 2134 | } |
| | 2135 | |
| | 2136 | void VKPopup::updateButtons() |
| | 2137 | { |
| | 2138 | bool st_shift = but[iShiftL]->isOn(); |
| | 2139 | bool st_altgr = (iAltGr ? but[iAltGr]->isOn() : false); |
| | 2140 | for (int i=0; but[i]; i++) |
| | 2141 | { |
| | 2142 | but[i]->setShiftState(st_shift, st_altgr); |
| | 2143 | } |
| | 2144 | } |
| | 2145 | |
| | 2146 | void VKPopup::shiftLOnOff() |
| | 2147 | { |
| | 2148 | if (but[iLock]->isOn()) |
| | 2149 | { |
| | 2150 | but[iShiftL]->setOn(false); |
| | 2151 | but[iShiftR]->setOn(false); |
| | 2152 | if (iAltGr) but[iAltGr]->setOn(false); |
| | 2153 | but[iLock]->setOn(false); |
| | 2154 | } |
| | 2155 | else but[iShiftR]->setOn(but[iShiftL]->isOn()); |
| | 2156 | updateButtons(); |
| | 2157 | } |
| | 2158 | |
| | 2159 | void VKPopup::shiftROnOff() |
| | 2160 | { |
| | 2161 | if (but[iLock]->isOn()) |
| | 2162 | { |
| | 2163 | but[iShiftL]->setOn(false); |
| | 2164 | but[iShiftR]->setOn(false); |
| | 2165 | if (iAltGr) but[iAltGr]->setOn(false); |
| | 2166 | but[iLock]->setOn(false); |
| | 2167 | } |
| | 2168 | else but[iShiftL]->setOn(but[iShiftR]->isOn()); |
| | 2169 | updateButtons(); |
| | 2170 | } |
| | 2171 | |
| | 2172 | VKButton * VKPopup::sideButton(VKButton * oldbut, int dirkey) |
| | 2173 | { |
| | 2174 | QRect butrect = oldbut->frameGeometry(); |
| | 2175 | QPoint newpoint; |
| | 2176 | switch (dirkey) { |
| | 2177 | case Qt::Key_Left: |
| | 2178 | newpoint = QPoint(butrect.left()-20, butrect.center().y()); |
| | 2179 | break; |
| | 2180 | case Qt::Key_Right: |
| | 2181 | newpoint = QPoint(butrect.right()+20, butrect.center().y()); |
| | 2182 | break; |
| | 2183 | case Qt::Key_Up: |
| | 2184 | newpoint = QPoint(butrect.center().x(), butrect.top()-20); |
| | 2185 | break; |
| | 2186 | case Qt::Key_Down: |
| | 2187 | newpoint = QPoint(butrect.center().x(), butrect.bottom()+20); |
| | 2188 | break; |
| | 2189 | } |
| | 2190 | int ibest = 0; |
| | 2191 | int bestdist = (newpoint - but[ibest]->frameGeometry().center()).manhattanLength(); |
| | 2192 | for (int i=0; but[i]; i++) |
| | 2193 | { |
| | 2194 | int thisdist = (newpoint - but[i]->frameGeometry().center()).manhattanLength(); |
| | 2195 | if (thisdist < bestdist) { |
| | 2196 | bestdist = thisdist; |
| | 2197 | ibest = i; |
| | 2198 | } |
| | 2199 | } |
| | 2200 | return but[ibest]; |
| | 2201 | } |
| | 2202 | |
| | 2203 | VKButton* VKPopup::highButton() |
| | 2204 | { |
| | 2205 | for (int i=0; but[i]; i++) |
| | 2206 | { |
| | 2207 | if (but[i]->isHighlighted()) |
| | 2208 | return but[i]; |
| | 2209 | } |
| | 2210 | return but[0]; |
| | 2211 | } |
| | 2212 | |
| | 2213 | void VKPopup::keyPressEvent(QKeyEvent *e) |
| | 2214 | { |
| | 2215 | bool handled = false; |
| | 2216 | QStringList actions; |
| | 2217 | if (gContext->GetMainWindow()->TranslateKeyPress("qt", e, actions)) |
| | 2218 | { |
| | 2219 | for (unsigned int i = 0; i < actions.size() && !handled; i++) |
| | 2220 | { |
| | 2221 | QString action = actions[i]; |
| | 2222 | handled = true; |
| | 2223 | VKButton* selected = highButton(); |
| | 2224 | |
| | 2225 | if (action == "UP") |
| | 2226 | { |
| | 2227 | selected->highlight(false); |
| | 2228 | sideButton(selected, Qt::Key_Up)->highlight(true); |
| | 2229 | } |
| | 2230 | |
| | 2231 | else if (action == "DOWN") |
| | 2232 | { |
| | 2233 | selected->highlight(false); |
| | 2234 | sideButton(selected, Qt::Key_Down)->highlight(true); |
| | 2235 | } |
| | 2236 | |
| | 2237 | else if (action == "LEFT") |
| | 2238 | { |
| | 2239 | selected->highlight(false); |
| | 2240 | sideButton(selected, Qt::Key_Left)->highlight(true); |
| | 2241 | } |
| | 2242 | |
| | 2243 | else if (action == "RIGHT") |
| | 2244 | { |
| | 2245 | selected->highlight(false); |
| | 2246 | sideButton(selected, Qt::Key_Right)->highlight(true); |
| | 2247 | } |
| | 2248 | |
| | 2249 | else if (action == "SELECT" && e->text().isNull()) |
| | 2250 | selected->animateClick(); |
| | 2251 | |
| | 2252 | else if (action == "ESCAPE") |
| | 2253 | hide(); |
| | 2254 | |
| | 2255 | else |
| | 2256 | handled = false; |
| | 2257 | } |
| | 2258 | } |
| | 2259 | |
| | 2260 | if (!handled) |
| | 2261 | { |
| | 2262 | QApplication::postEvent(parentWidget(), new QKeyEvent(e->type(), e->key(), |
| | 2263 | e->ascii(), e->state(), e->text(), e->isAutoRepeat(), e->count())); |
| | 2264 | parentWidget()->setFocus(); |
| | 2265 | } |
| | 2266 | } |