• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • applications API Reference
  • KDE Home
  • Contact Us
 

Konsole

  • sources
  • kde-4.12
  • applications
  • konsole
  • src
Emulation.h
Go to the documentation of this file.
1 /*
2  This file is part of Konsole, an X terminal.
3 
4  Copyright 2007-2008 by Robert Knight <robertknight@gmail.com>
5  Copyright 1997,1998 by Lars Doelle <lars.doelle@on-line.de>
6 
7  This program is free software; you can redistribute it and/or modify
8  it under the terms of the GNU General Public License as published by
9  the Free Software Foundation; either version 2 of the License, or
10  (at your option) any later version.
11 
12  This program is distributed in the hope that it will be useful,
13  but WITHOUT ANY WARRANTY; without even the implied warranty of
14  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  GNU General Public License for more details.
16 
17  You should have received a copy of the GNU General Public License
18  along with this program; if not, write to the Free Software
19  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
20  02110-1301 USA.
21 */
22 
23 #ifndef EMULATION_H
24 #define EMULATION_H
25 
26 // Qt
27 #include <QtCore/QSize>
28 #include <QtCore/QTextCodec>
29 #include <QtCore/QTimer>
30 
31 // Konsole
32 #include "konsole_export.h"
33 
34 class QKeyEvent;
35 
36 namespace Konsole
37 {
38 class KeyboardTranslator;
39 class HistoryType;
40 class Screen;
41 class ScreenWindow;
42 class TerminalCharacterDecoder;
43 
50 enum {
52  NOTIFYNORMAL = 0,
57  NOTIFYBELL = 1,
62  NOTIFYACTIVITY = 2,
63 
64  // unused here?
65  NOTIFYSILENCE = 3
66 };
67 
117 class KONSOLEPRIVATE_EXPORT Emulation : public QObject
118 {
119  Q_OBJECT
120 
121 public:
123  Emulation();
124  ~Emulation();
125 
131  ScreenWindow* createWindow();
132 
134  QSize imageSize() const;
135 
139  int lineCount() const;
140 
149  void setHistory(const HistoryType&);
151  const HistoryType& history() const;
153  void clearHistory();
154 
166  virtual void writeToStream(TerminalCharacterDecoder* decoder, int startLine, int endLine);
167 
169  const QTextCodec* codec() const {
170  return _codec;
171  }
173  void setCodec(const QTextCodec*);
174 
180  bool utf8() const {
181  Q_ASSERT(_codec);
182  return _codec->mibEnum() == 106;
183  }
184 
185 
187  virtual char eraseChar() const;
188 
194  void setKeyBindings(const QString& name);
199  QString keyBindings() const;
200 
204  virtual void clearEntireScreen() = 0;
205 
207  virtual void reset() = 0;
208 
216  bool programUsesMouse() const;
217 
218 public slots:
219 
221  virtual void setImageSize(int lines, int columns);
222 
227  virtual void sendText(const QString& text) = 0;
228 
233  virtual void sendKeyEvent(QKeyEvent*);
234 
239  virtual void sendMouseEvent(int buttons, int column, int line, int eventType);
240 
248  virtual void sendString(const char* string, int length = -1) = 0;
249 
262  void receiveData(const char* buffer, int len);
263 
264 signals:
265 
273  void sendData(const char* data, int len);
274 
281  void useUtf8Request(bool);
282 
289  void stateSet(int state);
290 
295  void zmodemDetected();
296 
297 
306  void changeTabTextColorRequest(int color);
307 
315  void programUsesMouseChanged(bool usesMouse);
316 
329  void outputChanged();
330 
363  void titleChanged(int title, const QString& newTitle);
364 
368  void imageSizeChanged(int lineCount , int columnCount);
369 
374  void imageSizeInitialized();
375 
380  void imageResizeRequest(const QSize& sizz);
381 
393  void profileChangeCommandReceived(const QString& text);
394 
400  void flowControlKeyPressed(bool suspendKeyPressed);
401 
406  void primaryScreenInUse(bool use);
407 
411  void selectionChanged(const QString& text);
412 
413 protected:
414  virtual void setMode(int mode) = 0;
415  virtual void resetMode(int mode) = 0;
416 
421  virtual void receiveChar(int ch);
422 
430  void setScreen(int index);
431 
432  enum EmulationCodec {
433  LocaleCodec = 0,
434  Utf8Codec = 1
435  };
436 
437  void setCodec(EmulationCodec codec);
438 
439  QList<ScreenWindow*> _windows;
440 
441  Screen* _currentScreen; // pointer to the screen which is currently active,
442  // this is one of the elements in the screen[] array
443 
444  Screen* _screen[2]; // 0 = primary screen ( used by most programs, including the shell
445  // scrollbars are enabled in this mode )
446  // 1 = alternate ( used by vi , emacs etc.
447  // scrollbars are not enabled in this mode )
448 
449 
450  //decodes an incoming C-style character stream into a unicode QString using
451  //the current text codec. (this allows for rendering of non-ASCII characters in text files etc.)
452  const QTextCodec* _codec;
453  QTextDecoder* _decoder;
454  const KeyboardTranslator* _keyTranslator; // the keyboard layout
455 
456 protected slots:
462  void bufferedUpdate();
463 
464  // used to emit the primaryScreenInUse(bool) signal
465  void checkScreenInUse();
466 
467  // used to emit the selectionChanged(QString) signal
468  void checkSelectedText();
469 
470 private slots:
471  // triggered by timer, causes the emulation to send an updated screen image to each
472  // view
473  void showBulk();
474 
475  void usesMouseChanged(bool usesMouse);
476 
477 private:
478  bool _usesMouse;
479  QTimer _bulkTimer1;
480  QTimer _bulkTimer2;
481  bool _imageSizeInitialized;
482 };
483 }
484 
485 #endif // ifndef EMULATION_H
Konsole::NOTIFYSILENCE
Definition: Emulation.h:65
Konsole::KeyboardTranslator
A converter which maps between key sequences pressed by the user and the character strings which shou...
Definition: KeyboardTranslator.h:52
Konsole::Emulation::_currentScreen
Screen * _currentScreen
Definition: Emulation.h:441
konsole_export.h
QObject
Konsole::Emulation::_keyTranslator
const KeyboardTranslator * _keyTranslator
Definition: Emulation.h:454
Konsole::NOTIFYACTIVITY
The emulation is currently receiving data from its terminal input.
Definition: Emulation.h:62
Konsole::TerminalCharacterDecoder
Base class for terminal character decoders.
Definition: TerminalCharacterDecoder.h:45
Konsole::Emulation::EmulationCodec
EmulationCodec
Definition: Emulation.h:432
Konsole::ScreenWindow
Provides a window onto a section of a terminal screen.
Definition: ScreenWindow.h:52
Konsole::Screen
An image of characters with associated attributes.
Definition: Screen.h:74
Konsole::NOTIFYBELL
The terminal program has triggered a bell event to get the user's attention.
Definition: Emulation.h:57
Konsole::Emulation
Base class for terminal emulation back-ends.
Definition: Emulation.h:117
Konsole::NOTIFYNORMAL
The emulation is currently receiving user input.
Definition: Emulation.h:52
Konsole::Emulation::_codec
const QTextCodec * _codec
Definition: Emulation.h:452
Konsole::HistoryType
Definition: History.h:319
KONSOLEPRIVATE_EXPORT
#define KONSOLEPRIVATE_EXPORT
Definition: konsole_export.h:33
Konsole::Emulation::codec
const QTextCodec * codec() const
Returns the codec used to decode incoming characters.
Definition: Emulation.h:169
Konsole::Emulation::_windows
QList< ScreenWindow * > _windows
Definition: Emulation.h:439
Konsole::Emulation::utf8
bool utf8() const
Convenience method.
Definition: Emulation.h:180
Konsole::Emulation::_decoder
QTextDecoder * _decoder
Definition: Emulation.h:453
QList
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:31:24 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

Konsole

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

applications API Reference

Skip menu "applications API Reference"
  •   kate
  •       kate
  •   KTextEditor
  •   Kate
  • Applications
  •   Libraries
  •     libkonq
  • Konsole

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal