summaryrefslogtreecommitdiff
authorharlekin <harlekin>2004-04-22 19:42:52 (UTC)
committer harlekin <harlekin>2004-04-22 19:42:52 (UTC)
commit47d4d04c8b593d9d26c262add5b16d9ce3868866 (patch) (side-by-side diff)
treefed29f8c72cb345a770826a3ded7fc50a1311e20
parente9d1a3bf70b2f79f47a4d5ad826712aa5d654d8e (diff)
downloadopie-47d4d04c8b593d9d26c262add5b16d9ce3868866.zip
opie-47d4d04c8b593d9d26c262add5b16d9ce3868866.tar.gz
opie-47d4d04c8b593d9d26c262add5b16d9ce3868866.tar.bz2
set fixed
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/opie-console/emulation_handler.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/noncore/apps/opie-console/emulation_handler.cpp b/noncore/apps/opie-console/emulation_handler.cpp
index 1a0613f..c8022b9 100644
--- a/noncore/apps/opie-console/emulation_handler.cpp
+++ b/noncore/apps/opie-console/emulation_handler.cpp
@@ -1,94 +1,97 @@
#include "TEmuVt102.h"
#include "profile.h"
#include "emulation_handler.h"
#include "script.h"
/* OPIE */
#include <opie2/odebug.h>
using namespace Opie::Core;
EmulationHandler::EmulationHandler( const Profile& prof, QWidget* parent,const char* name )
: QObject(0, name )
{
m_teWid = new TEWidget( parent, "TerminalMain");
// use setWrapAt(0) for classic behaviour (wrap at screen width, no scrollbar)
// use setWrapAt(80) for normal console with scrollbar
setWrap(prof.readNumEntry("Wrap", 0) ? 0 : 80);
m_teWid->setMinimumSize(150, 70 );
m_script = 0;
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 );
}
TEmulation* EmulationHandler::emulation() {
return m_teEmu;
}
EmulationHandler::~EmulationHandler() {
if (isRecording())
clearScript();
delete m_teEmu;
delete m_teWid;
}
void EmulationHandler::load( const Profile& prof) {
// m_teWid->setVTFont( font( prof.readNumEntry("Font") ) );
- m_teWid->setVTFont( QFont( prof.readEntry("Font"), prof.readNumEntry( "FontSize" ), QFont::Normal ) );
+ QFont font( prof.readEntry("Font"), prof.readNumEntry( "FontSize" ), QFont::Normal );
+ font.setFixedPitch( TRUE );
+ m_teWid->setVTFont( font );
+
int num = prof.readNumEntry("Color");
setColor( foreColor(num), backColor(num) );
m_teWid->setBackgroundColor(backColor(num) );
int term = prof.readNumEntry("Terminal", 0) ;
switch(term) {
default:
case Profile::VT102:
case Profile::VT100:
m_teEmu->setKeytrans("vt100.keytab");
break;
case Profile::Linux:
m_teEmu->setKeytrans("linux.keytab");
break;
case Profile::XTerm:
m_teEmu->setKeytrans("default.Keytab");
break;
}
}
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 );
if (isRecording())
m_script->append(ar);
emit send(ar);
}
QWidget* EmulationHandler::widget() {
return m_teWid;
}
/*
* allocate a new table of colors
*/
void EmulationHandler::setColor( const QColor& fore, const QColor& back ) {
ColorEntry table[TABLE_COLORS];
const ColorEntry *defaultCt = m_teWid->getdefaultColorTable();
for (int i = 0; i < TABLE_COLORS; i++ ) {
if ( i == 0 || i == 10 ) {
table[i].color = fore;
}else if ( i == 1 || i == 11 ) {
table[i].color = back;
table[i].transparent = 0;
}else {
table[i].color = defaultCt[i].color;