Diffstat (limited to 'noncore/apps/opie-console/emulation_handler.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | noncore/apps/opie-console/emulation_handler.cpp | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/noncore/apps/opie-console/emulation_handler.cpp b/noncore/apps/opie-console/emulation_handler.cpp index 956ac76..e045aef 100644 --- a/noncore/apps/opie-console/emulation_handler.cpp +++ b/noncore/apps/opie-console/emulation_handler.cpp @@ -3,7 +3,12 @@ #include "emulation_handler.h" #include "script.h" +#include "logger.h" /* OPIE */ #include <opie2/odebug.h> + +#include <qfile.h> +#include <qtextstream.h> + using namespace Opie::Core; @@ -17,4 +22,5 @@ EmulationHandler::EmulationHandler( const Profile& prof, QWidget* parent,const c m_teWid->setMinimumSize(150, 70 ); m_script = 0; + m_log = 0; parent->resize( m_teWid->calcSize(80, 24 ) ); m_teEmu = new TEmuVt102(m_teWid ); @@ -39,4 +45,5 @@ EmulationHandler::~EmulationHandler() { delete m_teEmu; delete m_teWid; + delete m_log; } @@ -69,5 +76,9 @@ void EmulationHandler::load( const Profile& prof) { void EmulationHandler::recv( const QByteArray& ar) { m_teEmu->onRcvBlock(ar.data(), ar.count() ); + if ( isLogging() ) { + m_log->append( ar ); } +} + void EmulationHandler::recvEmulation(const char* src, int len ) { QByteArray ar(len); @@ -78,4 +89,6 @@ void EmulationHandler::recvEmulation(const char* src, int len ) { emit send(ar); } + + QWidget* EmulationHandler::widget() { return m_teWid; @@ -185,4 +198,8 @@ bool EmulationHandler::isRecording() { } +bool EmulationHandler::isLogging() { + return (m_log != 0); +} + void EmulationHandler::startRecording() { if (!isRecording()) @@ -190,4 +207,14 @@ void EmulationHandler::startRecording() { } +void EmulationHandler::startLogging(const QString fileName) { + m_logFileName = fileName; + if (!isLogging()) + m_log = new Logger(m_logFileName); +} + +QString EmulationHandler::logFileName() { + return m_logFileName; +} + void EmulationHandler::clearScript() { if (isRecording()) { @@ -197,4 +224,11 @@ void EmulationHandler::clearScript() { } +void EmulationHandler::clearLog() { + if (isLogging()) { + delete m_log; + m_log = 0; + } +} + void EmulationHandler::runScript(const Script *script) { emit send(script->script()); |