Diffstat (limited to 'noncore/apps/opie-console/emulation_handler.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/apps/opie-console/emulation_handler.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/noncore/apps/opie-console/emulation_handler.cpp b/noncore/apps/opie-console/emulation_handler.cpp index 2c1d888..99d069f 100644 --- a/noncore/apps/opie-console/emulation_handler.cpp +++ b/noncore/apps/opie-console/emulation_handler.cpp | |||
@@ -1,87 +1,87 @@ | |||
1 | 1 | ||
2 | #include "TEmuVt102.h" | 2 | #include "TEmuVt102.h" |
3 | 3 | ||
4 | #include "profile.h" | 4 | #include "profile.h" |
5 | #include "emulation_handler.h" | 5 | #include "emulation_handler.h" |
6 | #include "script.h" | 6 | #include "script.h" |
7 | 7 | ||
8 | EmulationHandler::EmulationHandler( const Profile& prof, QWidget* parent,const char* name ) | 8 | EmulationHandler::EmulationHandler( const Profile& prof, QWidget* parent,const char* name ) |
9 | : QObject(0, name ) | 9 | : QObject(0, name ) |
10 | { | 10 | { |
11 | m_teWid = new TEWidget( parent, "TerminalMain"); | 11 | m_teWid = new TEWidget( parent, "TerminalMain"); |
12 | // use setWrapAt(0) for classic behaviour (wrap at screen width, no scrollbar) | 12 | // use setWrapAt(0) for classic behaviour (wrap at screen width, no scrollbar) |
13 | // use setWrapAt(80) for normal console with scrollbar | 13 | // use setWrapAt(80) for normal console with scrollbar |
14 | setWrap(prof.readNumEntry("Wrap", 0) ? 0 : 80); | 14 | setWrap(prof.readNumEntry("Wrap", 0) ? 0 : 80); |
15 | m_teWid->setMinimumSize(150, 70 ); | 15 | m_teWid->setMinimumSize(150, 70 ); |
16 | m_script = 0; | 16 | m_script = 0; |
17 | parent->resize( m_teWid->calcSize(80, 24 ) ); | 17 | parent->resize( m_teWid->calcSize(80, 24 ) ); |
18 | m_teEmu = new TEmuVt102(m_teWid ); | 18 | m_teEmu = new TEmuVt102(m_teWid ); |
19 | 19 | ||
20 | connect(m_teEmu,SIGNAL(ImageSizeChanged(int, int) ), | 20 | connect(m_teEmu,SIGNAL(ImageSizeChanged(int,int) ), |
21 | this, SIGNAL(changeSize(int, int) ) ); | 21 | this, SIGNAL(changeSize(int,int) ) ); |
22 | connect(m_teEmu, SIGNAL(sndBlock(const char*, int) ), | 22 | connect(m_teEmu, SIGNAL(sndBlock(const char*,int) ), |
23 | this, SLOT(recvEmulation(const char*, int) ) ); | 23 | this, SLOT(recvEmulation(const char*,int) ) ); |
24 | m_teEmu->setConnect( true ); | 24 | m_teEmu->setConnect( true ); |
25 | m_teEmu->setHistory( TRUE ); | 25 | m_teEmu->setHistory( TRUE ); |
26 | load( prof ); | 26 | load( prof ); |
27 | 27 | ||
28 | 28 | ||
29 | 29 | ||
30 | } | 30 | } |
31 | TEmulation* EmulationHandler::emulation() { | 31 | TEmulation* EmulationHandler::emulation() { |
32 | return m_teEmu; | 32 | return m_teEmu; |
33 | } | 33 | } |
34 | EmulationHandler::~EmulationHandler() { | 34 | EmulationHandler::~EmulationHandler() { |
35 | if (isRecording()) | 35 | if (isRecording()) |
36 | clearScript(); | 36 | clearScript(); |
37 | delete m_teEmu; | 37 | delete m_teEmu; |
38 | delete m_teWid; | 38 | delete m_teWid; |
39 | } | 39 | } |
40 | 40 | ||
41 | void EmulationHandler::load( const Profile& prof) { | 41 | void EmulationHandler::load( const Profile& prof) { |
42 | m_teWid->setVTFont( font( prof.readNumEntry("Font") ) ); | 42 | m_teWid->setVTFont( font( prof.readNumEntry("Font") ) ); |
43 | int num = prof.readNumEntry("Color"); | 43 | int num = prof.readNumEntry("Color"); |
44 | setColor( foreColor(num), backColor(num) ); | 44 | setColor( foreColor(num), backColor(num) ); |
45 | m_teWid->setBackgroundColor(backColor(num) ); | 45 | m_teWid->setBackgroundColor(backColor(num) ); |
46 | 46 | ||
47 | int term = prof.readNumEntry("Terminal", 0) ; | 47 | int term = prof.readNumEntry("Terminal", 0) ; |
48 | switch(term) { | 48 | switch(term) { |
49 | default: | 49 | default: |
50 | case Profile::VT102: | 50 | case Profile::VT102: |
51 | case Profile::VT100: | 51 | case Profile::VT100: |
52 | m_teEmu->setKeytrans("vt100.keytab"); | 52 | m_teEmu->setKeytrans("vt100.keytab"); |
53 | break; | 53 | break; |
54 | case Profile::Linux: | 54 | case Profile::Linux: |
55 | m_teEmu->setKeytrans("linux.keytab"); | 55 | m_teEmu->setKeytrans("linux.keytab"); |
56 | break; | 56 | break; |
57 | case Profile::XTerm: | 57 | case Profile::XTerm: |
58 | m_teEmu->setKeytrans("default.Keytab"); | 58 | m_teEmu->setKeytrans("default.Keytab"); |
59 | break; | 59 | break; |
60 | } | 60 | } |
61 | } | 61 | } |
62 | void EmulationHandler::recv( const QByteArray& ar) { | 62 | void EmulationHandler::recv( const QByteArray& ar) { |
63 | m_teEmu->onRcvBlock(ar.data(), ar.count() ); | 63 | m_teEmu->onRcvBlock(ar.data(), ar.count() ); |
64 | } | 64 | } |
65 | void EmulationHandler::recvEmulation(const char* src, int len ) { | 65 | void EmulationHandler::recvEmulation(const char* src, int len ) { |
66 | QByteArray ar(len); | 66 | QByteArray ar(len); |
67 | 67 | ||
68 | memcpy(ar.data(), src, sizeof(char) * len ); | 68 | memcpy(ar.data(), src, sizeof(char) * len ); |
69 | if (isRecording()) | 69 | if (isRecording()) |
70 | m_script->append(ar); | 70 | m_script->append(ar); |
71 | emit send(ar); | 71 | emit send(ar); |
72 | } | 72 | } |
73 | QWidget* EmulationHandler::widget() { | 73 | QWidget* EmulationHandler::widget() { |
74 | return m_teWid; | 74 | return m_teWid; |
75 | } | 75 | } |
76 | /* | 76 | /* |
77 | * allocate a new table of colors | 77 | * allocate a new table of colors |
78 | */ | 78 | */ |
79 | void EmulationHandler::setColor( const QColor& fore, const QColor& back ) { | 79 | void EmulationHandler::setColor( const QColor& fore, const QColor& back ) { |
80 | ColorEntry table[TABLE_COLORS]; | 80 | ColorEntry table[TABLE_COLORS]; |
81 | const ColorEntry *defaultCt = m_teWid->getdefaultColorTable(); | 81 | const ColorEntry *defaultCt = m_teWid->getdefaultColorTable(); |
82 | 82 | ||
83 | for (int i = 0; i < TABLE_COLORS; i++ ) { | 83 | for (int i = 0; i < TABLE_COLORS; i++ ) { |
84 | if ( i == 0 || i == 10 ) { | 84 | if ( i == 0 || i == 10 ) { |
85 | table[i].color = fore; | 85 | table[i].color = fore; |
86 | }else if ( i == 1 || i == 11 ) { | 86 | }else if ( i == 1 || i == 11 ) { |
87 | table[i].color = back; | 87 | table[i].color = back; |