~larryprice/acolyterm/release-0.1

« back to all changes in this revision

Viewing changes to src/plugin/konsole/TerminalDisplay.h

  • Committer: Larry Price
  • Date: 2016-06-15 14:47:59 UTC
  • Revision ID: larry.price@canonical.com-20160615144759-6wopn0gxwgta3x1n
Updating QMLTermWidget and removing unnecessary konsole codebase

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*
2
 
    This file is part of KTerminal, QML plugin of the Konsole,
3
 
    which is a terminal emulator from KDE.
4
 
 
5
 
    Copyright 2006-2008 by Robert Knight   <robertknight@gmail.com>
6
 
    Copyright 1997,1998 by Lars Doelle     <lars.doelle@on-line.de>
7
 
 
8
 
    Rewritten for QT5/QML by Dmitry Zagnoyko   <hiroshidi@gmail.com>, Copyright (C) 2013
9
 
 
10
 
    This program is free software; you can redistribute it and/or modify
11
 
    it under the terms of the GNU General Public License as published by
12
 
    the Free Software Foundation; either version 2 of the License, or
13
 
    (at your option) any later version.
14
 
 
15
 
    This program is distributed in the hope that it will be useful,
16
 
    but WITHOUT ANY WARRANTY; without even the implied warranty of
17
 
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18
 
    GNU General Public License for more details.
19
 
 
20
 
    You should have received a copy of the GNU General Public License
21
 
    along with this program; if not, write to the Free Software
22
 
    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
23
 
    02110-1301  USA.
24
 
*/
25
 
 
26
 
#ifndef TERMINALDISPLAY_H
27
 
#define TERMINALDISPLAY_H
28
 
 
29
 
#include <QtGui/QColor>
30
 
#include <QtCore/QPointer>
31
 
 
32
 
// Konsole
33
 
#include "Filter.h"
34
 
#include "Character.h"
35
 
#include "ksession.h"
36
 
//#include "konsole_export.h"
37
 
#define KONSOLEPRIVATE_EXPORT
38
 
 
39
 
#include <QtQuick/QQuickItem>
40
 
#include <QtQuick/QQuickPaintedItem>
41
 
 
42
 
class QTimer;
43
 
class QEvent;
44
 
class QKeyEvent;
45
 
class QTimerEvent;
46
 
//class KMenu;
47
 
 
48
 
extern unsigned short vt100_graphics[32];
49
 
 
50
 
class ScreenWindow;
51
 
 
52
 
/**
53
 
 * A widget which displays output from a terminal emulation and sends input keypresses and mouse activity
54
 
 * to the terminal.
55
 
 *
56
 
 * When the terminal emulation receives new output from the program running in the terminal,
57
 
 * it will update the display by calling updateImage().
58
 
 *
59
 
 * TODO More documentation
60
 
 */
61
 
 
62
 
class KONSOLEPRIVATE_EXPORT KTerminalDisplay : public QQuickPaintedItem
63
 
{
64
 
    Q_OBJECT
65
 
 
66
 
    Q_PROPERTY(KSession *session       READ getSession      WRITE setSession     NOTIFY changedSession)
67
 
    Q_PROPERTY(QString  colorScheme    READ scheme()        WRITE setColorScheme NOTIFY changedScheme)
68
 
    Q_PROPERTY(QFont    font           READ getVTFont       WRITE setVTFont )
69
 
    Q_PROPERTY(bool activeFocusOnClick READ autoFocus       WRITE setAutoFocus   NOTIFY changedAutoFocus)
70
 
    Q_PROPERTY(bool ShowIMEOnClick     READ autoVKB         WRITE setAutoVKB     NOTIFY changedAutoVKB)
71
 
 
72
 
 
73
 
public:
74
 
    KTerminalDisplay(QQuickItem *parent = 0);
75
 
    ~KTerminalDisplay();
76
 
 
77
 
    QString scheme() { return m_scheme; }
78
 
    /////////////////////////////////////////////////////////////////////////////////////
79
 
    /////////////////////////////////////////////////////////////////////////////////////
80
 
    /** Returns the terminal color palette used by the display. */
81
 
    const ColorEntry* colorTable() const;
82
 
    /** Sets the terminal color palette used by the display. */
83
 
    void setColorTable(const ColorEntry table[]);
84
 
    /**
85
 
     * Returns the seed used to generate random colors for the display
86
 
     * (in color schemes that support them).
87
 
     */
88
 
    uint randomSeed() const;
89
 
 
90
 
    /** Returns true if the cursor is set to blink or false otherwise. */
91
 
    bool blinkingCursor() { return _hasBlinkingCursor; }
92
 
    /** Specifies whether or not the cursor blinks. */
93
 
    void setBlinkingCursor(bool blink);
94
 
 
95
 
    /** Specifies whether or not text can blink. */
96
 
    void setBlinkingTextEnabled(bool blink);
97
 
 
98
 
    void setLineSpacing(uint);
99
 
    uint lineSpacing() const;
100
 
 
101
 
    void emitSelection(bool useXselection,bool appendReturn);
102
 
 
103
 
    /**
104
 
     * This enum describes the available shapes for the keyboard cursor.
105
 
     * See setKeyboardCursorShape()
106
 
     */
107
 
    enum KeyboardCursorShape
108
 
    {
109
 
        /** A rectangular block which covers the entire area of the cursor character. */
110
 
        BlockCursor,
111
 
        /**
112
 
         * A single flat line which occupies the space at the bottom of the cursor
113
 
         * character's area.
114
 
         */
115
 
        UnderlineCursor,
116
 
        /**
117
 
         * An cursor shaped like the capital letter 'I', similar to the IBeam
118
 
         * cursor used in Qt/KDE text editors.
119
 
         */
120
 
        IBeamCursor
121
 
    };
122
 
    /**
123
 
     * Sets the shape of the keyboard cursor.  This is the cursor drawn
124
 
     * at the position in the terminal where keyboard input will appear.
125
 
     *
126
 
     * In addition the terminal display widget also has a cursor for
127
 
     * the mouse pointer, which can be set using the QWidget::setCursor()
128
 
     * method.
129
 
     *
130
 
     * Defaults to BlockCursor
131
 
     */
132
 
    void setKeyboardCursorShape(KeyboardCursorShape shape);
133
 
    /**
134
 
     * Returns the shape of the keyboard cursor.  See setKeyboardCursorShape()
135
 
     */
136
 
    KeyboardCursorShape keyboardCursorShape() const;
137
 
 
138
 
    /**
139
 
     * Sets the color used to draw the keyboard cursor.
140
 
     *
141
 
     * The keyboard cursor defaults to using the foreground color of the character
142
 
     * underneath it.
143
 
     *
144
 
     * @param useForegroundColor If true, the cursor color will change to match
145
 
     * the foreground color of the character underneath it as it is moved, in this
146
 
     * case, the @p color parameter is ignored and the color of the character
147
 
     * under the cursor is inverted to ensure that it is still readable.
148
 
     * @param color The color to use to draw the cursor.  This is only taken into
149
 
     * account if @p useForegroundColor is false.
150
 
     */
151
 
    void setKeyboardCursorColor(bool useForegroundColor , const QColor& color);
152
 
 
153
 
    /**
154
 
     * Returns the color of the keyboard cursor, or an invalid color if the keyboard
155
 
     * cursor color is set to change according to the foreground color of the character
156
 
     * underneath it.
157
 
     */
158
 
    QColor keyboardCursorColor() const;
159
 
 
160
 
    // Show VKB
161
 
    void ShowVKB(bool show);
162
 
 
163
 
    /**
164
 
     * Returns the number of lines of text which can be displayed in the widget.
165
 
     *
166
 
     * This will depend upon the height of the widget and the current font.
167
 
     * See fontHeight()
168
 
     */
169
 
    int  lines()   { return _lines;   }
170
 
    /**
171
 
     * Returns the number of characters of text which can be displayed on
172
 
     * each line in the widget.
173
 
     *
174
 
     * This will depend upon the width of the widget and the current font.
175
 
     * See fontWidth()
176
 
     */
177
 
    int  columns() { return _columns; }
178
 
 
179
 
    /**
180
 
     * Returns the height of the characters in the font used to draw the text in the display.
181
 
     */
182
 
    int  fontHeight()   { return _fontHeight;   }
183
 
    /**
184
 
     * Returns the width of the characters in the display.
185
 
     * This assumes the use of a fixed-width font.
186
 
     */
187
 
    int  fontWidth()    { return _fontWidth; }
188
 
 
189
 
 
190
 
 
191
 
    /**
192
 
     * Sets which characters, in addition to letters and numbers,
193
 
     * are regarded as being part of a word for the purposes
194
 
     * of selecting words in the display by double clicking on them.
195
 
     *
196
 
     * The word boundaries occur at the first and last characters which
197
 
     * are either a letter, number, or a character in @p wc
198
 
     *
199
 
     * @param wc An array of characters which are to be considered parts
200
 
     * of a word ( in addition to letters and numbers ).
201
 
     */
202
 
    void setWordCharacters(const QString& wc);
203
 
    /**
204
 
     * Returns the characters which are considered part of a word for the
205
 
     * purpose of selecting words in the display with the mouse.
206
 
     *
207
 
     * @see setWordCharacters()
208
 
     */
209
 
    QString wordCharacters() { return _wordCharacters; }
210
 
 
211
 
    /**
212
 
     * Sets the type of effect used to alert the user when a 'bell' occurs in the
213
 
     * terminal session.
214
 
     *
215
 
     * The terminal session can trigger the bell effect by calling bell() with
216
 
     * the alert message.
217
 
     */
218
 
    void setBellMode(int mode);
219
 
    /**
220
 
     * Returns the type of effect used to alert the user when a 'bell' occurs in
221
 
     * the terminal session.
222
 
     *
223
 
     * See setBellMode()
224
 
     */
225
 
    int bellMode() { return _bellMode; }
226
 
 
227
 
    /**
228
 
     * This enum describes the different types of sounds and visual effects which
229
 
     * can be used to alert the user when a 'bell' occurs in the terminal
230
 
     * session.
231
 
     */
232
 
    enum BellMode
233
 
    {
234
 
        /** A system beep. */
235
 
        SystemBeepBell=0,
236
 
        /**
237
 
         * KDE notification.  This may play a sound, show a passive popup
238
 
         * or perform some other action depending on the user's settings.
239
 
         */
240
 
        NotifyBell=1,
241
 
        /** A silent, visual bell (eg. inverting the display's colors briefly) */
242
 
        VisualBell=2,
243
 
        /** No bell effects */
244
 
        NoBell=3
245
 
    };
246
 
 
247
 
    void setSelection(const QString &t);
248
 
 
249
 
    /**
250
 
     * Specified whether anti-aliasing of text in the terminal display
251
 
     * is enabled or not.  Defaults to enabled.
252
 
     */
253
 
    static void setAntialias( bool antialias ) { _antialiasText = antialias; }
254
 
    /**
255
 
     * Returns true if anti-aliasing of text in the terminal is enabled.
256
 
     */
257
 
    static bool antialias()                 { return _antialiasText;   }
258
 
 
259
 
    /**
260
 
     * Specifies whether characters with intense colors should be rendered
261
 
     * as bold. Defaults to true.
262
 
     */
263
 
    void setBoldIntense(bool value) { _boldIntense = value; }
264
 
    /**
265
 
     * Returns true if characters with intense colors are rendered in bold.
266
 
     */
267
 
    bool getBoldIntense() { return _boldIntense; }
268
 
 
269
 
    /**
270
 
     * Sets the status of the BiDi rendering inside the terminal display.
271
 
     * Defaults to disabled.
272
 
     */
273
 
    void setBidiEnabled(bool set) { _bidiEnabled=set; }
274
 
    /**
275
 
     * Returns the status of the BiDi rendering in this widget.
276
 
     */
277
 
    bool isBidiEnabled() { return _bidiEnabled; }
278
 
 
279
 
    /**
280
 
     * Sets the terminal screen section which is displayed in this widget.
281
 
     * When updateImage() is called, the display fetches the latest character image from the
282
 
     * the associated terminal screen window.
283
 
     *
284
 
     * In terms of the model-view paradigm, the ScreenWindow is the model which is rendered
285
 
     * by the TerminalDisplay.
286
 
     */
287
 
    void setScreenWindow( ScreenWindow* window );
288
 
    /** Returns the terminal screen section which is displayed in this widget.  See setScreenWindow() */
289
 
    ScreenWindow* screenWindow() const;
290
 
 
291
 
    static bool HAVE_TRANSPARENCY;
292
 
    /////////////////////////////////////////////////////////////////////////////////////
293
 
    /////////////////////////////////////////////////////////////////////////////////////
294
 
 
295
 
 
296
 
 
297
 
 
298
 
public slots:
299
 
    void forcedFocus();
300
 
    void setColorScheme(const QString &name);
301
 
    QStringList availableColorSchemes();
302
 
 
303
 
    void click(qreal x, qreal y);
304
 
 
305
 
    bool autoFocus() { return m_focusOnClick; }
306
 
    void setAutoFocus(bool au);
307
 
    bool autoVKB() { return m_showVKBonClick; }
308
 
    void setAutoVKB(bool au);
309
 
 
310
 
 
311
 
    /** Returns the font used to draw characters in the display */
312
 
    QFont getVTFont() { return m_font; }
313
 
 
314
 
    /**
315
 
     * Sets the font used to draw the display.  Has no effect if @p font
316
 
     * is larger than the size of the display itself.
317
 
     */
318
 
    void setVTFont(const QFont& font);
319
 
 
320
 
    /**
321
 
     * Scroll to the bottom of the terminal (reset scrolling).
322
 
     */
323
 
    void scrollToEnd();
324
 
 
325
 
    /////////////////////////////////////////////////////////////////////////////////////
326
 
    /////////////////////////////////////////////////////////////////////////////////////
327
 
    /**
328
 
     * Causes the terminal display to fetch the latest character image from the associated
329
 
     * terminal screen ( see setScreenWindow() ) and redraw the display.
330
 
     */
331
 
    void updateImage();
332
 
    /**
333
 
     * Causes the terminal display to fetch the latest line status flags from the
334
 
     * associated terminal screen ( see setScreenWindow() ).
335
 
     */
336
 
    void updateLineProperties();
337
 
 
338
 
    /** Copies the selected text to the clipboard. */
339
 
    void copyClipboard();
340
 
    /**
341
 
     * Pastes the content of the clipboard into the
342
 
     * display.
343
 
     */
344
 
    void pasteClipboard();
345
 
    /**
346
 
     * Pastes the content of the selection into the
347
 
     * display.
348
 
     */
349
 
    void pasteSelection();
350
 
 
351
 
    /**
352
 
       * Changes whether the flow control warning box should be shown when the flow control
353
 
       * stop key (Ctrl+S) are pressed.
354
 
       */
355
 
    void setFlowControlWarningEnabled(bool enabled);
356
 
    /**
357
 
     * Returns true if the flow control warning box is enabled.
358
 
     * See outputSuspended() and setFlowControlWarningEnabled()
359
 
     */
360
 
    bool flowControlWarningEnabled() const
361
 
    { return _flowControlWarningEnabled; }
362
 
 
363
 
    /**
364
 
     * Causes the widget to display or hide a message informing the user that terminal
365
 
     * output has been suspended (by using the flow control key combination Ctrl+S)
366
 
     *
367
 
     * @param suspended True if terminal output has been suspended and the warning message should
368
 
     *                     be shown or false to indicate that terminal output has been resumed and that
369
 
     *                     the warning message should disappear.
370
 
     */
371
 
    //void outputSuspended(bool suspended);
372
 
 
373
 
    /**
374
 
     * Shows a notification that a bell event has occurred in the terminal.
375
 
     * TODO: More documentation here
376
 
     */
377
 
    void bell(const QString& message);
378
 
 
379
 
    /**
380
 
     * Sets the background of the display to the specified color.
381
 
     * @see setColorTable(), setForegroundColor()
382
 
     */
383
 
    void setBackgroundColor(const QColor& color);
384
 
 
385
 
    /**
386
 
     * Sets the text of the display to the specified color.
387
 
     * @see setColorTable(), setBackgroundColor()
388
 
     */
389
 
    void setForegroundColor(const QColor& color);
390
 
 
391
 
    void selectionChanged();
392
 
    /////////////////////////////////////////////////////////////////////////////////////
393
 
    /////////////////////////////////////////////////////////////////////////////////////
394
 
 
395
 
    void setSession(KSession * session);
396
 
    KSession * getSession() const { return m_session; }
397
 
 
398
 
signals:
399
 
    void changedScheme(QString scheme);
400
 
    void changedAutoVKB(bool au);
401
 
    void changedAutoFocus(bool au);
402
 
 
403
 
    void clicked();
404
 
 
405
 
    /////////////////////////////////////////////////////////////////////////////////////
406
 
    /////////////////////////////////////////////////////////////////////////////////////
407
 
    /**
408
 
     * Emitted when the user presses a key whilst the terminal widget has focus.
409
 
     */
410
 
    void keyPressedSignal(QKeyEvent *e);
411
 
 
412
 
    void changedFontMetricSignal(int height, int width);
413
 
    void changedContentSizeSignal(int height, int width);
414
 
 
415
 
    /**
416
 
     * Emitted when the user right clicks on the display, or right-clicks with the Shift
417
 
     * key held down if usesMouse() is true.
418
 
     *
419
 
     * This can be used to display a context menu.
420
 
     */
421
 
    void configureRequest(const QPoint& position);
422
 
 
423
 
    /**
424
 
     * When a shortcut which is also a valid terminal key sequence is pressed while
425
 
     * the terminal widget  has focus, this signal is emitted to allow the host to decide
426
 
     * whether the shortcut should be overridden.
427
 
     * When the shortcut is overridden, the key sequence will be sent to the terminal emulation instead
428
 
     * and the action associated with the shortcut will not be triggered.
429
 
     *
430
 
     * @p override is set to false by default and the shortcut will be triggered as normal.
431
 
     */
432
 
    void overrideShortcutCheck(QKeyEvent* keyEvent,bool& override);
433
 
    void isBusySelecting(bool);
434
 
    //void sendStringToEmu(const char*);
435
 
 
436
 
    // qtermwidget signals
437
 
    void copyAvailable(bool);
438
 
    void termGetFocus();
439
 
    void termLostFocus();
440
 
    /////////////////////////////////////////////////////////////////////////////////////
441
 
    /////////////////////////////////////////////////////////////////////////////////////
442
 
 
443
 
    void changedSession(KSession *session);
444
 
 
445
 
 
446
 
protected:
447
 
    void paint (QPainter * painter);
448
 
    void keyPressEvent(QKeyEvent *event);
449
 
    bool event( QEvent *);
450
 
 
451
 
    void geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry);
