Mercurial > octave-antonio
annotate libgui/qterminal/libqterminal/QTerminal.cc @ 20147:f0a8c1bc3b60 stable
fix checking copy shortcut in terminal when no setting available (bug #44968)
* QTerminal.cc (notice_settings): check for empty copy shortcut from settings
file and take the default in this case
author | Torsten <ttl@justmail.de> |
---|---|
date | Fri, 01 May 2015 08:56:48 +0200 |
parents | 88233ac3f3ea |
children |
rev | line source |
---|---|
16413
28136851099a
remove _terminal pointer from main_window, it is contained by other Qt object
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
diff
changeset
|
1 /* |
28136851099a
remove _terminal pointer from main_window, it is contained by other Qt object
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
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. |
16413
28136851099a
remove _terminal pointer from main_window, it is contained by other Qt object
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
diff
changeset
|
5 |
28136851099a
remove _terminal pointer from main_window, it is contained by other Qt object
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
diff
changeset
|
6 This file is part of QTerminal. |
28136851099a
remove _terminal pointer from main_window, it is contained by other Qt object
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
diff
changeset
|
7 |
17795
0a8c35ae5ce1
maint: Fix various problems with GPL copyright statements.
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
8 This program is free software: you can redistribute it and/or modify |
16413
28136851099a
remove _terminal pointer from main_window, it is contained by other Qt object
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
diff
changeset
|
9 it under the terms of the GNU General Public License as published by |
28136851099a
remove _terminal pointer from main_window, it is contained by other Qt object
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
diff
changeset
|
10 the Free Software Foundation, either version 3 of the License, or |
28136851099a
remove _terminal pointer from main_window, it is contained by other Qt object
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
diff
changeset
|
11 (at your option) any later version. |
28136851099a
remove _terminal pointer from main_window, it is contained by other Qt object
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
diff
changeset
|
12 |
17795
0a8c35ae5ce1
maint: Fix various problems with GPL copyright statements.
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
13 This program is distributed in the hope that it will be useful, |
16413
28136851099a
remove _terminal pointer from main_window, it is contained by other Qt object
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
diff
changeset
|
14 but WITHOUT ANY WARRANTY; without even the implied warranty of |
28136851099a
remove _terminal pointer from main_window, it is contained by other Qt object
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
diff
changeset
|
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
28136851099a
remove _terminal pointer from main_window, it is contained by other Qt object
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
diff
changeset
|
16 GNU General Public License for more details. |
28136851099a
remove _terminal pointer from main_window, it is contained by other Qt object
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
diff
changeset
|
17 |
28136851099a
remove _terminal pointer from main_window, it is contained by other Qt object
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
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:
17744
diff
changeset
|
19 along with this program. If not, |
0a8c35ae5ce1
maint: Fix various problems with GPL copyright statements.
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
20 see <http://www.gnu.org/licenses/>. |
16413
28136851099a
remove _terminal pointer from main_window, it is contained by other Qt object
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
diff
changeset
|
21 |
28136851099a
remove _terminal pointer from main_window, it is contained by other Qt object
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
diff
changeset
|
22 */ |
28136851099a
remove _terminal pointer from main_window, it is contained by other Qt object
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
diff
changeset
|
23 |
28136851099a
remove _terminal pointer from main_window, it is contained by other Qt object
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
diff
changeset
|
24 #include "QTerminal.h" |
28136851099a
remove _terminal pointer from main_window, it is contained by other Qt object
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
diff
changeset
|
25 |
16639
ba808cd9d86c
simplify QTerminal inheritance scheme
John W. Eaton <jwe@octave.org>
parents:
16620
diff
changeset
|
26 #if defined (Q_OS_WIN32) |
ba808cd9d86c
simplify QTerminal inheritance scheme
John W. Eaton <jwe@octave.org>
parents:
16620
diff
changeset
|
27 # include "win32/QWinTerminalImpl.h" |
ba808cd9d86c
simplify QTerminal inheritance scheme
John W. Eaton <jwe@octave.org>
parents:
16620
diff
changeset
|
28 #else |
ba808cd9d86c
simplify QTerminal inheritance scheme
John W. Eaton <jwe@octave.org>
parents:
16620
diff
changeset
|
29 # include "unix/QUnixTerminalImpl.h" |
ba808cd9d86c
simplify QTerminal inheritance scheme
John W. Eaton <jwe@octave.org>
parents:
16620
diff
changeset
|
30 #endif |
ba808cd9d86c
simplify QTerminal inheritance scheme
John W. Eaton <jwe@octave.org>
parents:
16620
diff
changeset
|
31 |
ba808cd9d86c
simplify QTerminal inheritance scheme
John W. Eaton <jwe@octave.org>
parents:
16620
diff
changeset
|
32 QTerminal * |
ba808cd9d86c
simplify QTerminal inheritance scheme
John W. Eaton <jwe@octave.org>
parents:
16620
diff
changeset
|
33 QTerminal::create (QWidget *xparent) |
ba808cd9d86c
simplify QTerminal inheritance scheme
John W. Eaton <jwe@octave.org>
parents:
16620
diff
changeset
|
34 { |
ba808cd9d86c
simplify QTerminal inheritance scheme
John W. Eaton <jwe@octave.org>
parents:
16620
diff
changeset
|
35 #if defined (Q_OS_WIN32) |
ba808cd9d86c
simplify QTerminal inheritance scheme
John W. Eaton <jwe@octave.org>
parents:
16620
diff
changeset
|
36 return new QWinTerminalImpl (xparent); |
ba808cd9d86c
simplify QTerminal inheritance scheme
John W. Eaton <jwe@octave.org>
parents:
16620
diff
changeset
|
37 #else |
ba808cd9d86c
simplify QTerminal inheritance scheme
John W. Eaton <jwe@octave.org>
parents:
16620
diff
changeset
|
38 return new QUnixTerminalImpl (xparent); |
ba808cd9d86c
simplify QTerminal inheritance scheme
John W. Eaton <jwe@octave.org>
parents:
16620
diff
changeset
|
39 #endif |
ba808cd9d86c
simplify QTerminal inheritance scheme
John W. Eaton <jwe@octave.org>
parents:
16620
diff
changeset
|
40 } |
ba808cd9d86c
simplify QTerminal inheritance scheme
John W. Eaton <jwe@octave.org>
parents:
16620
diff
changeset
|
41 |
16641
64f9a3e301d3
don't store default values in resource manager class
John W. Eaton <jwe@octave.org>
parents:
16640
diff
changeset
|
42 QList<QColor> |
64f9a3e301d3
don't store default values in resource manager class
John W. Eaton <jwe@octave.org>
parents:
16640
diff
changeset
|
43 QTerminal::default_colors (void) |
64f9a3e301d3
don't store default values in resource manager class
John W. Eaton <jwe@octave.org>
parents:
16640
diff
changeset
|
44 { |
64f9a3e301d3
don't store default values in resource manager class
John W. Eaton <jwe@octave.org>
parents:
16640
diff
changeset
|
45 static QList<QColor> colors; |
64f9a3e301d3
don't store default values in resource manager class
John W. Eaton <jwe@octave.org>
parents:
16640
diff
changeset
|
46 |
64f9a3e301d3
don't store default values in resource manager class
John W. Eaton <jwe@octave.org>
parents:
16640
diff
changeset
|
47 if (colors.isEmpty ()) |
64f9a3e301d3
don't store default values in resource manager class
John W. Eaton <jwe@octave.org>
parents:
16640
diff
changeset
|
48 { |
64f9a3e301d3
don't store default values in resource manager class
John W. Eaton <jwe@octave.org>
parents:
16640
diff
changeset
|
49 colors << QColor(0,0,0) |
64f9a3e301d3
don't store default values in resource manager class
John W. Eaton <jwe@octave.org>
parents:
16640
diff
changeset
|
50 << QColor(255,255,255) |
64f9a3e301d3
don't store default values in resource manager class
John W. Eaton <jwe@octave.org>
parents:
16640
diff
changeset
|
51 << QColor(192,192,192) |
64f9a3e301d3
don't store default values in resource manager class
John W. Eaton <jwe@octave.org>
parents:
16640
diff
changeset
|
52 << QColor(128,128,128); |
64f9a3e301d3
don't store default values in resource manager class
John W. Eaton <jwe@octave.org>
parents:
16640
diff
changeset
|
53 } |
64f9a3e301d3
don't store default values in resource manager class
John W. Eaton <jwe@octave.org>
parents:
16640
diff
changeset
|
54 |
64f9a3e301d3
don't store default values in resource manager class
John W. Eaton <jwe@octave.org>
parents:
16640
diff
changeset
|
55 return colors; |
64f9a3e301d3
don't store default values in resource manager class
John W. Eaton <jwe@octave.org>
parents:
16640
diff
changeset
|
56 } |
64f9a3e301d3
don't store default values in resource manager class
John W. Eaton <jwe@octave.org>
parents:
16640
diff
changeset
|
57 |
64f9a3e301d3
don't store default values in resource manager class
John W. Eaton <jwe@octave.org>
parents:
16640
diff
changeset
|
58 QStringList |
64f9a3e301d3
don't store default values in resource manager class
John W. Eaton <jwe@octave.org>
parents:
16640
diff
changeset
|
59 QTerminal::color_names (void) |
64f9a3e301d3
don't store default values in resource manager class
John W. Eaton <jwe@octave.org>
parents:
16640
diff
changeset
|
60 { |
64f9a3e301d3
don't store default values in resource manager class
John W. Eaton <jwe@octave.org>
parents:
16640
diff
changeset
|
61 static QStringList names; |
64f9a3e301d3
don't store default values in resource manager class
John W. Eaton <jwe@octave.org>
parents:
16640
diff
changeset
|
62 |
64f9a3e301d3
don't store default values in resource manager class
John W. Eaton <jwe@octave.org>
parents:
16640
diff
changeset
|
63 if (names.isEmpty ()) |
64f9a3e301d3
don't store default values in resource manager class
John W. Eaton <jwe@octave.org>
parents:
16640
diff
changeset
|
64 { |
64f9a3e301d3
don't store default values in resource manager class
John W. Eaton <jwe@octave.org>
parents:
16640
diff
changeset
|
65 names << QObject::tr ("foreground") |
64f9a3e301d3
don't store default values in resource manager class
John W. Eaton <jwe@octave.org>
parents:
16640
diff
changeset
|
66 << QObject::tr ("background") |
64f9a3e301d3
don't store default values in resource manager class
John W. Eaton <jwe@octave.org>
parents:
16640
diff
changeset
|
67 << QObject::tr ("selection") |
64f9a3e301d3
don't store default values in resource manager class
John W. Eaton <jwe@octave.org>
parents:
16640
diff
changeset
|
68 << QObject::tr ("cursor"); |
64f9a3e301d3
don't store default values in resource manager class
John W. Eaton <jwe@octave.org>
parents:
16640
diff
changeset
|
69 } |
64f9a3e301d3
don't store default values in resource manager class
John W. Eaton <jwe@octave.org>
parents:
16640
diff
changeset
|
70 |
64f9a3e301d3
don't store default values in resource manager class
John W. Eaton <jwe@octave.org>
parents:
16640
diff
changeset
|
71 return names; |
64f9a3e301d3
don't store default values in resource manager class
John W. Eaton <jwe@octave.org>
parents:
16640
diff
changeset
|
72 } |
64f9a3e301d3
don't store default values in resource manager class
John W. Eaton <jwe@octave.org>
parents:
16640
diff
changeset
|
73 |
19943
88233ac3f3ea
fix issue with ctrl-c for copying when editor has focus and is docked
Torsten <ttl@justmail.de>
parents:
19697
diff
changeset
|
74 // slot for disabling the interrupt action when terminal loses focus |
88233ac3f3ea
fix issue with ctrl-c for copying when editor has focus and is docked
Torsten <ttl@justmail.de>
parents:
19697
diff
changeset
|
75 void |
88233ac3f3ea
fix issue with ctrl-c for copying when editor has focus and is docked
Torsten <ttl@justmail.de>
parents:
19697
diff
changeset
|
76 QTerminal::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:
19697
diff
changeset
|
77 { |
88233ac3f3ea
fix issue with ctrl-c for copying when editor has focus and is docked
Torsten <ttl@justmail.de>
parents:
19697
diff
changeset
|
78 if (focus_out) |
88233ac3f3ea
fix issue with ctrl-c for copying when editor has focus and is docked
Torsten <ttl@justmail.de>
parents:
19697
diff
changeset
|
79 _interrupt_action->setShortcut (QKeySequence ()); |
88233ac3f3ea
fix issue with ctrl-c for copying when editor has focus and is docked
Torsten <ttl@justmail.de>
parents:
19697
diff
changeset
|
80 else |
88233ac3f3ea
fix issue with ctrl-c for copying when editor has focus and is docked
Torsten <ttl@justmail.de>
parents:
19697
diff
changeset
|
81 _interrupt_action->setShortcut ( |
88233ac3f3ea
fix issue with ctrl-c for copying when editor has focus and is docked
Torsten <ttl@justmail.de>
parents:
19697
diff
changeset
|
82 QKeySequence (Qt::ControlModifier + Qt::Key_C)); |
88233ac3f3ea
fix issue with ctrl-c for copying when editor has focus and is docked
Torsten <ttl@justmail.de>
parents:
19697
diff
changeset
|
83 } |
88233ac3f3ea
fix issue with ctrl-c for copying when editor has focus and is docked
Torsten <ttl@justmail.de>
parents:
19697
diff
changeset
|
84 |
16413
28136851099a
remove _terminal pointer from main_window, it is contained by other Qt object
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
diff
changeset
|
85 void |
28136851099a
remove _terminal pointer from main_window, it is contained by other Qt object
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
diff
changeset
|
86 QTerminal::notice_settings (const QSettings *settings) |
28136851099a
remove _terminal pointer from main_window, it is contained by other Qt object
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
diff
changeset
|
87 { |
28136851099a
remove _terminal pointer from main_window, it is contained by other Qt object
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
diff
changeset
|
88 // QSettings pointer is checked before emitting. |
28136851099a
remove _terminal pointer from main_window, it is contained by other Qt object
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
diff
changeset
|
89 |
28136851099a
remove _terminal pointer from main_window, it is contained by other Qt object
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
diff
changeset
|
90 // Set terminal font: |
16640
0ee7b4d1b940
* QTerminal.cc: Style fixes.
John W. Eaton <jwe@octave.org>
parents:
16639
diff
changeset
|
91 QFont term_font = QFont (); |
17508
a28c3fb15ad8
Set style hint to ensure a monospaced font in the gui terminal
Torsten <ttl@justmail.de>
parents:
16641
diff
changeset
|
92 term_font.setStyleHint (QFont::TypeWriter); |
16640
0ee7b4d1b940
* QTerminal.cc: Style fixes.
John W. Eaton <jwe@octave.org>
parents:
16639
diff
changeset
|
93 term_font.setFamily |
0ee7b4d1b940
* QTerminal.cc: Style fixes.
John W. Eaton <jwe@octave.org>
parents:
16639
diff
changeset
|
94 (settings->value ("terminal/fontName", "Courier New").toString ()); |
0ee7b4d1b940
* QTerminal.cc: Style fixes.
John W. Eaton <jwe@octave.org>
parents:
16639
diff
changeset
|
95 term_font.setPointSize (settings->value ("terminal/fontSize", 10).toInt ()); |
16413
28136851099a
remove _terminal pointer from main_window, it is contained by other Qt object
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
diff
changeset
|
96 setTerminalFont (term_font); |
28136851099a
remove _terminal pointer from main_window, it is contained by other Qt object
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
diff
changeset
|
97 |
16640
0ee7b4d1b940
* QTerminal.cc: Style fixes.
John W. Eaton <jwe@octave.org>
parents:
16639
diff
changeset
|
98 QString cursorType |
0ee7b4d1b940
* QTerminal.cc: Style fixes.
John W. Eaton <jwe@octave.org>
parents:
16639
diff
changeset
|
99 = settings->value ("terminal/cursorType", "ibeam").toString (); |
0ee7b4d1b940
* QTerminal.cc: Style fixes.
John W. Eaton <jwe@octave.org>
parents:
16639
diff
changeset
|
100 |
0ee7b4d1b940
* QTerminal.cc: Style fixes.
John W. Eaton <jwe@octave.org>
parents:
16639
diff
changeset
|
101 bool cursorBlinking |
0ee7b4d1b940
* QTerminal.cc: Style fixes.
John W. Eaton <jwe@octave.org>
parents:
16639
diff
changeset
|
102 = settings->value ("terminal/cursorBlinking", true).toBool (); |
0ee7b4d1b940
* QTerminal.cc: Style fixes.
John W. Eaton <jwe@octave.org>
parents:
16639
diff
changeset
|
103 |
16413
28136851099a
remove _terminal pointer from main_window, it is contained by other Qt object
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
diff
changeset
|
104 if (cursorType == "ibeam") |
16640
0ee7b4d1b940
* QTerminal.cc: Style fixes.
John W. Eaton <jwe@octave.org>
parents:
16639
diff
changeset
|
105 setCursorType (QTerminal::IBeamCursor, cursorBlinking); |
16413
28136851099a
remove _terminal pointer from main_window, it is contained by other Qt object
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
diff
changeset
|
106 else if (cursorType == "block") |
16640
0ee7b4d1b940
* QTerminal.cc: Style fixes.
John W. Eaton <jwe@octave.org>
parents:
16639
diff
changeset
|
107 setCursorType (QTerminal::BlockCursor, cursorBlinking); |
16413
28136851099a
remove _terminal pointer from main_window, it is contained by other Qt object
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
diff
changeset
|
108 else if (cursorType == "underline") |
16640
0ee7b4d1b940
* QTerminal.cc: Style fixes.
John W. Eaton <jwe@octave.org>
parents:
16639
diff
changeset
|
109 setCursorType (QTerminal::UnderlineCursor, cursorBlinking); |
16620
818eef7b2618
allow terminal colors to be set from preferences dialog
John W. Eaton <jwe@octave.org>
parents:
16570
diff
changeset
|
110 |
818eef7b2618
allow terminal colors to be set from preferences dialog
John W. Eaton <jwe@octave.org>
parents:
16570
diff
changeset
|
111 bool cursorUseForegroundColor |
16640
0ee7b4d1b940
* QTerminal.cc: Style fixes.
John W. Eaton <jwe@octave.org>
parents:
16639
diff
changeset
|
112 = settings->value ("terminal/cursorUseForegroundColor", true).toBool (); |
16620
818eef7b2618
allow terminal colors to be set from preferences dialog
John W. Eaton <jwe@octave.org>
parents:
16570
diff
changeset
|
113 |
16641
64f9a3e301d3
don't store default values in resource manager class
John W. Eaton <jwe@octave.org>
parents:
16640
diff
changeset
|
114 QList<QColor> colors = default_colors (); |
16620
818eef7b2618
allow terminal colors to be set from preferences dialog
John W. Eaton <jwe@octave.org>
parents:
16570
diff
changeset
|
115 |
818eef7b2618
allow terminal colors to be set from preferences dialog
John W. Eaton <jwe@octave.org>
parents:
16570
diff
changeset
|
116 setForegroundColor |
818eef7b2618
allow terminal colors to be set from preferences dialog
John W. Eaton <jwe@octave.org>
parents:
16570
diff
changeset
|
117 (settings->value ("terminal/color_f", |
16641
64f9a3e301d3
don't store default values in resource manager class
John W. Eaton <jwe@octave.org>
parents:
16640
diff
changeset
|
118 QVariant (colors.at (0))).value<QColor> ()); |
16620
818eef7b2618
allow terminal colors to be set from preferences dialog
John W. Eaton <jwe@octave.org>
parents:
16570
diff
changeset
|
119 |
818eef7b2618
allow terminal colors to be set from preferences dialog
John W. Eaton <jwe@octave.org>
parents:
16570
diff
changeset
|
120 setBackgroundColor |
818eef7b2618
allow terminal colors to be set from preferences dialog
John W. Eaton <jwe@octave.org>
parents:
16570
diff
changeset
|
121 (settings->value ("terminal/color_b", |
16641
64f9a3e301d3
don't store default values in resource manager class
John W. Eaton <jwe@octave.org>
parents:
16640
diff
changeset
|
122 QVariant (colors.at (1))).value<QColor> ()); |
16620
818eef7b2618
allow terminal colors to be set from preferences dialog
John W. Eaton <jwe@octave.org>
parents:
16570
diff
changeset
|
123 |
818eef7b2618
allow terminal colors to be set from preferences dialog
John W. Eaton <jwe@octave.org>
parents:
16570
diff
changeset
|
124 setSelectionColor |
818eef7b2618
allow terminal colors to be set from preferences dialog
John W. Eaton <jwe@octave.org>
parents:
16570
diff
changeset
|
125 (settings->value ("terminal/color_s", |
16641
64f9a3e301d3
don't store default values in resource manager class
John W. Eaton <jwe@octave.org>
parents:
16640
diff
changeset
|
126 QVariant (colors.at (2))).value<QColor> ()); |
16620
818eef7b2618
allow terminal colors to be set from preferences dialog
John W. Eaton <jwe@octave.org>
parents:
16570
diff
changeset
|
127 |
818eef7b2618
allow terminal colors to be set from preferences dialog
John W. Eaton <jwe@octave.org>
parents:
16570
diff
changeset
|
128 setCursorColor |
818eef7b2618
allow terminal colors to be set from preferences dialog
John W. Eaton <jwe@octave.org>
parents:
16570
diff
changeset
|
129 (cursorUseForegroundColor, |
818eef7b2618
allow terminal colors to be set from preferences dialog
John W. Eaton <jwe@octave.org>
parents:
16570
diff
changeset
|
130 settings->value ("terminal/color_c", |
16641
64f9a3e301d3
don't store default values in resource manager class
John W. Eaton <jwe@octave.org>
parents:
16640
diff
changeset
|
131 QVariant (colors.at (3))).value<QColor> ()); |
18678
6113e0c6920b
maint: Clean up extra spaces before/after parentheses.
Rik <rik@octave.org>
parents:
18610
diff
changeset
|
132 setScrollBufferSize (settings->value ("terminal/history_buffer",1000).toInt () ); |
19690
bd1369a2a651
add extra action for interrupting with Ctrl-C (bug #44204)
Torsten <ttl@justmail.de>
parents:
18678
diff
changeset
|
133 |
bd1369a2a651
add extra action for interrupting with Ctrl-C (bug #44204)
Torsten <ttl@justmail.de>
parents:
18678
diff
changeset
|
134 // check whether Copy shoretcut is Ctrl-C |
bd1369a2a651
add extra action for interrupting with Ctrl-C (bug #44204)
Torsten <ttl@justmail.de>
parents:
18678
diff
changeset
|
135 int set = settings->value ("shortcuts/set",0).toInt (); |
bd1369a2a651
add extra action for interrupting with Ctrl-C (bug #44204)
Torsten <ttl@justmail.de>
parents:
18678
diff
changeset
|
136 QKeySequence copy; |
bd1369a2a651
add extra action for interrupting with Ctrl-C (bug #44204)
Torsten <ttl@justmail.de>
parents:
18678
diff
changeset
|
137 QString key = QString ("shortcuts/main_edit:copy"); |
bd1369a2a651
add extra action for interrupting with Ctrl-C (bug #44204)
Torsten <ttl@justmail.de>
parents:
18678
diff
changeset
|
138 if (set) |
bd1369a2a651
add extra action for interrupting with Ctrl-C (bug #44204)
Torsten <ttl@justmail.de>
parents:
18678
diff
changeset
|
139 key.append ("_1"); // if second set is active |
bd1369a2a651
add extra action for interrupting with Ctrl-C (bug #44204)
Torsten <ttl@justmail.de>
parents:
18678
diff
changeset
|
140 copy = QKeySequence (settings->value (key).toString ()); // the copy shortcut |
bd1369a2a651
add extra action for interrupting with Ctrl-C (bug #44204)
Torsten <ttl@justmail.de>
parents:
18678
diff
changeset
|
141 |
20147
f0a8c1bc3b60
fix checking copy shortcut in terminal when no setting available (bug #44968)
Torsten <ttl@justmail.de>
parents:
19943
diff
changeset
|
142 // if copy is empty, shortcuts are not yet in the settings (take the default) |
f0a8c1bc3b60
fix checking copy shortcut in terminal when no setting available (bug #44968)
Torsten <ttl@justmail.de>
parents:
19943
diff
changeset
|
143 if (copy.isEmpty ()) // QKeySequence::Copy as second argument in |
f0a8c1bc3b60
fix checking copy shortcut in terminal when no setting available (bug #44968)
Torsten <ttl@justmail.de>
parents:
19943
diff
changeset
|
144 copy = QKeySequence::Copy; // settings->value () does not work! |
f0a8c1bc3b60
fix checking copy shortcut in terminal when no setting available (bug #44968)
Torsten <ttl@justmail.de>
parents:
19943
diff
changeset
|
145 |
19690
bd1369a2a651
add extra action for interrupting with Ctrl-C (bug #44204)
Torsten <ttl@justmail.de>
parents:
18678
diff
changeset
|
146 // dis- or enable extra interrupt action |
bd1369a2a651
add extra action for interrupting with Ctrl-C (bug #44204)
Torsten <ttl@justmail.de>
parents:
18678
diff
changeset
|
147 QKeySequence ctrl; |
bd1369a2a651
add extra action for interrupting with Ctrl-C (bug #44204)
Torsten <ttl@justmail.de>
parents:
18678
diff
changeset
|
148 ctrl = Qt::ControlModifier; |
bd1369a2a651
add extra action for interrupting with Ctrl-C (bug #44204)
Torsten <ttl@justmail.de>
parents:
18678
diff
changeset
|
149 |
bd1369a2a651
add extra action for interrupting with Ctrl-C (bug #44204)
Torsten <ttl@justmail.de>
parents:
18678
diff
changeset
|
150 bool extra_ir_action = (copy != QKeySequence (ctrl + Qt::Key_C)); |
bd1369a2a651
add extra action for interrupting with Ctrl-C (bug #44204)
Torsten <ttl@justmail.de>
parents:
18678
diff
changeset
|
151 |
bd1369a2a651
add extra action for interrupting with Ctrl-C (bug #44204)
Torsten <ttl@justmail.de>
parents:
18678
diff
changeset
|
152 _interrupt_action->setEnabled (extra_ir_action); |
bd1369a2a651
add extra action for interrupting with Ctrl-C (bug #44204)
Torsten <ttl@justmail.de>
parents:
18678
diff
changeset
|
153 has_extra_interrupt (extra_ir_action); |
16413
28136851099a
remove _terminal pointer from main_window, it is contained by other Qt object
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
diff
changeset
|
154 } |