summaryrefslogtreecommitdiff
path: root/noncore/apps/opie-console/emulation_handler.cpp
authorharlekin <harlekin>2004-10-08 20:03:40 (UTC)
committer harlekin <harlekin>2004-10-08 20:03:40 (UTC)
commit4e884ee63f16d1367ff7b854dbe5b50a6871c008 (patch) (side-by-side diff)
treefb9d9d13e9329e6ee9048bfc0e857d3918f4ecca /noncore/apps/opie-console/emulation_handler.cpp
parent51e49f0bd035545b983c799f7089de6b0ff2547e (diff)
downloadopie-4e884ee63f16d1367ff7b854dbe5b50a6871c008.zip
opie-4e884ee63f16d1367ff7b854dbe5b50a6871c008.tar.gz
opie-4e884ee63f16d1367ff7b854dbe5b50a6871c008.tar.bz2
added a 10east define for some changed builds for them, also added a logging mode, also some changes to the "fix broken distros" part, snapshot
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.cpp34
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
@@ -2,9 +2,14 @@
#include "profile.h"
#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;
EmulationHandler::EmulationHandler( const Profile& prof, QWidget* parent,const char* name )
@@ -16,6 +21,7 @@ EmulationHandler::EmulationHandler( const Profile& prof, QWidget* parent,const c
setWrap(prof.readNumEntry("Wrap", 80) ? 0 : 80);
m_teWid->setMinimumSize(150, 70 );
m_script = 0;
+ m_log = 0;
parent->resize( m_teWid->calcSize(80, 24 ) );
m_teEmu = new TEmuVt102(m_teWid );
@@ -38,6 +44,7 @@ EmulationHandler::~EmulationHandler() {
clearScript();
delete m_teEmu;
delete m_teWid;
+ delete m_log;
}
void EmulationHandler::load( const Profile& prof) {
@@ -68,7 +75,11 @@ 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);
@@ -77,6 +88,8 @@ void EmulationHandler::recvEmulation(const char* src, int len ) {
m_script->append(ar);
emit send(ar);
}
+
+
QWidget* EmulationHandler::widget() {
return m_teWid;
}
@@ -184,11 +197,25 @@ bool EmulationHandler::isRecording() {
return (m_script != 0);
}
+bool EmulationHandler::isLogging() {
+ return (m_log != 0);
+}
+
void EmulationHandler::startRecording() {
if (!isRecording())
m_script = new Script();
}
+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()) {
delete m_script;
@@ -196,6 +223,13 @@ void EmulationHandler::clearScript() {
}
}
+void EmulationHandler::clearLog() {
+ if (isLogging()) {
+ delete m_log;
+ m_log = 0;
+ }
+}
+
void EmulationHandler::runScript(const Script *script) {
emit send(script->script());
}