452
 
    QRect geometryRound(const QRectF &r) const;
453
 
 
454
 
    void mousePressEvent(QMouseEvent*ev);
455
 
//    void mouseReleaseEvent( QMouseEvent* );
456
 
//    void mouseMoveEvent( QMouseEvent* );
457
 
 
458
 
    void focusInEvent(QFocusEvent* event);
459
 
    void focusOutEvent(QFocusEvent* event);
460
 
 
461
 
 
462
 
 
463
 
    /////////////////////////////////////////////////////////////////////////////////////
464
 
    /////////////////////////////////////////////////////////////////////////////////////
465
 
    void fontChange(const QFont &font);
466
 
    void extendSelection(const QPoint &pos );
467
 
 
468
 
    // classifies the 'ch' into one of three categories
469
 
    // and returns a character to indicate which category it is in
470
 
    //
471
 
    //     - A space (returns ' ')
472
 
    //     - Part of a word (returns 'a')
473
 
    //     - Other characters (returns the input character)
474
 
    QChar charClass(QChar ch) const;
475
 
 
476
 
    void clearImage();
477
 
 
478
 
    // reimplemented
479
 
    // cath for UT Soft Keyboard QInputMethodEvent
480
 
    void inputMethodEvent ( QInputMethodEvent* event );
481
 
    void inputMethodQuery( QInputMethodQueryEvent* event );
482
 
    QVariant inputMethodQuery( Qt::InputMethodQuery query ) const;
483
 
    /////////////////////////////////////////////////////////////////////////////////////
484
 
    /////////////////////////////////////////////////////////////////////////////////////
485
 
 
486
 
 
487
 
protected slots:
488
 
    /////////////////////////////////////////////////////////////////////////////////////
489
 
    /////////////////////////////////////////////////////////////////////////////////////
490
 
    void blinkEvent();
491
 
    void blinkCursorEvent();
492
 
 
493
 
    //Renables bell noises and visuals.  Used to disable further bells for a short period of time
494
 
    //after emitting the first in a sequence of bell events.
495
 
    void enableBell();
496
 
    /////////////////////////////////////////////////////////////////////////////////////
497
 
    /////////////////////////////////////////////////////////////////////////////////////
498
 
 
499
 
 
500
 
private slots:
501
 
    void swapColorTable();
502
 
 
503
 
private:
504
 
    /////////////////////////////////////////////////////////////////////////////////////
505
 
    /////////////////////////////////////////////////////////////////////////////////////
506
 
    // -- Drawing helpers --
507
 
 
508
 
    // divides the part of the display specified by 'rect' into
