Diffstat (limited to 'noncore/apps/opie-console/emulation_handler.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | noncore/apps/opie-console/emulation_handler.cpp | 41 |
1 files changed, 41 insertions, 0 deletions
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 @@ | |||
1 | #include <qwidget.h> | ||
2 | |||
3 | #include "TEWidget.h" | ||
4 | #include "TEmuVt102.h" | ||
5 | |||
6 | #include "emulation_handler.h" | ||
7 | |||
8 | |||
9 | EmulationHandler::EmulationHandler( const Profile& prof, QWidget* parent, const char* name ) | ||
10 | : QObject(0, name ) | ||
11 | { | ||
12 | load(prof ); | ||
13 | m_teWid = new TEWidget( parent, "TerminalMain" ); | ||
14 | parent->resize( m_teWid->calcSize(80, 24 ) ); | ||
15 | m_teEmu = new TEmuVt102(m_teWid ); | ||
16 | |||
17 | connect(m_teEmu,SIGNAL(ImageSizeChanged(int, int) ), | ||
18 | this, SIGNAL(changeSize(int, int) ) ); | ||
19 | connect(m_teEmu, SIGNAL(sndBlock(const char*, int) ), | ||
20 | this, SLOT(recvEmulation(const char*, int) ) ); | ||
21 | |||
22 | } | ||
23 | EmulationHandler::~EmulationHandler() { | ||
24 | delete m_teEmu; | ||
25 | delete m_teWid; | ||
26 | } | ||
27 | void EmulationHandler::load( const Profile& ) { | ||
28 | |||
29 | } | ||
30 | void EmulationHandler::recv( const QByteArray& ar) { | ||
31 | m_teEmu->onRcvBlock(ar.data(), ar.count() ); | ||
32 | } | ||
33 | void EmulationHandler::recvEmulation(const char* src, int len ) { | ||
34 | QByteArray ar(len); | ||
35 | memcpy(ar.data(), src, sizeof(char) * len ); | ||
36 | |||
37 | emit send(ar); | ||
38 | } | ||
39 | QWidget* EmulationHandler::widget() { | ||
40 | return m_teWid; | ||
41 | } | ||