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 @@ -7,5 +7,5 @@ #include "profile.h" #include "emulation_handler.h" - +#include "script.h" EmulationHandler::EmulationHandler( const Profile& prof, QWidget* parent,const char* name ) @@ -14,4 +14,5 @@ EmulationHandler::EmulationHandler( const Profile& prof, QWidget* parent,const c 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 ); @@ -29,7 +30,10 @@ 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") ) ); @@ -46,4 +50,6 @@ void EmulationHandler::recvEmulation(const char* src, int len ) { memcpy(ar.data(), src, sizeof(char) * len ); + if (isRecording()) + m_script->append(ar); emit send(ar); } @@ -146,2 +152,28 @@ 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()); +} + |