Mercurial > octave
annotate libgui/qterminal/libqterminal/QTerminal.h @ 20987:f99cbd86a0f9
Prevent closing GUI by Ctrl+D in terminal (bug #46661)
* QTerminal.cc (set_global_shortcuts): (un)set shortcut Ctrl-D for dummy action;
(notice_settings): do not consider obsolete shortcut sets, check whether
Ctrl+D is used as global shortcut and enable the dummy action accordingly
* QTerminal.h (QTerminal): new dummy action with shortcut Ctrl+D
* shortcut-manager.cc (do_init_data): reset flag for global Ctrl-D usage;
(init, do_write_shortcuts): check for Ctrl-D usage as global shortcut and
set the flag in settings accordingly
author | Torsten <ttl@justmail.de> |
---|---|
date | Sat, 26 Dec 2015 08:49:41 +0100 |
parents | 88233ac3f3ea |
children | dd1dcef1ee33 |
rev | line source |
---|---|
15651
845cebf281aa
Added files of QConsole.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
15650
diff
changeset
|
1 /* |
845cebf281aa
Added files of QConsole.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
15650
diff
changeset
|
2 |
19697
4197fc428c7d
maint: Update copyright notices for 2015.
John W. Eaton <jwe@octave.org>
parents:
19690
diff
changeset
|
3 Copyright (C) 2012-2015 Michael Goffioul. |
4197fc428c7d
maint: Update copyright notices for 2015.
John W. Eaton <jwe@octave.org>
parents:
19690
diff
changeset
|
4 Copyright (C) 2012-2015 Jacob Dawid. |
15647
a044a259c423
Renamed SessionModel in TerminalModel.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
15646
diff
changeset
|
5 |
15651
845cebf281aa
Added files of QConsole.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
15650
diff
changeset
|
6 This file is part of QTerminal. |
15631 | 7 |
17795
0a8c35ae5ce1
maint: Fix various problems with GPL copyright statements.
Rik <rik@octave.org>
parents:
17790
diff
changeset
|
8 This program is free software; you can redistribute it and/or modify |
15651
845cebf281aa
Added files of QConsole.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
15650
diff
changeset
|
9 it under the terms of the GNU General Public License as published by |
845cebf281aa
Added files of QConsole.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
15650
diff
changeset
|
10 the Free Software Foundation, either version 3 of the License, or |
845cebf281aa
Added files of QConsole.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
15650
diff
changeset
|
11 (at your option) any later version. |
15631 | 12 |
17795
0a8c35ae5ce1
maint: Fix various problems with GPL copyright statements.
Rik <rik@octave.org>
parents:
17790
diff
changeset
|
13 This program is distributed in the hope that it will be useful, |
15651
845cebf281aa
Added files of QConsole.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
15650
diff
changeset
|
14 but WITHOUT ANY WARRANTY; without even the implied warranty of |
845cebf281aa
Added files of QConsole.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
15650
diff
changeset
|
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
845cebf281aa
Added files of QConsole.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
15650
diff
changeset
|
16 GNU General Public License for more details. |
845cebf281aa
Added files of QConsole.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
15650
diff
changeset
|
17 |
845cebf281aa
Added files of QConsole.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
15650
diff
changeset
|
18 You should have received a copy of the GNU General Public License |
17795
0a8c35ae5ce1
maint: Fix various problems with GPL copyright statements.
Rik <rik@octave.org>
parents:
17790
diff
changeset
|
19 along with this program. If not, |
0a8c35ae5ce1
maint: Fix various problems with GPL copyright statements.
Rik <rik@octave.org>
parents:
17790
diff
changeset
|
20 see <http://www.gnu.org/licenses/>. |
15651
845cebf281aa
Added files of QConsole.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
15650
diff
changeset
|
21 |
845cebf281aa
Added files of QConsole.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
15650
diff
changeset
|
22 */ |
15631 | 23 |
15651
845cebf281aa
Added files of QConsole.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
15650
diff
changeset
|
24 #ifndef QTERMINAL_H |
845cebf281aa
Added files of QConsole.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
15650
diff
changeset
|
25 #define QTERMINAL_H |
15649
c22fa57226b2
Fixed bug with ECHOCTL.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
15648
diff
changeset
|
26 |
16469
c89699ca005a
ensure QSettings is declared for QTerminal.h
John W. Eaton <jwe@octave.org>
parents:
16413
diff
changeset
|
27 #include <QSettings> |
16648
b04413e5a811
improve handling of interrupts, copy and paste shortcuts
John W. Eaton <jwe@octave.org>
parents:
16641
diff
changeset
|
28 #include <QKeySequence> |
16639
ba808cd9d86c
simplify QTerminal inheritance scheme
John W. Eaton <jwe@octave.org>
parents:
16570
diff
changeset
|
29 #include <QWidget> |
16641
64f9a3e301d3
don't store default values in resource manager class
John W. Eaton <jwe@octave.org>
parents:
16639
diff
changeset
|
30 #include <QStringList> |
16639
ba808cd9d86c
simplify QTerminal inheritance scheme
John W. Eaton <jwe@octave.org>
parents:
16570
diff
changeset
|
31 #include <QColor> |
16641
64f9a3e301d3
don't store default values in resource manager class
John W. Eaton <jwe@octave.org>
parents:
16639
diff
changeset
|
32 #include <QList> |
16639
ba808cd9d86c
simplify QTerminal inheritance scheme
John W. Eaton <jwe@octave.org>
parents:
16570
diff
changeset
|
33 #include <QMenu> |
16794
1d1f02e0f6b4
GUI: enable clipboard content detection for terminal window context menu
John Donoghue <john.donoghue@ieee.org>
parents:
16718
diff
changeset
|
34 #include <QClipboard> |
1d1f02e0f6b4
GUI: enable clipboard content detection for terminal window context menu
John Donoghue <john.donoghue@ieee.org>
parents:
16718
diff
changeset
|
35 #include <QApplication> |
19690
bd1369a2a651
add extra action for interrupting with Ctrl-C (bug #44204)
Torsten <ttl@justmail.de>
parents:
19303
diff
changeset
|
36 #include <QAction> |
15662
5758e0013246
Enable compilation on Win32-native platform.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
15658
diff
changeset
|
37 |
19936
29fe196d2ce0
GUI: use reource manager for command window icons (Bug #44528)
John Donoghue <john.donoghue@ieee.org>
parents:
19907
diff
changeset
|
38 #include "resource-manager.h" |
29fe196d2ce0
GUI: use reource manager for command window icons (Bug #44528)
John Donoghue <john.donoghue@ieee.org>
parents:
19907
diff
changeset
|
39 |
16639
ba808cd9d86c
simplify QTerminal inheritance scheme
John W. Eaton <jwe@octave.org>
parents:
16570
diff
changeset
|
40 class QTerminal : public QWidget |
ba808cd9d86c
simplify QTerminal inheritance scheme
John W. Eaton <jwe@octave.org>
parents:
16570
diff
changeset
|
41 { |
ba808cd9d86c
simplify QTerminal inheritance scheme
John W. Eaton <jwe@octave.org>
parents:
16570
diff
changeset
|
42 Q_OBJECT |
ba808cd9d86c
simplify QTerminal inheritance scheme
John W. Eaton <jwe@octave.org>
parents:
16570
diff
changeset
|
43 |
ba808cd9d86c
simplify QTerminal inheritance scheme
John W. Eaton <jwe@octave.org>
parents:
16570
diff
changeset
|
44 public: |
ba808cd9d86c
simplify QTerminal inheritance scheme
John W. Eaton <jwe@octave.org>
parents:
16570
diff
changeset
|
45 |
ba808cd9d86c
simplify QTerminal inheritance scheme
John W. Eaton <jwe@octave.org>
parents:
16570
diff
changeset
|
46 static QTerminal *create (QWidget *xparent = 0); |
ba808cd9d86c
simplify QTerminal inheritance scheme
John W. Eaton <jwe@octave.org>
parents:
16570
diff
changeset
|
47 |
16641
64f9a3e301d3
don't store default values in resource manager class
John W. Eaton <jwe@octave.org>
parents:
16639
diff
changeset
|
48 static QList<QColor> default_colors (void); |
64f9a3e301d3
don't store default values in resource manager class
John W. Eaton <jwe@octave.org>
parents:
16639
diff
changeset
|
49 |
64f9a3e301d3
don't store default values in resource manager class
John W. Eaton <jwe@octave.org>
parents:
16639
diff
changeset
|
50 static QStringList color_names (void); |
64f9a3e301d3
don't store default values in resource manager class
John W. Eaton <jwe@octave.org>
parents:
16639
diff
changeset
|
51 |
16639
ba808cd9d86c
simplify QTerminal inheritance scheme
John W. Eaton <jwe@octave.org>
parents:
16570
diff
changeset
|
52 virtual ~QTerminal (void) { } |
ba808cd9d86c
simplify QTerminal inheritance scheme
John W. Eaton <jwe@octave.org>
parents:
16570
diff
changeset
|
53 |
16794
1d1f02e0f6b4
GUI: enable clipboard content detection for terminal window context menu
John Donoghue <john.donoghue@ieee.org>
parents:
16718
diff
changeset
|
54 virtual void setTerminalFont (const QFont& font) = 0; |
1d1f02e0f6b4
GUI: enable clipboard content detection for terminal window context menu
John Donoghue <john.donoghue@ieee.org>
parents:
16718
diff
changeset
|
55 |
1d1f02e0f6b4
GUI: enable clipboard content detection for terminal window context menu
John Donoghue <john.donoghue@ieee.org>
parents:
16718
diff
changeset
|
56 virtual void setSize (int h, int v) = 0; |
16639
ba808cd9d86c
simplify QTerminal inheritance scheme
John W. Eaton <jwe@octave.org>
parents:
16570
diff
changeset
|
57 |
16794
1d1f02e0f6b4
GUI: enable clipboard content detection for terminal window context menu
John Donoghue <john.donoghue@ieee.org>
parents:
16718
diff
changeset
|
58 virtual void sendText (const QString& text) = 0; |
16639
ba808cd9d86c
simplify QTerminal inheritance scheme
John W. Eaton <jwe@octave.org>
parents:
16570
diff
changeset
|
59 |
16794
1d1f02e0f6b4
GUI: enable clipboard content detection for terminal window context menu
John Donoghue <john.donoghue@ieee.org>
parents:
16718
diff
changeset
|
60 virtual QString selectedText () = 0; |
16639
ba808cd9d86c
simplify QTerminal inheritance scheme
John W. Eaton <jwe@octave.org>
parents:
16570
diff
changeset
|
61 |
19690
bd1369a2a651
add extra action for interrupting with Ctrl-C (bug #44204)
Torsten <ttl@justmail.de>
parents:
19303
diff
changeset
|
62 virtual void has_extra_interrupt (bool extra) = 0; |
bd1369a2a651
add extra action for interrupting with Ctrl-C (bug #44204)
Torsten <ttl@justmail.de>
parents:
19303
diff
changeset
|
63 |
16639
ba808cd9d86c
simplify QTerminal inheritance scheme
John W. Eaton <jwe@octave.org>
parents:
16570
diff
changeset
|
64 enum CursorType |
17790
86c6ae5f969e
Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
65 { |
86c6ae5f969e
Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
66 UnderlineCursor, |
86c6ae5f969e
Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
67 BlockCursor, |
86c6ae5f969e
Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
68 IBeamCursor |
86c6ae5f969e
Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
69 }; |
16639
ba808cd9d86c
simplify QTerminal inheritance scheme
John W. Eaton <jwe@octave.org>
parents:
16570
diff
changeset
|
70 |
ba808cd9d86c
simplify QTerminal inheritance scheme
John W. Eaton <jwe@octave.org>
parents:
16570
diff
changeset
|
71 virtual void setCursorType (CursorType type, bool blinking) |
ba808cd9d86c
simplify QTerminal inheritance scheme
John W. Eaton <jwe@octave.org>
parents:
16570
diff
changeset
|
72 { |
ba808cd9d86c
simplify QTerminal inheritance scheme
John W. Eaton <jwe@octave.org>
parents:
16570
diff
changeset
|
73 // Provide empty default impl in order to avoid conflicts with the |
ba808cd9d86c
simplify QTerminal inheritance scheme
John W. Eaton <jwe@octave.org>
parents:
16570
diff
changeset
|
74 // win impl. |
ba808cd9d86c
simplify QTerminal inheritance scheme
John W. Eaton <jwe@octave.org>
parents:
16570
diff
changeset
|
75 |
ba808cd9d86c
simplify QTerminal inheritance scheme
John W. Eaton <jwe@octave.org>
parents:
16570
diff
changeset
|
76 Q_UNUSED (type); |
ba808cd9d86c
simplify QTerminal inheritance scheme
John W. Eaton <jwe@octave.org>
parents:
16570
diff
changeset
|
77 Q_UNUSED (blinking); |
ba808cd9d86c
simplify QTerminal inheritance scheme
John W. Eaton <jwe@octave.org>
parents:
16570
diff
changeset
|
78 } |
ba808cd9d86c
simplify QTerminal inheritance scheme
John W. Eaton <jwe@octave.org>
parents:
16570
diff
changeset
|
79 |
ba808cd9d86c
simplify QTerminal inheritance scheme
John W. Eaton <jwe@octave.org>
parents:
16570
diff
changeset
|
80 virtual void setBackgroundColor (const QColor& color) = 0; |
ba808cd9d86c
simplify QTerminal inheritance scheme
John W. Eaton <jwe@octave.org>
parents:
16570
diff
changeset
|
81 |
ba808cd9d86c
simplify QTerminal inheritance scheme
John W. Eaton <jwe@octave.org>
parents:
16570
diff
changeset
|
82 virtual void setForegroundColor (const QColor& color) = 0; |
ba808cd9d86c
simplify QTerminal inheritance scheme
John W. Eaton <jwe@octave.org>
parents:
16570
diff
changeset
|
83 |
ba808cd9d86c
simplify QTerminal inheritance scheme
John W. Eaton <jwe@octave.org>
parents:
16570
diff
changeset
|
84 virtual void setSelectionColor (const QColor& color) = 0; |
ba808cd9d86c
simplify QTerminal inheritance scheme
John W. Eaton <jwe@octave.org>
parents:
16570
diff
changeset
|
85 |
ba808cd9d86c
simplify QTerminal inheritance scheme
John W. Eaton <jwe@octave.org>
parents:
16570
diff
changeset
|
86 virtual void setCursorColor (bool useForegroundColor, |
ba808cd9d86c
simplify QTerminal inheritance scheme
John W. Eaton <jwe@octave.org>
parents:
16570
diff
changeset
|
87 const QColor& color) = 0; |
ba808cd9d86c
simplify QTerminal inheritance scheme
John W. Eaton <jwe@octave.org>
parents:
16570
diff
changeset
|
88 |
18610
6e81b59d657c
Add preference for terminal windows buffer size (bug #41474)
Ahsan Ali Shahid <ahsan.ali.shahid@gmail.com>
parents:
18555
diff
changeset
|
89 virtual void setScrollBufferSize(int value=1000) = 0; |
6e81b59d657c
Add preference for terminal windows buffer size (bug #41474)
Ahsan Ali Shahid <ahsan.ali.shahid@gmail.com>
parents:
18555
diff
changeset
|
90 |
16648
b04413e5a811
improve handling of interrupts, copy and paste shortcuts
John W. Eaton <jwe@octave.org>
parents:
16641
diff
changeset
|
91 signals: |
b04413e5a811
improve handling of interrupts, copy and paste shortcuts
John W. Eaton <jwe@octave.org>
parents:
16641
diff
changeset
|
92 |
b04413e5a811
improve handling of interrupts, copy and paste shortcuts
John W. Eaton <jwe@octave.org>
parents:
16641
diff
changeset
|
93 void report_status_message (const QString&); |
b04413e5a811
improve handling of interrupts, copy and paste shortcuts
John W. Eaton <jwe@octave.org>
parents:
16641
diff
changeset
|
94 |
17920
5c3f22dd0bbb
raise SIGINT in octave_interpreter instead of in QTerminal
John W. Eaton <jwe@octave.org>
parents:
17795
diff
changeset
|
95 void interrupt_signal (void); |
5c3f22dd0bbb
raise SIGINT in octave_interpreter instead of in QTerminal
John W. Eaton <jwe@octave.org>
parents:
17795
diff
changeset
|
96 |
16639
ba808cd9d86c
simplify QTerminal inheritance scheme
John W. Eaton <jwe@octave.org>
parents:
16570
diff
changeset
|
97 public slots: |
ba808cd9d86c
simplify QTerminal inheritance scheme
John W. Eaton <jwe@octave.org>
parents:
16570
diff
changeset
|
98 |
ba808cd9d86c
simplify QTerminal inheritance scheme
John W. Eaton <jwe@octave.org>
parents:
16570
diff
changeset
|
99 virtual void copyClipboard (void) = 0; |
ba808cd9d86c
simplify QTerminal inheritance scheme
John W. Eaton <jwe@octave.org>
parents:
16570
diff
changeset
|
100 |
ba808cd9d86c
simplify QTerminal inheritance scheme
John W. Eaton <jwe@octave.org>
parents:
16570
diff
changeset
|
101 virtual void pasteClipboard (void) = 0; |
16413
28136851099a
remove _terminal pointer from main_window, it is contained by other Qt object
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
15894
diff
changeset
|
102 |
18555
2d5d0d86432e
gui: Add select all menu (Bug #41797)
John Donoghue <john.donoghue@ieee.org>
parents:
17920
diff
changeset
|
103 virtual void selectAll (void) = 0; |
2d5d0d86432e
gui: Add select all menu (Bug #41797)
John Donoghue <john.donoghue@ieee.org>
parents:
17920
diff
changeset
|
104 |
16639
ba808cd9d86c
simplify QTerminal inheritance scheme
John W. Eaton <jwe@octave.org>
parents:
16570
diff
changeset
|
105 virtual void handleCustomContextMenuRequested (const QPoint& at) |
ba808cd9d86c
simplify QTerminal inheritance scheme
John W. Eaton <jwe@octave.org>
parents:
16570
diff
changeset
|
106 { |
16794
1d1f02e0f6b4
GUI: enable clipboard content detection for terminal window context menu
John Donoghue <john.donoghue@ieee.org>
parents:
16718
diff
changeset
|
107 QClipboard * cb = QApplication::clipboard (); |
1d1f02e0f6b4
GUI: enable clipboard content detection for terminal window context menu
John Donoghue <john.donoghue@ieee.org>
parents:
16718
diff
changeset
|
108 |
1d1f02e0f6b4
GUI: enable clipboard content detection for terminal window context menu
John Donoghue <john.donoghue@ieee.org>
parents:
16718
diff
changeset
|
109 _paste_action->setEnabled (cb->text().length() > 0); |
1d1f02e0f6b4
GUI: enable clipboard content detection for terminal window context menu
John Donoghue <john.donoghue@ieee.org>
parents:
16718
diff
changeset
|
110 _copy_action->setEnabled (selectedText().length() > 0); |
17790
86c6ae5f969e
Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
111 |
16639
ba808cd9d86c
simplify QTerminal inheritance scheme
John W. Eaton <jwe@octave.org>
parents:
16570
diff
changeset
|
112 _contextMenu->move (mapToGlobal (at)); |
ba808cd9d86c
simplify QTerminal inheritance scheme
John W. Eaton <jwe@octave.org>
parents:
16570
diff
changeset
|
113 _contextMenu->show (); |
ba808cd9d86c
simplify QTerminal inheritance scheme
John W. Eaton <jwe@octave.org>
parents:
16570
diff
changeset
|
114 } |
ba808cd9d86c
simplify QTerminal inheritance scheme
John W. Eaton <jwe@octave.org>
parents:
16570
diff
changeset
|
115 |
ba808cd9d86c
simplify QTerminal inheritance scheme
John W. Eaton <jwe@octave.org>
parents:
16570
diff
changeset
|
116 void notice_settings (const QSettings *settings); |
ba808cd9d86c
simplify QTerminal inheritance scheme
John W. Eaton <jwe@octave.org>
parents:
16570
diff
changeset
|
117 |
19303
c6615ca0a11d
horizontal scrollbar for GUI terminal on Windows systems
John W. Eaton <jwe@octave.org>
parents:
18610
diff
changeset
|
118 virtual void init_terminal_size (void) { } |
c6615ca0a11d
horizontal scrollbar for GUI terminal on Windows systems
John W. Eaton <jwe@octave.org>
parents:
18610
diff
changeset
|
119 |
17920
5c3f22dd0bbb
raise SIGINT in octave_interpreter instead of in QTerminal
John W. Eaton <jwe@octave.org>
parents:
17795
diff
changeset
|
120 void terminal_interrupt (void) { emit interrupt_signal (); } |
5c3f22dd0bbb
raise SIGINT in octave_interpreter instead of in QTerminal
John W. Eaton <jwe@octave.org>
parents:
17795
diff
changeset
|
121 |
19943
88233ac3f3ea
fix issue with ctrl-c for copying when editor has focus and is docked
Torsten <ttl@justmail.de>
parents:
19936
diff
changeset
|
122 void set_global_shortcuts (bool focus_out); |
88233ac3f3ea
fix issue with ctrl-c for copying when editor has focus and is docked
Torsten <ttl@justmail.de>
parents:
19936
diff
changeset
|
123 |
16639
ba808cd9d86c
simplify QTerminal inheritance scheme
John W. Eaton <jwe@octave.org>
parents:
16570
diff
changeset
|
124 protected: |
ba808cd9d86c
simplify QTerminal inheritance scheme
John W. Eaton <jwe@octave.org>
parents:
16570
diff
changeset
|
125 |
ba808cd9d86c
simplify QTerminal inheritance scheme
John W. Eaton <jwe@octave.org>
parents:
16570
diff
changeset
|
126 QTerminal (QWidget *xparent = 0) : QWidget (xparent) |
ba808cd9d86c
simplify QTerminal inheritance scheme
John W. Eaton <jwe@octave.org>
parents:
16570
diff
changeset
|
127 { |
19690
bd1369a2a651
add extra action for interrupting with Ctrl-C (bug #44204)
Torsten <ttl@justmail.de>
parents:
19303
diff
changeset
|
128 // context menu |
16639
ba808cd9d86c
simplify QTerminal inheritance scheme
John W. Eaton <jwe@octave.org>
parents:
16570
diff
changeset
|
129 setContextMenuPolicy (Qt::CustomContextMenu); |
ba808cd9d86c
simplify QTerminal inheritance scheme
John W. Eaton <jwe@octave.org>
parents:
16570
diff
changeset
|
130 |
ba808cd9d86c
simplify QTerminal inheritance scheme
John W. Eaton <jwe@octave.org>
parents:
16570
diff
changeset
|
131 _contextMenu = new QMenu (this); |
ba808cd9d86c
simplify QTerminal inheritance scheme
John W. Eaton <jwe@octave.org>
parents:
16570
diff
changeset
|
132 |
16794
1d1f02e0f6b4
GUI: enable clipboard content detection for terminal window context menu
John Donoghue <john.donoghue@ieee.org>
parents:
16718
diff
changeset
|
133 _copy_action = _contextMenu->addAction ( |
19936
29fe196d2ce0
GUI: use reource manager for command window icons (Bug #44528)
John Donoghue <john.donoghue@ieee.org>
parents:
19907
diff
changeset
|
134 resource_manager::icon ("edit-copy"), |
17790
86c6ae5f969e
Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
135 tr ("Copy"), this, SLOT (copyClipboard ())); |
16649 | 136 |
16794
1d1f02e0f6b4
GUI: enable clipboard content detection for terminal window context menu
John Donoghue <john.donoghue@ieee.org>
parents:
16718
diff
changeset
|
137 _paste_action = _contextMenu->addAction ( |
19936
29fe196d2ce0
GUI: use reource manager for command window icons (Bug #44528)
John Donoghue <john.donoghue@ieee.org>
parents:
19907
diff
changeset
|
138 resource_manager::icon ("edit-paste"), |
17790
86c6ae5f969e
Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
139 tr ("Paste"), this, SLOT (pasteClipboard ())); |
16718
0495339998f8
context menu of terminal widget: add icons and an entry to clear the console
Torsten <ttl@justmail.de>
parents:
16658
diff
changeset
|
140 |
0495339998f8
context menu of terminal widget: add icons and an entry to clear the console
Torsten <ttl@justmail.de>
parents:
16658
diff
changeset
|
141 _contextMenu->addSeparator (); |
0495339998f8
context menu of terminal widget: add icons and an entry to clear the console
Torsten <ttl@justmail.de>
parents:
16658
diff
changeset
|
142 |
18555
2d5d0d86432e
gui: Add select all menu (Bug #41797)
John Donoghue <john.donoghue@ieee.org>
parents:
17920
diff
changeset
|
143 _selectall_action = _contextMenu->addAction ( |
2d5d0d86432e
gui: Add select all menu (Bug #41797)
John Donoghue <john.donoghue@ieee.org>
parents:
17920
diff
changeset
|
144 tr ("Select All"), this, SLOT (selectAll ())); |
2d5d0d86432e
gui: Add select all menu (Bug #41797)
John Donoghue <john.donoghue@ieee.org>
parents:
17920
diff
changeset
|
145 |
2d5d0d86432e
gui: Add select all menu (Bug #41797)
John Donoghue <john.donoghue@ieee.org>
parents:
17920
diff
changeset
|
146 |
2d5d0d86432e
gui: Add select all menu (Bug #41797)
John Donoghue <john.donoghue@ieee.org>
parents:
17920
diff
changeset
|
147 _contextMenu->addSeparator (); |
2d5d0d86432e
gui: Add select all menu (Bug #41797)
John Donoghue <john.donoghue@ieee.org>
parents:
17920
diff
changeset
|
148 |
19726
94cc1bdaf884
Change text "Clear all" to "Clear Window" in right click menu (bug #44015).
Rik <rik@octave.org>
parents:
19697
diff
changeset
|
149 _contextMenu->addAction (tr ("Clear Window"), parent (), |
16718
0495339998f8
context menu of terminal widget: add icons and an entry to clear the console
Torsten <ttl@justmail.de>
parents:
16658
diff
changeset
|
150 SLOT (handle_clear_command_window_request ())); |
16639
ba808cd9d86c
simplify QTerminal inheritance scheme
John W. Eaton <jwe@octave.org>
parents:
16570
diff
changeset
|
151 |
16648
b04413e5a811
improve handling of interrupts, copy and paste shortcuts
John W. Eaton <jwe@octave.org>
parents:
16641
diff
changeset
|
152 connect (this, SIGNAL (customContextMenuRequested (QPoint)), |
b04413e5a811
improve handling of interrupts, copy and paste shortcuts
John W. Eaton <jwe@octave.org>
parents:
16641
diff
changeset
|
153 this, SLOT (handleCustomContextMenuRequested (QPoint))); |
b04413e5a811
improve handling of interrupts, copy and paste shortcuts
John W. Eaton <jwe@octave.org>
parents:
16641
diff
changeset
|
154 |
b04413e5a811
improve handling of interrupts, copy and paste shortcuts
John W. Eaton <jwe@octave.org>
parents:
16641
diff
changeset
|
155 connect (this, SIGNAL (report_status_message (const QString&)), |
b04413e5a811
improve handling of interrupts, copy and paste shortcuts
John W. Eaton <jwe@octave.org>
parents:
16641
diff
changeset
|
156 xparent, SLOT (report_status_message (const QString&))); |
b04413e5a811
improve handling of interrupts, copy and paste shortcuts
John W. Eaton <jwe@octave.org>
parents:
16641
diff
changeset
|
157 |
b04413e5a811
improve handling of interrupts, copy and paste shortcuts
John W. Eaton <jwe@octave.org>
parents:
16641
diff
changeset
|
158 connect (xparent, SIGNAL (settings_changed (const QSettings *)), |
b04413e5a811
improve handling of interrupts, copy and paste shortcuts
John W. Eaton <jwe@octave.org>
parents:
16641
diff
changeset
|
159 this, SLOT (notice_settings (const QSettings *))); |
b04413e5a811
improve handling of interrupts, copy and paste shortcuts
John W. Eaton <jwe@octave.org>
parents:
16641
diff
changeset
|
160 |
19303
c6615ca0a11d
horizontal scrollbar for GUI terminal on Windows systems
John W. Eaton <jwe@octave.org>
parents:
18610
diff
changeset
|
161 connect (xparent, SIGNAL (init_terminal_size_signal ()), |
c6615ca0a11d
horizontal scrollbar for GUI terminal on Windows systems
John W. Eaton <jwe@octave.org>
parents:
18610
diff
changeset
|
162 this, SLOT (init_terminal_size ())); |
c6615ca0a11d
horizontal scrollbar for GUI terminal on Windows systems
John W. Eaton <jwe@octave.org>
parents:
18610
diff
changeset
|
163 |
16648
b04413e5a811
improve handling of interrupts, copy and paste shortcuts
John W. Eaton <jwe@octave.org>
parents:
16641
diff
changeset
|
164 connect (xparent, SIGNAL (copyClipboard_signal ()), |
b04413e5a811
improve handling of interrupts, copy and paste shortcuts
John W. Eaton <jwe@octave.org>
parents:
16641
diff
changeset
|
165 this, SLOT (copyClipboard ())); |
b04413e5a811
improve handling of interrupts, copy and paste shortcuts
John W. Eaton <jwe@octave.org>
parents:
16641
diff
changeset
|
166 |
b04413e5a811
improve handling of interrupts, copy and paste shortcuts
John W. Eaton <jwe@octave.org>
parents:
16641
diff
changeset
|
167 connect (xparent, SIGNAL (pasteClipboard_signal ()), |
b04413e5a811
improve handling of interrupts, copy and paste shortcuts
John W. Eaton <jwe@octave.org>
parents:
16641
diff
changeset
|
168 this, SLOT (pasteClipboard ())); |
18555
2d5d0d86432e
gui: Add select all menu (Bug #41797)
John Donoghue <john.donoghue@ieee.org>
parents:
17920
diff
changeset
|
169 |
2d5d0d86432e
gui: Add select all menu (Bug #41797)
John Donoghue <john.donoghue@ieee.org>
parents:
17920
diff
changeset
|
170 connect (xparent, SIGNAL (selectAll_signal ()), |
2d5d0d86432e
gui: Add select all menu (Bug #41797)
John Donoghue <john.donoghue@ieee.org>
parents:
17920
diff
changeset
|
171 this, SLOT (selectAll ())); |
19690
bd1369a2a651
add extra action for interrupting with Ctrl-C (bug #44204)
Torsten <ttl@justmail.de>
parents:
19303
diff
changeset
|
172 |
bd1369a2a651
add extra action for interrupting with Ctrl-C (bug #44204)
Torsten <ttl@justmail.de>
parents:
19303
diff
changeset
|
173 // extra interrupt action |
bd1369a2a651
add extra action for interrupting with Ctrl-C (bug #44204)
Torsten <ttl@justmail.de>
parents:
19303
diff
changeset
|
174 _interrupt_action = new QAction (this); |
bd1369a2a651
add extra action for interrupting with Ctrl-C (bug #44204)
Torsten <ttl@justmail.de>
parents:
19303
diff
changeset
|
175 addAction (_interrupt_action); |
bd1369a2a651
add extra action for interrupting with Ctrl-C (bug #44204)
Torsten <ttl@justmail.de>
parents:
19303
diff
changeset
|
176 |
bd1369a2a651
add extra action for interrupting with Ctrl-C (bug #44204)
Torsten <ttl@justmail.de>
parents:
19303
diff
changeset
|
177 _interrupt_action->setShortcut ( |
bd1369a2a651
add extra action for interrupting with Ctrl-C (bug #44204)
Torsten <ttl@justmail.de>
parents:
19303
diff
changeset
|
178 QKeySequence (Qt::ControlModifier + Qt::Key_C)); |
bd1369a2a651
add extra action for interrupting with Ctrl-C (bug #44204)
Torsten <ttl@justmail.de>
parents:
19303
diff
changeset
|
179 |
19907 | 180 connect (_interrupt_action, SIGNAL (triggered ()), |
19690
bd1369a2a651
add extra action for interrupting with Ctrl-C (bug #44204)
Torsten <ttl@justmail.de>
parents:
19303
diff
changeset
|
181 this, SLOT (terminal_interrupt ())); |
20987
f99cbd86a0f9
Prevent closing GUI by Ctrl+D in terminal (bug #46661)
Torsten <ttl@justmail.de>
parents:
19943
diff
changeset
|
182 |
f99cbd86a0f9
Prevent closing GUI by Ctrl+D in terminal (bug #46661)
Torsten <ttl@justmail.de>
parents:
19943
diff
changeset
|
183 // dummy (nop) action catching Ctrl-D in terminal, no connection |
f99cbd86a0f9
Prevent closing GUI by Ctrl+D in terminal (bug #46661)
Torsten <ttl@justmail.de>
parents:
19943
diff
changeset
|
184 _nop_action = new QAction (this); |
f99cbd86a0f9
Prevent closing GUI by Ctrl+D in terminal (bug #46661)
Torsten <ttl@justmail.de>
parents:
19943
diff
changeset
|
185 addAction (_nop_action); |
f99cbd86a0f9
Prevent closing GUI by Ctrl+D in terminal (bug #46661)
Torsten <ttl@justmail.de>
parents:
19943
diff
changeset
|
186 |
f99cbd86a0f9
Prevent closing GUI by Ctrl+D in terminal (bug #46661)
Torsten <ttl@justmail.de>
parents:
19943
diff
changeset
|
187 _nop_action->setShortcut ( |
f99cbd86a0f9
Prevent closing GUI by Ctrl+D in terminal (bug #46661)
Torsten <ttl@justmail.de>
parents:
19943
diff
changeset
|
188 QKeySequence (Qt::ControlModifier + Qt::Key_D)); |
16639
ba808cd9d86c
simplify QTerminal inheritance scheme
John W. Eaton <jwe@octave.org>
parents:
16570
diff
changeset
|
189 } |
ba808cd9d86c
simplify QTerminal inheritance scheme
John W. Eaton <jwe@octave.org>
parents:
16570
diff
changeset
|
190 |
ba808cd9d86c
simplify QTerminal inheritance scheme
John W. Eaton <jwe@octave.org>
parents:
16570
diff
changeset
|
191 private: |
ba808cd9d86c
simplify QTerminal inheritance scheme
John W. Eaton <jwe@octave.org>
parents:
16570
diff
changeset
|
192 |
17790
86c6ae5f969e
Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
193 QMenu *_contextMenu; |
86c6ae5f969e
Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
194 QAction * _copy_action; |
86c6ae5f969e
Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
195 QAction * _paste_action; |
18555
2d5d0d86432e
gui: Add select all menu (Bug #41797)
John Donoghue <john.donoghue@ieee.org>
parents:
17920
diff
changeset
|
196 QAction * _selectall_action; |
19690
bd1369a2a651
add extra action for interrupting with Ctrl-C (bug #44204)
Torsten <ttl@justmail.de>
parents:
19303
diff
changeset
|
197 |
bd1369a2a651
add extra action for interrupting with Ctrl-C (bug #44204)
Torsten <ttl@justmail.de>
parents:
19303
diff
changeset
|
198 QAction *_interrupt_action; |
20987
f99cbd86a0f9
Prevent closing GUI by Ctrl+D in terminal (bug #46661)
Torsten <ttl@justmail.de>
parents:
19943
diff
changeset
|
199 QAction *_nop_action; |
16639
ba808cd9d86c
simplify QTerminal inheritance scheme
John W. Eaton <jwe@octave.org>
parents:
16570
diff
changeset
|
200 }; |
15631 | 201 |
15651
845cebf281aa
Added files of QConsole.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
15650
diff
changeset
|
202 #endif // QTERMINAL_H |