509
 
    // fragments according to their colors and styles and calls
510
 
    // drawTextFragment() to draw the fragments
511
 
    void drawContents(QPainter *paint, QRectF &rect);
512
 
 
513
 
    // draws a section of text, all the text in this section
514
 
    // has a common color and style
515
 
    void drawTextFragment(QPainter *painter, const QRectF &rect,
516
 
                          const QString& text, const Character* style);
517
 
 
518
 
    // draws the background for a text fragment
519
 
    // if useOpacitySetting is true then the color's alpha value will be set to
520
 
    // the display's transparency (set with setOpacity()), otherwise the background
521
 
    // will be drawn fully opaque
522
 
    void drawBackground(QPainter *painter, const QRectF& rect, const QColor& color,
523
 
                        bool useOpacitySetting);
524
 
 
525
 
    // draws the cursor character
526
 
    void drawCursor(QPainter *painter, const QRectF &rect , const QColor& foregroundColor,
527
 
                                       const QColor& backgroundColor , bool& invertColors);
528
 
 
529
 
    // draws the characters or line graphics in a text fragment
530
 
    void drawCharacters(QPainter *painter, const QRectF &rect,  const QString& text,
531
 
                                           const Character* style, bool invertCharacterColor);
532
 
 
533
 
    // draws a string of line graphics
