|
|
@ -24,15 +24,12 @@
|
|
|
|
// Qt
|
|
|
|
// Qt
|
|
|
|
#include <QColor>
|
|
|
|
#include <QColor>
|
|
|
|
#include <QPointer>
|
|
|
|
#include <QPointer>
|
|
|
|
//#include <QWidget>
|
|
|
|
|
|
|
|
#include <QQuickPaintedItem>
|
|
|
|
#include <QQuickPaintedItem>
|
|
|
|
|
|
|
|
|
|
|
|
// Konsole
|
|
|
|
// Konsole
|
|
|
|
#include "Filter.h"
|
|
|
|
#include "Filter.h"
|
|
|
|
#include "Character.h"
|
|
|
|
#include "Character.h"
|
|
|
|
#include "qtermwidget.h"
|
|
|
|
#include "qtermwidget.h"
|
|
|
|
//#include "konsole_export.h"
|
|
|
|
|
|
|
|
#define KONSOLEPRIVATE_EXPORT
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// QMLTermWidget
|
|
|
|
// QMLTermWidget
|
|
|
|
#include "ksession.h"
|
|
|
|
#include "ksession.h"
|
|
|
@ -44,21 +41,17 @@ class QDropEvent;
|
|
|
|
class QLabel;
|
|
|
|
class QLabel;
|
|
|
|
class QTimer;
|
|
|
|
class QTimer;
|
|
|
|
class QEvent;
|
|
|
|
class QEvent;
|
|
|
|
class QGridLayout;
|
|
|
|
|
|
|
|
class QKeyEvent;
|
|
|
|
class QKeyEvent;
|
|
|
|
class QScrollBar;
|
|
|
|
class QScrollBar;
|
|
|
|
class QShowEvent;
|
|
|
|
class QShowEvent;
|
|
|
|
class QHideEvent;
|
|
|
|
class QHideEvent;
|
|
|
|
class QTimerEvent;
|
|
|
|
class QTimerEvent;
|
|
|
|
class QWidget;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//class KMenu;
|
|
|
|
//class KMenu;
|
|
|
|
|
|
|
|
|
|
|
|
namespace Konsole
|
|
|
|
namespace Konsole
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
enum MotionAfterPasting {
|
|
|
|
enum MotionAfterPasting
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
// No move screenwindow after pasting
|
|
|
|
// No move screenwindow after pasting
|
|
|
|
NoMoveScreenWindow = 0,
|
|
|
|
NoMoveScreenWindow = 0,
|
|
|
|
// Move start of screenwindow after pasting
|
|
|
|
// Move start of screenwindow after pasting
|
|
|
@ -67,7 +60,6 @@ namespace Konsole
|
|
|
|
MoveEndScreenWindow = 2
|
|
|
|
MoveEndScreenWindow = 2
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
extern unsigned short vt100_graphics[32];
|
|
|
|
extern unsigned short vt100_graphics[32];
|
|
|
|
|
|
|
|
|
|
|
|
class ScreenWindow;
|
|
|
|
class ScreenWindow;
|
|
|
@ -81,7 +73,7 @@ class ScreenWindow;
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* TODO More documentation
|
|
|
|
* TODO More documentation
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
class KONSOLEPRIVATE_EXPORT TerminalDisplay : public QQuickPaintedItem
|
|
|
|
class TerminalDisplay : public QQuickPaintedItem
|
|
|
|
{
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
Q_OBJECT
|
|
|
|
Q_PROPERTY(KSession *session READ getSession WRITE setSession NOTIFY sessionChanged )
|
|
|
|
Q_PROPERTY(KSession *session READ getSession WRITE setSession NOTIFY sessionChanged )
|
|
|
@ -107,8 +99,8 @@ class KONSOLEPRIVATE_EXPORT TerminalDisplay : public QQuickPaintedItem
|
|
|
|
|
|
|
|
|
|
|
|
public:
|
|
|
|
public:
|
|
|
|
/** Constructs a new terminal display widget with the specified parent. */
|
|
|
|
/** Constructs a new terminal display widget with the specified parent. */
|
|
|
|
TerminalDisplay(QQuickItem *parent=0);
|
|
|
|
explicit TerminalDisplay(QQuickItem *parent = nullptr);
|
|
|
|
virtual ~TerminalDisplay();
|
|
|
|
~TerminalDisplay() override;
|
|
|
|
|
|
|
|
|
|
|
|
/** Returns the terminal color palette used by the display. */
|
|
|
|
/** Returns the terminal color palette used by the display. */
|
|
|
|
const ColorEntry *colorTable() const;
|
|
|
|
const ColorEntry *colorTable() const;
|
|
|
@ -131,8 +123,7 @@ public:
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* This enum describes the location where the scroll bar is positioned in the display widget.
|
|
|
|
* This enum describes the location where the scroll bar is positioned in the display widget.
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
enum ScrollBarPosition
|
|
|
|
enum ScrollBarPosition {
|
|
|
|
{
|
|
|
|
|
|
|
|
/** Do not show the scroll bar. */
|
|
|
|
/** Do not show the scroll bar. */
|
|
|
|
NoScrollBar=0,
|
|
|
|
NoScrollBar=0,
|
|
|
|
/** Show the scroll bar on the left side of the display. */
|
|
|
|
/** Show the scroll bar on the left side of the display. */
|
|
|
@ -214,8 +205,7 @@ public:
|
|
|
|
* This enum describes the methods for selecting text when
|
|
|
|
* This enum describes the methods for selecting text when
|
|
|
|
* the user triple-clicks within the display.
|
|
|
|
* the user triple-clicks within the display.
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
enum TripleClickMode
|
|
|
|
enum TripleClickMode {
|
|
|
|
{
|
|
|
|
|
|
|
|
/** Select the whole line underneath the cursor. */
|
|
|
|
/** Select the whole line underneath the cursor. */
|
|
|
|
SelectWholeLine,
|
|
|
|
SelectWholeLine,
|
|
|
|
/** Select from the current cursor position to the end of the line. */
|
|
|
|
/** Select from the current cursor position to the end of the line. */
|
|
|
@ -348,8 +338,7 @@ public:
|
|
|
|
* can be used to alert the user when a 'bell' occurs in the terminal
|
|
|
|
* can be used to alert the user when a 'bell' occurs in the terminal
|
|
|
|
* session.
|
|
|
|
* session.
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
enum BellMode
|
|
|
|
enum BellMode {
|
|
|
|
{
|
|
|
|
|
|
|
|
/** A system beep. */
|
|
|
|
/** A system beep. */
|
|
|
|
SystemBeepBell=0,
|
|
|
|
SystemBeepBell=0,
|
|
|
|
/**
|
|
|
|
/**
|
|
|
@ -624,30 +613,30 @@ signals:
|
|
|
|
void boldIntenseChanged();
|
|
|
|
void boldIntenseChanged();
|
|
|
|
|
|
|
|
|
|
|
|
protected:
|
|
|
|
protected:
|
|
|
|
virtual bool event( QEvent * );
|
|
|
|
bool event(QEvent *);
|
|
|
|
|
|
|
|
|
|
|
|
//virtual void paintEvent( QPaintEvent * );
|
|
|
|
//void paintEvent(QPaintEvent *);
|
|
|
|
|
|
|
|
|
|
|
|
virtual void showEvent(QShowEvent*);
|
|
|
|
void showEvent(QShowEvent *);
|
|
|
|
virtual void hideEvent(QHideEvent*);
|
|
|
|
void hideEvent(QHideEvent *);
|
|
|
|
virtual void resizeEvent(QResizeEvent*);
|
|
|
|
void resizeEvent(QResizeEvent *);
|
|
|
|
|
|
|
|
|
|
|
|
virtual void fontChange(const QFont &font);
|
|
|
|
virtual void fontChange(const QFont &font);
|
|
|
|
virtual void focusInEvent(QFocusEvent* event);
|
|
|
|
void focusInEvent(QFocusEvent *event);
|
|
|
|
virtual void focusOutEvent(QFocusEvent* event);
|
|
|
|
void focusOutEvent(QFocusEvent *event);
|
|
|
|
virtual void keyPressEvent(QKeyEvent* event);
|
|
|
|
void keyPressEvent(QKeyEvent *event);
|
|
|
|
virtual void mouseDoubleClickEvent(QMouseEvent* ev);
|
|
|
|
void mouseDoubleClickEvent(QMouseEvent *ev);
|
|
|
|
virtual void mousePressEvent( QMouseEvent* );
|
|
|
|
void mousePressEvent(QMouseEvent*);
|
|
|
|
virtual void mouseReleaseEvent( QMouseEvent* );
|
|
|
|
void mouseReleaseEvent(QMouseEvent*);
|
|
|
|
virtual void mouseMoveEvent( QMouseEvent* );
|
|
|
|
void mouseMoveEvent(QMouseEvent*);
|
|
|
|
virtual void extendSelection( const QPoint& pos );
|
|
|
|
void extendSelection(const QPoint& pos);
|
|
|
|
virtual void wheelEvent( QWheelEvent* );
|
|
|
|
void wheelEvent(QWheelEvent*);
|
|
|
|
|
|
|
|
|
|
|
|
virtual bool focusNextPrevChild( bool next );
|
|
|
|
bool focusNextPrevChild(bool next);
|
|
|
|
|
|
|
|
|
|
|
|
// drag and drop
|
|
|
|
// drag and drop
|
|
|
|
virtual void dragEnterEvent(QDragEnterEvent* event);
|
|
|
|
void dragEnterEvent(QDragEnterEvent *event);
|
|
|
|
virtual void dropEvent(QDropEvent* event);
|
|
|
|
void dropEvent(QDropEvent *event);
|
|
|
|
void doDrag();
|
|
|
|
void doDrag();
|
|
|
|
enum DragState { diNone, diPending, diDragging };
|
|
|
|
enum DragState { diNone, diPending, diDragging };
|
|
|
|
|
|
|
|
|
|
|
@ -768,11 +757,9 @@ private:
|
|
|
|
|
|
|
|
|
|
|
|
// the window onto the terminal screen which this display
|
|
|
|
// the window onto the terminal screen which this display
|
|
|
|
// is currently showing.
|
|
|
|
// is currently showing.
|
|
|
|
QPointer<ScreenWindow> _screenWindow;
|
|
|
|
QPointer<ScreenWindow> m_screenWindow;
|
|
|
|
|
|
|
|
|
|
|
|
bool _allowBell;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
QGridLayout* _gridLayout;
|
|
|
|
bool m_allowBell;
|
|
|
|
|
|
|
|
|
|
|
|
bool _fixedFont; // has fixed pitch
|
|
|
|
bool _fixedFont; // has fixed pitch
|
|
|
|
int _fontHeight; // height
|
|
|
|
int _fontHeight; // height
|
|
|
@ -845,7 +832,6 @@ private:
|
|
|
|
bool _possibleTripleClick; // is set in mouseDoubleClickEvent and deleted
|
|
|
|
bool _possibleTripleClick; // is set in mouseDoubleClickEvent and deleted
|
|
|
|
// after QApplication::doubleClickInterval() delay
|
|
|
|
// after QApplication::doubleClickInterval() delay
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
QLabel *_resizeWidget;
|
|
|
|
QLabel *_resizeWidget;
|
|
|
|
QTimer *_resizeTimer;
|
|
|
|
QTimer *_resizeTimer;
|
|
|
|
|
|
|
|
|
|
|
@ -876,8 +862,7 @@ private:
|
|
|
|
// color of the character under the cursor is used
|
|
|
|
// color of the character under the cursor is used
|
|
|
|
QColor _cursorColor;
|
|
|
|
QColor _cursorColor;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
MotionAfterPasting m_MotionAfterPasting;
|
|
|
|
MotionAfterPasting mMotionAfterPasting;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
struct InputMethodData
|
|
|
|
struct InputMethodData
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -897,7 +882,7 @@ private:
|
|
|
|
// QMLTermWidget port functions
|
|
|
|
// QMLTermWidget port functions
|
|
|
|
QFont m_font;
|
|
|
|
QFont m_font;
|
|
|
|
QPalette m_palette;
|
|
|
|
QPalette m_palette;
|
|
|
|
QPalette::ColorRole m_color_role;
|
|
|
|
QPalette::ColorRole m_colorRole;
|
|
|
|
KSession *m_session;
|
|
|
|
KSession *m_session;
|
|
|
|
bool m_full_cursor_height;
|
|
|
|
bool m_full_cursor_height;
|
|
|
|
|
|
|
|
|
|
|
@ -906,8 +891,8 @@ private:
|
|
|
|
const QPalette palette() { return m_palette; }
|
|
|
|
const QPalette palette() { return m_palette; }
|
|
|
|
void setPalette(const QPalette &p){ m_palette = p; }
|
|
|
|
void setPalette(const QPalette &p){ m_palette = p; }
|
|
|
|
|
|
|
|
|
|
|
|
QPalette::ColorRole backgroundRole() { return m_color_role; }
|
|
|
|
QPalette::ColorRole backgroundRole() { return m_colorRole; }
|
|
|
|
void setBackgroundRole(QPalette::ColorRole role) { m_color_role = role; }
|
|
|
|
void setBackgroundRole(QPalette::ColorRole role) { m_colorRole = role; }
|
|
|
|
|
|
|
|
|
|
|
|
void update(const QRegion ®ion);
|
|
|
|
void update(const QRegion ®ion);
|
|
|
|
void update();
|
|
|
|
void update();
|
|
|
@ -938,20 +923,6 @@ public:
|
|
|
|
bool fullCursorHeight() const;
|
|
|
|
bool fullCursorHeight() const;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
class AutoScrollHandler : public QObject
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
|
|
|
AutoScrollHandler(QWidget* parent);
|
|
|
|
|
|
|
|
protected:
|
|
|
|
|
|
|
|
virtual void timerEvent(QTimerEvent* event);
|
|
|
|
|
|
|
|
virtual bool eventFilter(QObject* watched,QEvent* event);
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
|
|
|
QWidget* widget() const { return static_cast<QWidget*>(parent()); }
|
|
|
|
|
|
|
|
int _timerId;
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#endif // TERMINALDISPLAY_H
|
|
|
|
#endif // TERMINALDISPLAY_H
|
|
|
|