summaryrefslogtreecommitdiff
path: root/noncore/apps/opie-console/emulation_handler.cpp
blob: 9e7f56cfa9d8d7b06d81b8d22475f63573a0034e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#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 )
{
    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 );
    m_teEmu->setHistory( 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::gray );
}
void EmulationHandler::recv( const QByteArray& ar) {
    qWarning("received in EmulationHandler!");
    m_teEmu->onRcvBlock(ar.data(), ar.count() );
}
void EmulationHandler::recvEmulation(const char* src, int len ) {
    qWarning("received from te ");
    QByteArray ar(len);

    memcpy(ar.data(), src, sizeof(char) * len );

    emit send(ar);
}
QWidget* EmulationHandler::widget() {
    return m_teWid;
}