author | wazlaf <wazlaf> | 2002-10-20 14:53:08 (UTC) |
---|---|---|
committer | wazlaf <wazlaf> | 2002-10-20 14:53:08 (UTC) |
commit | 18ba3be9ca69c42476e310649e3068d2d5f8a03b (patch) (side-by-side diff) | |
tree | d6a68e8f1a319ef8320d714356beebcf440a630f /noncore/apps/opie-console/emulation_handler.cpp | |
parent | 9f442f5af601d1e15bb4d0509ed012e61609260d (diff) | |
download | opie-18ba3be9ca69c42476e310649e3068d2d5f8a03b.zip opie-18ba3be9ca69c42476e310649e3068d2d5f8a03b.tar.gz opie-18ba3be9ca69c42476e310649e3068d2d5f8a03b.tar.bz2 |
scripting fixed (moved from emulation_layer to emulation_handler). Scripts now use QByteArray instead of QString
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 | 34 |
1 files changed, 33 insertions, 1 deletions
diff --git a/noncore/apps/opie-console/emulation_handler.cpp b/noncore/apps/opie-console/emulation_handler.cpp index 8846959..df8e573 100644 --- a/noncore/apps/opie-console/emulation_handler.cpp +++ b/noncore/apps/opie-console/emulation_handler.cpp @@ -6,13 +6,14 @@ #include "profile.h" #include "emulation_handler.h" - +#include "script.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 ); + m_script = 0; parent->resize( m_teWid->calcSize(80, 24 ) ); m_teEmu = new TEmuVt102(m_teWid ); @@ -28,9 +29,12 @@ EmulationHandler::EmulationHandler( const Profile& prof, QWidget* parent,const c } EmulationHandler::~EmulationHandler() { + if (isRecording()) + clearScript(); delete m_teEmu; delete m_teWid; } + void EmulationHandler::load( const Profile& prof) { m_teWid->setVTFont( font( prof.readNumEntry("Font") ) ); int num = prof.readNumEntry("Color"); @@ -45,6 +49,8 @@ void EmulationHandler::recvEmulation(const char* src, int len ) { memcpy(ar.data(), src, sizeof(char) * len ); + if (isRecording()) + m_script->append(ar); emit send(ar); } QWidget* EmulationHandler::widget() { @@ -145,3 +151,29 @@ QColor EmulationHandler::backColor(int col ) { QPushButton* EmulationHandler::cornerButton() { return m_teWid->cornerButton(); } + + +Script *EmulationHandler::script() { + return m_script; +} + +bool EmulationHandler::isRecording() { + return (m_script != 0); +} + +void EmulationHandler::startRecording() { + if (!isRecording()) + m_script = new Script(); +} + +void EmulationHandler::clearScript() { + if (isRecording()) { + delete m_script; + m_script = 0; + } +} + +void EmulationHandler::runScript(const Script *script) { + emit send(script->script()); +} + |