Mercurial > hg > octave-nkf
annotate libgui/qterminal/libqterminal/unix/QUnixTerminalImpl.h @ 16794:1d1f02e0f6b4
GUI: enable clipboard content detection for terminal window context menu
* libgui/qterminal/libqterminal/QTerminal.h, libgui/qterminal/libqterminal/QTerminal.cc
(QTerminal::handleCustomContentMenuRequested): Use clinboard and tem window selection buffer to determine enable state of copy/paste actions.
(QTerminal::QTerminal): save content actions for copy and paste to variables.
* libgui/qterminal/libqterminal/unix/QUnixTerminalImpl.cpp, libgui/qterminal/libqterminal/unix/QUnixTerminalImpl.h
(QUnixTerminalImpl::selectedText): New function.
* libgui/qterminal/libqterminal/unix/TerminalView.cpp, libgui/qterminal/libqterminal/unix/TerminalView.h
(TerminalView::selectedText): New function.
* libgui/qterminal/libqterminal/win32/QWinTerminalImpl.cpp, libgui/qterminal/libqterminal/win32/QWinTerminalImpl.h
(QWinTerminalImpl::selectedText): New function.
author | John Donoghue <john.donoghue@ieee.org> |
---|---|
date | Thu, 20 Jun 2013 22:04:58 -0400 |
parents | ba808cd9d86c |
children | d63878346099 |
rev | line source |
---|---|
15651
845cebf281aa
Added files of QConsole.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
1 /* Copyright (C) 2008 e_k (e_k@users.sourceforge.net) |
845cebf281aa
Added files of QConsole.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
2 Copyright (C) 2012 Jacob Dawid <jacob.dawid@googlemail.com> |
845cebf281aa
Added files of QConsole.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
3 |
845cebf281aa
Added files of QConsole.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
4 This library is free software; you can redistribute it and/or |
845cebf281aa
Added files of QConsole.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
5 modify it under the terms of the GNU Library General Public |
845cebf281aa
Added files of QConsole.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
6 License as published by the Free Software Foundation; either |
845cebf281aa
Added files of QConsole.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
7 version 2 of the License, or (at your option) any later version. |
845cebf281aa
Added files of QConsole.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
8 |
845cebf281aa
Added files of QConsole.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
9 This library is distributed in the hope that it will be useful, |
845cebf281aa
Added files of QConsole.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
10 but WITHOUT ANY WARRANTY; without even the implied warranty of |
845cebf281aa
Added files of QConsole.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
845cebf281aa
Added files of QConsole.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
12 Library General Public License for more details. |
845cebf281aa
Added files of QConsole.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
13 |
845cebf281aa
Added files of QConsole.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
14 You should have received a copy of the GNU Library General Public License |
845cebf281aa
Added files of QConsole.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
15 along with this library; see the file COPYING.LIB. If not, write to |
845cebf281aa
Added files of QConsole.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
16 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
845cebf281aa
Added files of QConsole.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
17 Boston, MA 02110-1301, USA. |
845cebf281aa
Added files of QConsole.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
18 */ |
845cebf281aa
Added files of QConsole.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
19 |
845cebf281aa
Added files of QConsole.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
20 |
15658
eaa7da75d202
Added QTerminalInteface class.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
15656
diff
changeset
|
21 #ifndef Q_UNIXTERMINALIMPL |
eaa7da75d202
Added QTerminalInteface class.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
15656
diff
changeset
|
22 #define Q_UNIXTERMINALIMPL |
15651
845cebf281aa
Added files of QConsole.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
23 |
845cebf281aa
Added files of QConsole.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
24 #include <QtGui> |
15653
35c891dce299
Removed INCLUDEPATH.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
15651
diff
changeset
|
25 #include "unix/kpty.h" |
35c891dce299
Removed INCLUDEPATH.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
15651
diff
changeset
|
26 #include "unix/TerminalModel.h" |
35c891dce299
Removed INCLUDEPATH.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
15651
diff
changeset
|
27 #include "unix/TerminalView.h" |
16639
ba808cd9d86c
simplify QTerminal inheritance scheme
John W. Eaton <jwe@octave.org>
parents:
16620
diff
changeset
|
28 #include "QTerminal.h" |
15651
845cebf281aa
Added files of QConsole.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
29 |
16639
ba808cd9d86c
simplify QTerminal inheritance scheme
John W. Eaton <jwe@octave.org>
parents:
16620
diff
changeset
|
30 class QUnixTerminalImpl : public QTerminal |
15651
845cebf281aa
Added files of QConsole.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
31 { |
845cebf281aa
Added files of QConsole.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
32 Q_OBJECT |
16484
fa842e78f491
Restore STDERR stream pipe before exit to capture error messages.
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
15681
diff
changeset
|
33 |
fa842e78f491
Restore STDERR stream pipe before exit to capture error messages.
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
15681
diff
changeset
|
34 int fdstderr; |
fa842e78f491
Restore STDERR stream pipe before exit to capture error messages.
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
15681
diff
changeset
|
35 |
15651
845cebf281aa
Added files of QConsole.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
36 public: |
15658
eaa7da75d202
Added QTerminalInteface class.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
15656
diff
changeset
|
37 QUnixTerminalImpl(QWidget *parent = 0); |
eaa7da75d202
Added QTerminalInteface class.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
15656
diff
changeset
|
38 virtual ~QUnixTerminalImpl(); |
16484
fa842e78f491
Restore STDERR stream pipe before exit to capture error messages.
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
15681
diff
changeset
|
39 |
15662
5758e0013246
Enable compilation on Win32-native platform.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
15659
diff
changeset
|
40 void setTerminalFont(const QFont &font); |
15651
845cebf281aa
Added files of QConsole.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
41 void setSize(int h, int v); |
15662
5758e0013246
Enable compilation on Win32-native platform.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
15659
diff
changeset
|
42 void sendText(const QString& text); |
15651
845cebf281aa
Added files of QConsole.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
43 |
15677
f620ecde2566
Added support for changing the cursor.
Jacob Dawid <jacob.dawid@gmail.com>
parents:
15662
diff
changeset
|
44 void setCursorType(CursorType type, bool blinking); |
f620ecde2566
Added support for changing the cursor.
Jacob Dawid <jacob.dawid@gmail.com>
parents:
15662
diff
changeset
|
45 |
16620
818eef7b2618
allow terminal colors to be set from preferences dialog
John W. Eaton <jwe@octave.org>
parents:
16609
diff
changeset
|
46 void setBackgroundColor (const QColor& color); |
818eef7b2618
allow terminal colors to be set from preferences dialog
John W. Eaton <jwe@octave.org>
parents:
16609
diff
changeset
|
47 void setForegroundColor (const QColor& color); |
818eef7b2618
allow terminal colors to be set from preferences dialog
John W. Eaton <jwe@octave.org>
parents:
16609
diff
changeset
|
48 void setSelectionColor (const QColor& color); |
818eef7b2618
allow terminal colors to be set from preferences dialog
John W. Eaton <jwe@octave.org>
parents:
16609
diff
changeset
|
49 void setCursorColor (bool useForegroundColor, const QColor& color); |
818eef7b2618
allow terminal colors to be set from preferences dialog
John W. Eaton <jwe@octave.org>
parents:
16609
diff
changeset
|
50 |
16794
1d1f02e0f6b4
GUI: enable clipboard content detection for terminal window context menu
John Donoghue <john.donoghue@ieee.org>
parents:
16639
diff
changeset
|
51 QString selectedText(); |
1d1f02e0f6b4
GUI: enable clipboard content detection for terminal window context menu
John Donoghue <john.donoghue@ieee.org>
parents:
16639
diff
changeset
|
52 |
15651
845cebf281aa
Added files of QConsole.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
53 public slots: |
845cebf281aa
Added files of QConsole.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
54 void copyClipboard(); |
845cebf281aa
Added files of QConsole.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
55 void pasteClipboard(); |
16484
fa842e78f491
Restore STDERR stream pipe before exit to capture error messages.
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
15681
diff
changeset
|
56 |
15651
845cebf281aa
Added files of QConsole.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
57 protected: |
845cebf281aa
Added files of QConsole.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
58 void showEvent(QShowEvent *); |
15658
eaa7da75d202
Added QTerminalInteface class.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
15656
diff
changeset
|
59 virtual void resizeEvent(QResizeEvent *); |
16484
fa842e78f491
Restore STDERR stream pipe before exit to capture error messages.
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
15681
diff
changeset
|
60 |
15651
845cebf281aa
Added files of QConsole.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
61 private: |
845cebf281aa
Added files of QConsole.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
62 void initialize(); |
845cebf281aa
Added files of QConsole.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
63 void connectToPty(); |
845cebf281aa
Added files of QConsole.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
64 |
15659 | 65 TerminalView *m_terminalView; |
66 TerminalModel *m_terminalModel; | |
15651
845cebf281aa
Added files of QConsole.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
67 KPty *m_kpty; |
845cebf281aa
Added files of QConsole.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
68 }; |
845cebf281aa
Added files of QConsole.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
69 |
15658
eaa7da75d202
Added QTerminalInteface class.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
15656
diff
changeset
|
70 #endif // Q_UNIXTERMINALIMPL |