author | zecke <zecke> | 2002-10-14 18:13:20 (UTC) |
---|---|---|
committer | zecke <zecke> | 2002-10-14 18:13:20 (UTC) |
commit | e789f01a4fc6ada39809d40f8c44a6f6deec7785 (patch) (side-by-side diff) | |
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 | 11 | ||||
-rw-r--r-- | noncore/apps/opie-console/keytrans.cpp | 3 | ||||
-rw-r--r-- | noncore/apps/opie-console/mainwindow.cpp | 9 |
3 files changed, 18 insertions, 5 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 @@ #include <qwidget.h> #include "TEWidget.h" #include "TEmuVt102.h" #include "emulation_handler.h" EmulationHandler::EmulationHandler( const Profile& prof, QWidget* parent, const char* name ) : QObject(0, name ) { - load(prof ); m_teWid = new TEWidget( parent, "TerminalMain" ); + m_teWid->setMinimumSize(150, 70 ); parent->resize( m_teWid->calcSize(80, 24 ) ); m_teEmu = new TEmuVt102(m_teWid ); connect(m_teEmu,SIGNAL(ImageSizeChanged(int, int) ), this, SIGNAL(changeSize(int, int) ) ); connect(m_teEmu, SIGNAL(sndBlock(const char*, int) ), this, SLOT(recvEmulation(const char*, int) ) ); + m_teEmu->setConnect( true ); + load( prof ); + + } EmulationHandler::~EmulationHandler() { delete m_teEmu; delete m_teWid; } void EmulationHandler::load( const Profile& ) { - + QFont font = QFont("Fixed", 12, QFont::Normal ); + font.setFixedPitch(TRUE); + m_teWid->setVTFont( font ); + m_teWid->setBackgroundColor(Qt::black ); } void EmulationHandler::recv( const QByteArray& ar) { m_teEmu->onRcvBlock(ar.data(), ar.count() ); } void EmulationHandler::recvEmulation(const char* src, int len ) { QByteArray ar(len); memcpy(ar.data(), src, sizeof(char) * len ); emit send(ar); } QWidget* EmulationHandler::widget() { return m_teWid; } 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) { oprsyms.insert(key,(QObject*)(val+1)); } void KeyTransSymbols::defModSym(const char* key, int val) { modsyms.insert(key,(QObject*)(val+1)); } void KeyTransSymbols::defOprSyms() { // Modifier defOprSym("scrollLineUp", CMD_scrollLineUp ); defOprSym("scrollLineDown",CMD_scrollLineDown); defOprSym("scrollPageUp", CMD_scrollPageUp ); defOprSym("scrollPageDown",CMD_scrollPageDown); defOprSym("emitSelection", CMD_emitSelection ); defOprSym("prevSession", CMD_prevSession ); defOprSym("nextSession", CMD_nextSession ); } void KeyTransSymbols::defModSyms() { // Modifier defModSym("Shift", BITS_Shift ); defModSym("Control", BITS_Control ); defModSym("Alt", BITS_Alt ); // Modes defModSym("BsHack", BITS_BsHack ); // deprecated defModSym("Ansi", BITS_Ansi ); defModSym("NewLine", BITS_NewLine ); defModSym("AppCuKeys", BITS_AppCuKeys ); } void KeyTransSymbols::defKeySyms() { // Grey keys defKeySym("Escape", Qt::Key_Escape ); defKeySym("Tab", Qt::Key_Tab ); defKeySym("Backtab", Qt::Key_Backtab ); defKeySym("Backspace", Qt::Key_Backspace ); defKeySym("Return", Qt::Key_Return ); defKeySym("Enter", Qt::Key_Enter ); defKeySym("Insert", Qt::Key_Insert ); defKeySym("Delete", Qt::Key_Delete ); defKeySym("Pause", Qt::Key_Pause ); defKeySym("Print", Qt::Key_Print ); defKeySym("SysReq", Qt::Key_SysReq ); defKeySym("Home", Qt::Key_Home ); defKeySym("End", Qt::Key_End ); defKeySym("Left", Qt::Key_Left ); defKeySym("Up", Qt::Key_Up ); defKeySym("Right", Qt::Key_Right ); defKeySym("Down", Qt::Key_Down ); defKeySym("Prior", Qt::Key_Prior ); defKeySym("Next", Qt::Key_Next ); defKeySym("Shift", Qt::Key_Shift ); defKeySym("Control", Qt::Key_Control ); defKeySym("Meta", Qt::Key_Meta ); defKeySym("Alt", Qt::Key_Alt ); defKeySym("CapsLock", Qt::Key_CapsLock ); defKeySym("NumLock", Qt::Key_NumLock ); defKeySym("ScrollLock", Qt::Key_ScrollLock ); defKeySym("F1", Qt::Key_F1 ); defKeySym("F2", Qt::Key_F2 ); defKeySym("F3", Qt::Key_F3 ); defKeySym("F4", Qt::Key_F4 ); defKeySym("F5", Qt::Key_F5 ); defKeySym("F6", Qt::Key_F6 ); defKeySym("F7", Qt::Key_F7 ); defKeySym("F8", Qt::Key_F8 ); defKeySym("F9", Qt::Key_F9 ); defKeySym("F10", Qt::Key_F10 ); defKeySym("F11", Qt::Key_F11 ); defKeySym("F12", Qt::Key_F12 ); defKeySym("F13", Qt::Key_F13 ); defKeySym("F14", Qt::Key_F14 ); defKeySym("F15", Qt::Key_F15 ); defKeySym("F16", Qt::Key_F16 ); defKeySym("F17", Qt::Key_F17 ); defKeySym("F18", Qt::Key_F18 ); defKeySym("F19", Qt::Key_F19 ); defKeySym("F20", Qt::Key_F20 ); defKeySym("F21", Qt::Key_F21 ); defKeySym("F22", Qt::Key_F22 ); defKeySym("F23", Qt::Key_F23 ); defKeySym("F24", Qt::Key_F24 ); defKeySym("F25", Qt::Key_F25 ); defKeySym("F26", Qt::Key_F26 ); defKeySym("F27", Qt::Key_F27 ); defKeySym("F28", Qt::Key_F28 ); defKeySym("F29", Qt::Key_F29 ); defKeySym("F30", Qt::Key_F30 ); defKeySym("F31", Qt::Key_F31 ); defKeySym("F32", Qt::Key_F32 ); defKeySym("F33", Qt::Key_F33 ); defKeySym("F34", Qt::Key_F34 ); defKeySym("F35", Qt::Key_F35 ); defKeySym("Super_L", Qt::Key_Super_L ); defKeySym("Super_R", Qt::Key_Super_R ); defKeySym("Menu", Qt::Key_Menu ); defKeySym("Hyper_L", Qt::Key_Hyper_L ); defKeySym("Hyper_R", Qt::Key_Hyper_R ); // Regular keys defKeySym("Space", Qt::Key_Space ); defKeySym("Exclam", Qt::Key_Exclam ); defKeySym("QuoteDbl", Qt::Key_QuoteDbl ); defKeySym("NumberSign", Qt::Key_NumberSign ); defKeySym("Dollar", Qt::Key_Dollar ); defKeySym("Percent", Qt::Key_Percent ); defKeySym("Ampersand", Qt::Key_Ampersand ); defKeySym("Apostrophe", Qt::Key_Apostrophe ); defKeySym("ParenLeft", Qt::Key_ParenLeft ); defKeySym("ParenRight", Qt::Key_ParenRight ); defKeySym("Asterisk", Qt::Key_Asterisk ); defKeySym("Plus", Qt::Key_Plus ); defKeySym("Comma", Qt::Key_Comma ); defKeySym("Minus", Qt::Key_Minus ); defKeySym("Period", Qt::Key_Period ); defKeySym("Slash", Qt::Key_Slash ); defKeySym("0", Qt::Key_0 ); defKeySym("1", Qt::Key_1 ); defKeySym("2", Qt::Key_2 ); defKeySym("3", Qt::Key_3 ); defKeySym("4", Qt::Key_4 ); defKeySym("5", Qt::Key_5 ); defKeySym("6", Qt::Key_6 ); defKeySym("7", Qt::Key_7 ); defKeySym("8", Qt::Key_8 ); defKeySym("9", Qt::Key_9 ); defKeySym("Colon", Qt::Key_Colon ); defKeySym("Semicolon", Qt::Key_Semicolon ); defKeySym("Less", Qt::Key_Less ); defKeySym("Equal", Qt::Key_Equal ); defKeySym("Greater", Qt::Key_Greater ); defKeySym("Question", Qt::Key_Question ); defKeySym("At", Qt::Key_At ); defKeySym("A", Qt::Key_A ); defKeySym("B", Qt::Key_B ); defKeySym("C", Qt::Key_C ); defKeySym("D", Qt::Key_D ); defKeySym("E", Qt::Key_E ); defKeySym("F", Qt::Key_F ); defKeySym("G", Qt::Key_G ); defKeySym("H", Qt::Key_H ); defKeySym("I", Qt::Key_I ); defKeySym("J", Qt::Key_J ); defKeySym("K", Qt::Key_K ); defKeySym("L", Qt::Key_L ); defKeySym("M", Qt::Key_M ); defKeySym("N", Qt::Key_N ); defKeySym("O", Qt::Key_O ); defKeySym("P", Qt::Key_P ); defKeySym("Q", Qt::Key_Q ); defKeySym("R", Qt::Key_R ); defKeySym("S", Qt::Key_S ); defKeySym("T", Qt::Key_T ); defKeySym("U", Qt::Key_U ); defKeySym("V", Qt::Key_V ); defKeySym("W", Qt::Key_W ); defKeySym("X", Qt::Key_X ); defKeySym("Y", Qt::Key_Y ); defKeySym("Z", Qt::Key_Z ); defKeySym("BracketLeft", Qt::Key_BracketLeft ); defKeySym("Backslash", Qt::Key_Backslash ); defKeySym("BracketRight", Qt::Key_BracketRight); defKeySym("AsciiCircum", Qt::Key_AsciiCircum ); defKeySym("Underscore", Qt::Key_Underscore ); defKeySym("QuoteLeft", Qt::Key_QuoteLeft ); defKeySym("BraceLeft", Qt::Key_BraceLeft ); defKeySym("Bar", Qt::Key_Bar ); defKeySym("BraceRight", Qt::Key_BraceRight ); defKeySym("AsciiTilde", Qt::Key_AsciiTilde ); } KeyTransSymbols::KeyTransSymbols() { defModSyms(); defOprSyms(); defKeySyms(); } // Global material ----------------------------------------------------------- static int keytab_serial = 0; //FIXME: remove,localize static QIntDict<KeyTrans> * numb2keymap = 0L; static QDict<KeyTrans> * path2keymap = 0L; KeyTrans* KeyTrans::find(int numb) { - loadAll(); KeyTrans* res = numb2keymap->find(numb); return res ? res : numb2keymap->find(0); } KeyTrans* KeyTrans::find(const char* path) { - loadAll(); KeyTrans* res = path2keymap->find(path); return res ? res : numb2keymap->find(0); } int KeyTrans::count() { - loadAll(); return numb2keymap->count(); } void KeyTrans::addKeyTrans() { this->numb = keytab_serial ++; numb2keymap->insert(numb,this); path2keymap->insert(path,this); } void KeyTrans::loadAll() { if (!numb2keymap) numb2keymap = new QIntDict<KeyTrans>; if (!path2keymap) path2keymap = new QDict<KeyTrans>; if (!syms) syms = new KeyTransSymbols; defaultKeyTrans()->addKeyTrans(); QString path = QPEApplication::qpeDir() + "etc/keytabs"; QDir dir(path); QStringList lst = dir.entryList("*.keytab"); for(QStringList::Iterator it = lst.begin(); it != lst.end(); ++it ) { QFile file(path + "/" + *it); KeyTrans* sc = KeyTrans::fromDevice(*it, file); if (sc) { sc->addKeyTrans(); } } } // Debugging material ----------------------------------------------------------- /* void TestTokenizer(QBuffer &buf) { // opening sequence buf.open(IO_ReadOnly); cc = buf.getch(); lineno = 1; // Test tokenizer while (getSymbol(buf)) ReportToken(); buf.close(); } void test() { // Opening sequence QCString txt = #include "default.keytab.h" ; QBuffer buf(txt); if (0) TestTokenizer(buf); if (1) { KeyTrans kt; kt.scanTable(buf); } } */ 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 @@ +#include <assert.h> + + #include <qaction.h> #include <qmenubar.h> #include <qlabel.h> #include <qpopupmenu.h> #include <qtoolbar.h> #include <qpe/resource.h> #include <opie/ofiledialog.h> #include <qmessagebox.h> +#include "keytrans.h" #include "profileeditordialog.h" #include "configdialog.h" #include "default.h" #include "metafactory.h" #include "profile.h" #include "profilemanager.h" #include "mainwindow.h" #include "tabwidget.h" #include "transferdialog.h" #include "function_keyboard.h" #include "script.h" MainWindow::MainWindow() { + KeyTrans::loadAll(); + for (int i = 0; i < KeyTrans::count(); i++ ) { + KeyTrans* s = KeyTrans::find(i ); + assert( s ); + } m_factory = new MetaFactory(); Default def(m_factory); m_sessions.setAutoDelete( TRUE ); m_curSession = 0; m_manager = new ProfileManager( m_factory ); m_manager->load(); initUI(); populateProfiles(); } void MainWindow::initUI() { setToolBarsMovable( FALSE ); /* tool bar for the menu */ m_tool = new QToolBar( this ); m_tool->setHorizontalStretchable( TRUE ); m_bar = new QMenuBar( m_tool ); m_console = new QPopupMenu( this ); m_scripts = new QPopupMenu( this ); m_sessionsPop= new QPopupMenu( this ); m_settings = new QPopupMenu( this ); /* add a toolbar for icons */ m_icons = new QToolBar(this); /* * new Action for new sessions */ QAction* a = new QAction(tr("New Connection"), Resource::loadPixmap( "new" ), QString::null, 0, this, 0); a->addTo( m_console ); a->addTo( m_icons ); connect(a, SIGNAL(activated() ), this, SLOT(slotNew() ) ); /* * connect action */ m_connect = new QAction(); m_connect->setText( tr("Connect") ); m_connect->addTo( m_console ); connect(m_connect, SIGNAL(activated() ), this, SLOT(slotConnect() ) ); /* * disconnect action */ m_disconnect = new QAction(); m_disconnect->setText( tr("Disconnect") ); m_disconnect->addTo( m_console ); connect(m_disconnect, SIGNAL(activated() ), this, SLOT(slotDisconnect() ) ); m_transfer = new QAction(); m_transfer->setText( tr("Transfer file...") ); m_transfer->addTo( m_console ); connect(m_transfer, SIGNAL(activated() ), this, SLOT(slotTransfer() ) ); /* * terminate action */ m_terminate = new QAction(); m_terminate->setText( tr("Terminate") ); m_terminate->addTo( m_console ); connect(m_terminate, SIGNAL(activated() ), this, SLOT(slotTerminate() ) ); a = new QAction(); a->setText( tr("Close Window") ); a->addTo( m_console ); connect(a, SIGNAL(activated() ), this, SLOT(slotClose() ) ); /* * the settings action */ m_setProfiles = new QAction(tr("Configure Profiles"), Resource::loadPixmap( "SettingsIcon" ), QString::null, 0, this, 0); m_setProfiles->addTo( m_settings ); m_setProfiles->addTo( m_icons ); connect( m_setProfiles, SIGNAL(activated() ), this, SLOT(slotConfigure() ) ); /* * script actions */ m_recordScript = new QAction(tr("Record Script"), QString::null, 0, this, 0); m_recordScript->addTo(m_scripts); connect(m_recordScript, SIGNAL(activated()), this, SLOT(slotRecordScript())); m_saveScript = new QAction(tr("Save Script"), QString::null, 0, this, 0); m_saveScript->addTo(m_scripts); connect(m_saveScript, SIGNAL(activated()), this, SLOT(slotSaveScript())); m_runScript = new QAction(tr("Run Script"), QString::null, 0, this, 0); m_runScript->addTo(m_scripts); connect(m_runScript, SIGNAL(activated()), this, SLOT(slotRunScript())); /* * action that open/closes the keyboard */ m_openKeys = new QAction (tr("Open Keyboard..."), Resource::loadPixmap( "down" ), QString::null, 0, this, 0); m_openKeys->setToggleAction(true); connect (m_openKeys, SIGNAL(toggled(bool)), this, SLOT(slotOpenKeb(bool))); m_openKeys->addTo(m_icons); /* insert the submenu */ m_console->insertItem(tr("New from Profile"), m_sessionsPop, -1, 0); /* insert the connection menu */ m_bar->insertItem( tr("Connection"), m_console ); /* the scripts menu */ m_bar->insertItem( tr("Scripts"), m_scripts ); /* the settings menu */ m_bar->insertItem( tr("Settings"), m_settings ); /* and the keyboard */ m_keyBar = new QToolBar(this); addToolBar( m_keyBar, "Keyboard", QMainWindow::Top, TRUE ); m_keyBar->setHorizontalStretchable( TRUE ); m_keyBar->hide(); m_kb = new FunctionKeyboard(m_keyBar); /* * connect to the menu activation */ connect( m_sessionsPop, SIGNAL(activated( int ) ), this, SLOT(slotProfile( int ) ) ); m_consoleWindow = new TabWidget( this, "blah"); connect(m_consoleWindow, SIGNAL(activated(Session*) ), this, SLOT(slotSessionChanged(Session*) ) ); setCentralWidget( m_consoleWindow ); } ProfileManager* MainWindow::manager() { return m_manager; } TabWidget* MainWindow::tabWidget() { return m_consoleWindow; } void MainWindow::populateProfiles() { m_sessionsPop->clear(); Profile::ValueList list = manager()->all(); for (Profile::ValueList::Iterator it = list.begin(); it != list.end(); ++it ) { m_sessionsPop->insertItem( (*it).name() ); } } MainWindow::~MainWindow() { delete m_factory; manager()->save(); } MetaFactory* MainWindow::factory() { return m_factory; } Session* MainWindow::currentSession() { return m_curSession; } QList<Session> MainWindow::sessions() { return m_sessions; } void MainWindow::slotNew() { qWarning("New Connection"); ProfileEditorDialog dlg(factory() ); dlg.showMaximized(); int ret = dlg.exec(); if ( ret == QDialog::Accepted ) { create( dlg.profile() ); } } |