-rw-r--r-- | noncore/apps/opie-console/emulation_handler.cpp | 15 | ||||
-rw-r--r-- | noncore/apps/opie-console/keytrans.cpp | 3 | ||||
-rw-r--r-- | noncore/apps/opie-console/mainwindow.cpp | 9 |
3 files changed, 20 insertions, 7 deletions
diff --git a/noncore/apps/opie-console/emulation_handler.cpp b/noncore/apps/opie-console/emulation_handler.cpp index 787de67..c67c7c7 100644 --- a/noncore/apps/opie-console/emulation_handler.cpp +++ b/noncore/apps/opie-console/emulation_handler.cpp | |||
@@ -1,41 +1,48 @@ | |||
1 | #include <qwidget.h> | 1 | #include <qwidget.h> |
2 | 2 | ||
3 | #include "TEWidget.h" | 3 | #include "TEWidget.h" |
4 | #include "TEmuVt102.h" | 4 | #include "TEmuVt102.h" |
5 | 5 | ||
6 | #include "emulation_handler.h" | 6 | #include "emulation_handler.h" |
7 | 7 | ||
8 | 8 | ||
9 | EmulationHandler::EmulationHandler( const Profile& prof, QWidget* parent, const char* name ) | 9 | EmulationHandler::EmulationHandler( const Profile& prof, QWidget* parent,const char* name ) |
10 | : QObject(0, name ) | 10 | : QObject(0, name ) |
11 | { | 11 | { |
12 | load(prof ); | 12 | m_teWid = new TEWidget( parent, "TerminalMain"); |
13 | m_teWid = new TEWidget( parent, "TerminalMain" ); | 13 | m_teWid->setMinimumSize(150, 70 ); |
14 | parent->resize( m_teWid->calcSize(80, 24 ) ); | 14 | parent->resize( m_teWid->calcSize(80, 24 ) ); |
15 | m_teEmu = new TEmuVt102(m_teWid ); | 15 | m_teEmu = new TEmuVt102(m_teWid ); |
16 | 16 | ||
17 | connect(m_teEmu,SIGNAL(ImageSizeChanged(int, int) ), | 17 | connect(m_teEmu,SIGNAL(ImageSizeChanged(int, int) ), |
18 | this, SIGNAL(changeSize(int, int) ) ); | 18 | this, SIGNAL(changeSize(int, int) ) ); |
19 | connect(m_teEmu, SIGNAL(sndBlock(const char*, int) ), | 19 | connect(m_teEmu, SIGNAL(sndBlock(const char*, int) ), |
20 | this, SLOT(recvEmulation(const char*, int) ) ); | 20 | this, SLOT(recvEmulation(const char*, int) ) ); |
21 | m_teEmu->setConnect( true ); | ||
22 | load( prof ); | ||
23 | |||
24 | |||
21 | 25 | ||
22 | } | 26 | } |
23 | EmulationHandler::~EmulationHandler() { | 27 | EmulationHandler::~EmulationHandler() { |
24 | delete m_teEmu; | 28 | delete m_teEmu; |
25 | delete m_teWid; | 29 | delete m_teWid; |
26 | } | 30 | } |
27 | void EmulationHandler::load( const Profile& ) { | 31 | void EmulationHandler::load( const Profile& ) { |
28 | 32 | QFont font = QFont("Fixed", 12, QFont::Normal ); | |
33 | font.setFixedPitch(TRUE); | ||
34 | m_teWid->setVTFont( font ); | ||
35 | m_teWid->setBackgroundColor(Qt::black ); | ||
29 | } | 36 | } |
30 | void EmulationHandler::recv( const QByteArray& ar) { | 37 | void EmulationHandler::recv( const QByteArray& ar) { |
31 | m_teEmu->onRcvBlock(ar.data(), ar.count() ); | 38 | m_teEmu->onRcvBlock(ar.data(), ar.count() ); |
32 | } | 39 | } |
33 | void EmulationHandler::recvEmulation(const char* src, int len ) { | 40 | void EmulationHandler::recvEmulation(const char* src, int len ) { |
34 | QByteArray ar(len); | 41 | QByteArray ar(len); |
35 | memcpy(ar.data(), src, sizeof(char) * len ); | 42 | memcpy(ar.data(), src, sizeof(char) * len ); |
36 | 43 | ||
37 | emit send(ar); | 44 | emit send(ar); |
38 | } | 45 | } |
39 | QWidget* EmulationHandler::widget() { | 46 | QWidget* EmulationHandler::widget() { |
40 | return m_teWid; | 47 | return m_teWid; |
41 | } | 48 | } |
diff --git a/noncore/apps/opie-console/keytrans.cpp b/noncore/apps/opie-console/keytrans.cpp index 5ea192e..d569ae0 100644 --- a/noncore/apps/opie-console/keytrans.cpp +++ b/noncore/apps/opie-console/keytrans.cpp | |||
@@ -438,272 +438,269 @@ void KeyTransSymbols::defOprSym(const char* key, int val) | |||
438 | { | 438 | { |
439 | oprsyms.insert(key,(QObject*)(val+1)); | 439 | oprsyms.insert(key,(QObject*)(val+1)); |
440 | } | 440 | } |
441 | 441 | ||
442 | void KeyTransSymbols::defModSym(const char* key, int val) | 442 | void KeyTransSymbols::defModSym(const char* key, int val) |
443 | { | 443 | { |
444 | modsyms.insert(key,(QObject*)(val+1)); | 444 | modsyms.insert(key,(QObject*)(val+1)); |
445 | } | 445 | } |
446 | 446 | ||
447 | void KeyTransSymbols::defOprSyms() | 447 | void KeyTransSymbols::defOprSyms() |
448 | { | 448 | { |
449 | // Modifier | 449 | // Modifier |
450 | defOprSym("scrollLineUp", CMD_scrollLineUp ); | 450 | defOprSym("scrollLineUp", CMD_scrollLineUp ); |
451 | defOprSym("scrollLineDown",CMD_scrollLineDown); | 451 | defOprSym("scrollLineDown",CMD_scrollLineDown); |
452 | defOprSym("scrollPageUp", CMD_scrollPageUp ); | 452 | defOprSym("scrollPageUp", CMD_scrollPageUp ); |
453 | defOprSym("scrollPageDown",CMD_scrollPageDown); | 453 | defOprSym("scrollPageDown",CMD_scrollPageDown); |
454 | defOprSym("emitSelection", CMD_emitSelection ); | 454 | defOprSym("emitSelection", CMD_emitSelection ); |
455 | defOprSym("prevSession", CMD_prevSession ); | 455 | defOprSym("prevSession", CMD_prevSession ); |
456 | defOprSym("nextSession", CMD_nextSession ); | 456 | defOprSym("nextSession", CMD_nextSession ); |
457 | } | 457 | } |
458 | 458 | ||
459 | void KeyTransSymbols::defModSyms() | 459 | void KeyTransSymbols::defModSyms() |
460 | { | 460 | { |
461 | // Modifier | 461 | // Modifier |
462 | defModSym("Shift", BITS_Shift ); | 462 | defModSym("Shift", BITS_Shift ); |
463 | defModSym("Control", BITS_Control ); | 463 | defModSym("Control", BITS_Control ); |
464 | defModSym("Alt", BITS_Alt ); | 464 | defModSym("Alt", BITS_Alt ); |
465 | // Modes | 465 | // Modes |
466 | defModSym("BsHack", BITS_BsHack ); // deprecated | 466 | defModSym("BsHack", BITS_BsHack ); // deprecated |
467 | defModSym("Ansi", BITS_Ansi ); | 467 | defModSym("Ansi", BITS_Ansi ); |
468 | defModSym("NewLine", BITS_NewLine ); | 468 | defModSym("NewLine", BITS_NewLine ); |
469 | defModSym("AppCuKeys", BITS_AppCuKeys ); | 469 | defModSym("AppCuKeys", BITS_AppCuKeys ); |
470 | } | 470 | } |
471 | 471 | ||
472 | void KeyTransSymbols::defKeySyms() | 472 | void KeyTransSymbols::defKeySyms() |
473 | { | 473 | { |
474 | // Grey keys | 474 | // Grey keys |
475 | defKeySym("Escape", Qt::Key_Escape ); | 475 | defKeySym("Escape", Qt::Key_Escape ); |
476 | defKeySym("Tab", Qt::Key_Tab ); | 476 | defKeySym("Tab", Qt::Key_Tab ); |
477 | defKeySym("Backtab", Qt::Key_Backtab ); | 477 | defKeySym("Backtab", Qt::Key_Backtab ); |
478 | defKeySym("Backspace", Qt::Key_Backspace ); | 478 | defKeySym("Backspace", Qt::Key_Backspace ); |
479 | defKeySym("Return", Qt::Key_Return ); | 479 | defKeySym("Return", Qt::Key_Return ); |
480 | defKeySym("Enter", Qt::Key_Enter ); | 480 | defKeySym("Enter", Qt::Key_Enter ); |
481 | defKeySym("Insert", Qt::Key_Insert ); | 481 | defKeySym("Insert", Qt::Key_Insert ); |
482 | defKeySym("Delete", Qt::Key_Delete ); | 482 | defKeySym("Delete", Qt::Key_Delete ); |
483 | defKeySym("Pause", Qt::Key_Pause ); | 483 | defKeySym("Pause", Qt::Key_Pause ); |
484 | defKeySym("Print", Qt::Key_Print ); | 484 | defKeySym("Print", Qt::Key_Print ); |
485 | defKeySym("SysReq", Qt::Key_SysReq ); | 485 | defKeySym("SysReq", Qt::Key_SysReq ); |
486 | defKeySym("Home", Qt::Key_Home ); | 486 | defKeySym("Home", Qt::Key_Home ); |
487 | defKeySym("End", Qt::Key_End ); | 487 | defKeySym("End", Qt::Key_End ); |
488 | defKeySym("Left", Qt::Key_Left ); | 488 | defKeySym("Left", Qt::Key_Left ); |
489 | defKeySym("Up", Qt::Key_Up ); | 489 | defKeySym("Up", Qt::Key_Up ); |
490 | defKeySym("Right", Qt::Key_Right ); | 490 | defKeySym("Right", Qt::Key_Right ); |
491 | defKeySym("Down", Qt::Key_Down ); | 491 | defKeySym("Down", Qt::Key_Down ); |
492 | defKeySym("Prior", Qt::Key_Prior ); | 492 | defKeySym("Prior", Qt::Key_Prior ); |
493 | defKeySym("Next", Qt::Key_Next ); | 493 | defKeySym("Next", Qt::Key_Next ); |
494 | defKeySym("Shift", Qt::Key_Shift ); | 494 | defKeySym("Shift", Qt::Key_Shift ); |
495 | defKeySym("Control", Qt::Key_Control ); | 495 | defKeySym("Control", Qt::Key_Control ); |
496 | defKeySym("Meta", Qt::Key_Meta ); | 496 | defKeySym("Meta", Qt::Key_Meta ); |
497 | defKeySym("Alt", Qt::Key_Alt ); | 497 | defKeySym("Alt", Qt::Key_Alt ); |
498 | defKeySym("CapsLock", Qt::Key_CapsLock ); | 498 | defKeySym("CapsLock", Qt::Key_CapsLock ); |
499 | defKeySym("NumLock", Qt::Key_NumLock ); | 499 | defKeySym("NumLock", Qt::Key_NumLock ); |
500 | defKeySym("ScrollLock", Qt::Key_ScrollLock ); | 500 | defKeySym("ScrollLock", Qt::Key_ScrollLock ); |
501 | defKeySym("F1", Qt::Key_F1 ); | 501 | defKeySym("F1", Qt::Key_F1 ); |
502 | defKeySym("F2", Qt::Key_F2 ); | 502 | defKeySym("F2", Qt::Key_F2 ); |
503 | defKeySym("F3", Qt::Key_F3 ); | 503 | defKeySym("F3", Qt::Key_F3 ); |
504 | defKeySym("F4", Qt::Key_F4 ); | 504 | defKeySym("F4", Qt::Key_F4 ); |
505 | defKeySym("F5", Qt::Key_F5 ); | 505 | defKeySym("F5", Qt::Key_F5 ); |
506 | defKeySym("F6", Qt::Key_F6 ); | 506 | defKeySym("F6", Qt::Key_F6 ); |
507 | defKeySym("F7", Qt::Key_F7 ); | 507 | defKeySym("F7", Qt::Key_F7 ); |
508 | defKeySym("F8", Qt::Key_F8 ); | 508 | defKeySym("F8", Qt::Key_F8 ); |
509 | defKeySym("F9", Qt::Key_F9 ); | 509 | defKeySym("F9", Qt::Key_F9 ); |
510 | defKeySym("F10", Qt::Key_F10 ); | 510 | defKeySym("F10", Qt::Key_F10 ); |
511 | defKeySym("F11", Qt::Key_F11 ); | 511 | defKeySym("F11", Qt::Key_F11 ); |
512 | defKeySym("F12", Qt::Key_F12 ); | 512 | defKeySym("F12", Qt::Key_F12 ); |
513 | defKeySym("F13", Qt::Key_F13 ); | 513 | defKeySym("F13", Qt::Key_F13 ); |
514 | defKeySym("F14", Qt::Key_F14 ); | 514 | defKeySym("F14", Qt::Key_F14 ); |
515 | defKeySym("F15", Qt::Key_F15 ); | 515 | defKeySym("F15", Qt::Key_F15 ); |
516 | defKeySym("F16", Qt::Key_F16 ); | 516 | defKeySym("F16", Qt::Key_F16 ); |
517 | defKeySym("F17", Qt::Key_F17 ); | 517 | defKeySym("F17", Qt::Key_F17 ); |
518 | defKeySym("F18", Qt::Key_F18 ); | 518 | defKeySym("F18", Qt::Key_F18 ); |
519 | defKeySym("F19", Qt::Key_F19 ); | 519 | defKeySym("F19", Qt::Key_F19 ); |
520 | defKeySym("F20", Qt::Key_F20 ); | 520 | defKeySym("F20", Qt::Key_F20 ); |
521 | defKeySym("F21", Qt::Key_F21 ); | 521 | defKeySym("F21", Qt::Key_F21 ); |
522 | defKeySym("F22", Qt::Key_F22 ); | 522 | defKeySym("F22", Qt::Key_F22 ); |
523 | defKeySym("F23", Qt::Key_F23 ); | 523 | defKeySym("F23", Qt::Key_F23 ); |
524 | defKeySym("F24", Qt::Key_F24 ); | 524 | defKeySym("F24", Qt::Key_F24 ); |
525 | defKeySym("F25", Qt::Key_F25 ); | 525 | defKeySym("F25", Qt::Key_F25 ); |
526 | defKeySym("F26", Qt::Key_F26 ); | 526 | defKeySym("F26", Qt::Key_F26 ); |
527 | defKeySym("F27", Qt::Key_F27 ); | 527 | defKeySym("F27", Qt::Key_F27 ); |
528 | defKeySym("F28", Qt::Key_F28 ); | 528 | defKeySym("F28", Qt::Key_F28 ); |
529 | defKeySym("F29", Qt::Key_F29 ); | 529 | defKeySym("F29", Qt::Key_F29 ); |
530 | defKeySym("F30", Qt::Key_F30 ); | 530 | defKeySym("F30", Qt::Key_F30 ); |
531 | defKeySym("F31", Qt::Key_F31 ); | 531 | defKeySym("F31", Qt::Key_F31 ); |
532 | defKeySym("F32", Qt::Key_F32 ); | 532 | defKeySym("F32", Qt::Key_F32 ); |
533 | defKeySym("F33", Qt::Key_F33 ); | 533 | defKeySym("F33", Qt::Key_F33 ); |
534 | defKeySym("F34", Qt::Key_F34 ); | 534 | defKeySym("F34", Qt::Key_F34 ); |
535 | defKeySym("F35", Qt::Key_F35 ); | 535 | defKeySym("F35", Qt::Key_F35 ); |
536 | defKeySym("Super_L", Qt::Key_Super_L ); | 536 | defKeySym("Super_L", Qt::Key_Super_L ); |
537 | defKeySym("Super_R", Qt::Key_Super_R ); | 537 | defKeySym("Super_R", Qt::Key_Super_R ); |
538 | defKeySym("Menu", Qt::Key_Menu ); | 538 | defKeySym("Menu", Qt::Key_Menu ); |
539 | defKeySym("Hyper_L", Qt::Key_Hyper_L ); | 539 | defKeySym("Hyper_L", Qt::Key_Hyper_L ); |
540 | defKeySym("Hyper_R", Qt::Key_Hyper_R ); | 540 | defKeySym("Hyper_R", Qt::Key_Hyper_R ); |
541 | 541 | ||
542 | // Regular keys | 542 | // Regular keys |
543 | defKeySym("Space", Qt::Key_Space ); | 543 | defKeySym("Space", Qt::Key_Space ); |
544 | defKeySym("Exclam", Qt::Key_Exclam ); | 544 | defKeySym("Exclam", Qt::Key_Exclam ); |
545 | defKeySym("QuoteDbl", Qt::Key_QuoteDbl ); | 545 | defKeySym("QuoteDbl", Qt::Key_QuoteDbl ); |
546 | defKeySym("NumberSign", Qt::Key_NumberSign ); | 546 | defKeySym("NumberSign", Qt::Key_NumberSign ); |
547 | defKeySym("Dollar", Qt::Key_Dollar ); | 547 | defKeySym("Dollar", Qt::Key_Dollar ); |
548 | defKeySym("Percent", Qt::Key_Percent ); | 548 | defKeySym("Percent", Qt::Key_Percent ); |
549 | defKeySym("Ampersand", Qt::Key_Ampersand ); | 549 | defKeySym("Ampersand", Qt::Key_Ampersand ); |
550 | defKeySym("Apostrophe", Qt::Key_Apostrophe ); | 550 | defKeySym("Apostrophe", Qt::Key_Apostrophe ); |
551 | defKeySym("ParenLeft", Qt::Key_ParenLeft ); | 551 | defKeySym("ParenLeft", Qt::Key_ParenLeft ); |
552 | defKeySym("ParenRight", Qt::Key_ParenRight ); | 552 | defKeySym("ParenRight", Qt::Key_ParenRight ); |
553 | defKeySym("Asterisk", Qt::Key_Asterisk ); | 553 | defKeySym("Asterisk", Qt::Key_Asterisk ); |
554 | defKeySym("Plus", Qt::Key_Plus ); | 554 | defKeySym("Plus", Qt::Key_Plus ); |
555 | defKeySym("Comma", Qt::Key_Comma ); | 555 | defKeySym("Comma", Qt::Key_Comma ); |
556 | defKeySym("Minus", Qt::Key_Minus ); | 556 | defKeySym("Minus", Qt::Key_Minus ); |
557 | defKeySym("Period", Qt::Key_Period ); | 557 | defKeySym("Period", Qt::Key_Period ); |
558 | defKeySym("Slash", Qt::Key_Slash ); | 558 | defKeySym("Slash", Qt::Key_Slash ); |
559 | defKeySym("0", Qt::Key_0 ); | 559 | defKeySym("0", Qt::Key_0 ); |
560 | defKeySym("1", Qt::Key_1 ); | 560 | defKeySym("1", Qt::Key_1 ); |
561 | defKeySym("2", Qt::Key_2 ); | 561 | defKeySym("2", Qt::Key_2 ); |
562 | defKeySym("3", Qt::Key_3 ); | 562 | defKeySym("3", Qt::Key_3 ); |
563 | defKeySym("4", Qt::Key_4 ); | 563 | defKeySym("4", Qt::Key_4 ); |
564 | defKeySym("5", Qt::Key_5 ); | 564 | defKeySym("5", Qt::Key_5 ); |
565 | defKeySym("6", Qt::Key_6 ); | 565 | defKeySym("6", Qt::Key_6 ); |
566 | defKeySym("7", Qt::Key_7 ); | 566 | defKeySym("7", Qt::Key_7 ); |
567 | defKeySym("8", Qt::Key_8 ); | 567 | defKeySym("8", Qt::Key_8 ); |
568 | defKeySym("9", Qt::Key_9 ); | 568 | defKeySym("9", Qt::Key_9 ); |
569 | defKeySym("Colon", Qt::Key_Colon ); | 569 | defKeySym("Colon", Qt::Key_Colon ); |
570 | defKeySym("Semicolon", Qt::Key_Semicolon ); | 570 | defKeySym("Semicolon", Qt::Key_Semicolon ); |
571 | defKeySym("Less", Qt::Key_Less ); | 571 | defKeySym("Less", Qt::Key_Less ); |
572 | defKeySym("Equal", Qt::Key_Equal ); | 572 | defKeySym("Equal", Qt::Key_Equal ); |
573 | defKeySym("Greater", Qt::Key_Greater ); | 573 | defKeySym("Greater", Qt::Key_Greater ); |
574 | defKeySym("Question", Qt::Key_Question ); | 574 | defKeySym("Question", Qt::Key_Question ); |
575 | defKeySym("At", Qt::Key_At ); | 575 | defKeySym("At", Qt::Key_At ); |
576 | defKeySym("A", Qt::Key_A ); | 576 | defKeySym("A", Qt::Key_A ); |
577 | defKeySym("B", Qt::Key_B ); | 577 | defKeySym("B", Qt::Key_B ); |
578 | defKeySym("C", Qt::Key_C ); | 578 | defKeySym("C", Qt::Key_C ); |
579 | defKeySym("D", Qt::Key_D ); | 579 | defKeySym("D", Qt::Key_D ); |
580 | defKeySym("E", Qt::Key_E ); | 580 | defKeySym("E", Qt::Key_E ); |
581 | defKeySym("F", Qt::Key_F ); | 581 | defKeySym("F", Qt::Key_F ); |
582 | defKeySym("G", Qt::Key_G ); | 582 | defKeySym("G", Qt::Key_G ); |
583 | defKeySym("H", Qt::Key_H ); | 583 | defKeySym("H", Qt::Key_H ); |
584 | defKeySym("I", Qt::Key_I ); | 584 | defKeySym("I", Qt::Key_I ); |
585 | defKeySym("J", Qt::Key_J ); | 585 | defKeySym("J", Qt::Key_J ); |
586 | defKeySym("K", Qt::Key_K ); | 586 | defKeySym("K", Qt::Key_K ); |
587 | defKeySym("L", Qt::Key_L ); | 587 | defKeySym("L", Qt::Key_L ); |
588 | defKeySym("M", Qt::Key_M ); | 588 | defKeySym("M", Qt::Key_M ); |
589 | defKeySym("N", Qt::Key_N ); | 589 | defKeySym("N", Qt::Key_N ); |
590 | defKeySym("O", Qt::Key_O ); | 590 | defKeySym("O", Qt::Key_O ); |
591 | defKeySym("P", Qt::Key_P ); | 591 | defKeySym("P", Qt::Key_P ); |
592 | defKeySym("Q", Qt::Key_Q ); | 592 | defKeySym("Q", Qt::Key_Q ); |
593 | defKeySym("R", Qt::Key_R ); | 593 | defKeySym("R", Qt::Key_R ); |
594 | defKeySym("S", Qt::Key_S ); | 594 | defKeySym("S", Qt::Key_S ); |
595 | defKeySym("T", Qt::Key_T ); | 595 | defKeySym("T", Qt::Key_T ); |
596 | defKeySym("U", Qt::Key_U ); | 596 | defKeySym("U", Qt::Key_U ); |
597 | defKeySym("V", Qt::Key_V ); | 597 | defKeySym("V", Qt::Key_V ); |
598 | defKeySym("W", Qt::Key_W ); | 598 | defKeySym("W", Qt::Key_W ); |
599 | defKeySym("X", Qt::Key_X ); | 599 | defKeySym("X", Qt::Key_X ); |
600 | defKeySym("Y", Qt::Key_Y ); | 600 | defKeySym("Y", Qt::Key_Y ); |
601 | defKeySym("Z", Qt::Key_Z ); | 601 | defKeySym("Z", Qt::Key_Z ); |
602 | defKeySym("BracketLeft", Qt::Key_BracketLeft ); | 602 | defKeySym("BracketLeft", Qt::Key_BracketLeft ); |
603 | defKeySym("Backslash", Qt::Key_Backslash ); | 603 | defKeySym("Backslash", Qt::Key_Backslash ); |
604 | defKeySym("BracketRight", Qt::Key_BracketRight); | 604 | defKeySym("BracketRight", Qt::Key_BracketRight); |
605 | defKeySym("AsciiCircum", Qt::Key_AsciiCircum ); | 605 | defKeySym("AsciiCircum", Qt::Key_AsciiCircum ); |
606 | defKeySym("Underscore", Qt::Key_Underscore ); | 606 | defKeySym("Underscore", Qt::Key_Underscore ); |
607 | defKeySym("QuoteLeft", Qt::Key_QuoteLeft ); | 607 | defKeySym("QuoteLeft", Qt::Key_QuoteLeft ); |
608 | defKeySym("BraceLeft", Qt::Key_BraceLeft ); | 608 | defKeySym("BraceLeft", Qt::Key_BraceLeft ); |
609 | defKeySym("Bar", Qt::Key_Bar ); | 609 | defKeySym("Bar", Qt::Key_Bar ); |
610 | defKeySym("BraceRight", Qt::Key_BraceRight ); | 610 | defKeySym("BraceRight", Qt::Key_BraceRight ); |
611 | defKeySym("AsciiTilde", Qt::Key_AsciiTilde ); | 611 | defKeySym("AsciiTilde", Qt::Key_AsciiTilde ); |
612 | } | 612 | } |
613 | 613 | ||
614 | KeyTransSymbols::KeyTransSymbols() | 614 | KeyTransSymbols::KeyTransSymbols() |
615 | { | 615 | { |
616 | defModSyms(); | 616 | defModSyms(); |
617 | defOprSyms(); | 617 | defOprSyms(); |
618 | defKeySyms(); | 618 | defKeySyms(); |
619 | } | 619 | } |
620 | 620 | ||
621 | // Global material ----------------------------------------------------------- | 621 | // Global material ----------------------------------------------------------- |
622 | 622 | ||
623 | static int keytab_serial = 0; //FIXME: remove,localize | 623 | static int keytab_serial = 0; //FIXME: remove,localize |
624 | 624 | ||
625 | static QIntDict<KeyTrans> * numb2keymap = 0L; | 625 | static QIntDict<KeyTrans> * numb2keymap = 0L; |
626 | static QDict<KeyTrans> * path2keymap = 0L; | 626 | static QDict<KeyTrans> * path2keymap = 0L; |
627 | 627 | ||
628 | KeyTrans* KeyTrans::find(int numb) | 628 | KeyTrans* KeyTrans::find(int numb) |
629 | { | 629 | { |
630 | loadAll(); | ||
631 | KeyTrans* res = numb2keymap->find(numb); | 630 | KeyTrans* res = numb2keymap->find(numb); |
632 | return res ? res : numb2keymap->find(0); | 631 | return res ? res : numb2keymap->find(0); |
633 | } | 632 | } |
634 | 633 | ||
635 | KeyTrans* KeyTrans::find(const char* path) | 634 | KeyTrans* KeyTrans::find(const char* path) |
636 | { | 635 | { |
637 | loadAll(); | ||
638 | KeyTrans* res = path2keymap->find(path); | 636 | KeyTrans* res = path2keymap->find(path); |
639 | return res ? res : numb2keymap->find(0); | 637 | return res ? res : numb2keymap->find(0); |
640 | } | 638 | } |
641 | 639 | ||
642 | int KeyTrans::count() | 640 | int KeyTrans::count() |
643 | { | 641 | { |
644 | loadAll(); | ||
645 | return numb2keymap->count(); | 642 | return numb2keymap->count(); |
646 | } | 643 | } |
647 | 644 | ||
648 | void KeyTrans::addKeyTrans() | 645 | void KeyTrans::addKeyTrans() |
649 | { | 646 | { |
650 | this->numb = keytab_serial ++; | 647 | this->numb = keytab_serial ++; |
651 | numb2keymap->insert(numb,this); | 648 | numb2keymap->insert(numb,this); |
652 | path2keymap->insert(path,this); | 649 | path2keymap->insert(path,this); |
653 | } | 650 | } |
654 | 651 | ||
655 | void KeyTrans::loadAll() | 652 | void KeyTrans::loadAll() |
656 | { | 653 | { |
657 | if (!numb2keymap) | 654 | if (!numb2keymap) |
658 | numb2keymap = new QIntDict<KeyTrans>; | 655 | numb2keymap = new QIntDict<KeyTrans>; |
659 | if (!path2keymap) | 656 | if (!path2keymap) |
660 | path2keymap = new QDict<KeyTrans>; | 657 | path2keymap = new QDict<KeyTrans>; |
661 | if (!syms) | 658 | if (!syms) |
662 | syms = new KeyTransSymbols; | 659 | syms = new KeyTransSymbols; |
663 | 660 | ||
664 | defaultKeyTrans()->addKeyTrans(); | 661 | defaultKeyTrans()->addKeyTrans(); |
665 | 662 | ||
666 | 663 | ||
667 | QString path = QPEApplication::qpeDir() + "etc/keytabs"; | 664 | QString path = QPEApplication::qpeDir() + "etc/keytabs"; |
668 | QDir dir(path); | 665 | QDir dir(path); |
669 | QStringList lst = dir.entryList("*.keytab"); | 666 | QStringList lst = dir.entryList("*.keytab"); |
670 | 667 | ||
671 | for(QStringList::Iterator it = lst.begin(); it != lst.end(); ++it ) { | 668 | for(QStringList::Iterator it = lst.begin(); it != lst.end(); ++it ) { |
672 | QFile file(path + "/" + *it); | 669 | QFile file(path + "/" + *it); |
673 | KeyTrans* sc = KeyTrans::fromDevice(*it, file); | 670 | KeyTrans* sc = KeyTrans::fromDevice(*it, file); |
674 | if (sc) { | 671 | if (sc) { |
675 | sc->addKeyTrans(); | 672 | sc->addKeyTrans(); |
676 | } | 673 | } |
677 | } | 674 | } |
678 | 675 | ||
679 | } | 676 | } |
680 | 677 | ||
681 | // Debugging material ----------------------------------------------------------- | 678 | // Debugging material ----------------------------------------------------------- |
682 | /* | 679 | /* |
683 | void TestTokenizer(QBuffer &buf) | 680 | void TestTokenizer(QBuffer &buf) |
684 | { | 681 | { |
685 | // opening sequence | 682 | // opening sequence |
686 | 683 | ||
687 | buf.open(IO_ReadOnly); | 684 | buf.open(IO_ReadOnly); |
688 | cc = buf.getch(); | 685 | cc = buf.getch(); |
689 | lineno = 1; | 686 | lineno = 1; |
690 | 687 | ||
691 | // Test tokenizer | 688 | // Test tokenizer |
692 | 689 | ||
693 | while (getSymbol(buf)) ReportToken(); | 690 | while (getSymbol(buf)) ReportToken(); |
694 | 691 | ||
695 | buf.close(); | 692 | buf.close(); |
696 | } | 693 | } |
697 | 694 | ||
698 | void test() | 695 | void test() |
699 | { | 696 | { |
700 | // Opening sequence | 697 | // Opening sequence |
701 | 698 | ||
702 | QCString txt = | 699 | QCString txt = |
703 | #include "default.keytab.h" | 700 | #include "default.keytab.h" |
704 | ; | 701 | ; |
705 | QBuffer buf(txt); | 702 | QBuffer buf(txt); |
706 | if (0) TestTokenizer(buf); | 703 | if (0) TestTokenizer(buf); |
707 | if (1) { KeyTrans kt; kt.scanTable(buf); } | 704 | if (1) { KeyTrans kt; kt.scanTable(buf); } |
708 | } | 705 | } |
709 | */ | 706 | */ |
diff --git a/noncore/apps/opie-console/mainwindow.cpp b/noncore/apps/opie-console/mainwindow.cpp index 1d7a4be..02f8451 100644 --- a/noncore/apps/opie-console/mainwindow.cpp +++ b/noncore/apps/opie-console/mainwindow.cpp | |||
@@ -1,215 +1,224 @@ | |||
1 | #include <assert.h> | ||
2 | |||
3 | |||
1 | 4 | ||
2 | #include <qaction.h> | 5 | #include <qaction.h> |
3 | #include <qmenubar.h> | 6 | #include <qmenubar.h> |
4 | #include <qlabel.h> | 7 | #include <qlabel.h> |
5 | #include <qpopupmenu.h> | 8 | #include <qpopupmenu.h> |
6 | #include <qtoolbar.h> | 9 | #include <qtoolbar.h> |
7 | #include <qpe/resource.h> | 10 | #include <qpe/resource.h> |
8 | #include <opie/ofiledialog.h> | 11 | #include <opie/ofiledialog.h> |
9 | #include <qmessagebox.h> | 12 | #include <qmessagebox.h> |
10 | 13 | ||
14 | #include "keytrans.h" | ||
11 | #include "profileeditordialog.h" | 15 | #include "profileeditordialog.h" |
12 | #include "configdialog.h" | 16 | #include "configdialog.h" |
13 | #include "default.h" | 17 | #include "default.h" |
14 | #include "metafactory.h" | 18 | #include "metafactory.h" |
15 | #include "profile.h" | 19 | #include "profile.h" |
16 | #include "profilemanager.h" | 20 | #include "profilemanager.h" |
17 | #include "mainwindow.h" | 21 | #include "mainwindow.h" |
18 | #include "tabwidget.h" | 22 | #include "tabwidget.h" |
19 | #include "transferdialog.h" | 23 | #include "transferdialog.h" |
20 | #include "function_keyboard.h" | 24 | #include "function_keyboard.h" |
21 | #include "script.h" | 25 | #include "script.h" |
22 | 26 | ||
23 | MainWindow::MainWindow() { | 27 | MainWindow::MainWindow() { |
28 | KeyTrans::loadAll(); | ||
29 | for (int i = 0; i < KeyTrans::count(); i++ ) { | ||
30 | KeyTrans* s = KeyTrans::find(i ); | ||
31 | assert( s ); | ||
32 | } | ||
24 | m_factory = new MetaFactory(); | 33 | m_factory = new MetaFactory(); |
25 | Default def(m_factory); | 34 | Default def(m_factory); |
26 | m_sessions.setAutoDelete( TRUE ); | 35 | m_sessions.setAutoDelete( TRUE ); |
27 | m_curSession = 0; | 36 | m_curSession = 0; |
28 | m_manager = new ProfileManager( m_factory ); | 37 | m_manager = new ProfileManager( m_factory ); |
29 | m_manager->load(); | 38 | m_manager->load(); |
30 | 39 | ||
31 | initUI(); | 40 | initUI(); |
32 | populateProfiles(); | 41 | populateProfiles(); |
33 | } | 42 | } |
34 | void MainWindow::initUI() { | 43 | void MainWindow::initUI() { |
35 | setToolBarsMovable( FALSE ); | 44 | setToolBarsMovable( FALSE ); |
36 | 45 | ||
37 | /* tool bar for the menu */ | 46 | /* tool bar for the menu */ |
38 | m_tool = new QToolBar( this ); | 47 | m_tool = new QToolBar( this ); |
39 | m_tool->setHorizontalStretchable( TRUE ); | 48 | m_tool->setHorizontalStretchable( TRUE ); |
40 | 49 | ||
41 | m_bar = new QMenuBar( m_tool ); | 50 | m_bar = new QMenuBar( m_tool ); |
42 | m_console = new QPopupMenu( this ); | 51 | m_console = new QPopupMenu( this ); |
43 | m_scripts = new QPopupMenu( this ); | 52 | m_scripts = new QPopupMenu( this ); |
44 | m_sessionsPop= new QPopupMenu( this ); | 53 | m_sessionsPop= new QPopupMenu( this ); |
45 | m_settings = new QPopupMenu( this ); | 54 | m_settings = new QPopupMenu( this ); |
46 | 55 | ||
47 | /* add a toolbar for icons */ | 56 | /* add a toolbar for icons */ |
48 | m_icons = new QToolBar(this); | 57 | m_icons = new QToolBar(this); |
49 | 58 | ||
50 | /* | 59 | /* |
51 | * new Action for new sessions | 60 | * new Action for new sessions |
52 | */ | 61 | */ |
53 | QAction* a = new QAction(tr("New Connection"), | 62 | QAction* a = new QAction(tr("New Connection"), |
54 | Resource::loadPixmap( "new" ), | 63 | Resource::loadPixmap( "new" ), |
55 | QString::null, 0, this, 0); | 64 | QString::null, 0, this, 0); |
56 | a->addTo( m_console ); | 65 | a->addTo( m_console ); |
57 | a->addTo( m_icons ); | 66 | a->addTo( m_icons ); |
58 | connect(a, SIGNAL(activated() ), | 67 | connect(a, SIGNAL(activated() ), |
59 | this, SLOT(slotNew() ) ); | 68 | this, SLOT(slotNew() ) ); |
60 | 69 | ||
61 | /* | 70 | /* |
62 | * connect action | 71 | * connect action |
63 | */ | 72 | */ |
64 | m_connect = new QAction(); | 73 | m_connect = new QAction(); |
65 | m_connect->setText( tr("Connect") ); | 74 | m_connect->setText( tr("Connect") ); |
66 | m_connect->addTo( m_console ); | 75 | m_connect->addTo( m_console ); |
67 | connect(m_connect, SIGNAL(activated() ), | 76 | connect(m_connect, SIGNAL(activated() ), |
68 | this, SLOT(slotConnect() ) ); | 77 | this, SLOT(slotConnect() ) ); |
69 | 78 | ||
70 | /* | 79 | /* |
71 | * disconnect action | 80 | * disconnect action |
72 | */ | 81 | */ |
73 | m_disconnect = new QAction(); | 82 | m_disconnect = new QAction(); |
74 | m_disconnect->setText( tr("Disconnect") ); | 83 | m_disconnect->setText( tr("Disconnect") ); |
75 | m_disconnect->addTo( m_console ); | 84 | m_disconnect->addTo( m_console ); |
76 | connect(m_disconnect, SIGNAL(activated() ), | 85 | connect(m_disconnect, SIGNAL(activated() ), |
77 | this, SLOT(slotDisconnect() ) ); | 86 | this, SLOT(slotDisconnect() ) ); |
78 | 87 | ||
79 | m_transfer = new QAction(); | 88 | m_transfer = new QAction(); |
80 | m_transfer->setText( tr("Transfer file...") ); | 89 | m_transfer->setText( tr("Transfer file...") ); |
81 | m_transfer->addTo( m_console ); | 90 | m_transfer->addTo( m_console ); |
82 | connect(m_transfer, SIGNAL(activated() ), | 91 | connect(m_transfer, SIGNAL(activated() ), |
83 | this, SLOT(slotTransfer() ) ); | 92 | this, SLOT(slotTransfer() ) ); |
84 | 93 | ||
85 | /* | 94 | /* |
86 | * terminate action | 95 | * terminate action |
87 | */ | 96 | */ |
88 | m_terminate = new QAction(); | 97 | m_terminate = new QAction(); |
89 | m_terminate->setText( tr("Terminate") ); | 98 | m_terminate->setText( tr("Terminate") ); |
90 | m_terminate->addTo( m_console ); | 99 | m_terminate->addTo( m_console ); |
91 | connect(m_terminate, SIGNAL(activated() ), | 100 | connect(m_terminate, SIGNAL(activated() ), |
92 | this, SLOT(slotTerminate() ) ); | 101 | this, SLOT(slotTerminate() ) ); |
93 | 102 | ||
94 | a = new QAction(); | 103 | a = new QAction(); |
95 | a->setText( tr("Close Window") ); | 104 | a->setText( tr("Close Window") ); |
96 | a->addTo( m_console ); | 105 | a->addTo( m_console ); |
97 | connect(a, SIGNAL(activated() ), | 106 | connect(a, SIGNAL(activated() ), |
98 | this, SLOT(slotClose() ) ); | 107 | this, SLOT(slotClose() ) ); |
99 | 108 | ||
100 | /* | 109 | /* |
101 | * the settings action | 110 | * the settings action |
102 | */ | 111 | */ |
103 | m_setProfiles = new QAction(tr("Configure Profiles"), | 112 | m_setProfiles = new QAction(tr("Configure Profiles"), |
104 | Resource::loadPixmap( "SettingsIcon" ), | 113 | Resource::loadPixmap( "SettingsIcon" ), |
105 | QString::null, 0, this, 0); | 114 | QString::null, 0, this, 0); |
106 | m_setProfiles->addTo( m_settings ); | 115 | m_setProfiles->addTo( m_settings ); |
107 | m_setProfiles->addTo( m_icons ); | 116 | m_setProfiles->addTo( m_icons ); |
108 | connect( m_setProfiles, SIGNAL(activated() ), | 117 | connect( m_setProfiles, SIGNAL(activated() ), |
109 | this, SLOT(slotConfigure() ) ); | 118 | this, SLOT(slotConfigure() ) ); |
110 | 119 | ||
111 | /* | 120 | /* |
112 | * script actions | 121 | * script actions |
113 | */ | 122 | */ |
114 | m_recordScript = new QAction(tr("Record Script"), QString::null, 0, this, 0); | 123 | m_recordScript = new QAction(tr("Record Script"), QString::null, 0, this, 0); |
115 | m_recordScript->addTo(m_scripts); | 124 | m_recordScript->addTo(m_scripts); |
116 | connect(m_recordScript, SIGNAL(activated()), this, SLOT(slotRecordScript())); | 125 | connect(m_recordScript, SIGNAL(activated()), this, SLOT(slotRecordScript())); |
117 | 126 | ||
118 | m_saveScript = new QAction(tr("Save Script"), QString::null, 0, this, 0); | 127 | m_saveScript = new QAction(tr("Save Script"), QString::null, 0, this, 0); |
119 | m_saveScript->addTo(m_scripts); | 128 | m_saveScript->addTo(m_scripts); |
120 | connect(m_saveScript, SIGNAL(activated()), this, SLOT(slotSaveScript())); | 129 | connect(m_saveScript, SIGNAL(activated()), this, SLOT(slotSaveScript())); |
121 | 130 | ||
122 | m_runScript = new QAction(tr("Run Script"), QString::null, 0, this, 0); | 131 | m_runScript = new QAction(tr("Run Script"), QString::null, 0, this, 0); |
123 | m_runScript->addTo(m_scripts); | 132 | m_runScript->addTo(m_scripts); |
124 | connect(m_runScript, SIGNAL(activated()), this, SLOT(slotRunScript())); | 133 | connect(m_runScript, SIGNAL(activated()), this, SLOT(slotRunScript())); |
125 | 134 | ||
126 | /* | 135 | /* |
127 | * action that open/closes the keyboard | 136 | * action that open/closes the keyboard |
128 | */ | 137 | */ |
129 | m_openKeys = new QAction (tr("Open Keyboard..."), | 138 | m_openKeys = new QAction (tr("Open Keyboard..."), |
130 | Resource::loadPixmap( "down" ), | 139 | Resource::loadPixmap( "down" ), |
131 | QString::null, 0, this, 0); | 140 | QString::null, 0, this, 0); |
132 | 141 | ||
133 | m_openKeys->setToggleAction(true); | 142 | m_openKeys->setToggleAction(true); |
134 | 143 | ||
135 | connect (m_openKeys, SIGNAL(toggled(bool)), | 144 | connect (m_openKeys, SIGNAL(toggled(bool)), |
136 | this, SLOT(slotOpenKeb(bool))); | 145 | this, SLOT(slotOpenKeb(bool))); |
137 | m_openKeys->addTo(m_icons); | 146 | m_openKeys->addTo(m_icons); |
138 | 147 | ||
139 | 148 | ||
140 | /* insert the submenu */ | 149 | /* insert the submenu */ |
141 | m_console->insertItem(tr("New from Profile"), m_sessionsPop, | 150 | m_console->insertItem(tr("New from Profile"), m_sessionsPop, |
142 | -1, 0); | 151 | -1, 0); |
143 | 152 | ||
144 | /* insert the connection menu */ | 153 | /* insert the connection menu */ |
145 | m_bar->insertItem( tr("Connection"), m_console ); | 154 | m_bar->insertItem( tr("Connection"), m_console ); |
146 | 155 | ||
147 | /* the scripts menu */ | 156 | /* the scripts menu */ |
148 | m_bar->insertItem( tr("Scripts"), m_scripts ); | 157 | m_bar->insertItem( tr("Scripts"), m_scripts ); |
149 | 158 | ||
150 | /* the settings menu */ | 159 | /* the settings menu */ |
151 | m_bar->insertItem( tr("Settings"), m_settings ); | 160 | m_bar->insertItem( tr("Settings"), m_settings ); |
152 | 161 | ||
153 | /* and the keyboard */ | 162 | /* and the keyboard */ |
154 | m_keyBar = new QToolBar(this); | 163 | m_keyBar = new QToolBar(this); |
155 | addToolBar( m_keyBar, "Keyboard", QMainWindow::Top, TRUE ); | 164 | addToolBar( m_keyBar, "Keyboard", QMainWindow::Top, TRUE ); |
156 | m_keyBar->setHorizontalStretchable( TRUE ); | 165 | m_keyBar->setHorizontalStretchable( TRUE ); |
157 | m_keyBar->hide(); | 166 | m_keyBar->hide(); |
158 | 167 | ||
159 | m_kb = new FunctionKeyboard(m_keyBar); | 168 | m_kb = new FunctionKeyboard(m_keyBar); |
160 | 169 | ||
161 | /* | 170 | /* |
162 | * connect to the menu activation | 171 | * connect to the menu activation |
163 | */ | 172 | */ |
164 | connect( m_sessionsPop, SIGNAL(activated( int ) ), | 173 | connect( m_sessionsPop, SIGNAL(activated( int ) ), |
165 | this, SLOT(slotProfile( int ) ) ); | 174 | this, SLOT(slotProfile( int ) ) ); |
166 | 175 | ||
167 | m_consoleWindow = new TabWidget( this, "blah"); | 176 | m_consoleWindow = new TabWidget( this, "blah"); |
168 | connect(m_consoleWindow, SIGNAL(activated(Session*) ), | 177 | connect(m_consoleWindow, SIGNAL(activated(Session*) ), |
169 | this, SLOT(slotSessionChanged(Session*) ) ); | 178 | this, SLOT(slotSessionChanged(Session*) ) ); |
170 | setCentralWidget( m_consoleWindow ); | 179 | setCentralWidget( m_consoleWindow ); |
171 | 180 | ||
172 | } | 181 | } |
173 | 182 | ||
174 | ProfileManager* MainWindow::manager() { | 183 | ProfileManager* MainWindow::manager() { |
175 | return m_manager; | 184 | return m_manager; |
176 | } | 185 | } |
177 | TabWidget* MainWindow::tabWidget() { | 186 | TabWidget* MainWindow::tabWidget() { |
178 | return m_consoleWindow; | 187 | return m_consoleWindow; |
179 | } | 188 | } |
180 | void MainWindow::populateProfiles() { | 189 | void MainWindow::populateProfiles() { |
181 | m_sessionsPop->clear(); | 190 | m_sessionsPop->clear(); |
182 | Profile::ValueList list = manager()->all(); | 191 | Profile::ValueList list = manager()->all(); |
183 | for (Profile::ValueList::Iterator it = list.begin(); it != list.end(); ++it ) { | 192 | for (Profile::ValueList::Iterator it = list.begin(); it != list.end(); ++it ) { |
184 | m_sessionsPop->insertItem( (*it).name() ); | 193 | m_sessionsPop->insertItem( (*it).name() ); |
185 | } | 194 | } |
186 | 195 | ||
187 | } | 196 | } |
188 | MainWindow::~MainWindow() { | 197 | MainWindow::~MainWindow() { |
189 | delete m_factory; | 198 | delete m_factory; |
190 | manager()->save(); | 199 | manager()->save(); |
191 | } | 200 | } |
192 | 201 | ||
193 | MetaFactory* MainWindow::factory() { | 202 | MetaFactory* MainWindow::factory() { |
194 | return m_factory; | 203 | return m_factory; |
195 | } | 204 | } |
196 | 205 | ||
197 | Session* MainWindow::currentSession() { | 206 | Session* MainWindow::currentSession() { |
198 | return m_curSession; | 207 | return m_curSession; |
199 | } | 208 | } |
200 | 209 | ||
201 | QList<Session> MainWindow::sessions() { | 210 | QList<Session> MainWindow::sessions() { |
202 | return m_sessions; | 211 | return m_sessions; |
203 | } | 212 | } |
204 | 213 | ||
205 | void MainWindow::slotNew() { | 214 | void MainWindow::slotNew() { |
206 | qWarning("New Connection"); | 215 | qWarning("New Connection"); |
207 | ProfileEditorDialog dlg(factory() ); | 216 | ProfileEditorDialog dlg(factory() ); |
208 | dlg.showMaximized(); | 217 | dlg.showMaximized(); |
209 | int ret = dlg.exec(); | 218 | int ret = dlg.exec(); |
210 | 219 | ||
211 | if ( ret == QDialog::Accepted ) { | 220 | if ( ret == QDialog::Accepted ) { |
212 | create( dlg.profile() ); | 221 | create( dlg.profile() ); |
213 | } | 222 | } |
214 | } | 223 | } |
215 | 224 | ||