GNU Octave 7.1.0
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
TerminalView.h
Go to the documentation of this file.
1/*
2 Copyright (C) 2007 by Robert Knight <robertknight@gmail.com>
3 Copyright (C) 1997,1998 by Lars Doelle <lars.doelle@on-line.de>
4
5 Rewritten for QT4 by e_k <e_k at users.sourceforge.net>, Copyright (C)2008
6 Copyright (C) 2012-2019 Jacob Dawid <jacob.dawid@cybercatalyst.com>
7
8 This program is free software: you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 2 of the License, or
11 (at your option) any later version.
12
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
17
18 You should have received a copy of the GNU General Public License
19 along with this program; if not, write to the Free Software
20 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
21 02110-1301 USA.
22*/
23
24#ifndef TERMINALVIEW_H
25#define TERMINALVIEW_H
26
27// Qt
28#include <QColor>
29#include <QtCore/QPointer>
30#include <QWidget>
31
32// Konsole
33#include "unix/Filter.h"
34#include "unix/Character.h"
35
36class QDrag;
37class QDragEnterEvent;
38class QDropEvent;
39class QLabel;
40class QTimer;
41class QEvent;
42class QFrame;
43class QGridLayout;
44class QKeyEvent;
45class QScrollBar;
46class QShowEvent;
47class QHideEvent;
48class QWidget;
49
50extern unsigned short vt100_graphics[32];
51
52class ScreenWindow;
53
54/**
55 * A widget which displays output from a terminal emulation and sends input keypresses and mouse activity
56 * to the terminal.
57 *
58 * When the terminal emulation receives new output from the program running in the terminal,
59 * it will update the display by calling updateImage().
60 *
61 * TODO More documentation
62 */
63class TerminalView : public QWidget
64{
65 Q_OBJECT
66
67public:
68 /** Constructs a new terminal display widget with the specified parent. */
69 TerminalView(QWidget *parent = nullptr);
70 virtual ~TerminalView();
71
72 /** Returns the terminal color palette used by the display. */
73 const ColorEntry* colorTable() const;
74 /** Sets the terminal color palette used by the display. */
75 void setColorTable(const ColorEntry table[]);
76 /**
77 * Sets the seed used to generate random colors for the display
78 * (in color schemes that support them).
79 */
80 void setRandomSeed(uint seed);
81 /**
82 * Returns the seed used to generate random colors for the display
83 * (in color schemes that support them).
84 */
85 uint randomSeed() const;
86
87
88 /**
89 * This enum describes the location where the scroll bar is positioned in the display widget.
90 */
92 {
93 /** Do not show the scroll bar. */
95 /** Show the scroll bar on the left side of the display. */
97 /** Show the scroll bar on the right side of the display. */
99 };
100 /**
101 * Specifies whether the terminal display has a vertical scroll bar, and if so whether it
102 * is shown on the left or right side of the display.
103 */
105
106 /**
107 * Sets the current position and range of the display's scroll bar.
108 *
109 * @param cursor The position of the scroll bar's thumb.
110 * @param lines The maximum value of the scroll bar.
111 */
112 void setScroll(int cursor, int lines);
113
114 /**
115 * Returns the display's filter chain. When the image for the display is updated,
116 * the text is passed through each filter in the chain. Each filter can define
117 * hotspots which correspond to certain strings (such as URLs or particular words).
118 * Depending on the type of the hotspots created by the filter ( returned by Filter::Hotspot::type() )
119 * the view will draw visual cues such as underlines on mouse-over for links or translucent
120 * rectangles for markers.
121 *
122 * To add a new filter to the view, call:
123 * viewWidget->filterChain()->addFilter( filterObject );
124 */
125 FilterChain* filterChain() const;
126
127 /**
128 * Returns a list of menu actions created by the filters for the content
129 * at the given @p position.
130 */
131 QList<QAction*> filterActions(const QPoint& position);
132
133 /** Returns true if the cursor is set to blink or false otherwise. */
135 /** Specifies whether or not the cursor blinks. */
136 void setBlinkingCursor(bool blink);
137 void setBlinkingCursorState(bool blink);
138
139 void setCtrlDrag(bool enable) { _ctrlDrag=enable; }
140 bool ctrlDrag() { return _ctrlDrag; }
141
142 /**
143 * This enum describes the methods for selecting text when
144 * the user triple-clicks within the display.
145 */
147 {
148 /** Select the whole line underneath the cursor. */
150 /** Select from the current cursor position to the end of the line. */
152 };
153 /** Sets how the text is selected when the user triple clicks within the display. */
155 /** See setTripleClickSelectionMode() */
157
158 void setLineSpacing(uint);
159 uint lineSpacing() const;
160
161 void emitSelection(bool useXselection,bool appendReturn);
162
163 /** change and wrap text corresponding to paste mode **/
164 void bracketText(QString& text);
165
166 /**
167 * This enum describes the available shapes for the keyboard cursor.
168 * See setKeyboardCursorShape()
169 */
171 {
172 /** A rectangular block which covers the entire area of the cursor character. */
174 /**
175 * A single flat line which occupies the space at the bottom of the cursor
176 * character's area.
177 */
179 /**
180 * An cursor shaped like the capital letter 'I', similar to the IBeam
181 * cursor used in Qt/KDE text editors.
182 */
184 };
185 /**
186 * Sets the shape of the keyboard cursor. This is the cursor drawn
187 * at the position in the terminal where keyboard input will appear.
188 *
189 * In addition the terminal display widget also has a cursor for
190 * the mouse pointer, which can be set using the QWidget::setCursor()
191 * method.
192 *
193 * Defaults to BlockCursor
194 */
196 /**
197 * Returns the shape of the keyboard cursor. See setKeyboardCursorShape()
198 */
200
201 /**
202 * Sets the color used to draw the keyboard cursor.
203 *
204 * The keyboard cursor defaults to using the foreground color of the character
205 * underneath it.
206 *
207 * @param useForegroundColor If true, the cursor color will change to match
208 * the foreground color of the character underneath it as it is moved, in this
209 * case, the @p color parameter is ignored and the color of the character
210 * under the cursor is inverted to ensure that it is still readable.
211 * @param color The color to use to draw the cursor. This is only taken into
212 * account if @p useForegroundColor is false.
213 */
214 void setKeyboardCursorColor(bool useForegroundColor , const QColor& color);
215
216 /**
217 * Returns the color of the keyboard cursor, or an invalid color if the keyboard
218 * cursor color is set to change according to the foreground color of the character
219 * underneath it.
220 */
221 QColor keyboardCursorColor() const;
222
223 /**
224 * Returns the number of lines of text which can be displayed in the widget.
225 *
226 * This will depend upon the height of the widget and the current font.
227 * See fontHeight()
228 */
229 int lines() { return _lines; }
230 /**
231 * Returns the number of characters of text which can be displayed on
232 * each line in the widget.
233 *
234 * This will depend upon the width of the widget and the current font.
235 * See fontWidth()
236 */
237 int columns() { return _columns; }
238
239 /**
240 * Returns the height of the characters in the font used to draw the text in the display.
241 */
242 int fontHeight() { return _fontHeight; }
243 /**
244 * Returns the width of the characters in the display.
245 * This assumes the use of a fixed-width font.
246 */
247 int fontWidth() { return _fontWidth; }
248
249 void setSize(int cols, int lins);
250 void setFixedSize(int cols, int lins);
251
252 // reimplemented
253 QSize sizeHint() const;
254
255 /**
256 * Sets which characters, in addition to letters and numbers,
257 * are regarded as being part of a word for the purposes
258 * of selecting words in the display by double clicking on them.
259 *
260 * The word boundaries occur at the first and last characters which
261 * are either a letter, number, or a character in @p wc
262 *
263 * @param wc An array of characters which are to be considered parts
264 * of a word ( in addition to letters and numbers ).
265 */
266 void setWordCharacters(const QString& wc);
267 /**
268 * Returns the characters which are considered part of a word for the
269 * purpose of selecting words in the display with the mouse.
270 *
271 * @see setWordCharacters()
272 */
273 QString wordCharacters() { return _wordCharacters; }
274
275 /**
276 * Sets the type of effect used to alert the user when a 'bell' occurs in the
277 * terminal session.
278 *
279 * The terminal session can trigger the bell effect by calling bell() with
280 * the alert message.
281 */
282 void setBellMode(int mode);
283 /**
284 * Returns the type of effect used to alert the user when a 'bell' occurs in
285 * the terminal session.
286 *
287 * See setBellMode()
288 */
289 int bellMode() { return _bellMode; }
290
291 /**
292 * This enum describes the different types of sounds and visual effects which
293 * can be used to alert the user when a 'bell' occurs in the terminal
294 * session.
295 */
297 {
298 /** A system beep. */
300 /**
301 * KDE notification. This may play a sound, show a passive popup
302 * or perform some other action depending on the user's settings.
303 */
305 /** A silent, visual bell (eg. inverting the display's colors briefly) */
307 /** No bell effects */
308 NoBell=3
309 };
310
311 void setSelection(const QString &t);
312
313 QString selectedText ();
314
315 /**
316 * Reimplemented. Has no effect. Use setVTFont() to change the font
317 * used to draw characters in the display.
318 */
319 virtual void setFont(const QFont &);
320
321
322 /** Returns the font used to draw characters in the display */
323 QFont getVTFont() { return font(); }
324
325 /**
326 * Sets the font used to draw the display. Has no effect if @p font
327 * is larger than the size of the display itself.
328 */
329 void setVTFont(const QFont& font);
330
331
332 /**
333 * Specified whether terminal widget should be at read-only mode
334 * Defaults to false.
335 */
336 void setReadOnly( bool readonly) { _readonly = readonly; }
337
338 /**
339 * Specified whether anti-aliasing of text in the terminal display
340 * is enabled or not. Defaults to enabled.
341 */
343 /**
344 * Returns true if anti-aliasing of text in the terminal is enabled.
345 */
346 static bool antialias() { return _antialiasText; }
347
348 /**
349 * Sets whether or not the current height and width of the
350 * terminal in lines and columns is displayed whilst the widget
351 * is being resized.
352 */
354 /**
355 * Returns whether or not the current height and width of
356 * the terminal in lines and columns is displayed whilst the widget
357 * is being resized.
358 */
360 /**
361 * Sets whether the terminal size display is shown briefly
362 * after the widget is first shown.
363 *
364 * See setTerminalSizeHint() , isTerminalSizeHint()
365 */
367
368 /**
369 * Sets the terminal screen section which is displayed in this widget.
370 * When updateImage() is called, the display fetches the latest character image from the
371 * the associated terminal screen window.
372 *
373 * In terms of the model-view paradigm, the ScreenWindow is the model which is rendered
374 * by the TerminalDisplay.
375 */
376 void setScreenWindow( ScreenWindow* window );
377 /** Returns the terminal screen section which is displayed in this widget. See setScreenWindow() */
378 ScreenWindow* screenWindow() const;
379
380 /** Is called, when the terminal's visibility has changed in order to
381 * stop orstart timers etc.
382 */
383 void visibility_changed (bool visible);
384
387
388public slots:
389
390 /**
391 * Updates the filters in the display's filter chain. This will cause
392 * the hotspots to be updated to match the current image.
393 *
394 * WARNING: This function can be expensive depending on the
395 * image size and number of filters in the filterChain()
396 *
397 * TODO - This API does not really allow efficient usage. Revise it so
398 * that the processing can be done in a better way.
399 *
400 * eg:
401 * - Area of interest may be known ( eg. mouse cursor hovering
402 * over an area )
403 */
404 void processFilters();
405
406 /**
407 * Causes the terminal display to fetch the latest character image from the associated
408 * terminal screen ( see setScreenWindow() ) and redraw the display.
409 */
410 void updateImage();
411 /**
412 * Causes the terminal display to fetch the latest line status flags from the
413 * associated terminal screen ( see setScreenWindow() ).
414 */
416
417 /** Copies the selected text to the clipboard. */
418 void copyClipboard (bool extra_interrupt);
419 /**
420 * Pastes the content of the clipboard into the
421 * display.
422 */
423 void pasteClipboard();
424 /**
425 * Pastes the content of the selection into the
426 * display.
427 */
428 void pasteSelection();
429
430 /**
431 * selects all content
432 */
433 void selectAll();
434
435 /**
436 * Causes the widget to display or hide a message informing the user that terminal
437 * output has been suspended (by using the flow control key combination Ctrl+S)
438 *
439 * @param suspended True if terminal output has been suspended and the warning message should
440 * be shown or false to indicate that terminal output has been resumed and that
441 * the warning message should disappear.
442 */
443 void outputSuspended(bool suspended);
444
445 /**
446 * Sets whether the program whoose output is being displayed in the view
447 * is interested in mouse events.
448 *
449 * If this is set to true, mouse signals will be emitted by the view when the user clicks, drags
450 * or otherwise moves the mouse inside the view.
451 * The user interaction needed to create selections will also change, and the user will be required
452 * to hold down the shift key to create a selection or perform other mouse activities inside the
453 * view area - since the program running in the terminal is being allowed to handle normal mouse
454 * events itself.
455 *
456 * @param usesMouse Set to true if the program running in the terminal is interested in mouse events
457 * or false otherwise.
458 */
459 void setUsesMouse(bool usesMouse);
460
461 /** See setUsesMouse() */
462 bool usesMouse() const;
463
465 bool bracketedPasteMode() const;
466
467signals:
468
469 void interrupt_signal (void);
470
471 /**
472 * Emitted when the user presses a key whilst the terminal widget has focus.
473 */
474 void keyPressedSignal(QKeyEvent *e);
475
476 /**
477 * A mouse event occurred.
478 * @param button The mouse button (0 for left button, 1 for middle button, 2 for right button, 3 for release)
479 * @param column The character column where the event occurred
480 * @param line The character row where the event occurred
481 * @param eventType The type of event. 0 for a mouse press / release or 1 for mouse motion
482 */
483 void mouseSignal(int button, int column, int line, int eventType);
484 void changedFontMetricSignal(int height, int width);
485 void changedContentSizeSignal(int height, int width);
486
487 /**
488 * Emitted when the user right clicks on the display, or right-clicks with the Shift
489 * key held down if usesMouse() is true.
490 *
491 * This can be used to display a context menu.
492 */
493 void configureRequest( TerminalView*, int state, const QPoint& position );
494
495 void isBusySelecting(bool);
496 void sendStringToEmu(const char*);
497
498 void tripleClicked( const QString& text );
499
500protected:
501 virtual void paintEvent( QPaintEvent * );
502
503 void focusInEvent(QFocusEvent *focusEvent);
504 void focusOutEvent(QFocusEvent *focusEvent);
505
506 virtual void showEvent(QShowEvent*);
507 virtual void hideEvent(QHideEvent*);
508 virtual void resizeEvent(QResizeEvent*);
509
510 virtual void fontChange(const QFont &font);
511
512 virtual void keyPressEvent(QKeyEvent* event);
513 virtual void mouseDoubleClickEvent(QMouseEvent* ev);
514 virtual void mousePressEvent( QMouseEvent* );
515 virtual void mouseReleaseEvent( QMouseEvent* );
516 virtual void mouseMoveEvent( QMouseEvent* );
517 virtual void extendSelection( const QPoint& pos );
518 virtual void wheelEvent( QWheelEvent* );
519
520 virtual bool focusNextPrevChild( bool next );
521
522 // drag and drop
523 virtual void dragEnterEvent(QDragEnterEvent* event);
524 virtual void dropEvent(QDropEvent* event);
525 void doDrag();
527
528 struct _dragInfo {
530 QPoint start;
533
534 virtual int charClass(quint16) const;
535
536 void clearImage();
537
538 void mouseTripleClickEvent(QMouseEvent* ev);
539
540 // reimplemented
541 virtual void inputMethodEvent ( QInputMethodEvent* event );
542 virtual QVariant inputMethodQuery( Qt::InputMethodQuery query ) const;
543
544protected slots:
545
546 void scrollBarPositionChanged(int value);
547 void blinkEvent();
548 void blinkCursorEvent();
549
550 //Renables bell noises and visuals. Used to disable further bells for a short period of time
551 //after emitting the first in a sequence of bell events.
552 void enableBell();
553
554private slots:
555
556 void swapColorTable();
557 void tripleClickTimeout(); // resets possibleTripleClick
558
559private:
560
561 // -- Drawing helpers --
562
563 // divides the part of the display specified by 'rect' into
564 // fragments according to their colors and styles and calls
565 // drawTextFragment() to draw the fragments
566 void drawContents(QPainter &paint, const QRect &rect);
567 // draws a section of text, all the text in this section
568 // has a common color and style
569 void drawTextFragment(QPainter& painter, const QRect& rect,
570 const QString& text, const Character* style);
571 // draws the background for a text fragment
572 // if useOpacitySetting is true then the color's alpha value will be set to
573 // the display's transparency (set with setOpacity()), otherwise the background
574 // will be drawn fully opaque
575 void drawBackground(QPainter& painter, const QRect& rect, const QColor& color);
576 // draws the cursor character
577 void drawCursor(QPainter& painter, const QRect& rect , const QColor& foregroundColor,
578 const QColor& backgroundColor , bool& invertColors);
579 // draws the characters or line graphics in a text fragment
580 void drawCharacters(QPainter& painter, const QRect& rect, const QString& text,
581 const Character* style, bool invertCharacterColor);
582
583 // draws the preedit string for input methods
584 void drawInputMethodPreeditString(QPainter& painter , const QRect& rect);
585
586 // --
587
588 // maps an area in the character image to an area on the widget
589 QRect imageToWidget(const QRect& imageArea) const;
590
591 // maps a point on the widget to the position ( ie. line and column )
592 // of the character at that point.
593 void getCharacterPosition(const QPoint& widgetPoint,int& line,int& column) const;
594
595 // the area where the preedit string for input methods will be draw
596 QRect preeditRect() const;
597
598 // shows a notification window in the middle of the widget indicating the terminal's
599 // current size in columns and lines
601
602 // scrolls the image by a number of lines.
603 // 'lines' may be positive ( to scroll the image down )
604 // or negative ( to scroll the image up )
605 // 'region' is the part of the image to scroll - currently only
606 // the top, bottom and height of 'region' are taken into account,
607 // the left and right are ignored.
608 void scrollImage(int lines , const QRect& region);
609
610 void calcGeometry();
611 void propagateSize();
612 void updateImageSize();
613 void makeImage();
614
615 void paintFilters(QPainter& painter);
616
617 // returns a region covering all of the areas of the widget which contain
618 // a hotspot
619 QRegion hotSpotRegion() const;
620
621 // returns the position of the cursor in columns and lines
622 QPoint cursorPosition() const;
623
624 // the window onto the terminal screen which this display
625 // is currently showing.
626 QPointer<ScreenWindow> _screenWindow;
627
629
630 QGridLayout* _gridLayout;
631
632 bool _fixedFont; // has fixed pitch
633
634 double _fontHeight; // height
635 double _fontWidth; // width
636 //type double to decrease rounding errors
637
638 int _fontAscent; // ascend
639
640 int _leftMargin; // offset
641 int _topMargin; // offset
642
643 int _lines; // the number of lines that can be displayed in the widget
644 int _columns; // the number of columns that can be displayed in the widget
645
646 int _usedLines; // the number of lines that are actually being used, this will be less
647 // than 'lines' if the character image provided with setImage() is smaller
648 // than the maximum image size which can be displayed
649
650 int _usedColumns; // the number of columns that are actually being used, this will be less
651 // than 'columns' if the character image provided with setImage() is smaller
652 // than the maximum image size which can be displayed
653
656 Character* _image; // [lines][columns]
657 // only the area [usedLines][usedColumns] in the image contains valid data
658
660 QVector<LineProperty> _lineProperties;
661
664
671
672 QPoint _iPntSel; // initial selection point
673 QPoint _pntSel; // current selection point
674 QPoint _tripleSelBegin; // help avoid flicker
675 int _actSel; // selection state
680
681 QClipboard* _clipboard;
682 QScrollBar* _scrollBar;
686
687 bool _blinking; // hide text in paintEvent
688 bool _hasBlinker; // has characters to blink
689 bool _cursorBlinking; // hide cursor in paintEvent
690 bool _hasBlinkingCursor; // has blinking cursor enabled
691 bool _ctrlDrag; // require Ctrl key for drag
693 bool _isFixedSize; //Columns / lines are locked.
694 QTimer* _blinkTimer; // active when hasBlinker
695 QTimer* _blinkCursorTimer; // active when hasBlinkingCursor
696 QTimer* _process_filter_timer; // active when visible, filter processing
697
698// KMenu* _drop;
699 QString _dropText;
701
702 bool _possibleTripleClick; // is set in mouseDoubleClickEvent and deleted
703 // after QApplication::doubleClickInterval() delay
704
705
708
710
711 //widgets related to the warning message that appears when the user presses Ctrl+S to suspend
712 //terminal output - informing them what has happened and how to resume output
714
716
717 bool _colorsInverted; // true during visual bell
718
719 QSize _size;
720
722
723 // list of filters currently applied to the display. used for links and
724 // search highlight
727
729
730 // custom cursor color. if this is invalid then the foreground
731 // color of the character under the cursor is used
733
734
736 {
739 };
741
742 static bool _antialiasText; // do we antialias or not
743
744 //the delay in milliseconds between redrawing blinking text
745 static const int BLINK_DELAY = 500;
746 static const int DEFAULT_LEFT_MARGIN = 2;
747 static const int DEFAULT_TOP_MARGIN = 2;
748
750};
751
752#endif // TERMINALVIEW_H
#define TABLE_COLORS
unsigned short vt100_graphics[32]
A single character in the terminal which consists of a unicode character value, foreground and backgr...
Definition: Character.h:56
An entry in a terminal display's color palette.
A chain which allows a group of filters to be processed as one.
Definition: Filter.h:362
Provides a window onto a section of a terminal screen.
Definition: ScreenWindow.h:52
A filter chain which processes character images from terminal displays.
Definition: Filter.h:396
A widget which displays output from a terminal emulation and sends input keypresses and mouse activit...
Definition: TerminalView.h:64
void selectAll()
selects all content
virtual void showEvent(QShowEvent *)
double _fontWidth
Definition: TerminalView.h:635
bool _flowControlWarningEnabled
Definition: TerminalView.h:709
QPoint _tripleSelBegin
Definition: TerminalView.h:674
FilterChain * filterChain() const
Returns the display's filter chain.
QGridLayout * _gridLayout
Definition: TerminalView.h:630
bool blinkingCursor()
Returns true if the cursor is set to blink or false otherwise.
Definition: TerminalView.h:134
uint randomSeed() const
Returns the seed used to generate random colors for the display (in color schemes that support them).
QRect preeditRect() const
virtual void inputMethodEvent(QInputMethodEvent *event)
bool _columnSelectionMode
Definition: TerminalView.h:679
void setWordCharacters(const QString &wc)
Sets which characters, in addition to letters and numbers, are regarded as being part of a word for t...
void processFilters()
Updates the filters in the display's filter chain.
static const int BLINK_DELAY
Definition: TerminalView.h:745
bool _colorsInverted
Definition: TerminalView.h:717
int fontHeight()
Returns the height of the characters in the font used to draw the text in the display.
Definition: TerminalView.h:242
void updateLineProperties()
Causes the terminal display to fetch the latest line status flags from the associated terminal screen...
virtual void extendSelection(const QPoint &pos)
void pasteClipboard()
Pastes the content of the clipboard into the display.
static const int DEFAULT_TOP_MARGIN
Definition: TerminalView.h:747
void sendStringToEmu(const char *)
virtual void resizeEvent(QResizeEvent *)
bool _wordSelectionMode
Definition: TerminalView.h:676
QVector< LineProperty > _lineProperties
Definition: TerminalView.h:660
void drawInputMethodPreeditString(QPainter &painter, const QRect &rect)
void drawBackground(QPainter &painter, const QRect &rect, const QColor &color)
void setTerminalSizeStartup(bool on)
Sets whether the terminal size display is shown briefly after the widget is first shown.
Definition: TerminalView.h:366
virtual void setFont(const QFont &)
Reimplemented.
void drawCursor(QPainter &painter, const QRect &rect, const QColor &foregroundColor, const QColor &backgroundColor, bool &invertColors)
void drawTextFragment(QPainter &painter, const QRect &rect, const QString &text, const Character *style)
int bellMode()
Returns the type of effect used to alert the user when a 'bell' occurs in the terminal session.
Definition: TerminalView.h:289
void getCharacterPosition(const QPoint &widgetPoint, int &line, int &column) const
virtual void hideEvent(QHideEvent *)
QTimer * _blinkCursorTimer
Definition: TerminalView.h:695
void setBellMode(int mode)
Sets the type of effect used to alert the user when a 'bell' occurs in the terminal session.
bool _bracketedPasteMode
Definition: TerminalView.h:669
void setUsesMouse(bool usesMouse)
Sets whether the program whoose output is being displayed in the view is interested in mouse events.
void changedFontMetricSignal(int height, int width)
virtual void mouseReleaseEvent(QMouseEvent *)
void scrollBarPositionChanged(int value)
static const int DEFAULT_LEFT_MARGIN
Definition: TerminalView.h:746
void setScroll(int cursor, int lines)
Sets the current position and range of the display's scroll bar.
void configureRequest(TerminalView *, int state, const QPoint &position)
Emitted when the user right clicks on the display, or right-clicks with the Shift key held down if us...
void setRandomSeed(uint seed)
Sets the seed used to generate random colors for the display (in color schemes that support them).
void isBusySelecting(bool)
void copyClipboard(bool extra_interrupt)
Copies the selected text to the clipboard.
void interrupt_signal(void)
QPoint cursorPosition() const
TripleClickMode
This enum describes the methods for selecting text when the user triple-clicks within the display.
Definition: TerminalView.h:147
@ SelectForwardsFromCursor
Select from the current cursor position to the end of the line.
Definition: TerminalView.h:151
@ SelectWholeLine
Select the whole line underneath the cursor.
Definition: TerminalView.h:149
void setColorTable(const ColorEntry table[])
Sets the terminal color palette used by the display.
QFont getVTFont()
Returns the font used to draw characters in the display.
Definition: TerminalView.h:323
void setScrollBarPosition(ScrollBarPosition position)
Specifies whether the terminal display has a vertical scroll bar, and if so whether it is shown on th...
QString wordCharacters()
Returns the characters which are considered part of a word for the purpose of selecting words in the ...
Definition: TerminalView.h:273
ScreenWindow * screenWindow() const
Returns the terminal screen section which is displayed in this widget.
void setKeyboardCursorShape(KeyboardCursorShape shape)
Sets the shape of the keyboard cursor.
bool _lineSelectionMode
Definition: TerminalView.h:677
Character * _image
Definition: TerminalView.h:656
static void setAntialias(bool antialias)
Specified whether anti-aliasing of text in the terminal display is enabled or not.
Definition: TerminalView.h:342
void focusInEvent(QFocusEvent *focusEvent)
QScrollBar * _scrollBar
Definition: TerminalView.h:682
QPointer< ScreenWindow > _screenWindow
Definition: TerminalView.h:626
TerminalImageFilterChain * _filterChain
Definition: TerminalView.h:725
virtual bool focusNextPrevChild(bool next)
void setScreenWindow(ScreenWindow *window)
Sets the terminal screen section which is displayed in this widget.
virtual int charClass(quint16) const
void setKeyboardCursorColor(bool useForegroundColor, const QColor &color)
Sets the color used to draw the keyboard cursor.
ColorEntry _colorTable[TABLE_COLORS]
Definition: TerminalView.h:662
bool _hasBlinkingCursor
Definition: TerminalView.h:690
TripleClickMode _tripleClickMode
Definition: TerminalView.h:692
bool _terminalSizeStartup
Definition: TerminalView.h:667
bool _preserveLineBreaks
Definition: TerminalView.h:678
void bracketText(QString &text)
change and wrap text corresponding to paste mode
void setVTFont(const QFont &font)
Sets the font used to draw the display.
QString selectedText()
QRect _mouseOverHotspotArea
Definition: TerminalView.h:726
QSize sizeHint() const
void updateImage()
Causes the terminal display to fetch the latest character image from the associated terminal screen (...
bool ctrlDrag()
Definition: TerminalView.h:140
int columns()
Returns the number of characters of text which can be displayed on each line in the widget.
Definition: TerminalView.h:237
virtual ~TerminalView()
void propagateSize()
void disableBracketedPasteMode(bool disable)
Definition: TerminalView.h:385
void blinkCursorEvent()
virtual void mouseMoveEvent(QMouseEvent *)
BellMode
This enum describes the different types of sounds and visual effects which can be used to alert the u...
Definition: TerminalView.h:297
@ VisualBell
A silent, visual bell (eg.
Definition: TerminalView.h:306
@ NotifyBell
KDE notification.
Definition: TerminalView.h:304
@ NoBell
No bell effects.
Definition: TerminalView.h:308
@ SystemBeepBell
A system beep.
Definition: TerminalView.h:299
InputMethodData _inputMethodData
Definition: TerminalView.h:740
void focusOutEvent(QFocusEvent *focusEvent)
void mouseSignal(int button, int column, int line, int eventType)
A mouse event occurred.
bool _cursorBlinking
Definition: TerminalView.h:689
void setReadOnly(bool readonly)
Specified whether terminal widget should be at read-only mode Defaults to false.
Definition: TerminalView.h:336
void setSelection(const QString &t)
void setBlinkingCursor(bool blink)
Specifies whether or not the cursor blinks.
void drawCharacters(QPainter &painter, const QRect &rect, const QString &text, const Character *style, bool invertCharacterColor)
bool usesMouse() const
See setUsesMouse()
virtual void mousePressEvent(QMouseEvent *)
KeyboardCursorShape _cursorShape
Definition: TerminalView.h:728
QTimer * _blinkTimer
Definition: TerminalView.h:694
virtual QVariant inputMethodQuery(Qt::InputMethodQuery query) const
virtual void mouseDoubleClickEvent(QMouseEvent *ev)
QClipboard * _clipboard
Definition: TerminalView.h:681
void paintFilters(QPainter &painter)
QList< QAction * > filterActions(const QPoint &position)
Returns a list of menu actions created by the filters for the content at the given position.
virtual void keyPressEvent(QKeyEvent *event)
void setTripleClickMode(TripleClickMode mode)
Sets how the text is selected when the user triple clicks within the display.
Definition: TerminalView.h:154
ScrollBarPosition
This enum describes the location where the scroll bar is positioned in the display widget.
Definition: TerminalView.h:92
@ ScrollBarLeft
Show the scroll bar on the left side of the display.
Definition: TerminalView.h:96
@ NoScrollBar
Do not show the scroll bar.
Definition: TerminalView.h:94
@ ScrollBarRight
Show the scroll bar on the right side of the display.
Definition: TerminalView.h:98
QPoint _pntSel
Definition: TerminalView.h:673
virtual void dropEvent(QDropEvent *event)
QRect imageToWidget(const QRect &imageArea) const
void updateImageSize()
virtual void dragEnterEvent(QDragEnterEvent *event)
void setFixedSize(int cols, int lins)
void setBlinkingCursorState(bool blink)
void setCtrlDrag(bool enable)
Definition: TerminalView.h:139
int lines()
Returns the number of lines of text which can be displayed in the widget.
Definition: TerminalView.h:229
virtual void fontChange(const QFont &font)
void tripleClickTimeout()
virtual void wheelEvent(QWheelEvent *)
QLabel * _outputSuspendedLabel
Definition: TerminalView.h:713
struct TerminalView::_dragInfo dragInfo
bool _terminalSizeHint
Definition: TerminalView.h:666
KeyboardCursorShape
This enum describes the available shapes for the keyboard cursor.
Definition: TerminalView.h:171
@ UnderlineCursor
A single flat line which occupies the space at the bottom of the cursor character's area.
Definition: TerminalView.h:178
@ IBeamCursor
An cursor shaped like the capital letter 'I', similar to the IBeam cursor used in Qt/KDE text editors...
Definition: TerminalView.h:183
@ BlockCursor
A rectangular block which covers the entire area of the cursor character.
Definition: TerminalView.h:173
QColor keyboardCursorColor() const
Returns the color of the keyboard cursor, or an invalid color if the keyboard cursor color is set to ...
KeyboardCursorShape keyboardCursorShape() const
Returns the shape of the keyboard cursor.
void setLineSpacing(uint)
QPoint _iPntSel
Definition: TerminalView.h:672
void outputSuspended(bool suspended)
Causes the widget to display or hide a message informing the user that terminal output has been suspe...
void swapColorTable()
double _fontHeight
Definition: TerminalView.h:634
bool _disabledBracketedPasteMode
Definition: TerminalView.h:670
const ColorEntry * colorTable() const
Returns the terminal color palette used by the display.
virtual void paintEvent(QPaintEvent *)
bool bracketedPasteMode() const
void pasteSelection()
Pastes the content of the selection into the display.
bool terminalSizeHint()
Returns whether or not the current height and width of the terminal in lines and columns is displayed...
Definition: TerminalView.h:359
void visibility_changed(bool visible)
Is called, when the terminal's visibility has changed in order to stop orstart timers etc.
void tripleClicked(const QString &text)
uint lineSpacing() const
QTimer * _resizeTimer
Definition: TerminalView.h:707
void setSize(int cols, int lins)
void showResizeNotification()
QRegion hotSpotRegion() const
int fontWidth()
Returns the width of the characters in the display.
Definition: TerminalView.h:247
QString _wordCharacters
Definition: TerminalView.h:684
ScrollBarPosition _scrollbarLocation
Definition: TerminalView.h:683
QString _dropText
Definition: TerminalView.h:699
TerminalView(QWidget *parent=nullptr)
Constructs a new terminal display widget with the specified parent.
void keyPressedSignal(QKeyEvent *e)
Emitted when the user presses a key whilst the terminal widget has focus.
TripleClickMode tripleClickMode()
See setTripleClickSelectionMode()
Definition: TerminalView.h:156
void setBracketedPasteMode(bool bracketedPasteMode)
QLabel * _resizeWidget
Definition: TerminalView.h:706
void changedContentSizeSignal(int height, int width)
void mouseTripleClickEvent(QMouseEvent *ev)
static bool _antialiasText
Definition: TerminalView.h:742
void emitSelection(bool useXselection, bool appendReturn)
void drawContents(QPainter &paint, const QRect &rect)
bool _possibleTripleClick
Definition: TerminalView.h:702
bool bracketedPasteModeIsDisabled() const
Definition: TerminalView.h:386
QTimer * _process_filter_timer
Definition: TerminalView.h:696
void scrollImage(int lines, const QRect &region)
void setTerminalSizeHint(bool on)
Sets whether or not the current height and width of the terminal in lines and columns is displayed wh...
Definition: TerminalView.h:353
static bool antialias()
Returns true if anti-aliasing of text in the terminal is enabled.
Definition: TerminalView.h:346
QColor _cursorColor
Definition: TerminalView.h:732
static uint32_t state[624]
Definition: randmtzig.cc:192
static uint32_t * next
Definition: randmtzig.cc:191