Mercurial > octave
annotate libgui/qterminal/libqterminal/QTerminal.h @ 27288:0a2e5c808709
allow editing and showing help on selected text in console (bug #41276)
* QTerminal.cc (handleCustomContextMenuRequested): make new context menu
action visible depending on selected text and on the occurrance of a word
within the selection, set menu text and action data accordingly;
(edit_selected): new slot for editing a selected function;
(help_on_expression): new slot for showing help on selected expressions;
(doc_on_expression): new slot for showing documentation on selected expr.
* QTerminal.h: new signal show_doc_signal, new slots edit_selected,
help_on_expression, doc_on_expression and new actions m_edit_selected_action,
m_help_selected_action, and m_doc_selected_action;
(ctor): add new actions on editing or showing help/doc on selected
expressions, connect new signal show_doc_signal to the already
existing slot in main_window
author | Torsten Lilge <ttl-octave@mailbox.org> |
---|---|
date | Wed, 24 Jul 2019 07:47:33 +0200 |
parents | 7455523fdf01 |
children | 315c35e6037c |
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 |
26376
00f796120a6d
maint: Update copyright dates in all source files.
John W. Eaton <jwe@octave.org>
parents:
25955
diff
changeset
|
3 Copyright (C) 2012-2019 Michael Goffioul. |
00f796120a6d
maint: Update copyright dates in all source files.
John W. Eaton <jwe@octave.org>
parents:
25955
diff
changeset
|
4 Copyright (C) 2012-2019 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 |
24534
194eb4bd202b
maint: Update punctuation for GPL v3 license text.
Rik <rik@octave.org>
parents:
23808
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, |
24534
194eb4bd202b
maint: Update punctuation for GPL v3 license text.
Rik <rik@octave.org>
parents:
23808
diff
changeset
|
20 see <https://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 |
23795
980f39c3ab90
Use C++11 nullptr rather than 0 in code (bug #51565).
Rik <rik@octave.org>
parents:
23403
diff
changeset
|
46 static QTerminal *create (QWidget *xparent = nullptr); |
16639
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 |
22868
87e3163f6c87
use c++11 "= default" syntax for declaration of trivial destructors
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
52 virtual ~QTerminal (void) = default; |
16639
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 |
23403
fee531225679
make url in the console window clickable under linux (bug #41076)
Torsten <mttl@mailbox.org>
parents:
23220
diff
changeset
|
64 virtual QList<QAction*> get_hotspot_actions (const QPoint&) |
25103
078b795c5219
maint: style check C++ ahead of 4.4 release.
Rik <rik@octave.org>
parents:
25054
diff
changeset
|
65 { return QList<QAction*> (); } |
23403
fee531225679
make url in the console window clickable under linux (bug #41076)
Torsten <mttl@mailbox.org>
parents:
23220
diff
changeset
|
66 |
16639
ba808cd9d86c
simplify QTerminal inheritance scheme
John W. Eaton <jwe@octave.org>
parents:
16570
diff
changeset
|
67 enum CursorType |
17790
86c6ae5f969e
Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
68 { |
86c6ae5f969e
Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
69 UnderlineCursor, |
86c6ae5f969e
Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
70 BlockCursor, |
86c6ae5f969e
Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
71 IBeamCursor |
86c6ae5f969e
Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
72 }; |
16639
ba808cd9d86c
simplify QTerminal inheritance scheme
John W. Eaton <jwe@octave.org>
parents:
16570
diff
changeset
|
73 |
ba808cd9d86c
simplify QTerminal inheritance scheme
John W. Eaton <jwe@octave.org>
parents:
16570
diff
changeset
|
74 virtual void setCursorType (CursorType type, bool blinking) |
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 // 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
|
77 // win impl. |
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 Q_UNUSED (type); |
ba808cd9d86c
simplify QTerminal inheritance scheme
John W. Eaton <jwe@octave.org>
parents:
16570
diff
changeset
|
80 Q_UNUSED (blinking); |
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 |
ba808cd9d86c
simplify QTerminal inheritance scheme
John W. Eaton <jwe@octave.org>
parents:
16570
diff
changeset
|
83 virtual void setBackgroundColor (const QColor& color) = 0; |
ba808cd9d86c
simplify QTerminal inheritance scheme
John W. Eaton <jwe@octave.org>
parents:
16570
diff
changeset
|
84 |
ba808cd9d86c
simplify QTerminal inheritance scheme
John W. Eaton <jwe@octave.org>
parents:
16570
diff
changeset
|
85 virtual void setForegroundColor (const QColor& color) = 0; |
ba808cd9d86c
simplify QTerminal inheritance scheme
John W. Eaton <jwe@octave.org>
parents:
16570
diff
changeset
|
86 |
ba808cd9d86c
simplify QTerminal inheritance scheme
John W. Eaton <jwe@octave.org>
parents:
16570
diff
changeset
|
87 virtual void setSelectionColor (const QColor& color) = 0; |
ba808cd9d86c
simplify QTerminal inheritance scheme
John W. Eaton <jwe@octave.org>
parents:
16570
diff
changeset
|
88 |
ba808cd9d86c
simplify QTerminal inheritance scheme
John W. Eaton <jwe@octave.org>
parents:
16570
diff
changeset
|
89 virtual void setCursorColor (bool useForegroundColor, |
ba808cd9d86c
simplify QTerminal inheritance scheme
John W. Eaton <jwe@octave.org>
parents:
16570
diff
changeset
|
90 const QColor& color) = 0; |
ba808cd9d86c
simplify QTerminal inheritance scheme
John W. Eaton <jwe@octave.org>
parents:
16570
diff
changeset
|
91 |
18610
6e81b59d657c
Add preference for terminal windows buffer size (bug #41474)
Ahsan Ali Shahid <ahsan.ali.shahid@gmail.com>
parents:
18555
diff
changeset
|
92 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
|
93 |
16648
b04413e5a811
improve handling of interrupts, copy and paste shortcuts
John W. Eaton <jwe@octave.org>
parents:
16641
diff
changeset
|
94 signals: |
b04413e5a811
improve handling of interrupts, copy and paste shortcuts
John W. Eaton <jwe@octave.org>
parents:
16641
diff
changeset
|
95 |
b04413e5a811
improve handling of interrupts, copy and paste shortcuts
John W. Eaton <jwe@octave.org>
parents:
16641
diff
changeset
|
96 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
|
97 |
17920
5c3f22dd0bbb
raise SIGINT in octave_interpreter instead of in QTerminal
John W. Eaton <jwe@octave.org>
parents:
17795
diff
changeset
|
98 void interrupt_signal (void); |
5c3f22dd0bbb
raise SIGINT in octave_interpreter instead of in QTerminal
John W. Eaton <jwe@octave.org>
parents:
17795
diff
changeset
|
99 |
20995
aab7a3c7168e
edit a file from an error message in the terminal (bug #35619)
Torsten <ttl@justmail.de>
parents:
20994
diff
changeset
|
100 void edit_mfile_request (const QString&, int); |
aab7a3c7168e
edit a file from an error message in the terminal (bug #35619)
Torsten <ttl@justmail.de>
parents:
20994
diff
changeset
|
101 |
27288
0a2e5c808709
allow editing and showing help on selected text in console (bug #41276)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27276
diff
changeset
|
102 void show_doc_signal (const QString&); |
0a2e5c808709
allow editing and showing help on selected text in console (bug #41276)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27276
diff
changeset
|
103 |
25813
d98d7df9fd15
updated context menus in editor and console window (bug #46884)
Torsten <mttl@mailbox.org>
parents:
25103
diff
changeset
|
104 void execute_command_in_terminal_signal (const QString&); |
d98d7df9fd15
updated context menus in editor and console window (bug #46884)
Torsten <mttl@mailbox.org>
parents:
25103
diff
changeset
|
105 |
16639
ba808cd9d86c
simplify QTerminal inheritance scheme
John W. Eaton <jwe@octave.org>
parents:
16570
diff
changeset
|
106 public slots: |
ba808cd9d86c
simplify QTerminal inheritance scheme
John W. Eaton <jwe@octave.org>
parents:
16570
diff
changeset
|
107 |
ba808cd9d86c
simplify QTerminal inheritance scheme
John W. Eaton <jwe@octave.org>
parents:
16570
diff
changeset
|
108 virtual void copyClipboard (void) = 0; |
ba808cd9d86c
simplify QTerminal inheritance scheme
John W. Eaton <jwe@octave.org>
parents:
16570
diff
changeset
|
109 |
ba808cd9d86c
simplify QTerminal inheritance scheme
John W. Eaton <jwe@octave.org>
parents:
16570
diff
changeset
|
110 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
|
111 |
18555
2d5d0d86432e
gui: Add select all menu (Bug #41797)
John Donoghue <john.donoghue@ieee.org>
parents:
17920
diff
changeset
|
112 virtual void selectAll (void) = 0; |
2d5d0d86432e
gui: Add select all menu (Bug #41797)
John Donoghue <john.donoghue@ieee.org>
parents:
17920
diff
changeset
|
113 |
20995
aab7a3c7168e
edit a file from an error message in the terminal (bug #35619)
Torsten <ttl@justmail.de>
parents:
20994
diff
changeset
|
114 virtual void handleCustomContextMenuRequested (const QPoint& at); |
16639
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 |
25813
d98d7df9fd15
updated context menus in editor and console window (bug #46884)
Torsten <mttl@mailbox.org>
parents:
25103
diff
changeset
|
124 void run_selection (void); |
d98d7df9fd15
updated context menus in editor and console window (bug #46884)
Torsten <mttl@mailbox.org>
parents:
25103
diff
changeset
|
125 |
20995
aab7a3c7168e
edit a file from an error message in the terminal (bug #35619)
Torsten <ttl@justmail.de>
parents:
20994
diff
changeset
|
126 void edit_file (void); |
aab7a3c7168e
edit a file from an error message in the terminal (bug #35619)
Torsten <ttl@justmail.de>
parents:
20994
diff
changeset
|
127 |
27288
0a2e5c808709
allow editing and showing help on selected text in console (bug #41276)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27276
diff
changeset
|
128 void edit_selected (void); |
0a2e5c808709
allow editing and showing help on selected text in console (bug #41276)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27276
diff
changeset
|
129 |
0a2e5c808709
allow editing and showing help on selected text in console (bug #41276)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27276
diff
changeset
|
130 void help_on_expression (void); |
0a2e5c808709
allow editing and showing help on selected text in console (bug #41276)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27276
diff
changeset
|
131 |
0a2e5c808709
allow editing and showing help on selected text in console (bug #41276)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27276
diff
changeset
|
132 void doc_on_expression (void); |
0a2e5c808709
allow editing and showing help on selected text in console (bug #41276)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27276
diff
changeset
|
133 |
23808
2b1b2a795ba6
update clickable urls in terminal also when visible terminal has no focus
Torsten <mttl@mailbox.org>
parents:
23795
diff
changeset
|
134 virtual void handle_visibility_changed (bool) { }; |
2b1b2a795ba6
update clickable urls in terminal also when visible terminal has no focus
Torsten <mttl@mailbox.org>
parents:
23795
diff
changeset
|
135 |
16639
ba808cd9d86c
simplify QTerminal inheritance scheme
John W. Eaton <jwe@octave.org>
parents:
16570
diff
changeset
|
136 protected: |
ba808cd9d86c
simplify QTerminal inheritance scheme
John W. Eaton <jwe@octave.org>
parents:
16570
diff
changeset
|
137 |
23795
980f39c3ab90
Use C++11 nullptr rather than 0 in code (bug #51565).
Rik <rik@octave.org>
parents:
23403
diff
changeset
|
138 QTerminal (QWidget *xparent = nullptr) : QWidget (xparent) |
16639
ba808cd9d86c
simplify QTerminal inheritance scheme
John W. Eaton <jwe@octave.org>
parents:
16570
diff
changeset
|
139 { |
19690
bd1369a2a651
add extra action for interrupting with Ctrl-C (bug #44204)
Torsten <ttl@justmail.de>
parents:
19303
diff
changeset
|
140 // context menu |
16639
ba808cd9d86c
simplify QTerminal inheritance scheme
John W. Eaton <jwe@octave.org>
parents:
16570
diff
changeset
|
141 setContextMenuPolicy (Qt::CustomContextMenu); |
ba808cd9d86c
simplify QTerminal inheritance scheme
John W. Eaton <jwe@octave.org>
parents:
16570
diff
changeset
|
142 |
ba808cd9d86c
simplify QTerminal inheritance scheme
John W. Eaton <jwe@octave.org>
parents:
16570
diff
changeset
|
143 _contextMenu = new QMenu (this); |
ba808cd9d86c
simplify QTerminal inheritance scheme
John W. Eaton <jwe@octave.org>
parents:
16570
diff
changeset
|
144 |
27276
7455523fdf01
style fixes: avoid breaking lines immediately after '('
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
145 _copy_action |
7455523fdf01
style fixes: avoid breaking lines immediately after '('
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
146 = _contextMenu->addAction (octave::resource_manager::icon ("edit-copy"), |
7455523fdf01
style fixes: avoid breaking lines immediately after '('
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
147 tr ("Copy"), this, SLOT (copyClipboard ())); |
16649 | 148 |
27276
7455523fdf01
style fixes: avoid breaking lines immediately after '('
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
149 _paste_action |
7455523fdf01
style fixes: avoid breaking lines immediately after '('
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
150 = _contextMenu->addAction (octave::resource_manager::icon ("edit-paste"), |
7455523fdf01
style fixes: avoid breaking lines immediately after '('
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
151 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
|
152 |
0495339998f8
context menu of terminal widget: add icons and an entry to clear the console
Torsten <ttl@justmail.de>
parents:
16658
diff
changeset
|
153 _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
|
154 |
27276
7455523fdf01
style fixes: avoid breaking lines immediately after '('
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
155 _selectall_action |
7455523fdf01
style fixes: avoid breaking lines immediately after '('
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
156 = _contextMenu->addAction (tr ("Select All"), this, SLOT (selectAll ())); |
18555
2d5d0d86432e
gui: Add select all menu (Bug #41797)
John Donoghue <john.donoghue@ieee.org>
parents:
17920
diff
changeset
|
157 |
27276
7455523fdf01
style fixes: avoid breaking lines immediately after '('
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
158 _run_selection_action |
7455523fdf01
style fixes: avoid breaking lines immediately after '('
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
159 = _contextMenu->addAction (tr ("Run Selection"), this, |
7455523fdf01
style fixes: avoid breaking lines immediately after '('
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
160 SLOT (run_selection ())); |
25813
d98d7df9fd15
updated context menus in editor and console window (bug #46884)
Torsten <mttl@mailbox.org>
parents:
25103
diff
changeset
|
161 |
27288
0a2e5c808709
allow editing and showing help on selected text in console (bug #41276)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27276
diff
changeset
|
162 m_edit_selected_action |
0a2e5c808709
allow editing and showing help on selected text in console (bug #41276)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27276
diff
changeset
|
163 = _contextMenu->addAction (tr ("Edit selection"), this, |
0a2e5c808709
allow editing and showing help on selected text in console (bug #41276)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27276
diff
changeset
|
164 SLOT (edit_selected ())); |
0a2e5c808709
allow editing and showing help on selected text in console (bug #41276)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27276
diff
changeset
|
165 m_help_selected_action |
0a2e5c808709
allow editing and showing help on selected text in console (bug #41276)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27276
diff
changeset
|
166 = _contextMenu->addAction (tr ("Help on selection"), this, |
0a2e5c808709
allow editing and showing help on selected text in console (bug #41276)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27276
diff
changeset
|
167 SLOT (help_on_expression ())); |
0a2e5c808709
allow editing and showing help on selected text in console (bug #41276)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27276
diff
changeset
|
168 m_doc_selected_action |
0a2e5c808709
allow editing and showing help on selected text in console (bug #41276)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27276
diff
changeset
|
169 = _contextMenu->addAction (tr ("Documentation on selection"), this, |
0a2e5c808709
allow editing and showing help on selected text in console (bug #41276)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27276
diff
changeset
|
170 SLOT (doc_on_expression ())); |
0a2e5c808709
allow editing and showing help on selected text in console (bug #41276)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27276
diff
changeset
|
171 |
27276
7455523fdf01
style fixes: avoid breaking lines immediately after '('
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
172 _edit_action = _contextMenu->addAction (tr (""), this, SLOT (edit_file ())); |
18555
2d5d0d86432e
gui: Add select all menu (Bug #41797)
John Donoghue <john.donoghue@ieee.org>
parents:
17920
diff
changeset
|
173 |
2d5d0d86432e
gui: Add select all menu (Bug #41797)
John Donoghue <john.donoghue@ieee.org>
parents:
17920
diff
changeset
|
174 _contextMenu->addSeparator (); |
2d5d0d86432e
gui: Add select all menu (Bug #41797)
John Donoghue <john.donoghue@ieee.org>
parents:
17920
diff
changeset
|
175 |
19726
94cc1bdaf884
Change text "Clear all" to "Clear Window" in right click menu (bug #44015).
Rik <rik@octave.org>
parents:
19697
diff
changeset
|
176 _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
|
177 SLOT (handle_clear_command_window_request ())); |
16639
ba808cd9d86c
simplify QTerminal inheritance scheme
John W. Eaton <jwe@octave.org>
parents:
16570
diff
changeset
|
178 |
16648
b04413e5a811
improve handling of interrupts, copy and paste shortcuts
John W. Eaton <jwe@octave.org>
parents:
16641
diff
changeset
|
179 connect (this, SIGNAL (customContextMenuRequested (QPoint)), |
b04413e5a811
improve handling of interrupts, copy and paste shortcuts
John W. Eaton <jwe@octave.org>
parents:
16641
diff
changeset
|
180 this, SLOT (handleCustomContextMenuRequested (QPoint))); |
b04413e5a811
improve handling of interrupts, copy and paste shortcuts
John W. Eaton <jwe@octave.org>
parents:
16641
diff
changeset
|
181 |
b04413e5a811
improve handling of interrupts, copy and paste shortcuts
John W. Eaton <jwe@octave.org>
parents:
16641
diff
changeset
|
182 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
|
183 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
|
184 |
27288
0a2e5c808709
allow editing and showing help on selected text in console (bug #41276)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27276
diff
changeset
|
185 connect (this, SIGNAL (show_doc_signal (const QString&)), |
0a2e5c808709
allow editing and showing help on selected text in console (bug #41276)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27276
diff
changeset
|
186 xparent, SLOT (handle_show_doc (const QString&))); |
0a2e5c808709
allow editing and showing help on selected text in console (bug #41276)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27276
diff
changeset
|
187 |
20995
aab7a3c7168e
edit a file from an error message in the terminal (bug #35619)
Torsten <ttl@justmail.de>
parents:
20994
diff
changeset
|
188 connect (this, SIGNAL (edit_mfile_request (const QString&, int)), |
aab7a3c7168e
edit a file from an error message in the terminal (bug #35619)
Torsten <ttl@justmail.de>
parents:
20994
diff
changeset
|
189 xparent, SLOT (edit_mfile (const QString&, int))); |
aab7a3c7168e
edit a file from an error message in the terminal (bug #35619)
Torsten <ttl@justmail.de>
parents:
20994
diff
changeset
|
190 |
25813
d98d7df9fd15
updated context menus in editor and console window (bug #46884)
Torsten <mttl@mailbox.org>
parents:
25103
diff
changeset
|
191 connect (this, SIGNAL (execute_command_in_terminal_signal (const QString&)), |
d98d7df9fd15
updated context menus in editor and console window (bug #46884)
Torsten <mttl@mailbox.org>
parents:
25103
diff
changeset
|
192 xparent, SLOT (execute_command_in_terminal (const QString&))); |
d98d7df9fd15
updated context menus in editor and console window (bug #46884)
Torsten <mttl@mailbox.org>
parents:
25103
diff
changeset
|
193 |
16648
b04413e5a811
improve handling of interrupts, copy and paste shortcuts
John W. Eaton <jwe@octave.org>
parents:
16641
diff
changeset
|
194 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
|
195 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
|
196 |
19303
c6615ca0a11d
horizontal scrollbar for GUI terminal on Windows systems
John W. Eaton <jwe@octave.org>
parents:
18610
diff
changeset
|
197 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
|
198 this, SLOT (init_terminal_size ())); |
c6615ca0a11d
horizontal scrollbar for GUI terminal on Windows systems
John W. Eaton <jwe@octave.org>
parents:
18610
diff
changeset
|
199 |
16648
b04413e5a811
improve handling of interrupts, copy and paste shortcuts
John W. Eaton <jwe@octave.org>
parents:
16641
diff
changeset
|
200 connect (xparent, SIGNAL (copyClipboard_signal ()), |
b04413e5a811
improve handling of interrupts, copy and paste shortcuts
John W. Eaton <jwe@octave.org>
parents:
16641
diff
changeset
|
201 this, SLOT (copyClipboard ())); |
b04413e5a811
improve handling of interrupts, copy and paste shortcuts
John W. Eaton <jwe@octave.org>
parents:
16641
diff
changeset
|
202 |
b04413e5a811
improve handling of interrupts, copy and paste shortcuts
John W. Eaton <jwe@octave.org>
parents:
16641
diff
changeset
|
203 connect (xparent, SIGNAL (pasteClipboard_signal ()), |
b04413e5a811
improve handling of interrupts, copy and paste shortcuts
John W. Eaton <jwe@octave.org>
parents:
16641
diff
changeset
|
204 this, SLOT (pasteClipboard ())); |
18555
2d5d0d86432e
gui: Add select all menu (Bug #41797)
John Donoghue <john.donoghue@ieee.org>
parents:
17920
diff
changeset
|
205 |
2d5d0d86432e
gui: Add select all menu (Bug #41797)
John Donoghue <john.donoghue@ieee.org>
parents:
17920
diff
changeset
|
206 connect (xparent, SIGNAL (selectAll_signal ()), |
2d5d0d86432e
gui: Add select all menu (Bug #41797)
John Donoghue <john.donoghue@ieee.org>
parents:
17920
diff
changeset
|
207 this, SLOT (selectAll ())); |
19690
bd1369a2a651
add extra action for interrupting with Ctrl-C (bug #44204)
Torsten <ttl@justmail.de>
parents:
19303
diff
changeset
|
208 |
bd1369a2a651
add extra action for interrupting with Ctrl-C (bug #44204)
Torsten <ttl@justmail.de>
parents:
19303
diff
changeset
|
209 // extra interrupt action |
bd1369a2a651
add extra action for interrupting with Ctrl-C (bug #44204)
Torsten <ttl@justmail.de>
parents:
19303
diff
changeset
|
210 _interrupt_action = new QAction (this); |
bd1369a2a651
add extra action for interrupting with Ctrl-C (bug #44204)
Torsten <ttl@justmail.de>
parents:
19303
diff
changeset
|
211 addAction (_interrupt_action); |
bd1369a2a651
add extra action for interrupting with Ctrl-C (bug #44204)
Torsten <ttl@justmail.de>
parents:
19303
diff
changeset
|
212 |
27276
7455523fdf01
style fixes: avoid breaking lines immediately after '('
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
213 _interrupt_action->setShortcut |
7455523fdf01
style fixes: avoid breaking lines immediately after '('
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
214 (QKeySequence (Qt::ControlModifier + Qt::Key_C)); |
19690
bd1369a2a651
add extra action for interrupting with Ctrl-C (bug #44204)
Torsten <ttl@justmail.de>
parents:
19303
diff
changeset
|
215 |
19907 | 216 connect (_interrupt_action, SIGNAL (triggered ()), |
25103
078b795c5219
maint: style check C++ ahead of 4.4 release.
Rik <rik@octave.org>
parents:
25054
diff
changeset
|
217 this, SLOT (terminal_interrupt ())); |
20987
f99cbd86a0f9
Prevent closing GUI by Ctrl+D in terminal (bug #46661)
Torsten <ttl@justmail.de>
parents:
19943
diff
changeset
|
218 |
f99cbd86a0f9
Prevent closing GUI by Ctrl+D in terminal (bug #46661)
Torsten <ttl@justmail.de>
parents:
19943
diff
changeset
|
219 // 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
|
220 _nop_action = new QAction (this); |
f99cbd86a0f9
Prevent closing GUI by Ctrl+D in terminal (bug #46661)
Torsten <ttl@justmail.de>
parents:
19943
diff
changeset
|
221 addAction (_nop_action); |
f99cbd86a0f9
Prevent closing GUI by Ctrl+D in terminal (bug #46661)
Torsten <ttl@justmail.de>
parents:
19943
diff
changeset
|
222 |
27276
7455523fdf01
style fixes: avoid breaking lines immediately after '('
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
223 _nop_action->setShortcut (QKeySequence (Qt::ControlModifier + Qt::Key_D)); |
16639
ba808cd9d86c
simplify QTerminal inheritance scheme
John W. Eaton <jwe@octave.org>
parents:
16570
diff
changeset
|
224 } |
ba808cd9d86c
simplify QTerminal inheritance scheme
John W. Eaton <jwe@octave.org>
parents:
16570
diff
changeset
|
225 |
ba808cd9d86c
simplify QTerminal inheritance scheme
John W. Eaton <jwe@octave.org>
parents:
16570
diff
changeset
|
226 private: |
ba808cd9d86c
simplify QTerminal inheritance scheme
John W. Eaton <jwe@octave.org>
parents:
16570
diff
changeset
|
227 |
17790
86c6ae5f969e
Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
228 QMenu *_contextMenu; |
86c6ae5f969e
Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
229 QAction * _copy_action; |
86c6ae5f969e
Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
230 QAction * _paste_action; |
18555
2d5d0d86432e
gui: Add select all menu (Bug #41797)
John Donoghue <john.donoghue@ieee.org>
parents:
17920
diff
changeset
|
231 QAction * _selectall_action; |
20995
aab7a3c7168e
edit a file from an error message in the terminal (bug #35619)
Torsten <ttl@justmail.de>
parents:
20994
diff
changeset
|
232 QAction * _edit_action; |
25813
d98d7df9fd15
updated context menus in editor and console window (bug #46884)
Torsten <mttl@mailbox.org>
parents:
25103
diff
changeset
|
233 QAction * _run_selection_action; |
27288
0a2e5c808709
allow editing and showing help on selected text in console (bug #41276)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27276
diff
changeset
|
234 QAction * m_edit_selected_action; |
0a2e5c808709
allow editing and showing help on selected text in console (bug #41276)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27276
diff
changeset
|
235 QAction * m_help_selected_action; |
0a2e5c808709
allow editing and showing help on selected text in console (bug #41276)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27276
diff
changeset
|
236 QAction * m_doc_selected_action; |
19690
bd1369a2a651
add extra action for interrupting with Ctrl-C (bug #44204)
Torsten <ttl@justmail.de>
parents:
19303
diff
changeset
|
237 |
bd1369a2a651
add extra action for interrupting with Ctrl-C (bug #44204)
Torsten <ttl@justmail.de>
parents:
19303
diff
changeset
|
238 QAction *_interrupt_action; |
20987
f99cbd86a0f9
Prevent closing GUI by Ctrl+D in terminal (bug #46661)
Torsten <ttl@justmail.de>
parents:
19943
diff
changeset
|
239 QAction *_nop_action; |
16639
ba808cd9d86c
simplify QTerminal inheritance scheme
John W. Eaton <jwe@octave.org>
parents:
16570
diff
changeset
|
240 }; |
15631 | 241 |
15651
845cebf281aa
Added files of QConsole.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
15650
diff
changeset
|
242 #endif // QTERMINAL_H |