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

Konsole

  • kde-4.14
  • 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  bool programBracketedPasteMode() const;
219 
220 public slots:
221 
223  virtual void setImageSize(int lines, int columns);
224 
229  virtual void sendText(const QString& text) = 0;
230 
235  virtual void sendKeyEvent(QKeyEvent*);
236 
241  virtual void sendMouseEvent(int buttons, int column, int line, int eventType);
242 
250  virtual void sendString(const char* string, int length = -1) = 0;
251 
264  void receiveData(const char* buffer, int len);
265 
266 signals:
267 
275  void sendData(const char* data, int len);
276 
283  void useUtf8Request(bool);
284 
291  void stateSet(int state);
292 
297  void zmodemDetected();
298 
299 
308  void changeTabTextColorRequest(int color);
309 
317  void programUsesMouseChanged(bool usesMouse);
318 
319  void programBracketedPasteModeChanged(bool bracketedPasteMode);
320 
333  void outputChanged();
334 
367  void titleChanged(int title, const QString& newTitle);
368 
372  void imageSizeChanged(int lineCount , int columnCount);
373 
378  void imageSizeInitialized();
379 
384  void imageResizeRequest(const QSize& sizz);
385 
397  void profileChangeCommandReceived(const QString& text);
398 
404  void flowControlKeyPressed(bool suspendKeyPressed);
405 
410  void primaryScreenInUse(bool use);
411 
415  void selectionChanged(const QString& text);
416 
417 protected:
418  virtual void setMode(int mode) = 0;
419  virtual void resetMode(int mode) = 0;
420 
425  virtual void receiveChar(int ch);
426 
434  void setScreen(int index);
435 
436  enum EmulationCodec {
437  LocaleCodec = 0,
438  Utf8Codec = 1
439  };
440 
441  void setCodec(EmulationCodec codec);
442 
443  QList<ScreenWindow*> _windows;
444 
445  Screen* _currentScreen; // pointer to the screen which is currently active,
446  // this is one of the elements in the screen[] array
447 
448  Screen* _screen[2]; // 0 = primary screen ( used by most programs, including the shell
449  // scrollbars are enabled in this mode )
450  // 1 = alternate ( used by vi , emacs etc.
451  // scrollbars are not enabled in this mode )
452 
453 
454  //decodes an incoming C-style character stream into a unicode QString using
455  //the current text codec. (this allows for rendering of non-ASCII characters in text files etc.)
456  const QTextCodec* _codec;
457  QTextDecoder* _decoder;
458  const KeyboardTranslator* _keyTranslator; // the keyboard layout
459 
460 protected slots:
466  void bufferedUpdate();
467 
468  // used to emit the primaryScreenInUse(bool) signal
469  void checkScreenInUse();
470 
471  // used to emit the selectionChanged(QString) signal
472  void checkSelectedText();
473 
474 private slots:
475  // triggered by timer, causes the emulation to send an updated screen image to each
476  // view
477  void showBulk();
478 
479  void usesMouseChanged(bool usesMouse);
480 
481  void bracketedPasteModeChanged(bool bracketedPasteMode);
482 
483 private:
484  bool _usesMouse;
485  bool _bracketedPasteMode;
486  QTimer _bulkTimer1;
487  QTimer _bulkTimer2;
488  bool _imageSizeInitialized;
489 };
490 }
491 
492 #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:445
konsole_export.h
Konsole::Emulation::_keyTranslator
const KeyboardTranslator * _keyTranslator
Definition: Emulation.h:458
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
QTimer
QObject
Konsole::Emulation::EmulationCodec
EmulationCodec
Definition: Emulation.h:436
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
QString
QList
QTextCodec
QSize
Konsole::Emulation::_codec
const QTextCodec * _codec
Definition: Emulation.h:456
Konsole::HistoryType
Definition: History.h:319
QKeyEvent
KONSOLEPRIVATE_EXPORT
#define KONSOLEPRIVATE_EXPORT
Definition: konsole_export.h:33
QTextDecoder
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:443
Konsole::Emulation::utf8
bool utf8() const
Convenience method.
Definition: Emulation.h:180
Konsole::Emulation::_decoder
QTextDecoder * _decoder
Definition: Emulation.h:457
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Sat May 9 2020 03:56:27 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
  • 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