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 @@ -4,2 +4,3 @@ #include "script.h" +#include "logger.h" @@ -7,2 +8,6 @@ #include <opie2/odebug.h> + +#include <qfile.h> +#include <qtextstream.h> + using namespace Opie::Core; @@ -18,2 +23,3 @@ EmulationHandler::EmulationHandler( const Profile& prof, QWidget* parent,const c m_script = 0; + m_log = 0; parent->resize( m_teWid->calcSize(80, 24 ) ); @@ -40,2 +46,3 @@ EmulationHandler::~EmulationHandler() { delete m_teWid; + delete m_log; } @@ -70,3 +77,7 @@ 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 ) { @@ -79,2 +90,4 @@ void EmulationHandler::recvEmulation(const char* src, int len ) { } + + QWidget* EmulationHandler::widget() { @@ -186,2 +199,6 @@ bool EmulationHandler::isRecording() { +bool EmulationHandler::isLogging() { + return (m_log != 0); +} + void EmulationHandler::startRecording() { @@ -191,2 +208,12 @@ 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() { @@ -198,2 +225,9 @@ void EmulationHandler::clearScript() { +void EmulationHandler::clearLog() { + if (isLogging()) { + delete m_log; + m_log = 0; + } +} + void EmulationHandler::runScript(const Script *script) { |