534
 
    void drawLineCharString(QPainter *painter, qreal x, qreal y,
535
 
                            const QString& str, const Character* attributes);
536
 
 
537
 
    // draws the preedit string for input methods
538
 
    void drawInputMethodPreeditString(QPainter *painter , const QRectF& rect);
539
 
 
540
 
    // --
541
 
 
542
 
    // maps an area in the character image to an area on the widget
543
 
    QRect imageToWidget(const QRect& imageArea) const;
544
 
 
545
 
    // maps a point on the widget to the position ( ie. line and column )
546
 
    // of the character at that point.
547
 
    void getCharacterPosition(const QPointF& widgetPoint,int& line,int& column) const;
548
 
 
549
 
    // the area where the preedit string for input methods will be draw
550
 
    QRectF preeditRect() const;
551
 
 
552
 
    // scrolls the image by a number of lines.
553
 
    // 'lines' may be positive ( to scroll the image down )
554
 
    // or negative ( to scroll the image up )
555
 
    // 'region' is the part of the image to scroll - currently only
556
 
    // the top, bottom and height of 'region' are taken into account,
557
 
    // the left and right are ignored.
558
 
    void scrollImage(int lines , const QRect& region);
559
 
 
560
 
    void calcGeometry();
561
 
    void propagateSize();
