1 /* Copyright (C) 2008 e_k (e_k@users.sourceforge.net) 2 Copyright (C) 2012-2019 Jacob Dawid <jacob.dawid@cybercatalyst.com> 3 4 This library is free software: you can redistribute it and/or 5 modify it under the terms of the GNU Library General Public 6 License as published by the Free Software Foundation; either 7 version 2 of the License, or (at your option) any later version. 8 9 This library is distributed in the hope that it will be useful, 10 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 Library General Public License for more details. 13 14 You should have received a copy of the GNU Library General Public License 15 along with this library; see the file COPYING.LIB. If not, write to 16 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 17 Boston, MA 02110-1301, USA. 18 */ 19 20 21 #ifndef Q_UNIXTERMINALIMPL 22 #define Q_UNIXTERMINALIMPL 23 24 #include <QtGui> 25 #include "unix/kpty.h" 26 #include "unix/TerminalModel.h" 27 #include "unix/TerminalView.h" 28 #include "QTerminal.h" 29 30 class QUnixTerminalImpl : public QTerminal 31 { 32 Q_OBJECT 33 34 int fdstderr; 35 36 public: 37 QUnixTerminalImpl(QWidget *parent = nullptr); 38 virtual ~QUnixTerminalImpl(); 39 40 void setTerminalFont(const QFont &font); 41 void setSize(int h, int v); 42 void sendText(const QString& text); 43 44 void setCursorType(CursorType type, bool blinking); 45 46 void setBackgroundColor (const QColor& color); 47 void setForegroundColor (const QColor& color); 48 void setSelectionColor (const QColor& color); 49 void setCursorColor (bool useForegroundColor, const QColor& color); 50 void setScrollBufferSize(int value); 51 QString selectedText(); 52 void has_extra_interrupt (bool extra_interrupt); 53 QList<QAction*> get_hotspot_actions (const QPoint& at); 54 55 public slots: 56 void copyClipboard(); 57 void pasteClipboard(); 58 void selectAll(); 59 virtual void handle_visibility_changed (bool visible); 60 61 protected: 62 void showEvent(QShowEvent *); 63 virtual void resizeEvent(QResizeEvent *); 64 65 private: 66 void initialize(); 67 void connectToPty(); 68 69 TerminalView *m_terminalView; 70 TerminalModel *m_terminalModel; 71 KPty *m_kpty; 72 bool _extra_interrupt; 73 QWidget *_parent; 74 }; 75 76 #endif // Q_UNIXTERMINALIMPL 77