Mercurial > octave
annotate libgui/src/terminal-dock-widget.cc @ 31619:ad014fc78bd6
use individual local gui_settings objects
Previously, we created a single gui_settings object (derived from
QSettings) and accessed it from the resource_manager object. That
design is not necessary and is not the way QSettings was designed to
be used. Instead of managing a single object, we should be using
individual QSettings objects where needed. Each individual QSettings
object manages thread-safe access to a single global collection of
settings. The Qt docs say that operations on QSettings are not thread
safe, but that means that you can't create a QSettings object in one
thread and use it in another without some locking. I'm not sure
whether we were doing that correctly, but with this change it no
longer matters. Each QSettings object does perform locking when
reading or writing the underlying global data.
* resource-manager.h, resource-manager.cc
(resource_manager::m_settings): Delete data member.
(resource_manager::get_settings): Delete.
* annotation-dialog.cc, QTerminal.cc, QTerminal.h, command-widget.cc,
command-widget.h, community-news.cc, dialog.cc,
documentation-bookmarks.cc, documentation-bookmarks.h,
documentation-dock-widget.cc, documentation-dock-widget.h,
documentation.cc, documentation.h, dw-main-window.cc,
dw-main-window.h, external-editor-interface.cc, files-dock-widget.cc,
files-dock-widget.h, find-files-dialog.cc, history-dock-widget.cc,
history-dock-widget.h, file-editor-interface.h, file-editor-tab.cc,
file-editor-tab.h, file-editor.cc, file-editor.h, find-dialog.cc,
octave-qscintilla.cc, main-window.cc, main-window.h, news-reader.cc,
octave-dock-widget.cc, octave-dock-widget.h, qt-interpreter-events.cc,
qt-interpreter-events.h, release-notes.cc, resource-manager.cc,
resource-manager.h, set-path-dialog.cc, settings-dialog.cc,
settings-dialog.h, shortcut-manager.cc, shortcut-manager.h,
terminal-dock-widget.cc, terminal-dock-widget.h, variable-editor.cc,
variable-editor.h, welcome-wizard.cc, workspace-model.cc,
workspace-model.h, workspace-view.cc: Use local gui_settings objects
instead of accessing a pointer to a single gui_settings object owned
by the resource_manager object.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Fri, 02 Dec 2022 14:23:53 -0500 |
parents | 1a0756f7c90a |
children | 431f80aba37a |
rev | line source |
---|---|
27923
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
1 //////////////////////////////////////////////////////////////////////// |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
2 // |
30564
796f54d4ddbf
update Octave Project Developers copyright for the new year
John W. Eaton <jwe@octave.org>
parents:
29787
diff
changeset
|
3 // Copyright (C) 2011-2022 The Octave Project Developers |
27923
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
4 // |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
5 // See the file COPYRIGHT.md in the top-level directory of this |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
6 // distribution or <https://octave.org/copyright/>. |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
7 // |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
8 // This file is part of Octave. |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
9 // |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
10 // Octave is free software: you can redistribute it and/or modify it |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
11 // under the terms of the GNU General Public License as published by |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
12 // the Free Software Foundation, either version 3 of the License, or |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
13 // (at your option) any later version. |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
14 // |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
15 // Octave is distributed in the hope that it will be useful, but |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
16 // WITHOUT ANY WARRANTY; without even the implied warranty of |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
17 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
18 // GNU General Public License for more details. |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
19 // |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
20 // You should have received a copy of the GNU General Public License |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
21 // along with Octave; see the file COPYING. If not, see |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
22 // <https://www.gnu.org/licenses/>. |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
23 // |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
24 //////////////////////////////////////////////////////////////////////// |
14692
d6d250812c01
Made the terminal window dockable, too. Now the whole interface is fully dockable.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
25 |
21724
aba2e6293dd8
use "#if ..." consistently instead of "#ifdef" and "#ifndef"
John W. Eaton <jwe@octave.org>
parents:
21301
diff
changeset
|
26 #if defined (HAVE_CONFIG_H) |
21301
40de9f8f23a6
Use '#include "config.h"' rather than <config.h>.
Rik <rik@octave.org>
parents:
21203
diff
changeset
|
27 # include "config.h" |
15286
ae9079bbc627
Add '#include <config.h>' to C++ files in libgui/src
Rik <rik@octave.org>
parents:
15204
diff
changeset
|
28 #endif |
ae9079bbc627
Add '#include <config.h>' to C++ files in libgui/src
Rik <rik@octave.org>
parents:
15204
diff
changeset
|
29 |
30690
e2c8c852399e
replace use of depreciated QDesktopWidget in GUI
Torsten Lilge <ttl-octave@mailbox.org>
parents:
30564
diff
changeset
|
30 #include <QScreen> |
24791
9421e891294e
fix truncated startup message in terminal widget on windows (bug #53189)
Torsten <mttl@mailbox.org>
parents:
24768
diff
changeset
|
31 |
29503
3bfec185c9e2
experimental command window widget with server loop
John W. Eaton <jwe@octave.org>
parents:
29359
diff
changeset
|
32 // This header is only needed for the new terminal widget. |
31222
1a0756f7c90a
disable experimental terminal widget when building without qscintilla
Torsten Lilge <ttl-octave@mailbox.org>
parents:
31087
diff
changeset
|
33 #if defined (HAVE_QSCINTILLA) |
1a0756f7c90a
disable experimental terminal widget when building without qscintilla
Torsten Lilge <ttl-octave@mailbox.org>
parents:
31087
diff
changeset
|
34 # include "command-widget.h" |
1a0756f7c90a
disable experimental terminal widget when building without qscintilla
Torsten Lilge <ttl-octave@mailbox.org>
parents:
31087
diff
changeset
|
35 #endif |
29503
3bfec185c9e2
experimental command window widget with server loop
John W. Eaton <jwe@octave.org>
parents:
29359
diff
changeset
|
36 |
3bfec185c9e2
experimental command window widget with server loop
John W. Eaton <jwe@octave.org>
parents:
29359
diff
changeset
|
37 // This header is only needed for the old terminal widget. |
3bfec185c9e2
experimental command window widget with server loop
John W. Eaton <jwe@octave.org>
parents:
29359
diff
changeset
|
38 #include "QTerminal.h" |
3bfec185c9e2
experimental command window widget with server loop
John W. Eaton <jwe@octave.org>
parents:
29359
diff
changeset
|
39 |
27560
3fcc650de22f
split gui-preferences.h into one file per widget
John W. Eaton <jwe@octave.org>
parents:
27412
diff
changeset
|
40 #include "gui-preferences-cs.h" |
3fcc650de22f
split gui-preferences.h into one file per widget
John W. Eaton <jwe@octave.org>
parents:
27412
diff
changeset
|
41 #include "gui-preferences-global.h" |
29503
3bfec185c9e2
experimental command window widget with server loop
John W. Eaton <jwe@octave.org>
parents:
29359
diff
changeset
|
42 |
27629
8b6e928e0705
in GUI objects, store reference to base_qobject instead of resource_manager
John W. Eaton <jwe@octave.org>
parents:
27620
diff
changeset
|
43 #include "octave-qobject.h" |
27412
da1f59fe04b3
try to use consitent ordering for include files in libgui sources
John W. Eaton <jwe@octave.org>
parents:
27281
diff
changeset
|
44 #include "terminal-dock-widget.h" |
da1f59fe04b3
try to use consitent ordering for include files in libgui sources
John W. Eaton <jwe@octave.org>
parents:
27281
diff
changeset
|
45 |
24733
e15d53d2de1e
move more GUI classse inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
46 namespace octave |
14692
d6d250812c01
Made the terminal window dockable, too. Now the whole interface is fully dockable.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
47 { |
27620
45bb5bbaf291
don't use singleton pattern for resource manager in GUI
John W. Eaton <jwe@octave.org>
parents:
27611
diff
changeset
|
48 terminal_dock_widget::terminal_dock_widget (QWidget *p, |
27629
8b6e928e0705
in GUI objects, store reference to base_qobject instead of resource_manager
John W. Eaton <jwe@octave.org>
parents:
27620
diff
changeset
|
49 base_qobject& oct_qobj) |
8b6e928e0705
in GUI objects, store reference to base_qobject instead of resource_manager
John W. Eaton <jwe@octave.org>
parents:
27620
diff
changeset
|
50 : octave_dock_widget ("TerminalDockWidget", p, oct_qobj), |
29503
3bfec185c9e2
experimental command window widget with server loop
John W. Eaton <jwe@octave.org>
parents:
29359
diff
changeset
|
51 m_experimental_terminal_widget (oct_qobj.experimental_terminal_widget ()) |
24733
e15d53d2de1e
move more GUI classse inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
52 { |
29503
3bfec185c9e2
experimental command window widget with server loop
John W. Eaton <jwe@octave.org>
parents:
29359
diff
changeset
|
53 // FIXME: we could do this in a better way, but improving it doesn't |
3bfec185c9e2
experimental command window widget with server loop
John W. Eaton <jwe@octave.org>
parents:
29359
diff
changeset
|
54 // matter much if we will eventually be removing the old terminal. |
3bfec185c9e2
experimental command window widget with server loop
John W. Eaton <jwe@octave.org>
parents:
29359
diff
changeset
|
55 if (m_experimental_terminal_widget) |
29787
b4d2fa28d1d4
allow terminal window to be opened from command line
John W. Eaton <jwe@octave.org>
parents:
29783
diff
changeset
|
56 { |
31222
1a0756f7c90a
disable experimental terminal widget when building without qscintilla
Torsten Lilge <ttl-octave@mailbox.org>
parents:
31087
diff
changeset
|
57 #if defined (HAVE_QSCINTILLA) |
29787
b4d2fa28d1d4
allow terminal window to be opened from command line
John W. Eaton <jwe@octave.org>
parents:
29783
diff
changeset
|
58 command_widget *widget = new command_widget (oct_qobj, this); |
31068
0b402f523f09
allow executing a command in the new terminal widget
Torsten Lilge <ttl-octave@mailbox.org>
parents:
31067
diff
changeset
|
59 console *con = widget->get_console (); |
29787
b4d2fa28d1d4
allow terminal window to be opened from command line
John W. Eaton <jwe@octave.org>
parents:
29783
diff
changeset
|
60 |
b4d2fa28d1d4
allow terminal window to be opened from command line
John W. Eaton <jwe@octave.org>
parents:
29783
diff
changeset
|
61 connect (this, &terminal_dock_widget::settings_changed, |
b4d2fa28d1d4
allow terminal window to be opened from command line
John W. Eaton <jwe@octave.org>
parents:
29783
diff
changeset
|
62 widget, &command_widget::notice_settings); |
b4d2fa28d1d4
allow terminal window to be opened from command line
John W. Eaton <jwe@octave.org>
parents:
29783
diff
changeset
|
63 |
b4d2fa28d1d4
allow terminal window to be opened from command line
John W. Eaton <jwe@octave.org>
parents:
29783
diff
changeset
|
64 connect (this, &terminal_dock_widget::update_prompt_signal, |
b4d2fa28d1d4
allow terminal window to be opened from command line
John W. Eaton <jwe@octave.org>
parents:
29783
diff
changeset
|
65 widget, &command_widget::update_prompt); |
b4d2fa28d1d4
allow terminal window to be opened from command line
John W. Eaton <jwe@octave.org>
parents:
29783
diff
changeset
|
66 |
b4d2fa28d1d4
allow terminal window to be opened from command line
John W. Eaton <jwe@octave.org>
parents:
29783
diff
changeset
|
67 connect (this, &terminal_dock_widget::interpreter_output_signal, |
b4d2fa28d1d4
allow terminal window to be opened from command line
John W. Eaton <jwe@octave.org>
parents:
29783
diff
changeset
|
68 widget, &command_widget::insert_interpreter_output); |
b4d2fa28d1d4
allow terminal window to be opened from command line
John W. Eaton <jwe@octave.org>
parents:
29783
diff
changeset
|
69 |
31068
0b402f523f09
allow executing a command in the new terminal widget
Torsten Lilge <ttl-octave@mailbox.org>
parents:
31067
diff
changeset
|
70 connect (this, &terminal_dock_widget::execute_command_signal, |
0b402f523f09
allow executing a command in the new terminal widget
Torsten Lilge <ttl-octave@mailbox.org>
parents:
31067
diff
changeset
|
71 con, &console::execute_command); |
0b402f523f09
allow executing a command in the new terminal widget
Torsten Lilge <ttl-octave@mailbox.org>
parents:
31067
diff
changeset
|
72 |
31087
9c0099048264
exp cmd widget: fix missing promt after error
Torsten Lilge <ttl-octave@mailbox.org>
parents:
31068
diff
changeset
|
73 connect (this, &terminal_dock_widget::new_command_line_signal, |
9c0099048264
exp cmd widget: fix missing promt after error
Torsten Lilge <ttl-octave@mailbox.org>
parents:
31068
diff
changeset
|
74 con, &console::new_command_line); |
9c0099048264
exp cmd widget: fix missing promt after error
Torsten Lilge <ttl-octave@mailbox.org>
parents:
31068
diff
changeset
|
75 |
29787
b4d2fa28d1d4
allow terminal window to be opened from command line
John W. Eaton <jwe@octave.org>
parents:
29783
diff
changeset
|
76 m_terminal = widget; |
31222
1a0756f7c90a
disable experimental terminal widget when building without qscintilla
Torsten Lilge <ttl-octave@mailbox.org>
parents:
31087
diff
changeset
|
77 #endif |
29787
b4d2fa28d1d4
allow terminal window to be opened from command line
John W. Eaton <jwe@octave.org>
parents:
29783
diff
changeset
|
78 } |
29503
3bfec185c9e2
experimental command window widget with server loop
John W. Eaton <jwe@octave.org>
parents:
29359
diff
changeset
|
79 else |
29787
b4d2fa28d1d4
allow terminal window to be opened from command line
John W. Eaton <jwe@octave.org>
parents:
29783
diff
changeset
|
80 { |
b4d2fa28d1d4
allow terminal window to be opened from command line
John W. Eaton <jwe@octave.org>
parents:
29783
diff
changeset
|
81 QTerminal *widget = QTerminal::create (oct_qobj, this); |
b4d2fa28d1d4
allow terminal window to be opened from command line
John W. Eaton <jwe@octave.org>
parents:
29783
diff
changeset
|
82 |
b4d2fa28d1d4
allow terminal window to be opened from command line
John W. Eaton <jwe@octave.org>
parents:
29783
diff
changeset
|
83 connect (this, &terminal_dock_widget::settings_changed, |
b4d2fa28d1d4
allow terminal window to be opened from command line
John W. Eaton <jwe@octave.org>
parents:
29783
diff
changeset
|
84 widget, &QTerminal::notice_settings); |
b4d2fa28d1d4
allow terminal window to be opened from command line
John W. Eaton <jwe@octave.org>
parents:
29783
diff
changeset
|
85 |
b4d2fa28d1d4
allow terminal window to be opened from command line
John W. Eaton <jwe@octave.org>
parents:
29783
diff
changeset
|
86 // Connect the visibility signal to the terminal for |
b4d2fa28d1d4
allow terminal window to be opened from command line
John W. Eaton <jwe@octave.org>
parents:
29783
diff
changeset
|
87 // dis-/enabling timers. |
b4d2fa28d1d4
allow terminal window to be opened from command line
John W. Eaton <jwe@octave.org>
parents:
29783
diff
changeset
|
88 connect (this, &terminal_dock_widget::visibilityChanged, |
b4d2fa28d1d4
allow terminal window to be opened from command line
John W. Eaton <jwe@octave.org>
parents:
29783
diff
changeset
|
89 widget, &QTerminal::handle_visibility_changed); |
b4d2fa28d1d4
allow terminal window to be opened from command line
John W. Eaton <jwe@octave.org>
parents:
29783
diff
changeset
|
90 |
b4d2fa28d1d4
allow terminal window to be opened from command line
John W. Eaton <jwe@octave.org>
parents:
29783
diff
changeset
|
91 m_terminal = widget; |
b4d2fa28d1d4
allow terminal window to be opened from command line
John W. Eaton <jwe@octave.org>
parents:
29783
diff
changeset
|
92 } |
29503
3bfec185c9e2
experimental command window widget with server loop
John W. Eaton <jwe@octave.org>
parents:
29359
diff
changeset
|
93 |
24768
11cc3973381b
use "m_" prefix for member variable in terminal dock widget class
John W. Eaton <jwe@octave.org>
parents:
24733
diff
changeset
|
94 m_terminal->setObjectName ("OctaveTerminal"); |
11cc3973381b
use "m_" prefix for member variable in terminal dock widget class
John W. Eaton <jwe@octave.org>
parents:
24733
diff
changeset
|
95 m_terminal->setFocusPolicy (Qt::StrongFocus); |
17920
5c3f22dd0bbb
raise SIGINT in octave_interpreter instead of in QTerminal
John W. Eaton <jwe@octave.org>
parents:
17790
diff
changeset
|
96 |
25508
3edae6ba1fcd
use a custom title bar widget for the main dock widgets
Torsten <mttl@mailbox.org>
parents:
25355
diff
changeset
|
97 set_title (tr ("Command Window")); |
24733
e15d53d2de1e
move more GUI classse inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
98 |
24768
11cc3973381b
use "m_" prefix for member variable in terminal dock widget class
John W. Eaton <jwe@octave.org>
parents:
24733
diff
changeset
|
99 setWidget (m_terminal); |
11cc3973381b
use "m_" prefix for member variable in terminal dock widget class
John W. Eaton <jwe@octave.org>
parents:
24733
diff
changeset
|
100 setFocusProxy (m_terminal); |
23808
2b1b2a795ba6
update clickable urls in terminal also when visible terminal has no focus
Torsten <mttl@mailbox.org>
parents:
23220
diff
changeset
|
101 |
24791
9421e891294e
fix truncated startup message in terminal widget on windows (bug #53189)
Torsten <mttl@mailbox.org>
parents:
24768
diff
changeset
|
102 // Chose a reasonable size at startup in order to avoid truncated |
9421e891294e
fix truncated startup message in terminal widget on windows (bug #53189)
Torsten <mttl@mailbox.org>
parents:
24768
diff
changeset
|
103 // startup messages |
31619
ad014fc78bd6
use individual local gui_settings objects
John W. Eaton <jwe@octave.org>
parents:
31222
diff
changeset
|
104 |
ad014fc78bd6
use individual local gui_settings objects
John W. Eaton <jwe@octave.org>
parents:
31222
diff
changeset
|
105 gui_settings settings; |
24791
9421e891294e
fix truncated startup message in terminal widget on windows (bug #53189)
Torsten <mttl@mailbox.org>
parents:
24768
diff
changeset
|
106 |
9421e891294e
fix truncated startup message in terminal widget on windows (bug #53189)
Torsten <mttl@mailbox.org>
parents:
24768
diff
changeset
|
107 QFont font = QFont (); |
9421e891294e
fix truncated startup message in terminal widget on windows (bug #53189)
Torsten <mttl@mailbox.org>
parents:
24768
diff
changeset
|
108 font.setStyleHint (QFont::TypeWriter); |
31619
ad014fc78bd6
use individual local gui_settings objects
John W. Eaton <jwe@octave.org>
parents:
31222
diff
changeset
|
109 QString default_font = settings.value (global_mono_font).toString (); |
24791
9421e891294e
fix truncated startup message in terminal widget on windows (bug #53189)
Torsten <mttl@mailbox.org>
parents:
24768
diff
changeset
|
110 font.setFamily |
31619
ad014fc78bd6
use individual local gui_settings objects
John W. Eaton <jwe@octave.org>
parents:
31222
diff
changeset
|
111 (settings.value (cs_font.key, default_font).toString ()); |
27583
315c35e6037c
use symbolic constants for command widget preferences
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27560
diff
changeset
|
112 font.setPointSize |
31619
ad014fc78bd6
use individual local gui_settings objects
John W. Eaton <jwe@octave.org>
parents:
31222
diff
changeset
|
113 (settings.value (cs_font_size).toInt ()); |
24791
9421e891294e
fix truncated startup message in terminal widget on windows (bug #53189)
Torsten <mttl@mailbox.org>
parents:
24768
diff
changeset
|
114 |
9421e891294e
fix truncated startup message in terminal widget on windows (bug #53189)
Torsten <mttl@mailbox.org>
parents:
24768
diff
changeset
|
115 QFontMetrics metrics(font); |
9421e891294e
fix truncated startup message in terminal widget on windows (bug #53189)
Torsten <mttl@mailbox.org>
parents:
24768
diff
changeset
|
116 |
9421e891294e
fix truncated startup message in terminal widget on windows (bug #53189)
Torsten <mttl@mailbox.org>
parents:
24768
diff
changeset
|
117 int win_x = metrics.maxWidth()*80; |
9421e891294e
fix truncated startup message in terminal widget on windows (bug #53189)
Torsten <mttl@mailbox.org>
parents:
24768
diff
changeset
|
118 int win_y = metrics.height()*25; |
9421e891294e
fix truncated startup message in terminal widget on windows (bug #53189)
Torsten <mttl@mailbox.org>
parents:
24768
diff
changeset
|
119 |
30690
e2c8c852399e
replace use of depreciated QDesktopWidget in GUI
Torsten Lilge <ttl-octave@mailbox.org>
parents:
30564
diff
changeset
|
120 int max_x = QGuiApplication::primaryScreen ()->availableGeometry ().width (); |
e2c8c852399e
replace use of depreciated QDesktopWidget in GUI
Torsten Lilge <ttl-octave@mailbox.org>
parents:
30564
diff
changeset
|
121 int max_y = QGuiApplication::primaryScreen ()->availableGeometry ().height (); |
24791
9421e891294e
fix truncated startup message in terminal widget on windows (bug #53189)
Torsten <mttl@mailbox.org>
parents:
24768
diff
changeset
|
122 |
9421e891294e
fix truncated startup message in terminal widget on windows (bug #53189)
Torsten <mttl@mailbox.org>
parents:
24768
diff
changeset
|
123 if (win_x > max_x) |
9421e891294e
fix truncated startup message in terminal widget on windows (bug #53189)
Torsten <mttl@mailbox.org>
parents:
24768
diff
changeset
|
124 win_x = max_x; |
9421e891294e
fix truncated startup message in terminal widget on windows (bug #53189)
Torsten <mttl@mailbox.org>
parents:
24768
diff
changeset
|
125 if (win_y > max_y) |
9421e891294e
fix truncated startup message in terminal widget on windows (bug #53189)
Torsten <mttl@mailbox.org>
parents:
24768
diff
changeset
|
126 win_y = max_y; |
9421e891294e
fix truncated startup message in terminal widget on windows (bug #53189)
Torsten <mttl@mailbox.org>
parents:
24768
diff
changeset
|
127 |
9421e891294e
fix truncated startup message in terminal widget on windows (bug #53189)
Torsten <mttl@mailbox.org>
parents:
24768
diff
changeset
|
128 setGeometry (0, 0, win_x, win_y); |
29787
b4d2fa28d1d4
allow terminal window to be opened from command line
John W. Eaton <jwe@octave.org>
parents:
29783
diff
changeset
|
129 |
b4d2fa28d1d4
allow terminal window to be opened from command line
John W. Eaton <jwe@octave.org>
parents:
29783
diff
changeset
|
130 if (! p) |
b4d2fa28d1d4
allow terminal window to be opened from command line
John W. Eaton <jwe@octave.org>
parents:
29783
diff
changeset
|
131 make_window (); |
24733
e15d53d2de1e
move more GUI classse inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
132 } |
24011
9107bae20480
style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents:
23808
diff
changeset
|
133 |
24733
e15d53d2de1e
move more GUI classse inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
134 bool terminal_dock_widget::has_focus (void) const |
e15d53d2de1e
move more GUI classse inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
135 { |
e15d53d2de1e
move more GUI classse inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
136 QWidget *w = widget (); |
e15d53d2de1e
move more GUI classse inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
137 return w->hasFocus (); |
e15d53d2de1e
move more GUI classse inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
138 } |
29503
3bfec185c9e2
experimental command window widget with server loop
John W. Eaton <jwe@octave.org>
parents:
29359
diff
changeset
|
139 |
29783
5154c91e0d98
eliminate some connections to parent objects in octave_dock_widget classes
John W. Eaton <jwe@octave.org>
parents:
29611
diff
changeset
|
140 QTerminal * terminal_dock_widget::get_qterminal (void) |
5154c91e0d98
eliminate some connections to parent objects in octave_dock_widget classes
John W. Eaton <jwe@octave.org>
parents:
29611
diff
changeset
|
141 { |
5154c91e0d98
eliminate some connections to parent objects in octave_dock_widget classes
John W. Eaton <jwe@octave.org>
parents:
29611
diff
changeset
|
142 return (m_experimental_terminal_widget |
5154c91e0d98
eliminate some connections to parent objects in octave_dock_widget classes
John W. Eaton <jwe@octave.org>
parents:
29611
diff
changeset
|
143 ? nullptr : dynamic_cast<QTerminal *> (m_terminal)); |
5154c91e0d98
eliminate some connections to parent objects in octave_dock_widget classes
John W. Eaton <jwe@octave.org>
parents:
29611
diff
changeset
|
144 } |
5154c91e0d98
eliminate some connections to parent objects in octave_dock_widget classes
John W. Eaton <jwe@octave.org>
parents:
29611
diff
changeset
|
145 |
31222
1a0756f7c90a
disable experimental terminal widget when building without qscintilla
Torsten Lilge <ttl-octave@mailbox.org>
parents:
31087
diff
changeset
|
146 #if defined (HAVE_QSCINTILLA) |
29783
5154c91e0d98
eliminate some connections to parent objects in octave_dock_widget classes
John W. Eaton <jwe@octave.org>
parents:
29611
diff
changeset
|
147 command_widget * terminal_dock_widget::get_command_widget (void) |
5154c91e0d98
eliminate some connections to parent objects in octave_dock_widget classes
John W. Eaton <jwe@octave.org>
parents:
29611
diff
changeset
|
148 { |
5154c91e0d98
eliminate some connections to parent objects in octave_dock_widget classes
John W. Eaton <jwe@octave.org>
parents:
29611
diff
changeset
|
149 return (m_experimental_terminal_widget |
5154c91e0d98
eliminate some connections to parent objects in octave_dock_widget classes
John W. Eaton <jwe@octave.org>
parents:
29611
diff
changeset
|
150 ? dynamic_cast<command_widget *> (m_terminal) : nullptr); |
5154c91e0d98
eliminate some connections to parent objects in octave_dock_widget classes
John W. Eaton <jwe@octave.org>
parents:
29611
diff
changeset
|
151 } |
31222
1a0756f7c90a
disable experimental terminal widget when building without qscintilla
Torsten Lilge <ttl-octave@mailbox.org>
parents:
31087
diff
changeset
|
152 #endif |
29783
5154c91e0d98
eliminate some connections to parent objects in octave_dock_widget classes
John W. Eaton <jwe@octave.org>
parents:
29611
diff
changeset
|
153 |
31619
ad014fc78bd6
use individual local gui_settings objects
John W. Eaton <jwe@octave.org>
parents:
31222
diff
changeset
|
154 void terminal_dock_widget::notice_settings (void) |
29611
d64ad3b93372
eliminate direct parent to child connection in terminal dock widget
John W. Eaton <jwe@octave.org>
parents:
29550
diff
changeset
|
155 { |
31619
ad014fc78bd6
use individual local gui_settings objects
John W. Eaton <jwe@octave.org>
parents:
31222
diff
changeset
|
156 emit settings_changed (); |
29611
d64ad3b93372
eliminate direct parent to child connection in terminal dock widget
John W. Eaton <jwe@octave.org>
parents:
29550
diff
changeset
|
157 } |
d64ad3b93372
eliminate direct parent to child connection in terminal dock widget
John W. Eaton <jwe@octave.org>
parents:
29550
diff
changeset
|
158 |
31067
5261a81765b0
merge input and output of exp. terminal widget into one widget
Torsten Lilge <ttl-octave@mailbox.org>
parents:
30964
diff
changeset
|
159 void terminal_dock_widget::init_command_prompt () |
5261a81765b0
merge input and output of exp. terminal widget into one widget
Torsten Lilge <ttl-octave@mailbox.org>
parents:
30964
diff
changeset
|
160 { |
5261a81765b0
merge input and output of exp. terminal widget into one widget
Torsten Lilge <ttl-octave@mailbox.org>
parents:
30964
diff
changeset
|
161 if (m_experimental_terminal_widget) |
5261a81765b0
merge input and output of exp. terminal widget into one widget
Torsten Lilge <ttl-octave@mailbox.org>
parents:
30964
diff
changeset
|
162 { |
31222
1a0756f7c90a
disable experimental terminal widget when building without qscintilla
Torsten Lilge <ttl-octave@mailbox.org>
parents:
31087
diff
changeset
|
163 #if defined (HAVE_QSCINTILLA) |
31067
5261a81765b0
merge input and output of exp. terminal widget into one widget
Torsten Lilge <ttl-octave@mailbox.org>
parents:
30964
diff
changeset
|
164 command_widget *cmd = get_command_widget (); |
5261a81765b0
merge input and output of exp. terminal widget into one widget
Torsten Lilge <ttl-octave@mailbox.org>
parents:
30964
diff
changeset
|
165 if (cmd) |
5261a81765b0
merge input and output of exp. terminal widget into one widget
Torsten Lilge <ttl-octave@mailbox.org>
parents:
30964
diff
changeset
|
166 cmd->init_command_prompt (); |
31222
1a0756f7c90a
disable experimental terminal widget when building without qscintilla
Torsten Lilge <ttl-octave@mailbox.org>
parents:
31087
diff
changeset
|
167 #endif |
31067
5261a81765b0
merge input and output of exp. terminal widget into one widget
Torsten Lilge <ttl-octave@mailbox.org>
parents:
30964
diff
changeset
|
168 } |
5261a81765b0
merge input and output of exp. terminal widget into one widget
Torsten Lilge <ttl-octave@mailbox.org>
parents:
30964
diff
changeset
|
169 } |
16461
094bd3627ead
move common functionality to octave_dock_widget base class
John W. Eaton <jwe@octave.org>
parents:
16460
diff
changeset
|
170 } |