00001 /* -------------------------------------------------------------------------- */ 00002 /* */ 00003 /* [emulation.h] Fundamental Terminal Emulation */ 00004 /* */ 00005 /* -------------------------------------------------------------------------- */ 00006 /* */ 00007 /* Copyright (c) 1997,1998 by Lars Doelle <lars.doelle@on-line.de> */ 00008 /* */ 00009 /* This file is part of Konsole - an X terminal for KDE */ 00010 /* */ 00011 /* -------------------------------------------------------------------------- */ 00012 /* */ 00013 /* Ported Konsole to Qt/Embedded */ 00014 /* */ 00015 /* Copyright (C) 2000 by John Ryland <jryland@trolltech.com> */ 00016 /* */ 00017 /* -------------------------------------------------------------------------- */ 00018 00019 #ifndef EMULATION_H 00020 #define EMULATION_H 00021 00022 #include "TEWidget.h" 00023 #include "TEScreen.h" 00024 #include <qtimer.h> 00025 #include <stdio.h> 00026 #include <qtextcodec.h> 00027 #include <qtextstream.h> 00028 00029 #include "keytrans.h" 00030 00031 class TEmulation : public QObject 00032 { Q_OBJECT 00033 00034 public: 00035 00036 TEmulation(TEWidget* gui); 00037 ~TEmulation(); 00038 00039 public: 00040 virtual void setHistory(bool on); 00041 virtual bool history(); 00042 virtual void streamHistory( QTextStream* ); 00043 00044 public slots: // signals incoming from TEWidget 00045 00046 virtual void onImageSizeChange(int lines, int columns); 00047 virtual void onHistoryCursorChange(int cursor); 00048 virtual void onKeyPress(QKeyEvent*); 00049 00050 virtual void clearSelection(); 00051 virtual void onSelectionBegin(const int x, const int y); 00052 virtual void onSelectionExtend(const int x, const int y); 00053 virtual void setSelection(const BOOL preserve_line_breaks); 00054 00055 public slots: // signals incoming from data source 00056 00057 void onRcvBlock(const char* txt,int len); 00058 00059 signals: 00060 00061 void sndBlock(const char* txt,int len); 00062 void ImageSizeChanged(int lines, int columns); 00063 void changeColumns(int columns); 00064 void changeTitle(int arg, const char* str); 00065 00066 public: 00067 00068 virtual void onRcvChar(int); 00069 00070 virtual void setMode (int) = 0; 00071 virtual void resetMode(int) = 0; 00072 00073 virtual void sendString(const char*) = 0; 00074 00075 virtual void setConnect(bool r); 00076 void setColumns(int columns); 00077 00078 void setKeytrans(int no); 00079 void setKeytrans(const char * no); 00080 00081 00082 00083 protected: 00084 00085 TEWidget* gui; 00086 TEScreen* scr; // referes to one `screen' 00087 TEScreen* screen[2]; // 0 = primary, 1 = alternate 00088 void setScreen(int n); // set `scr' to `screen[n]' 00089 00090 bool connected; // communicate with widget 00091 00092 void setCodec(int c); // codec number, 0 = locale, 1=utf8 00093 00094 QTextCodec* codec; 00095 QTextCodec* localeCodec; 00096 QTextDecoder* decoder; 00097 00098 KeyTrans* keytrans; 00099 00100 // refreshing related material. 00101 // this is localized in the class. 00102 private slots: // triggered by timer 00103 00104 void showBulk(); 00105 00106 private: 00107 00108 void bulkNewline(); 00109 void bulkStart(); 00110 void bulkEnd(); 00111 00112 private: 00113 00114 QTimer bulk_timer; 00115 int bulk_nlcnt; // bulk newline counter 00116 char* SelectedText; 00117 int bulk_incnt; // bulk counter 00118 00119 00120 }; 00121 00122 #endif // ifndef EMULATION_H
1.4.2