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();
00139
00143 int lineCount();
00144
00145
00154 void setHistory(const HistoryType&);
00156 const HistoryType& history();
00158 void clearHistory();
00159
00170 virtual void writeToStream(TerminalCharacterDecoder* decoder,int startLine,int endLine);
00171
00172
00174 const QTextCodec* codec() { return _codec; }
00176 void setCodec(const QTextCodec*);
00177
00183 bool utf8() { Q_ASSERT(_codec); return _codec->mibEnum() == 106; }
00184
00185
00187 virtual char getErase() const;
00188
00194 void setKeyBindings(const QString& name);
00199 QString keyBindings();
00200
00204 virtual void clearEntireScreen() =0;
00205
00207 virtual void reset() =0;
00208
00216 bool programUsesMouse() const;
00217
00218 public slots:
00219
00221 virtual void setImageSize(int lines, int columns);
00222
00227 virtual void sendText(const QString& text) = 0;
00228
00233 virtual void sendKeyEvent(QKeyEvent*);
00234
00239 virtual void sendMouseEvent(int buttons, int column, int line, int eventType);
00240
00248 virtual void sendString(const char* string, int length = -1) = 0;
00249
00262 void receiveData(const char* buffer,int len);
00263
00264 signals:
00265
00273 void sendData(const char* data,int len);
00274
00284 void lockPtyRequest(bool suspend);
00285
00292 void useUtf8Request(bool);
00293
00300 void stateSet(int state);
00301
00303 void zmodemDetected();
00304
00305
00314 void changeTabTextColorRequest(int color);
00315
00323 void programUsesMouseChanged(bool usesMouse);
00324
00337 void outputChanged();
00338
00371 void titleChanged(int title,const QString& newTitle);
00372
00377 void imageSizeChanged(int lineCount , int columnCount);
00378
00390 void profileChangeCommandReceived(const QString& text);
00391
00397 void flowControlKeyPressed(bool suspendKeyPressed);
00398
00399 protected:
00400 virtual void setMode (int mode) = 0;
00401 virtual void resetMode(int mode) = 0;
00402
00407 virtual void receiveChar(int ch);
00408
00416 void setScreen(int index);
00417
00418 enum EmulationCodec
00419 {
00420 LocaleCodec = 0,
00421 Utf8Codec = 1
00422 };
00423 void setCodec(EmulationCodec codec);
00424
00425
00426 QList<ScreenWindow*> _windows;
00427
00428 Screen* _currentScreen;
00429
00430
00431 Screen* _screen[2];
00432
00433
00434
00435
00436
00437
00438
00439 const QTextCodec* _codec;
00440 QTextDecoder* _decoder;
00441
00442 const KeyboardTranslator* _keyTranslator;
00443
00444 protected slots:
00450 void bufferedUpdate();
00451
00452 private slots:
00453
00454
00455
00456 void showBulk();
00457
00458 void usesMouseChanged(bool usesMouse);
00459
00460 private:
00461
00462 bool _usesMouse;
00463 QTimer _bulkTimer1;
00464 QTimer _bulkTimer2;
00465
00466 };
00467
00468 }
00469
00470 #endif // ifndef EMULATION_H