562
 
    void updateImageSize();
563
 
    void makeImage();
564
 
 
565
 
    // returns the position of the cursor in columns and lines
566
 
    QPoint cursorPosition() const;
567
 
 
568
 
    // redraws the cursor
569
 
    void updateCursor();
570
 
 
571
 
    bool handleShortcutOverrideEvent(QKeyEvent* event);
572
 
    /////////////////////////////////////////////////////////////////////////////////////
573
 
    /////////////////////////////////////////////////////////////////////////////////////
574
 
 
575
 
    /**
576
 
    * Sets the seed used to generate random colors for the display
577
 
    * (in color schemes that support them).
578
 
    */
579
 
    void setRandomSeed(uint seed);
580
 
 
581
 
 
582
 
 
583
 
    /////////////////////////////////////////////////////////////////////////////////////
584
 
    ///                                 MEMBERS
585
 
    /////////////////////////////////////////////////////////////////////////////////////
586
 
    QFont       m_font;
587
 
    QPalette    m_palette;
588
 
    KSession   *m_session;
589
 
    QString     m_scheme;
590
 
 
591
 
    bool m_focusOnClick;
592
 
    bool m_showVKBonClick;
593
 
 
594
 
    QQuickItem *m_parent;
595
 
    QRectF      m_widgetRect;
596
 
 
597
 
    /////////////////////////////////////////////////////////////////////////////////////
598
 
    /////////////////////////////////////////////////////////////////////////////////////
599
 
    // the window onto the terminal screen which this display
600
 
    // is currently showing.
601
 
    QPointer<ScreenWindow> _screenWindow;
602
 
 
603
 
    bool   _allowBell;
604
 
    bool   _fixedFont;     // has fixed pitch
605
 
    int    _fontHeight;    // height
606
 
    qreal  _fontWidth;     // width
607
 
    int    _fontAscent;    // ascend
608
 
    bool   _boldIntense;   // Whether intense colors should be rendered with bold font
609
 
 
610
 
    qreal  _leftMargin;   // offset
611
 
    qreal  _topMargin;    // offset
612
 
 
613
 
    int _lines;      // the number of lines that can be displayed in the widget
614
 
    int _columns;    // the number of columns that can be displayed in the widget
615
 
 
616
 
    int _usedLines;  // the number of lines that are actually being used, this will be less
617
 
                     // than 'lines' if the character image provided with setImage() is smaller
618
 
                     // than the maximum image size which can be displayed
619
 
 
620
 
    int _usedColumns; // the number of columns that are actually being used, this will be less
621
 
                      // than 'columns' if the character image provided with setImage() is smaller
622
 
                      // than the maximum image size which can be displayed
