00001
00002
00003
00004
00005
00006
00007
00008 #include "session.h"
00009
00010
00011 #include <stdlib.h>
00012
00013 #define HERE fprintf(stderr,"%s(%d): here\n",__FILE__,__LINE__)
00014
00025 TESession::TESession(QMainWindow* main, TEWidget* _te, const char* _pgm, QStrList & _args, const char *_term) : schema_no(0), font_no(3), pgm(_pgm), args(_args)
00026 {
00027 te = _te;
00028 term = _term;
00029
00030
00031 sh = new MyPty();
00032 em = new TEmuVt102(te);
00033
00034 sh->setSize(te->Lines(),te->Columns());
00035 QObject::connect( sh,SIGNAL(block_in(const char*,int)),
00036 em,SLOT(onRcvBlock(const char*,int)) );
00037 QObject::connect( em,SIGNAL(ImageSizeChanged(int,int)),
00038 sh,SLOT(setSize(int,int)));
00039
00040
00041
00042
00043
00044
00045
00046
00047 QObject::connect( em,SIGNAL(sndBlock(const char*,int)),
00048 sh,SLOT(send_bytes(const char*,int)) );
00049 QObject::connect( em,SIGNAL(changeColumns(int)),
00050 main,SLOT(changeColumns(int)) );
00051
00052
00053
00054 QObject::connect( em,SIGNAL(changeTitle(int,const QString&)),
00055 this,SLOT(changeTitle(int,const QString&)) );
00056
00057 QObject::connect( sh,SIGNAL(done(int)), this,SLOT(done(int)) );
00058 }
00059
00060
00061
00062 void TESession::run()
00063 {
00064
00065 sh->run(pgm,args,term.data(),FALSE);
00066 }
00067
00068 void TESession::kill(int )
00069 {
00070
00071 }
00072
00073 TESession::~TESession()
00074 {
00075 QObject::disconnect( sh, SIGNAL( done(int) ),
00076 this, SLOT( done(int) ) );
00077 delete em;
00078 delete sh;
00079 }
00080
00081 void TESession::setConnect(bool c)
00082 {
00083 em->setConnect(c);
00084 }
00085
00086 void TESession::done(int status)
00087 {
00088 emit done(te,status);
00089 }
00090
00091 void TESession::terminate()
00092 {
00093 delete this;
00094 }
00095
00096 TEmulation* TESession::getEmulation()
00097 {
00098 return em;
00099 }
00100
00101
00102
00103 int TESession::schemaNo()
00104 {
00105 return schema_no;
00106 }
00107
00108 int TESession::keymap()
00109 {
00110 return keymap_no;
00111 }
00112
00113 int TESession::fontNo()
00114 {
00115 return font_no;
00116 }
00117
00118 const char* TESession::emuName()
00119 {
00120 return term.data();
00121 }
00122
00123 void TESession::setSchemaNo(int sn)
00124 {
00125 schema_no = sn;
00126 }
00127
00128 void TESession::setKeymapNo(int kn)
00129 {
00130 keymap_no = kn;
00131 em->setKeytrans(kn);
00132 }
00133
00134 void TESession::setFontNo(int fn)
00135 {
00136 font_no = fn;
00137 }
00138
00139 void TESession::changeTitle(int, const QString& title)
00140 {
00141 this->title = title;
00142 emit changeTitle(te, title);
00143 }
00144
00145 const QString& TESession::Title()
00146 {
00147 return title;
00148 }
00149
00150 void TESession::setHistory(bool on)
00151 {
00152 em->setHistory( on );
00153 }
00154
00155 bool TESession::history()
00156 {
00157 return em->history();
00158 }
00159
00160