From 3e92f4eba0510e7d3744f096a62eaa175b15c993 Mon Sep 17 00:00:00 2001 From: zecke Date: Mon, 14 Oct 2002 17:51:25 +0000 Subject: add the bridge --- (limited to 'noncore/apps') diff --git a/noncore/apps/opie-console/emulation_handler.cpp b/noncore/apps/opie-console/emulation_handler.cpp new file mode 100644 index 0000000..787de67 --- a/dev/null +++ b/noncore/apps/opie-console/emulation_handler.cpp @@ -0,0 +1,41 @@ +#include + +#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" ); + 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) ) ); + +} +EmulationHandler::~EmulationHandler() { + delete m_teEmu; + delete m_teWid; +} +void EmulationHandler::load( const Profile& ) { + +} +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/emulation_handler.h b/noncore/apps/opie-console/emulation_handler.h new file mode 100644 index 0000000..58b94bc --- a/dev/null +++ b/noncore/apps/opie-console/emulation_handler.h @@ -0,0 +1,62 @@ +#ifndef OPIE_EMULATION_HANDLER_H +#define OPIE_EMULATION_HANDLER_H + +#include +#include + +/* + * Badly ibotty lacks the time to finish + * his widget in time.. + * Never the less we've to have an EmulationWidget + * This is why I'm taking the inferior not cleaned + * up TE* KDE STUFF + */ + +/** + * This is the layer above the IOLayer* + * This nice QObject here will get stuff from + * got a slot and a signal + * the signal for data + * the slot for receiving + * it'll set up the widget internally + * and manage the communication between + * the pre QByteArray world! + */ +class Profile; +class QWidget; +class TEWidget; +class TEmulation; +class EmulationHandler : public QObject { + Q_OBJECT +public: + /** + * simple c'tor the parent of the TEWdiget + * and a name + * and a Profile + */ + EmulationHandler( const Profile&, QWidget* parent, const char* name = 0l ); + + /** + * delete all components + */ + ~EmulationHandler(); + + void load( const Profile& ); + QWidget* widget(); +signals: + void send( const QByteArray& ); + void changeSize(int rows, int cols ); + +public slots: + void recv( const QByteArray& ); + +private slots: + void recvEmulation( const char*, int len ); + +private: + TEWidget* m_teWid; + TEmulation* m_teEmu; + +}; + +#endif -- cgit v0.9.0.2