• Skip to content
  • Skip to link menu
KDE 4.1 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();
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); // codec number, 0 = locale, 1=utf8
00424 
00425 
00426   QList<ScreenWindow*> _windows;
00427   
00428   Screen* _currentScreen;  // pointer to the screen which is currently active, 
00429                             // this is one of the elements in the screen[] array
00430 
00431   Screen* _screen[2];      // 0 = primary screen ( used by most programs, including the shell
00432                             //                      scrollbars are enabled in this mode )
00433                             // 1 = alternate      ( used by vi , emacs etc.
00434                             //                      scrollbars are not enabled in this mode )
00435                             
00436   
00437   //decodes an incoming C-style character stream into a unicode QString using 
00438   //the current text codec.  (this allows for rendering of non-ASCII characters in text files etc.)
00439   const QTextCodec* _codec;
00440   QTextDecoder* _decoder;
00441 
00442   const KeyboardTranslator* _keyTranslator; // the keyboard layout
00443 
00444 protected slots:
00450   void bufferedUpdate();
00451 
00452 private slots: 
00453 
00454   // triggered by timer, causes the emulation to send an updated screen image to each
00455   // view
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

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.4
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