author | zecke <zecke> | 2002-10-14 18:13:20 (UTC) |
---|---|---|
committer | zecke <zecke> | 2002-10-14 18:13:20 (UTC) |
commit | e789f01a4fc6ada39809d40f8c44a6f6deec7785 (patch) (unidiff) | |
tree | fffa1e5394daf5f648f62aa331b4aa8a792ceba1 | |
parent | 3e92f4eba0510e7d3744f096a62eaa175b15c993 (diff) | |
download | opie-e789f01a4fc6ada39809d40f8c44a6f6deec7785.zip opie-e789f01a4fc6ada39809d40f8c44a6f6deec7785.tar.gz opie-e789f01a4fc6ada39809d40f8c44a6f6deec7785.tar.bz2 |
Make it work!
-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 | |||
@@ -582,111 +582,108 @@ void KeyTransSymbols::defKeySyms() | |||
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 | ||
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,71 +1,80 @@ | |||
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 |