Konsole
Emulation.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 #ifndef EMULATION_H
00024 #define EMULATION_H
00025
00026
00027 #include <stdio.h>
00028
00029
00030 #include <QtGui/QKeyEvent>
00031
00032 #include <QtCore/QTextCodec>
00033 #include <QtCore/QTextStream>
00034 #include <QtCore/QTimer>
00035
00036
00037 namespace Konsole
00038 {
00039
00040 class KeyboardTranslator;
00041 class HistoryType;
00042 class Screen;
00043 class ScreenWindow;
00044 class TerminalCharacterDecoder;
00045
00052 enum
00053 {
00055 NOTIFYNORMAL=0,
00060 NOTIFYBELL=1,
00065 NOTIFYACTIVITY=2,
00066
00067
00068 NOTIFYSILENCE=3
00069 };
00070
00120 class Emulation : public QObject
00121 {
00122 Q_OBJECT
00123
00124 public:
00125
00127 Emulation();
00128 ~Emulation();
00129
00135 ScreenWindow* createWindow();
00136
00138 QSize imageSize() const;
00139
00143 int lineCount() const;
00144
00153 void setHistory(const HistoryType&);
00155 const HistoryType& history() const;
00157 void clearHistory();
00158
00169 virtual void writeToStream(TerminalCharacterDecoder* decoder,int startLine,int endLine);
00170
00172 const QTextCodec* codec() const { return _codec; }
00174 void setCodec(const QTextCodec*);
00175
00181 bool utf8() const
00182 { Q_ASSERT(_codec); return _codec->mibEnum() == 106; }
00183
00184
00186 virtual char eraseChar() const;
00187
00193 void setKeyBindings(const QString& name);
00198 QString keyBindings() const;
00199
00203 virtual void clearEntireScreen() =0;
00204
00206 virtual void reset() =0;
00207
00215 bool programUsesMouse() const;
00216
00217 public slots:
00218
00220 virtual void setImageSize(int lines, int columns);
00221
00226 virtual void sendText(const QString& text) = 0;
00227
00232 virtual void sendKeyEvent(QKeyEvent*);
00233
00238 virtual void sendMouseEvent(int buttons, int column, int line, int eventType);
00239
00247 virtual void sendString(const char* string, int length = -1) = 0;
00248
00261 void receiveData(const char* buffer,int len);
00262
00263 signals:
00264
00272 void sendData(const char* data,int len);
00273
00283 void lockPtyRequest(bool suspend);
00284
00291 void useUtf8Request(bool);
00292
00299 void stateSet(int state);
00300
00302 void zmodemDetected();
00303
00304
00313 void changeTabTextColorRequest(int color);
00314
00322 void programUsesMouseChanged(bool usesMouse);
00323
00336 void outputChanged();
00337
00370 void titleChanged(int title,const QString& newTitle);
00371
00376 void imageSizeChanged(int lineCount , int columnCount);
00377
00389 void profileChangeCommandReceived(const QString& text);
00390
00396 void flowControlKeyPressed(bool suspendKeyPressed);
00397
00398 protected:
00399 virtual void setMode(int mode) = 0;
00400 virtual void resetMode(int mode) = 0;
00401
00406 virtual void receiveChar(int ch);
00407
00415 void setScreen(int index);
00416
00417 enum EmulationCodec
00418 {
00419 LocaleCodec = 0,
00420 Utf8Codec = 1
00421 };
00422 void setCodec(EmulationCodec codec);
00423
00424
00425 QList<ScreenWindow*> _windows;
00426
00427 Screen* _currentScreen;
00428
00429
00430 Screen* _screen[2];
00431
00432
00433
00434
00435
00436
00437
00438 const QTextCodec* _codec;
00439 QTextDecoder* _decoder;
00440 const KeyboardTranslator* _keyTranslator;
00441
00442 protected slots:
00448 void bufferedUpdate();
00449
00450 private slots:
00451
00452
00453
00454 void showBulk();
00455
00456 void usesMouseChanged(bool usesMouse);
00457
00458 private:
00459 bool _usesMouse;
00460 QTimer _bulkTimer1;
00461 QTimer _bulkTimer2;
00462
00463 };
00464
00465 }
00466
00467 #endif // ifndef EMULATION_H