annotate libgui/qterminal/libqterminal/QTerminal.h @ 25054:6652d3823428 stable

maint: Update copyright dates in all source files.
author John W. Eaton <jwe@octave.org>
date Fri, 30 Mar 2018 09:19:05 -0400
parents 194eb4bd202b
children 078b795c5219
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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
25054
6652d3823428 maint: Update copyright dates in all source files.
John W. Eaton <jwe@octave.org>
parents: 24534
diff changeset
3 Copyright (C) 2012-2018 Michael Goffioul.
6652d3823428 maint: Update copyright dates in all source files.
John W. Eaton <jwe@octave.org>
parents: 24534
diff changeset
4 Copyright (C) 2012-2018 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
9712f29c97de Compiles again.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
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
9712f29c97de Compiles again.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
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
9712f29c97de Compiles again.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
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&)
fee531225679 make url in the console window clickable under linux (bug #41076)
Torsten <mttl@mailbox.org>
parents: 23220
diff changeset
65 { return QList<QAction*> (); }
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
16639
ba808cd9d86c simplify QTerminal inheritance scheme
John W. Eaton <jwe@octave.org>
parents: 16570
diff changeset
102 public slots:
ba808cd9d86c simplify QTerminal inheritance scheme
John W. Eaton <jwe@octave.org>
parents: 16570
diff changeset
103
ba808cd9d86c simplify QTerminal inheritance scheme
John W. Eaton <jwe@octave.org>
parents: 16570
diff changeset
104 virtual void copyClipboard (void) = 0;
ba808cd9d86c simplify QTerminal inheritance scheme
John W. Eaton <jwe@octave.org>
parents: 16570
diff changeset
105
ba808cd9d86c simplify QTerminal inheritance scheme
John W. Eaton <jwe@octave.org>
parents: 16570
diff changeset
106 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
107
18555
2d5d0d86432e gui: Add select all menu (Bug #41797)
John Donoghue <john.donoghue@ieee.org>
parents: 17920
diff changeset
108 virtual void selectAll (void) = 0;
2d5d0d86432e gui: Add select all menu (Bug #41797)
John Donoghue <john.donoghue@ieee.org>
parents: 17920
diff changeset
109
20995
aab7a3c7168e edit a file from an error message in the terminal (bug #35619)
Torsten <ttl@justmail.de>
parents: 20994
diff changeset
110 virtual void handleCustomContextMenuRequested (const QPoint& at);
16639
ba808cd9d86c simplify QTerminal inheritance scheme
John W. Eaton <jwe@octave.org>
parents: 16570
diff changeset
111
ba808cd9d86c simplify QTerminal inheritance scheme
John W. Eaton <jwe@octave.org>
parents: 16570
diff changeset
112 void notice_settings (const QSettings *settings);
ba808cd9d86c simplify QTerminal inheritance scheme
John W. Eaton <jwe@octave.org>
parents: 16570
diff changeset
113
19303
c6615ca0a11d horizontal scrollbar for GUI terminal on Windows systems
John W. Eaton <jwe@octave.org>
parents: 18610
diff changeset
114 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
115
17920
5c3f22dd0bbb raise SIGINT in octave_interpreter instead of in QTerminal
John W. Eaton <jwe@octave.org>
parents: 17795
diff changeset
116 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
117
19943
88233ac3f3ea fix issue with ctrl-c for copying when editor has focus and is docked
Torsten <ttl@justmail.de>
parents: 19936
diff changeset
118 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
119
20995
aab7a3c7168e edit a file from an error message in the terminal (bug #35619)
Torsten <ttl@justmail.de>
parents: 20994
diff changeset
120 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
121
23808
2b1b2a795ba6 update clickable urls in terminal also when visible terminal has no focus
Torsten <mttl@mailbox.org>
parents: 23795
diff changeset
122 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
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
23795
980f39c3ab90 Use C++11 nullptr rather than 0 in code (bug #51565).
Rik <rik@octave.org>
parents: 23403
diff changeset
126 QTerminal (QWidget *xparent = nullptr) : QWidget (xparent)
16639
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
de1f8e4b6b9b more copy/paste tweaks
John W. Eaton <jwe@octave.org>
parents: 16648
diff changeset
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
20995
aab7a3c7168e edit a file from an error message in the terminal (bug #35619)
Torsten <ttl@justmail.de>
parents: 20994
diff changeset
146 _edit_action = _contextMenu->addAction (
aab7a3c7168e edit a file from an error message in the terminal (bug #35619)
Torsten <ttl@justmail.de>
parents: 20994
diff changeset
147 tr (""), this, SLOT (edit_file ()));
18555
2d5d0d86432e gui: Add select all menu (Bug #41797)
John Donoghue <john.donoghue@ieee.org>
parents: 17920
diff changeset
148
2d5d0d86432e gui: Add select all menu (Bug #41797)
John Donoghue <john.donoghue@ieee.org>
parents: 17920
diff changeset
149 _contextMenu->addSeparator ();
2d5d0d86432e gui: Add select all menu (Bug #41797)
John Donoghue <john.donoghue@ieee.org>
parents: 17920
diff changeset
150
19726
94cc1bdaf884 Change text "Clear all" to "Clear Window" in right click menu (bug #44015).
Rik <rik@octave.org>
parents: 19697
diff changeset
151 _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
152 SLOT (handle_clear_command_window_request ()));
16639
ba808cd9d86c simplify QTerminal inheritance scheme
John W. Eaton <jwe@octave.org>
parents: 16570
diff changeset
153
16648
b04413e5a811 improve handling of interrupts, copy and paste shortcuts
John W. Eaton <jwe@octave.org>
parents: 16641
diff changeset
154 connect (this, SIGNAL (customContextMenuRequested (QPoint)),
b04413e5a811 improve handling of interrupts, copy and paste shortcuts
John W. Eaton <jwe@octave.org>
parents: 16641
diff changeset
155 this, SLOT (handleCustomContextMenuRequested (QPoint)));
b04413e5a811 improve handling of interrupts, copy and paste shortcuts
John W. Eaton <jwe@octave.org>
parents: 16641
diff changeset
156
b04413e5a811 improve handling of interrupts, copy and paste shortcuts
John W. Eaton <jwe@octave.org>
parents: 16641
diff changeset
157 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
158 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
159
20995
aab7a3c7168e edit a file from an error message in the terminal (bug #35619)
Torsten <ttl@justmail.de>
parents: 20994
diff changeset
160 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
161 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
162
16648
b04413e5a811 improve handling of interrupts, copy and paste shortcuts
John W. Eaton <jwe@octave.org>
parents: 16641
diff changeset
163 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
164 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
165
19303
c6615ca0a11d horizontal scrollbar for GUI terminal on Windows systems
John W. Eaton <jwe@octave.org>
parents: 18610
diff changeset
166 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
167 this, SLOT (init_terminal_size ()));
c6615ca0a11d horizontal scrollbar for GUI terminal on Windows systems
John W. Eaton <jwe@octave.org>
parents: 18610
diff changeset
168
16648
b04413e5a811 improve handling of interrupts, copy and paste shortcuts
John W. Eaton <jwe@octave.org>
parents: 16641
diff changeset
169 connect (xparent, SIGNAL (copyClipboard_signal ()),
b04413e5a811 improve handling of interrupts, copy and paste shortcuts
John W. Eaton <jwe@octave.org>
parents: 16641
diff changeset
170 this, SLOT (copyClipboard ()));
b04413e5a811 improve handling of interrupts, copy and paste shortcuts
John W. Eaton <jwe@octave.org>
parents: 16641
diff changeset
171
b04413e5a811 improve handling of interrupts, copy and paste shortcuts
John W. Eaton <jwe@octave.org>
parents: 16641
diff changeset
172 connect (xparent, SIGNAL (pasteClipboard_signal ()),
b04413e5a811 improve handling of interrupts, copy and paste shortcuts
John W. Eaton <jwe@octave.org>
parents: 16641
diff changeset
173 this, SLOT (pasteClipboard ()));
18555
2d5d0d86432e gui: Add select all menu (Bug #41797)
John Donoghue <john.donoghue@ieee.org>
parents: 17920
diff changeset
174
2d5d0d86432e gui: Add select all menu (Bug #41797)
John Donoghue <john.donoghue@ieee.org>
parents: 17920
diff changeset
175 connect (xparent, SIGNAL (selectAll_signal ()),
2d5d0d86432e gui: Add select all menu (Bug #41797)
John Donoghue <john.donoghue@ieee.org>
parents: 17920
diff changeset
176 this, SLOT (selectAll ()));
19690
bd1369a2a651 add extra action for interrupting with Ctrl-C (bug #44204)
Torsten <ttl@justmail.de>
parents: 19303
diff changeset
177
bd1369a2a651 add extra action for interrupting with Ctrl-C (bug #44204)
Torsten <ttl@justmail.de>
parents: 19303
diff changeset
178 // extra interrupt action
bd1369a2a651 add extra action for interrupting with Ctrl-C (bug #44204)
Torsten <ttl@justmail.de>
parents: 19303
diff changeset
179 _interrupt_action = new QAction (this);
bd1369a2a651 add extra action for interrupting with Ctrl-C (bug #44204)
Torsten <ttl@justmail.de>
parents: 19303
diff changeset
180 addAction (_interrupt_action);
bd1369a2a651 add extra action for interrupting with Ctrl-C (bug #44204)
Torsten <ttl@justmail.de>
parents: 19303
diff changeset
181
bd1369a2a651 add extra action for interrupting with Ctrl-C (bug #44204)
Torsten <ttl@justmail.de>
parents: 19303
diff changeset
182 _interrupt_action->setShortcut (
bd1369a2a651 add extra action for interrupting with Ctrl-C (bug #44204)
Torsten <ttl@justmail.de>
parents: 19303
diff changeset
183 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
184
19907
7d888f9e94eb fix some shortcut issues
Torsten <ttl@justmail.de>
parents: 19899
diff changeset
185 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
186 this, SLOT (terminal_interrupt ()));
20987
f99cbd86a0f9 Prevent closing GUI by Ctrl+D in terminal (bug #46661)
Torsten <ttl@justmail.de>
parents: 19943
diff changeset
187
f99cbd86a0f9 Prevent closing GUI by Ctrl+D in terminal (bug #46661)
Torsten <ttl@justmail.de>
parents: 19943
diff changeset
188 // 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
189 _nop_action = new QAction (this);
f99cbd86a0f9 Prevent closing GUI by Ctrl+D in terminal (bug #46661)
Torsten <ttl@justmail.de>
parents: 19943
diff changeset
190 addAction (_nop_action);
f99cbd86a0f9 Prevent closing GUI by Ctrl+D in terminal (bug #46661)
Torsten <ttl@justmail.de>
parents: 19943
diff changeset
191
f99cbd86a0f9 Prevent closing GUI by Ctrl+D in terminal (bug #46661)
Torsten <ttl@justmail.de>
parents: 19943
diff changeset
192 _nop_action->setShortcut (
f99cbd86a0f9 Prevent closing GUI by Ctrl+D in terminal (bug #46661)
Torsten <ttl@justmail.de>
parents: 19943
diff changeset
193 QKeySequence (Qt::ControlModifier + Qt::Key_D));
16639
ba808cd9d86c simplify QTerminal inheritance scheme
John W. Eaton <jwe@octave.org>
parents: 16570
diff changeset
194 }
ba808cd9d86c simplify QTerminal inheritance scheme
John W. Eaton <jwe@octave.org>
parents: 16570
diff changeset
195
ba808cd9d86c simplify QTerminal inheritance scheme
John W. Eaton <jwe@octave.org>
parents: 16570
diff changeset
196 private:
ba808cd9d86c simplify QTerminal inheritance scheme
John W. Eaton <jwe@octave.org>
parents: 16570
diff changeset
197
17790
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17744
diff changeset
198 QMenu *_contextMenu;
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17744
diff changeset
199 QAction * _copy_action;
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17744
diff changeset
200 QAction * _paste_action;
18555
2d5d0d86432e gui: Add select all menu (Bug #41797)
John Donoghue <john.donoghue@ieee.org>
parents: 17920
diff changeset
201 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
202 QAction * _edit_action;
19690
bd1369a2a651 add extra action for interrupting with Ctrl-C (bug #44204)
Torsten <ttl@justmail.de>
parents: 19303
diff changeset
203
bd1369a2a651 add extra action for interrupting with Ctrl-C (bug #44204)
Torsten <ttl@justmail.de>
parents: 19303
diff changeset
204 QAction *_interrupt_action;
20987
f99cbd86a0f9 Prevent closing GUI by Ctrl+D in terminal (bug #46661)
Torsten <ttl@justmail.de>
parents: 19943
diff changeset
205 QAction *_nop_action;
16639
ba808cd9d86c simplify QTerminal inheritance scheme
John W. Eaton <jwe@octave.org>
parents: 16570
diff changeset
206 };
15631
9712f29c97de Compiles again.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
207
15651
845cebf281aa Added files of QConsole.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 15650
diff changeset
208 #endif // QTERMINAL_H