623
 
 
624
 
    qreal _contentHeight;
625
 
    qreal _contentWidth;
626
 
 
627
 
    Character* _image; // [lines][columns]
628
 
                       // only the area [usedLines][usedColumns] in the image contains valid data
629
 
 
630
 
    int _imageSize;
631
 
    QVector<LineProperty> _lineProperties;
632
 
 
633
 
    ColorEntry _colorTable[TABLE_COLORS];
634
 
    uint _randomSeed;
635
 
 
636
 
    bool _resizing;
637
 
    bool _bidiEnabled;
638
 
 
639
 
    QPoint  _iPntSel;           // initial selection point
640
 
    QPoint  _pntSel;            // current selection point
641
 
    QPoint  _tripleSelBegin;    // help avoid flicker
642
 
    int     _actSel;            // selection state
643
 
    bool    _wordSelectionMode;
644
 
    bool    _lineSelectionMode;
645
 
    bool    _preserveLineBreaks;
646
 
    bool    _columnSelectionMode;
647
 
 
648
 
    QClipboard*  _clipboard;
649
 
    QString     _wordCharacters;
650
 
    int         _bellMode;
651
 
 
652
 
    bool _blinking;           // hide text in paintEvent
653
 
    bool _hasBlinker;         // has characters to blink
654
 
    bool _cursorBlinking;     // hide cursor in paintEvent
655
 
    bool _hasBlinkingCursor;  // has blinking cursor enabled
656
 
    bool _allowBlinkingText;  // allow text to blink
657
 
 
658
 
    bool _isFixedSize;           //Columns / lines are locked.
659
 
    QTimer* _blinkTimer;         // active when hasBlinker
660
 
    QTimer* _blinkCursorTimer;   // active when hasBlinkingCursor
661
 
    QTimer* _resizeTimer;
662
 
 
663
 
    bool _flowControlWarningEnabled;
664
 
 
665
 
    uint _lineSpacing;
666
 
    bool _colorsInverted; // true during visual bell
667
 
    QRgb _blendColor;
668
 
 
669
 
    KeyboardCursorShape _cursorShape;
670
 
 
671
 
    // custom cursor color.  if this is invalid then the foreground
672
 
    // color of the character under the cursor is used
673
 
    QColor _cursorColor;
674
 
 
675
 
 
676
 
    struct InputMethodData
677
 
    {
678
 
        QString preeditString;
679
 
        QRectF previousPreeditRect;
680
 
    };
681
 
    InputMethodData _inputMethodData;
682
 
 
683
 
    static bool _antialiasText;   // do we antialias or not
684
 
 
685
 
    //the delay in milliseconds between redrawing blinking text
686
 
    static const int TEXT_BLINK_DELAY = 500;
687
 
    static const int DEFAULT_LEFT_MARGIN = 1;
688
 
    static const int DEFAULT_TOP_MARGIN = 1;
689
 
    /////////////////////////////////////////////////////////////////////////////////////
690
 
    /////////////////////////////////////////////////////////////////////////////////////
691
 
 
692
 
public:
693
 
    static void setTransparencyEnabled(bool enable)
694
 
    {
695
 
        HAVE_TRANSPARENCY = enable;
696
 
    }
697
 
};
698
 
 
699
 
class AutoScrollHandler : public QObject
700
 
{
701
 
    Q_OBJECT
702
 
 
703
 
public:
704
 
    AutoScrollHandler(QQuickItem* parent);
705
 
 
706
 
protected:
707
 
    virtual void timerEvent(QTimerEvent* event);
708
 
    virtual bool eventFilter(QObject* watched,QEvent* event);
709
 
 
710
 
private:
711
 
    QQuickItem* widget() const { return static_cast<QQuickItem*>(parent()); }
712
 
    int _timerId;
713
 
};
714
 
 
715
 
#endif // TERMINALDISPLAY_H