• Skip to content
  • Skip to link menu
KDE 4.2 API Reference
  • KDE API Reference
  • API Reference
  • Sitemap
  • Contact Us
 

Konsole

Emulation.h

Go to the documentation of this file.
00001 /*
00002     This file is part of Konsole, an X terminal.
00003     
00004     Copyright 2007-2008 by Robert Knight <robertknight@gmail.com>
00005     Copyright 1997,1998 by Lars Doelle <lars.doelle@on-line.de>
00006 
00007     This program is free software; you can redistribute it and/or modify
00008     it under the terms of the GNU General Public License as published by
00009     the Free Software Foundation; either version 2 of the License, or
00010     (at your option) any later version.
00011 
00012     This program is distributed in the hope that it will be useful,
00013     but WITHOUT ANY WARRANTY; without even the implied warranty of
00014     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015     GNU General Public License for more details.
00016 
00017     You should have received a copy of the GNU General Public License
00018     along with this program; if not, write to the Free Software
00019     Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
00020     02110-1301  USA.
00021 */
00022 
00023 #ifndef EMULATION_H
00024 #define EMULATION_H
00025 
00026 // System
00027 #include <stdio.h>
00028 
00029 // Qt 
00030 #include <QtGui/QKeyEvent>
00031 //#include <QPointer>
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     // unused here? 
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); // codec number, 0 = locale, 1=utf8
00423 
00424 
00425   QList<ScreenWindow*> _windows;
00426   
00427   Screen* _currentScreen;  // pointer to the screen which is currently active, 
00428                             // this is one of the elements in the screen[] array
00429 
00430   Screen* _screen[2];      // 0 = primary screen ( used by most programs, including the shell
00431                             //                      scrollbars are enabled in this mode )
00432                             // 1 = alternate      ( used by vi , emacs etc.
00433                             //                      scrollbars are not enabled in this mode )
00434                             
00435   
00436   //decodes an incoming C-style character stream into a unicode QString using 
00437   //the current text codec.  (this allows for rendering of non-ASCII characters in text files etc.)
00438   const QTextCodec* _codec;
00439   QTextDecoder* _decoder;
00440   const KeyboardTranslator* _keyTranslator; // the keyboard layout
00441 
00442 protected slots:
00448   void bufferedUpdate();
00449 
00450 private slots: 
00451 
00452   // triggered by timer, causes the emulation to send an updated screen image to each
00453   // view
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

Konsole

Skip menu "Konsole"
  • Main Page
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members
  • Related Pages

API Reference

Skip menu "API Reference"
  • Konsole
  • Libraries
  •   libkonq
Generated for API Reference by doxygen 1.5.7
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal