annotate libgui/src/octave-qobject.cc @ 32051:17a09d2bbe0f

gui: Remove usage of QTextCodec from some more places. * libgui/src/gui-preference.h: Remove unused header. * libgui/src/octave-qobject.cc: Include header only if function from it are used. * m4/acinclude.m4: Do not require Qt6Core5Compat on platforms that don't need it.
author Markus Mützel <markus.muetzel@gmx.de>
date Sun, 23 Apr 2023 11:08:16 +0200
parents c8dd3da44e83
children 29f761f24ab0
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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 //
31706
597f3ee61a48 update Octave Project Developers copyright for the new year
John W. Eaton <jwe@octave.org>
parents: 31648
diff changeset
3 // Copyright (C) 2011-2023 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 ////////////////////////////////////////////////////////////////////////
27197
b8c0d5ad024f refactor and rename some qt application objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
25
b8c0d5ad024f refactor and rename some qt application objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
26 #if defined (HAVE_CONFIG_H)
b8c0d5ad024f refactor and rename some qt application objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
27 # include "config.h"
b8c0d5ad024f refactor and rename some qt application objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
28 #endif
b8c0d5ad024f refactor and rename some qt application objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
29
27412
da1f59fe04b3 try to use consitent ordering for include files in libgui sources
John W. Eaton <jwe@octave.org>
parents: 27393
diff changeset
30 #include <utility>
da1f59fe04b3 try to use consitent ordering for include files in libgui sources
John W. Eaton <jwe@octave.org>
parents: 27393
diff changeset
31
27197
b8c0d5ad024f refactor and rename some qt application objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
32 #include <QApplication>
27648
2952471e29a7 eliminate global access to resource_manager in qterminal widget
John W. Eaton <jwe@octave.org>
parents: 27630
diff changeset
33 #include <QClipboard>
27197
b8c0d5ad024f refactor and rename some qt application objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
34 #include <QFile>
32051
17a09d2bbe0f gui: Remove usage of QTextCodec from some more places.
Markus Mützel <markus.muetzel@gmx.de>
parents: 31827
diff changeset
35 #if ! defined (Q_OS_WIN32)
17a09d2bbe0f gui: Remove usage of QTextCodec from some more places.
Markus Mützel <markus.muetzel@gmx.de>
parents: 31827
diff changeset
36 # include <QTextCodec>
17a09d2bbe0f gui: Remove usage of QTextCodec from some more places.
Markus Mützel <markus.muetzel@gmx.de>
parents: 31827
diff changeset
37 #endif
27197
b8c0d5ad024f refactor and rename some qt application objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
38 #include <QThread>
27412
da1f59fe04b3 try to use consitent ordering for include files in libgui sources
John W. Eaton <jwe@octave.org>
parents: 27393
diff changeset
39 #include <QTimer>
27197
b8c0d5ad024f refactor and rename some qt application objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
40 #include <QTranslator>
b8c0d5ad024f refactor and rename some qt application objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
41
29787
b4d2fa28d1d4 allow terminal window to be opened from command line
John W. Eaton <jwe@octave.org>
parents: 29786
diff changeset
42 // QTerminal includes
b4d2fa28d1d4 allow terminal window to be opened from command line
John W. Eaton <jwe@octave.org>
parents: 29786
diff changeset
43 #include "QTerminal.h"
b4d2fa28d1d4 allow terminal window to be opened from command line
John W. Eaton <jwe@octave.org>
parents: 29786
diff changeset
44
31222
1a0756f7c90a disable experimental terminal widget when building without qscintilla
Torsten Lilge <ttl-octave@mailbox.org>
parents: 31087
diff changeset
45 #if defined (HAVE_QSCINTILLA)
1a0756f7c90a disable experimental terminal widget when building without qscintilla
Torsten Lilge <ttl-octave@mailbox.org>
parents: 31087
diff changeset
46 # include "command-widget.h"
1a0756f7c90a disable experimental terminal widget when building without qscintilla
Torsten Lilge <ttl-octave@mailbox.org>
parents: 31087
diff changeset
47 #endif
29835
a946d742fb97 allow community news window to be opened from command line
John W. Eaton <jwe@octave.org>
parents: 29822
diff changeset
48 #include "community-news.h"
29613
9367cba2a6d5 allow most dock widgets to be used from command line
John W. Eaton <jwe@octave.org>
parents: 29575
diff changeset
49 #include "documentation-dock-widget.h"
9367cba2a6d5 allow most dock widgets to be used from command line
John W. Eaton <jwe@octave.org>
parents: 29575
diff changeset
50 #include "files-dock-widget.h"
31621
0645ea65ca6b handle icons and themes in gui_settings class, not resource_manager
John W. Eaton <jwe@octave.org>
parents: 31614
diff changeset
51 #include "gui-settings.h"
29613
9367cba2a6d5 allow most dock widgets to be used from command line
John W. Eaton <jwe@octave.org>
parents: 29575
diff changeset
52 #include "history-dock-widget.h"
27197
b8c0d5ad024f refactor and rename some qt application objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
53 #include "interpreter-qobject.h"
b8c0d5ad024f refactor and rename some qt application objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
54 #include "main-window.h"
b8c0d5ad024f refactor and rename some qt application objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
55 #include "octave-qobject.h"
27412
da1f59fe04b3 try to use consitent ordering for include files in libgui sources
John W. Eaton <jwe@octave.org>
parents: 27393
diff changeset
56 #include "qt-application.h"
27263
99aa1bcb8848 rename octave_link and octave_link_events classes, move inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 27261
diff changeset
57 #include "qt-interpreter-events.h"
29836
56465c0739fa allow release notes window to be opened from command line
John W. Eaton <jwe@octave.org>
parents: 29835
diff changeset
58 #include "release-notes.h"
29787
b4d2fa28d1d4 allow terminal window to be opened from command line
John W. Eaton <jwe@octave.org>
parents: 29786
diff changeset
59 #include "terminal-dock-widget.h"
29613
9367cba2a6d5 allow most dock widgets to be used from command line
John W. Eaton <jwe@octave.org>
parents: 29575
diff changeset
60 #include "variable-editor.h"
9367cba2a6d5 allow most dock widgets to be used from command line
John W. Eaton <jwe@octave.org>
parents: 29575
diff changeset
61 #include "workspace-model.h"
9367cba2a6d5 allow most dock widgets to be used from command line
John W. Eaton <jwe@octave.org>
parents: 29575
diff changeset
62 #include "workspace-view.h"
27197
b8c0d5ad024f refactor and rename some qt application objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
63
27616
1c13a0f36160 Temporarily disable code in cset d0fe6e344c41 (bug #55940)
Rik <rik@octave.org>
parents: 27604
diff changeset
64 // Bug #55940 (Disable App Nap on Mac)
27575
d0fe6e344c41 Disable Mac App Nap feature so that pause, sleep work correctly (bug #55940).
Andrew Janke <andrew@apjanke.net>
parents: 27551
diff changeset
65 #if defined (Q_OS_MAC)
d0fe6e344c41 Disable Mac App Nap feature so that pause, sleep work correctly (bug #55940).
Andrew Janke <andrew@apjanke.net>
parents: 27551
diff changeset
66 # include <objc/runtime.h>
d0fe6e344c41 Disable Mac App Nap feature so that pause, sleep work correctly (bug #55940).
Andrew Janke <andrew@apjanke.net>
parents: 27551
diff changeset
67 # include <objc/message.h>
d0fe6e344c41 Disable Mac App Nap feature so that pause, sleep work correctly (bug #55940).
Andrew Janke <andrew@apjanke.net>
parents: 27551
diff changeset
68 #endif
d0fe6e344c41 Disable Mac App Nap feature so that pause, sleep work correctly (bug #55940).
Andrew Janke <andrew@apjanke.net>
parents: 27551
diff changeset
69
29503
3bfec185c9e2 experimental command window widget with server loop
John W. Eaton <jwe@octave.org>
parents: 29359
diff changeset
70 #include "interpreter.h"
27197
b8c0d5ad024f refactor and rename some qt application objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
71 #include "oct-env.h"
b8c0d5ad024f refactor and rename some qt application objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
72 #include "version.h"
b8c0d5ad024f refactor and rename some qt application objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
73
27412
da1f59fe04b3 try to use consitent ordering for include files in libgui sources
John W. Eaton <jwe@octave.org>
parents: 27393
diff changeset
74 #include "ovl.h"
da1f59fe04b3 try to use consitent ordering for include files in libgui sources
John W. Eaton <jwe@octave.org>
parents: 27393
diff changeset
75
27621
39fac14ab25a Enable App Nap disabling on macOS (bug #55490).
Andrew Janke <andrew@apjanke.net>
parents: 27620
diff changeset
76 // Bug #55940 (Disable App Nap on Mac)
39fac14ab25a Enable App Nap disabling on macOS (bug #55490).
Andrew Janke <andrew@apjanke.net>
parents: 27620
diff changeset
77 #if defined (Q_OS_MAC)
31771
21f9b34eb893 maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents: 31726
diff changeset
78 static void disable_app_nap ()
27624
d6b561842eeb maint: Fix indentation in static function to disable App Nap.
Andrew Janke <andrew@apjanke.net>
parents: 27621
diff changeset
79 {
d6b561842eeb maint: Fix indentation in static function to disable App Nap.
Andrew Janke <andrew@apjanke.net>
parents: 27621
diff changeset
80 Class process_info_class;
d6b561842eeb maint: Fix indentation in static function to disable App Nap.
Andrew Janke <andrew@apjanke.net>
parents: 27621
diff changeset
81 SEL process_info_selector;
d6b561842eeb maint: Fix indentation in static function to disable App Nap.
Andrew Janke <andrew@apjanke.net>
parents: 27621
diff changeset
82 SEL begin_activity_with_options_selector;
d6b561842eeb maint: Fix indentation in static function to disable App Nap.
Andrew Janke <andrew@apjanke.net>
parents: 27621
diff changeset
83 id process_info;
d6b561842eeb maint: Fix indentation in static function to disable App Nap.
Andrew Janke <andrew@apjanke.net>
parents: 27621
diff changeset
84 id reason_string;
d6b561842eeb maint: Fix indentation in static function to disable App Nap.
Andrew Janke <andrew@apjanke.net>
parents: 27621
diff changeset
85 id osx_latencycritical_activity;
27621
39fac14ab25a Enable App Nap disabling on macOS (bug #55490).
Andrew Janke <andrew@apjanke.net>
parents: 27620
diff changeset
86
27624
d6b561842eeb maint: Fix indentation in static function to disable App Nap.
Andrew Janke <andrew@apjanke.net>
parents: 27621
diff changeset
87 // Option codes found at https://stackoverflow.com/questions/22784886/what-can-make-nanosleep-drift-with-exactly-10-sec-on-mac-os-x-10-9/32729281#32729281
d6b561842eeb maint: Fix indentation in static function to disable App Nap.
Andrew Janke <andrew@apjanke.net>
parents: 27621
diff changeset
88 unsigned long long NSActivityUserInitiatedAllowingIdleSystemSleep = 0x00FFFFFFULL;
d6b561842eeb maint: Fix indentation in static function to disable App Nap.
Andrew Janke <andrew@apjanke.net>
parents: 27621
diff changeset
89 unsigned long long NSActivityLatencyCritical = 0xFF00000000ULL;
27621
39fac14ab25a Enable App Nap disabling on macOS (bug #55490).
Andrew Janke <andrew@apjanke.net>
parents: 27620
diff changeset
90
27624
d6b561842eeb maint: Fix indentation in static function to disable App Nap.
Andrew Janke <andrew@apjanke.net>
parents: 27621
diff changeset
91 // Avoid errors on older versions of OS X
30702
36be88bf3525 Use reinterpret_cast for return value of objc_getClass.
Markus Mützel <markus.muetzel@gmx.de>
parents: 30564
diff changeset
92 process_info_class = reinterpret_cast<Class> (objc_getClass ("NSProcessInfo"));
27624
d6b561842eeb maint: Fix indentation in static function to disable App Nap.
Andrew Janke <andrew@apjanke.net>
parents: 27621
diff changeset
93 if (process_info_class == nil)
d6b561842eeb maint: Fix indentation in static function to disable App Nap.
Andrew Janke <andrew@apjanke.net>
parents: 27621
diff changeset
94 return;
27621
39fac14ab25a Enable App Nap disabling on macOS (bug #55490).
Andrew Janke <andrew@apjanke.net>
parents: 27620
diff changeset
95
27624
d6b561842eeb maint: Fix indentation in static function to disable App Nap.
Andrew Janke <andrew@apjanke.net>
parents: 27621
diff changeset
96 process_info_selector = sel_getUid ("processInfo");
d6b561842eeb maint: Fix indentation in static function to disable App Nap.
Andrew Janke <andrew@apjanke.net>
parents: 27621
diff changeset
97 if (class_getClassMethod (process_info_class, process_info_selector)
d6b561842eeb maint: Fix indentation in static function to disable App Nap.
Andrew Janke <andrew@apjanke.net>
parents: 27621
diff changeset
98 == nullptr)
d6b561842eeb maint: Fix indentation in static function to disable App Nap.
Andrew Janke <andrew@apjanke.net>
parents: 27621
diff changeset
99 return;
27621
39fac14ab25a Enable App Nap disabling on macOS (bug #55490).
Andrew Janke <andrew@apjanke.net>
parents: 27620
diff changeset
100
27624
d6b561842eeb maint: Fix indentation in static function to disable App Nap.
Andrew Janke <andrew@apjanke.net>
parents: 27621
diff changeset
101 begin_activity_with_options_selector = sel_getUid ("beginActivityWithOptions:reason:");
d6b561842eeb maint: Fix indentation in static function to disable App Nap.
Andrew Janke <andrew@apjanke.net>
parents: 27621
diff changeset
102 if (class_getInstanceMethod (process_info_class,
27935
f1844e33f621 maint: Use Octave coding conventions in libgui/ directory.
Rik <rik@octave.org>
parents: 27923
diff changeset
103 begin_activity_with_options_selector)
27624
d6b561842eeb maint: Fix indentation in static function to disable App Nap.
Andrew Janke <andrew@apjanke.net>
parents: 27621
diff changeset
104 == nullptr)
d6b561842eeb maint: Fix indentation in static function to disable App Nap.
Andrew Janke <andrew@apjanke.net>
parents: 27621
diff changeset
105 return;
27621
39fac14ab25a Enable App Nap disabling on macOS (bug #55490).
Andrew Janke <andrew@apjanke.net>
parents: 27620
diff changeset
106
28063
60e4a9909fac Fix App Nap for new prototype of "objc_msgSend" in OS X Mojave (bug #57754).
Markus Mützel <markus.muetzel@gmx.de>
parents: 27935
diff changeset
107 process_info = reinterpret_cast<id (*) (id, SEL)> (objc_msgSend)
60e4a9909fac Fix App Nap for new prototype of "objc_msgSend" in OS X Mojave (bug #57754).
Markus Mützel <markus.muetzel@gmx.de>
parents: 27935
diff changeset
108 (reinterpret_cast<id> (process_info_class),
60e4a9909fac Fix App Nap for new prototype of "objc_msgSend" in OS X Mojave (bug #57754).
Markus Mützel <markus.muetzel@gmx.de>
parents: 27935
diff changeset
109 process_info_selector);
27624
d6b561842eeb maint: Fix indentation in static function to disable App Nap.
Andrew Janke <andrew@apjanke.net>
parents: 27621
diff changeset
110 if (process_info == nil)
d6b561842eeb maint: Fix indentation in static function to disable App Nap.
Andrew Janke <andrew@apjanke.net>
parents: 27621
diff changeset
111 return;
27621
39fac14ab25a Enable App Nap disabling on macOS (bug #55490).
Andrew Janke <andrew@apjanke.net>
parents: 27620
diff changeset
112
28063
60e4a9909fac Fix App Nap for new prototype of "objc_msgSend" in OS X Mojave (bug #57754).
Markus Mützel <markus.muetzel@gmx.de>
parents: 27935
diff changeset
113 reason_string = reinterpret_cast<id (*) (id, SEL)> (objc_msgSend)
60e4a9909fac Fix App Nap for new prototype of "objc_msgSend" in OS X Mojave (bug #57754).
Markus Mützel <markus.muetzel@gmx.de>
parents: 27935
diff changeset
114 (reinterpret_cast<id> (objc_getClass ("NSString")),
60e4a9909fac Fix App Nap for new prototype of "objc_msgSend" in OS X Mojave (bug #57754).
Markus Mützel <markus.muetzel@gmx.de>
parents: 27935
diff changeset
115 sel_getUid ("alloc"));
60e4a9909fac Fix App Nap for new prototype of "objc_msgSend" in OS X Mojave (bug #57754).
Markus Mützel <markus.muetzel@gmx.de>
parents: 27935
diff changeset
116 reason_string = reinterpret_cast<id (*) (id, SEL, const char *)> (objc_msgSend)
60e4a9909fac Fix App Nap for new prototype of "objc_msgSend" in OS X Mojave (bug #57754).
Markus Mützel <markus.muetzel@gmx.de>
parents: 27935
diff changeset
117 (reason_string, sel_getUid ("initWithUTF8String:"),
60e4a9909fac Fix App Nap for new prototype of "objc_msgSend" in OS X Mojave (bug #57754).
Markus Mützel <markus.muetzel@gmx.de>
parents: 27935
diff changeset
118 "App Nap causes pause() malfunction");
27621
39fac14ab25a Enable App Nap disabling on macOS (bug #55490).
Andrew Janke <andrew@apjanke.net>
parents: 27620
diff changeset
119
27624
d6b561842eeb maint: Fix indentation in static function to disable App Nap.
Andrew Janke <andrew@apjanke.net>
parents: 27621
diff changeset
120 // Start an Activity that suppresses App Nap. This Activity will run for
d6b561842eeb maint: Fix indentation in static function to disable App Nap.
Andrew Janke <andrew@apjanke.net>
parents: 27621
diff changeset
121 // the entire duration of the Octave process. This is intentional,
d6b561842eeb maint: Fix indentation in static function to disable App Nap.
Andrew Janke <andrew@apjanke.net>
parents: 27621
diff changeset
122 // not a leak.
28063
60e4a9909fac Fix App Nap for new prototype of "objc_msgSend" in OS X Mojave (bug #57754).
Markus Mützel <markus.muetzel@gmx.de>
parents: 27935
diff changeset
123 osx_latencycritical_activity =
60e4a9909fac Fix App Nap for new prototype of "objc_msgSend" in OS X Mojave (bug #57754).
Markus Mützel <markus.muetzel@gmx.de>
parents: 27935
diff changeset
124 reinterpret_cast<id (*) (id, SEL, unsigned long long, id)> (objc_msgSend)
60e4a9909fac Fix App Nap for new prototype of "objc_msgSend" in OS X Mojave (bug #57754).
Markus Mützel <markus.muetzel@gmx.de>
parents: 27935
diff changeset
125 (process_info,
60e4a9909fac Fix App Nap for new prototype of "objc_msgSend" in OS X Mojave (bug #57754).
Markus Mützel <markus.muetzel@gmx.de>
parents: 27935
diff changeset
126 begin_activity_with_options_selector,
60e4a9909fac Fix App Nap for new prototype of "objc_msgSend" in OS X Mojave (bug #57754).
Markus Mützel <markus.muetzel@gmx.de>
parents: 27935
diff changeset
127 NSActivityUserInitiatedAllowingIdleSystemSleep
60e4a9909fac Fix App Nap for new prototype of "objc_msgSend" in OS X Mojave (bug #57754).
Markus Mützel <markus.muetzel@gmx.de>
parents: 27935
diff changeset
128 | NSActivityLatencyCritical,
60e4a9909fac Fix App Nap for new prototype of "objc_msgSend" in OS X Mojave (bug #57754).
Markus Mützel <markus.muetzel@gmx.de>
parents: 27935
diff changeset
129 reason_string);
27624
d6b561842eeb maint: Fix indentation in static function to disable App Nap.
Andrew Janke <andrew@apjanke.net>
parents: 27621
diff changeset
130 }
27621
39fac14ab25a Enable App Nap disabling on macOS (bug #55490).
Andrew Janke <andrew@apjanke.net>
parents: 27620
diff changeset
131 #endif
39fac14ab25a Enable App Nap disabling on macOS (bug #55490).
Andrew Janke <andrew@apjanke.net>
parents: 27620
diff changeset
132
31646
c6d54dd31a7e maint: Use macros to begin/end C++ namespaces.
John W. Eaton <jwe@octave.org>
parents: 31222
diff changeset
133 OCTAVE_BEGIN_NAMESPACE(octave)
c6d54dd31a7e maint: Use macros to begin/end C++ namespaces.
John W. Eaton <jwe@octave.org>
parents: 31222
diff changeset
134
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
135 // Disable all Qt messages by default.
27197
b8c0d5ad024f refactor and rename some qt application objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
136
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
137 static void
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
138 message_handler (QtMsgType, const QMessageLogContext&, const QString&)
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
139 { }
27197
b8c0d5ad024f refactor and rename some qt application objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
140
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
141 //! Reimplement QApplication::notify. Octave's own exceptions are
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
142 //! caught and rethrown in the interpreter thread.
27197
b8c0d5ad024f refactor and rename some qt application objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
143
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
144 bool octave_qapplication::notify (QObject *receiver, QEvent *ev)
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
145 {
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
146 try
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
147 {
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
148 return QApplication::notify (receiver, ev);
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
149 }
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
150 catch (execution_exception& ee)
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
151 {
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
152 emit interpreter_event
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
153 ([=] ()
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
154 {
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
155 // INTERPRETER THREAD
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
156 throw ee;
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
157 });
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
158 }
27197
b8c0d5ad024f refactor and rename some qt application objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
159
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
160 return false;
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
161 }
27197
b8c0d5ad024f refactor and rename some qt application objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
162
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
163 // We will create a QApplication object, even if START_GUI is false,
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
164 // so that we can use Qt widgets for plot windows when running in
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
165 // command-line mode. Note that we are creating an
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
166 // octave_qapplication object but handling it as a QApplication object
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
167 // because the octave_qapplication should behave identically to a
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
168 // QApplication object except that it overrides the notify method so
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
169 // we can handle forward Octave interpreter exceptions from the GUI
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
170 // thread to the interpreter thread.
27197
b8c0d5ad024f refactor and rename some qt application objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
171
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
172 base_qobject::base_qobject (qt_application& app_context, bool gui_app)
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
173 : QObject (),
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
174 m_app_context (app_context),
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
175 m_argc (m_app_context.sys_argc ()),
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
176 m_argv (m_app_context.sys_argv ()),
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
177 m_qapplication (new octave_qapplication (m_argc, m_argv)),
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
178 m_qt_tr (new QTranslator ()),
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
179 m_gui_tr (new QTranslator ()),
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
180 m_qsci_tr (new QTranslator ()),
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
181 m_translators_installed (false),
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
182 m_qt_interpreter_events (new qt_interpreter_events (*this)),
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
183 m_interpreter_qobj (new interpreter_qobject (*this)),
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
184 m_main_thread (new QThread ()),
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
185 m_gui_app (gui_app),
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
186 m_interpreter_ready (false),
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
187 m_workspace_model (new workspace_model ()),
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
188 m_documentation_widget (),
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
189 m_file_browser_widget (),
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
190 m_history_widget (),
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
191 m_workspace_widget (),
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
192 m_editor_widget (),
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
193 m_variable_editor_widget (),
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
194 m_main_window (nullptr)
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
195 {
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
196 std::string show_gui_msgs = sys::env::getenv ("OCTAVE_SHOW_GUI_MESSAGES");
27197
b8c0d5ad024f refactor and rename some qt application objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
197
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
198 // Installing our handler suppresses the messages.
27197
b8c0d5ad024f refactor and rename some qt application objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
199
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
200 if (show_gui_msgs.empty ())
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
201 qInstallMessageHandler (message_handler);
27197
b8c0d5ad024f refactor and rename some qt application objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
202
32051
17a09d2bbe0f gui: Remove usage of QTextCodec from some more places.
Markus Mützel <markus.muetzel@gmx.de>
parents: 31827
diff changeset
203 #if ! defined (Q_OS_WIN32)
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
204 // Set the codec for all strings (before wizard or any GUI object)
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
205 QTextCodec::setCodecForLocale (QTextCodec::codecForName ("UTF-8"));
27197
b8c0d5ad024f refactor and rename some qt application objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
206 #endif
b8c0d5ad024f refactor and rename some qt application objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
207
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
208 // Register octave_value_list for connecting thread crossing signals.
27197
b8c0d5ad024f refactor and rename some qt application objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
209
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
210 qRegisterMetaType<octave_value_list> ("octave_value_list");
27197
b8c0d5ad024f refactor and rename some qt application objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
211
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
212 // Bug #55940 (Disable App Nap on Mac)
27575
d0fe6e344c41 Disable Mac App Nap feature so that pause, sleep work correctly (bug #55940).
Andrew Janke <andrew@apjanke.net>
parents: 27551
diff changeset
213 #if defined (Q_OS_MAC)
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
214 // Mac App Nap feature causes pause() and sleep() to misbehave.
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
215 // Disable it for the entire program run.
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
216 disable_app_nap ();
31696
8fed04d0607c eliminate shortcut_manager class and revamp shortcut handling
John W. Eaton <jwe@octave.org>
parents: 31690
diff changeset
217
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
218 // Don't let Qt interpret CMD key ("Meta" in Qt terminology) as Ctrl.
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
219 QCoreApplication::setAttribute (Qt::AA_MacDontSwapCtrlAndMeta, true);
27575
d0fe6e344c41 Disable Mac App Nap feature so that pause, sleep work correctly (bug #55940).
Andrew Janke <andrew@apjanke.net>
parents: 27551
diff changeset
220 #endif
d0fe6e344c41 Disable Mac App Nap feature so that pause, sleep work correctly (bug #55940).
Andrew Janke <andrew@apjanke.net>
parents: 27551
diff changeset
221
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
222 // Force left-to-right alignment (see bug #46204)
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
223 m_qapplication->setLayoutDirection (Qt::LeftToRight);
27197
b8c0d5ad024f refactor and rename some qt application objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
224
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
225 // Qt docs recommend using Qt::QueuedConnection when connecting to
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
226 // the QCoreApplication::exit slot.
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
227 connect (m_interpreter_qobj, &interpreter_qobject::shutdown_finished,
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
228 m_qapplication, &octave_qapplication::exit,
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
229 Qt::QueuedConnection);
27197
b8c0d5ad024f refactor and rename some qt application objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
230
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
231 connect (m_interpreter_qobj, &interpreter_qobject::ready,
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
232 this, &base_qobject::interpreter_ready);
29786
63c515ff762f eliminate more signal connections to parent objects
John W. Eaton <jwe@octave.org>
parents: 29785
diff changeset
233
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
234 connect (m_main_thread, &QThread::finished,
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
235 m_main_thread, &QThread::deleteLater);
27302
5f170ea12fa1 use Qt signals to pass interpreter callbacks to octave-qobject
John W. Eaton <jwe@octave.org>
parents: 27263
diff changeset
236
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
237 // Handle any interpreter_event signal from the octave_qapplication
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
238 // object here.
27302
5f170ea12fa1 use Qt signals to pass interpreter callbacks to octave-qobject
John W. Eaton <jwe@octave.org>
parents: 27263
diff changeset
239
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
240 connect (m_qapplication, QOverload<const fcn_callback&>::of (&octave_qapplication::interpreter_event),
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
241 this, QOverload<const fcn_callback&>::of (&base_qobject::interpreter_event));
27302
5f170ea12fa1 use Qt signals to pass interpreter callbacks to octave-qobject
John W. Eaton <jwe@octave.org>
parents: 27263
diff changeset
242
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
243 connect (m_qapplication, QOverload<const meth_callback&>::of (&octave_qapplication::interpreter_event),
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
244 this, QOverload<const meth_callback&>::of (&base_qobject::interpreter_event));
27588
f0e3f3e28a8e move qt_interpreter_events object from interpreter_qobject to octave_qobject
John W. Eaton <jwe@octave.org>
parents: 27582
diff changeset
245
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
246 if (m_app_context.experimental_terminal_widget ())
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
247 {
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
248 connect (qt_link (), &qt_interpreter_events::start_gui_signal,
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
249 this, &base_qobject::start_gui);
29787
b4d2fa28d1d4 allow terminal window to be opened from command line
John W. Eaton <jwe@octave.org>
parents: 29786
diff changeset
250
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
251 connect (qt_link (), &qt_interpreter_events::show_terminal_window_signal,
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
252 this, &base_qobject::show_terminal_window);
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
253 }
29503
3bfec185c9e2 experimental command window widget with server loop
John W. Eaton <jwe@octave.org>
parents: 29359
diff changeset
254
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
255 connect (qt_link (), &qt_interpreter_events::copy_image_to_clipboard_signal,
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
256 this, &base_qobject::copy_image_to_clipboard);
29153
02ee34a30351 eliminate separate cli_qobject and gui_qobject classes
John W. Eaton <jwe@octave.org>
parents: 28851
diff changeset
257
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
258 connect (qt_link (), &qt_interpreter_events::show_documentation_signal,
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
259 this, &base_qobject::show_documentation_window);
29613
9367cba2a6d5 allow most dock widgets to be used from command line
John W. Eaton <jwe@octave.org>
parents: 29575
diff changeset
260
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
261 connect (qt_link (), &qt_interpreter_events::show_file_browser_signal,
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
262 this, &base_qobject::show_file_browser_window);
29613
9367cba2a6d5 allow most dock widgets to be used from command line
John W. Eaton <jwe@octave.org>
parents: 29575
diff changeset
263
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
264 connect (qt_link (), &qt_interpreter_events::show_command_history_signal,
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
265 this, &base_qobject::show_command_history_window);
29613
9367cba2a6d5 allow most dock widgets to be used from command line
John W. Eaton <jwe@octave.org>
parents: 29575
diff changeset
266
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
267 connect (qt_link (), &qt_interpreter_events::show_workspace_signal,
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
268 this, &base_qobject::show_workspace_window);
29613
9367cba2a6d5 allow most dock widgets to be used from command line
John W. Eaton <jwe@octave.org>
parents: 29575
diff changeset
269
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
270 connect (qt_link (), &qt_interpreter_events::edit_variable_signal,
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
271 this, &base_qobject::show_variable_editor_window);
29613
9367cba2a6d5 allow most dock widgets to be used from command line
John W. Eaton <jwe@octave.org>
parents: 29575
diff changeset
272
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
273 connect (qt_link (), &qt_interpreter_events::show_community_news_signal,
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
274 this, &base_qobject::show_community_news);
29835
a946d742fb97 allow community news window to be opened from command line
John W. Eaton <jwe@octave.org>
parents: 29822
diff changeset
275
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
276 connect (qt_link (), &qt_interpreter_events::show_release_notes_signal,
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
277 this, &base_qobject::show_release_notes);
29836
56465c0739fa allow release notes window to be opened from command line
John W. Eaton <jwe@octave.org>
parents: 29835
diff changeset
278
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
279 if (m_app_context.experimental_terminal_widget ())
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
280 {
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
281 m_qapplication->setQuitOnLastWindowClosed (false);
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
282 }
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
283 else
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
284 {
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
285 if (gui_app)
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
286 {
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
287 m_main_window = new main_window (*this);
29503
3bfec185c9e2 experimental command window widget with server loop
John W. Eaton <jwe@octave.org>
parents: 29359
diff changeset
288
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
289 connect (m_main_window, &main_window::show_community_news_signal,
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
290 this, &base_qobject::show_community_news);
29835
a946d742fb97 allow community news window to be opened from command line
John W. Eaton <jwe@octave.org>
parents: 29822
diff changeset
291
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
292 connect (m_main_window, &main_window::show_release_notes_signal,
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
293 this, &base_qobject::show_release_notes);
29836
56465c0739fa allow release notes window to be opened from command line
John W. Eaton <jwe@octave.org>
parents: 29835
diff changeset
294
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
295 if (m_interpreter_ready)
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
296 m_main_window->handle_octave_ready ();
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
297 else
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
298 connect (m_interpreter_qobj, &interpreter_qobject::ready,
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
299 m_main_window, &main_window::handle_octave_ready);
29503
3bfec185c9e2 experimental command window widget with server loop
John W. Eaton <jwe@octave.org>
parents: 29359
diff changeset
300
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
301 connect (qt_link (), &qt_interpreter_events::focus_window_signal,
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
302 m_main_window, &main_window::focus_window);
29503
3bfec185c9e2 experimental command window widget with server loop
John W. Eaton <jwe@octave.org>
parents: 29359
diff changeset
303
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
304 m_app_context.gui_running (true);
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
305 }
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
306 else
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
307 {
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
308 // Get settings file.
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
309 gui_settings settings;
29503
3bfec185c9e2 experimental command window widget with server loop
John W. Eaton <jwe@octave.org>
parents: 29359
diff changeset
310
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
311 settings.reload ();
29503
3bfec185c9e2 experimental command window widget with server loop
John W. Eaton <jwe@octave.org>
parents: 29359
diff changeset
312
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
313 // After settings.
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
314 config_translators ();
29503
3bfec185c9e2 experimental command window widget with server loop
John W. Eaton <jwe@octave.org>
parents: 29359
diff changeset
315
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
316 settings.config_icon_theme ();
29780
d79f65e37e89 provide shortcuts in widgets launched from the cli
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29775
diff changeset
317
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
318 m_qapplication->setQuitOnLastWindowClosed (false);
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
319 }
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
320 }
29153
02ee34a30351 eliminate separate cli_qobject and gui_qobject classes
John W. Eaton <jwe@octave.org>
parents: 28851
diff changeset
321
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
322 start_main_thread ();
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
323 }
27197
b8c0d5ad024f refactor and rename some qt application objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
324
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
325 base_qobject::~base_qobject ()
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
326 {
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
327 // Note that we don't delete m_main_thread here. That is handled by
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
328 // deleteLater slot that is called when the m_main_thread issues a
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
329 // finished signal.
27219
b88d66c631c8 delete translator objects in base_qobject destructor
John W. Eaton <jwe@octave.org>
parents: 27218
diff changeset
330
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
331 // FIXME: Why are dock widget settings and/or the main window
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
332 // configuration not saved correctly if the main window is deleted
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
333 // after the dock widgets?
29757
f8322ca49578 delete main window before dock widgets (bug #60646)
John W. Eaton <jwe@octave.org>
parents: 29756
diff changeset
334
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
335 // Calling close will cause settings to be saved.
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
336 // If m_main_window exists, the widgets are closed by the main window
29755
23cf249a0ad8 explicitly close all dock widgets in base_qobject destructor (bug #60646)
John W. Eaton <jwe@octave.org>
parents: 29754
diff changeset
337
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
338 if (! m_main_window)
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
339 {
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
340 if (m_terminal_widget)
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
341 m_terminal_widget->close ();
29787
b4d2fa28d1d4 allow terminal window to be opened from command line
John W. Eaton <jwe@octave.org>
parents: 29786
diff changeset
342
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
343 if (m_documentation_widget)
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
344 m_documentation_widget->close ();
29758
1511b7cd3474 only close dock widgets when main window does not exist (bug #60646)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29757
diff changeset
345
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
346 if (m_file_browser_widget)
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
347 m_file_browser_widget->close ();
29758
1511b7cd3474 only close dock widgets when main window does not exist (bug #60646)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29757
diff changeset
348
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
349 if (m_history_widget)
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
350 m_history_widget->close ();
29758
1511b7cd3474 only close dock widgets when main window does not exist (bug #60646)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29757
diff changeset
351
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
352 if (m_workspace_widget)
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
353 m_workspace_widget->close ();
29758
1511b7cd3474 only close dock widgets when main window does not exist (bug #60646)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29757
diff changeset
354
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
355 if (m_editor_widget)
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
356 m_editor_widget->close ();
29758
1511b7cd3474 only close dock widgets when main window does not exist (bug #60646)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29757
diff changeset
357
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
358 if (m_variable_editor_widget)
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
359 m_variable_editor_widget->close ();
29835
a946d742fb97 allow community news window to be opened from command line
John W. Eaton <jwe@octave.org>
parents: 29822
diff changeset
360
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
361 if (m_community_news)
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
362 m_community_news->close ();
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
363 }
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
364 else
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
365 {
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
366 delete m_main_window;
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
367 }
29755
23cf249a0ad8 explicitly close all dock widgets in base_qobject destructor (bug #60646)
John W. Eaton <jwe@octave.org>
parents: 29754
diff changeset
368
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
369 delete m_terminal_widget;
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
370 delete m_documentation_widget;
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
371 delete m_file_browser_widget;
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
372 delete m_history_widget;
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
373 delete m_workspace_widget;
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
374 delete m_editor_widget;
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
375 delete m_variable_editor_widget;
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
376 delete m_community_news;
29755
23cf249a0ad8 explicitly close all dock widgets in base_qobject destructor (bug #60646)
John W. Eaton <jwe@octave.org>
parents: 29754
diff changeset
377
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
378 delete m_interpreter_qobj;
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
379 delete m_qsci_tr;
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
380 delete m_gui_tr;
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
381 delete m_qt_tr;
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
382 delete m_qapplication;
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
383 delete m_workspace_model;
27197
b8c0d5ad024f refactor and rename some qt application objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
384
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
385 string_vector::delete_c_str_vec (m_argv);
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
386 }
27197
b8c0d5ad024f refactor and rename some qt application objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
387
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
388 void base_qobject::config_translators ()
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
389 {
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
390 if (m_translators_installed)
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
391 return;
27197
b8c0d5ad024f refactor and rename some qt application objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
392
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
393 gui_settings settings;
31690
1a1f47f17ed4 eliminate resource_manager class
John W. Eaton <jwe@octave.org>
parents: 31649
diff changeset
394
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
395 settings.config_translators (m_qt_tr, m_qsci_tr, m_gui_tr);
27197
b8c0d5ad024f refactor and rename some qt application objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
396
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
397 m_qapplication->installTranslator (m_qt_tr);
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
398 m_qapplication->installTranslator (m_gui_tr);
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
399 m_qapplication->installTranslator (m_qsci_tr);
27197
b8c0d5ad024f refactor and rename some qt application objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
400
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
401 m_translators_installed = true;
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
402 }
27197
b8c0d5ad024f refactor and rename some qt application objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
403
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
404 void base_qobject::start_main_thread ()
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
405 {
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
406 // Note: if using the new experimental terminal widget, we defer
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
407 // initializing and executing the interpreter until the main event
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
408 // loop begins executing.
29503
3bfec185c9e2 experimental command window widget with server loop
John W. Eaton <jwe@octave.org>
parents: 29359
diff changeset
409
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
410 // With the old terminal widget, we defer initializing and executing
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
411 // the interpreter until after the main window and QApplication are
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
412 // running to prevent race conditions.
29503
3bfec185c9e2 experimental command window widget with server loop
John W. Eaton <jwe@octave.org>
parents: 29359
diff changeset
413
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
414 QTimer::singleShot (0, m_interpreter_qobj, SLOT (execute ()));
27197
b8c0d5ad024f refactor and rename some qt application objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
415
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
416 m_interpreter_qobj->moveToThread (m_main_thread);
27197
b8c0d5ad024f refactor and rename some qt application objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
417
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
418 m_main_thread->start ();
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
419 }
27197
b8c0d5ad024f refactor and rename some qt application objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
420
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
421 int base_qobject::exec ()
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
422 {
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
423 int status = m_qapplication->exec ();
29503
3bfec185c9e2 experimental command window widget with server loop
John W. Eaton <jwe@octave.org>
parents: 29359
diff changeset
424
29548
f6ad83cbe3c4 simplify interpreter shutdown in the GUI
John W. Eaton <jwe@octave.org>
parents: 29544
diff changeset
425 #if defined (Q_OS_MAC)
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
426 // fprintf to stderr is needed by macOS, for poorly-understood reasons.
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
427 fprintf (stderr, "\n");
29548
f6ad83cbe3c4 simplify interpreter shutdown in the GUI
John W. Eaton <jwe@octave.org>
parents: 29544
diff changeset
428 #endif
f6ad83cbe3c4 simplify interpreter shutdown in the GUI
John W. Eaton <jwe@octave.org>
parents: 29544
diff changeset
429
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
430 m_main_thread->quit ();
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
431 m_main_thread->wait ();
29503
3bfec185c9e2 experimental command window widget with server loop
John W. Eaton <jwe@octave.org>
parents: 29359
diff changeset
432
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
433 return status;
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
434 }
29503
3bfec185c9e2 experimental command window widget with server loop
John W. Eaton <jwe@octave.org>
parents: 29359
diff changeset
435
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
436 // Provided for convenience. Will be removed once we eliminate the
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
437 // old terminal widget.
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
438 bool base_qobject::experimental_terminal_widget () const
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
439 {
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
440 return m_app_context.experimental_terminal_widget ();
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
441 }
29503
3bfec185c9e2 experimental command window widget with server loop
John W. Eaton <jwe@octave.org>
parents: 29359
diff changeset
442
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
443 bool base_qobject::gui_running () const
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
444 {
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
445 return m_app_context.gui_running ();
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
446 }
27197
b8c0d5ad024f refactor and rename some qt application objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
447
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
448 QPointer<terminal_dock_widget>
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
449 base_qobject::terminal_widget (main_window *mw)
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
450 {
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
451 if (m_terminal_widget && mw)
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
452 {
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
453 m_terminal_widget->set_main_window (mw);
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
454 m_terminal_widget->set_adopted (true);
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
455 }
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
456 else if (! m_terminal_widget)
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
457 {
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
458 bool etw = m_app_context.experimental_terminal_widget ();
31725
32bc0f1c0a88 fix error introduced in changeset 286306a9a393
John W. Eaton <jwe@octave.org>
parents: 31707
diff changeset
459
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
460 m_terminal_widget
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
461 = QPointer<terminal_dock_widget> (new terminal_dock_widget (mw, etw));
31725
32bc0f1c0a88 fix error introduced in changeset 286306a9a393
John W. Eaton <jwe@octave.org>
parents: 31707
diff changeset
462
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
463 if (etw)
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
464 {
31222
1a0756f7c90a disable experimental terminal widget when building without qscintilla
Torsten Lilge <ttl-octave@mailbox.org>
parents: 31087
diff changeset
465 #if defined (HAVE_QSCINTILLA)
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
466 command_widget *cmd_widget
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
467 = m_terminal_widget->get_command_widget ();
29787
b4d2fa28d1d4 allow terminal window to be opened from command line
John W. Eaton <jwe@octave.org>
parents: 29786
diff changeset
468
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
469 connect (cmd_widget, &command_widget::interpreter_pause,
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
470 this, &base_qobject::interpreter_pause);
29787
b4d2fa28d1d4 allow terminal window to be opened from command line
John W. Eaton <jwe@octave.org>
parents: 29786
diff changeset
471
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
472 connect (cmd_widget, &command_widget::interpreter_resume,
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
473 this, &base_qobject::interpreter_resume);
29787
b4d2fa28d1d4 allow terminal window to be opened from command line
John W. Eaton <jwe@octave.org>
parents: 29786
diff changeset
474
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
475 connect (cmd_widget, &command_widget::interpreter_stop,
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
476 this, &base_qobject::interpreter_stop);
29787
b4d2fa28d1d4 allow terminal window to be opened from command line
John W. Eaton <jwe@octave.org>
parents: 29786
diff changeset
477
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
478 connect (qt_link (), &qt_interpreter_events::interpreter_output_signal,
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
479 m_terminal_widget, &terminal_dock_widget::interpreter_output_signal);
29787
b4d2fa28d1d4 allow terminal window to be opened from command line
John W. Eaton <jwe@octave.org>
parents: 29786
diff changeset
480
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
481 connect (qt_link (), &qt_interpreter_events::update_prompt_signal,
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
482 m_terminal_widget, &terminal_dock_widget::update_prompt_signal);
29796
a0fce019cd1f additional reorganization of signal/slot connections in main_window class
John W. Eaton <jwe@octave.org>
parents: 29787
diff changeset
483
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
484 connect (qt_link (), &qt_interpreter_events::new_command_line_signal,
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
485 m_terminal_widget, &terminal_dock_widget::new_command_line_signal);
29796
a0fce019cd1f additional reorganization of signal/slot connections in main_window class
John W. Eaton <jwe@octave.org>
parents: 29787
diff changeset
486
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
487 connect (mw, &main_window::update_prompt_signal,
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
488 m_terminal_widget, &terminal_dock_widget::update_prompt_signal);
31726
eacd3dee4b01 eliminate some uses of the event manager in GUI callback functions
John W. Eaton <jwe@octave.org>
parents: 31725
diff changeset
489
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
490 connect_interpreter_events (cmd_widget);
31222
1a0756f7c90a disable experimental terminal widget when building without qscintilla
Torsten Lilge <ttl-octave@mailbox.org>
parents: 31087
diff changeset
491 #endif
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
492 }
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
493 else
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
494 {
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
495 QTerminal *cmd_widget = m_terminal_widget->get_qterminal ();
29787
b4d2fa28d1d4 allow terminal window to be opened from command line
John W. Eaton <jwe@octave.org>
parents: 29786
diff changeset
496
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
497 // Connect the interrupt signal (emitted by Ctrl-C)
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
498 connect (cmd_widget, &QTerminal::interrupt_signal,
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
499 this, &base_qobject::interpreter_interrupt);
29787
b4d2fa28d1d4 allow terminal window to be opened from command line
John W. Eaton <jwe@octave.org>
parents: 29786
diff changeset
500
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
501 connect_interpreter_events (cmd_widget);
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
502 }
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
503 }
29787
b4d2fa28d1d4 allow terminal window to be opened from command line
John W. Eaton <jwe@octave.org>
parents: 29786
diff changeset
504
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
505 return m_terminal_widget;
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
506 }
29787
b4d2fa28d1d4 allow terminal window to be opened from command line
John W. Eaton <jwe@octave.org>
parents: 29786
diff changeset
507
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
508 QPointer<documentation_dock_widget>
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
509 base_qobject::documentation_widget (main_window *mw)
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
510 {
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
511 if (m_documentation_widget && mw)
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
512 {
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
513 m_documentation_widget->set_main_window (mw);
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
514 m_documentation_widget->set_adopted (true);
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
515 }
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
516 else if (! m_documentation_widget)
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
517 {
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
518 m_documentation_widget
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
519 = QPointer<documentation_dock_widget> (new documentation_dock_widget (mw));
29613
9367cba2a6d5 allow most dock widgets to be used from command line
John W. Eaton <jwe@octave.org>
parents: 29575
diff changeset
520
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
521 connect (qt_link (),
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
522 &qt_interpreter_events::register_documentation_signal,
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
523 m_documentation_widget,
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
524 &documentation_dock_widget::registerDoc);
29613
9367cba2a6d5 allow most dock widgets to be used from command line
John W. Eaton <jwe@octave.org>
parents: 29575
diff changeset
525
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
526 connect (qt_link (),
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
527 &qt_interpreter_events::unregister_documentation_signal,
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
528 m_documentation_widget,
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
529 &documentation_dock_widget::unregisterDoc);
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
530 }
29613
9367cba2a6d5 allow most dock widgets to be used from command line
John W. Eaton <jwe@octave.org>
parents: 29575
diff changeset
531
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
532 return m_documentation_widget;
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
533 }
29613
9367cba2a6d5 allow most dock widgets to be used from command line
John W. Eaton <jwe@octave.org>
parents: 29575
diff changeset
534
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
535 QPointer<files_dock_widget>
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
536 base_qobject::file_browser_widget (main_window *mw)
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
537 {
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
538 if (m_file_browser_widget)
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
539 {
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
540 m_file_browser_widget->set_main_window (mw);
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
541 m_file_browser_widget->set_adopted (true);
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
542 }
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
543 else if (! m_file_browser_widget)
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
544 m_file_browser_widget
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
545 = QPointer<files_dock_widget> (new files_dock_widget (mw));
29796
a0fce019cd1f additional reorganization of signal/slot connections in main_window class
John W. Eaton <jwe@octave.org>
parents: 29787
diff changeset
546
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
547 connect (qt_link (), &qt_interpreter_events::directory_changed_signal,
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
548 m_file_browser_widget, &files_dock_widget::update_octave_directory);
29796
a0fce019cd1f additional reorganization of signal/slot connections in main_window class
John W. Eaton <jwe@octave.org>
parents: 29787
diff changeset
549
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
550 return m_file_browser_widget;
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
551 }
29613
9367cba2a6d5 allow most dock widgets to be used from command line
John W. Eaton <jwe@octave.org>
parents: 29575
diff changeset
552
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
553 QPointer<history_dock_widget>
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
554 base_qobject::history_widget (main_window *mw)
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
555 {
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
556 if (m_history_widget)
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
557 {
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
558 m_history_widget->set_main_window (mw);
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
559 m_history_widget->set_adopted (true);
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
560 }
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
561 else if (! m_history_widget)
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
562 {
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
563 m_history_widget
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
564 = QPointer<history_dock_widget> (new history_dock_widget (mw));
29613
9367cba2a6d5 allow most dock widgets to be used from command line
John W. Eaton <jwe@octave.org>
parents: 29575
diff changeset
565
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
566 connect (qt_link (), &qt_interpreter_events::set_history_signal,
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
567 m_history_widget, &history_dock_widget::set_history);
29613
9367cba2a6d5 allow most dock widgets to be used from command line
John W. Eaton <jwe@octave.org>
parents: 29575
diff changeset
568
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
569 connect (qt_link (), &qt_interpreter_events::append_history_signal,
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
570 m_history_widget, &history_dock_widget::append_history);
29613
9367cba2a6d5 allow most dock widgets to be used from command line
John W. Eaton <jwe@octave.org>
parents: 29575
diff changeset
571
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
572 connect (qt_link (), &qt_interpreter_events::clear_history_signal,
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
573 m_history_widget, &history_dock_widget::clear_history);
29613
9367cba2a6d5 allow most dock widgets to be used from command line
John W. Eaton <jwe@octave.org>
parents: 29575
diff changeset
574
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
575 emit interpreter_event
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
576 ([=] (interpreter& interp) {
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
577 // INTERPRETER THREAD
29775
a64352cadda8 use interpreter events to set initial data for workspace and history widgets
John W. Eaton <jwe@octave.org>
parents: 29774
diff changeset
578
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
579 event_manager& xevmgr = interp.get_event_manager ();
29775
a64352cadda8 use interpreter events to set initial data for workspace and history widgets
John W. Eaton <jwe@octave.org>
parents: 29774
diff changeset
580
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
581 xevmgr.set_history ();
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
582 });
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
583 }
29613
9367cba2a6d5 allow most dock widgets to be used from command line
John W. Eaton <jwe@octave.org>
parents: 29575
diff changeset
584
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
585 return m_history_widget;
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
586 }
29613
9367cba2a6d5 allow most dock widgets to be used from command line
John W. Eaton <jwe@octave.org>
parents: 29575
diff changeset
587
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
588 QPointer<workspace_view>
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
589 base_qobject::workspace_widget (main_window *mw)
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
590 {
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
591 if (m_workspace_widget)
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
592 {
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
593 m_workspace_widget->set_main_window (mw);
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
594 m_workspace_widget->set_adopted (true);
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
595 }
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
596 else if (! m_workspace_widget)
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
597 {
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
598 m_workspace_widget
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
599 = QPointer<workspace_view> (new workspace_view (mw));
29613
9367cba2a6d5 allow most dock widgets to be used from command line
John W. Eaton <jwe@octave.org>
parents: 29575
diff changeset
600
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
601 m_workspace_widget->setModel (m_workspace_model);
29613
9367cba2a6d5 allow most dock widgets to be used from command line
John W. Eaton <jwe@octave.org>
parents: 29575
diff changeset
602
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
603 connect (m_workspace_model, &workspace_model::model_changed,
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
604 m_workspace_widget, &workspace_view::handle_model_changed);
29613
9367cba2a6d5 allow most dock widgets to be used from command line
John W. Eaton <jwe@octave.org>
parents: 29575
diff changeset
605
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
606 connect (qt_link (), &qt_interpreter_events::set_workspace_signal,
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
607 m_workspace_model, &workspace_model::set_workspace);
29613
9367cba2a6d5 allow most dock widgets to be used from command line
John W. Eaton <jwe@octave.org>
parents: 29575
diff changeset
608
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
609 connect (qt_link (), &qt_interpreter_events::clear_workspace_signal,
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
610 m_workspace_model, &workspace_model::clear_workspace);
29768
38bbe1a2828f allow variable editor to open from workspace view without main window
John W. Eaton <jwe@octave.org>
parents: 29762
diff changeset
611
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
612 connect (m_workspace_widget,
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
613 &workspace_view::copy_variable_value_to_clipboard,
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
614 [=] (const QString& var_name) {
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
615 emit interpreter_event
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
616 ([=] (interpreter& interp)
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
617 {
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
618 // INTERPRETER THREAD
29774
aa46787ed8b7 eliminate direct dependence on octave intepreter from workspace_view
John W. Eaton <jwe@octave.org>
parents: 29773
diff changeset
619
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
620 octave_value val = interp.varval (var_name.toStdString ());
29774
aa46787ed8b7 eliminate direct dependence on octave intepreter from workspace_view
John W. Eaton <jwe@octave.org>
parents: 29773
diff changeset
621
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
622 if (val.is_undefined ())
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
623 val = 0;
29774
aa46787ed8b7 eliminate direct dependence on octave intepreter from workspace_view
John W. Eaton <jwe@octave.org>
parents: 29773
diff changeset
624
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
625 std::ostringstream buf;
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
626 val.print_raw (buf, true);
29774
aa46787ed8b7 eliminate direct dependence on octave intepreter from workspace_view
John W. Eaton <jwe@octave.org>
parents: 29773
diff changeset
627
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
628 // FIXME: is the following operation thread safe or should
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
629 // it be done with a signal/slot connection?
29774
aa46787ed8b7 eliminate direct dependence on octave intepreter from workspace_view
John W. Eaton <jwe@octave.org>
parents: 29773
diff changeset
630
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
631 QClipboard *clipboard = QApplication::clipboard ();
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
632 clipboard->setText (QString::fromStdString (buf.str ()));
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
633 });
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
634 });
29773
5f404ae822ee allow variable renaming in workspace_view to work without main_window
John W. Eaton <jwe@octave.org>
parents: 29768
diff changeset
635
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
636 connect (m_workspace_widget, &workspace_view::rename_variable_signal,
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
637 [=] (const QString& old_name, const QString& new_name) {
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
638 emit interpreter_event
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
639 ([=] (interpreter& interp) {
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
640 // INTERPRETER THREAD
29773
5f404ae822ee allow variable renaming in workspace_view to work without main_window
John W. Eaton <jwe@octave.org>
parents: 29768
diff changeset
641
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
642 symbol_scope scope = interp.get_current_scope ();
29773
5f404ae822ee allow variable renaming in workspace_view to work without main_window
John W. Eaton <jwe@octave.org>
parents: 29768
diff changeset
643
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
644 if (scope)
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
645 {
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
646 scope.rename (old_name.toStdString (),
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
647 new_name.toStdString ());
29773
5f404ae822ee allow variable renaming in workspace_view to work without main_window
John W. Eaton <jwe@octave.org>
parents: 29768
diff changeset
648
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
649 tree_evaluator& tw = interp.get_evaluator ();
29773
5f404ae822ee allow variable renaming in workspace_view to work without main_window
John W. Eaton <jwe@octave.org>
parents: 29768
diff changeset
650
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
651 event_manager& xevmgr = interp.get_event_manager ();
29773
5f404ae822ee allow variable renaming in workspace_view to work without main_window
John W. Eaton <jwe@octave.org>
parents: 29768
diff changeset
652
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
653 xevmgr.set_workspace (true, tw.get_symbol_info ());
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
654 }
29773
5f404ae822ee allow variable renaming in workspace_view to work without main_window
John W. Eaton <jwe@octave.org>
parents: 29768
diff changeset
655
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
656 // FIXME: if this action fails, do we need a way to
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
657 // display that info in the GUI?
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
658 });
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
659 });
29774
aa46787ed8b7 eliminate direct dependence on octave intepreter from workspace_view
John W. Eaton <jwe@octave.org>
parents: 29773
diff changeset
660
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
661 connect (m_workspace_widget, &workspace_view::edit_variable_signal,
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
662 [=] (const QString& var_name) {
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
663 emit interpreter_event
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
664 ([=] (interpreter& interp) {
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
665 // INTERPRETER THREAD
29774
aa46787ed8b7 eliminate direct dependence on octave intepreter from workspace_view
John W. Eaton <jwe@octave.org>
parents: 29773
diff changeset
666
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
667 std::string name = var_name.toStdString ();
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
668 octave_value val = interp.varval (name);
29774
aa46787ed8b7 eliminate direct dependence on octave intepreter from workspace_view
John W. Eaton <jwe@octave.org>
parents: 29773
diff changeset
669
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
670 event_manager& xevmgr = interp.get_event_manager ();
29774
aa46787ed8b7 eliminate direct dependence on octave intepreter from workspace_view
John W. Eaton <jwe@octave.org>
parents: 29773
diff changeset
671
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
672 xevmgr.edit_variable (name, val);
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
673 });
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
674 });
29775
a64352cadda8 use interpreter events to set initial data for workspace and history widgets
John W. Eaton <jwe@octave.org>
parents: 29774
diff changeset
675
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
676 emit interpreter_event
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
677 ([=] (interpreter& interp) {
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
678 // INTERPRETER THREAD
29775
a64352cadda8 use interpreter events to set initial data for workspace and history widgets
John W. Eaton <jwe@octave.org>
parents: 29774
diff changeset
679
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
680 event_manager& xevmgr = interp.get_event_manager ();
29775
a64352cadda8 use interpreter events to set initial data for workspace and history widgets
John W. Eaton <jwe@octave.org>
parents: 29774
diff changeset
681
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
682 xevmgr.set_workspace ();
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
683 });
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
684 }
29613
9367cba2a6d5 allow most dock widgets to be used from command line
John W. Eaton <jwe@octave.org>
parents: 29575
diff changeset
685
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
686 return m_workspace_widget;
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
687 }
29613
9367cba2a6d5 allow most dock widgets to be used from command line
John W. Eaton <jwe@octave.org>
parents: 29575
diff changeset
688
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
689 QPointer<file_editor_interface>
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
690 base_qobject::editor_widget (main_window */*mw*/)
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
691 {
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
692 return m_editor_widget;
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
693 }
29613
9367cba2a6d5 allow most dock widgets to be used from command line
John W. Eaton <jwe@octave.org>
parents: 29575
diff changeset
694
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
695 QPointer<variable_editor>
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
696 base_qobject::variable_editor_widget (main_window *mw)
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
697 {
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
698 if (m_variable_editor_widget && mw)
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
699 {
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
700 m_variable_editor_widget->set_main_window (mw);
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
701 m_variable_editor_widget->set_adopted (true);
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
702 }
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
703 else if (! m_variable_editor_widget)
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
704 {
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
705 m_variable_editor_widget
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
706 = QPointer<variable_editor> (new variable_editor (mw));
29762
84d7e1ace446 improve variable editor functionality when used without GUI main window
John W. Eaton <jwe@octave.org>
parents: 29758
diff changeset
707
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
708 connect (m_variable_editor_widget, &variable_editor::updated,
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
709 this, &base_qobject::handle_variable_editor_update);
29762
84d7e1ace446 improve variable editor functionality when used without GUI main window
John W. Eaton <jwe@octave.org>
parents: 29758
diff changeset
710
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
711 connect (m_variable_editor_widget, &variable_editor::command_signal,
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
712 this, &base_qobject::execute_command);
29762
84d7e1ace446 improve variable editor functionality when used without GUI main window
John W. Eaton <jwe@octave.org>
parents: 29758
diff changeset
713
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
714 connect (qt_link (),
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
715 &qt_interpreter_events::refresh_variable_editor_signal,
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
716 m_variable_editor_widget, &variable_editor::refresh);
29783
5154c91e0d98 eliminate some connections to parent objects in octave_dock_widget classes
John W. Eaton <jwe@octave.org>
parents: 29780
diff changeset
717
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
718 connect_interpreter_events<variable_editor> (m_variable_editor_widget);
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
719 }
29613
9367cba2a6d5 allow most dock widgets to be used from command line
John W. Eaton <jwe@octave.org>
parents: 29575
diff changeset
720
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
721 return m_variable_editor_widget;
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
722 }
29613
9367cba2a6d5 allow most dock widgets to be used from command line
John W. Eaton <jwe@octave.org>
parents: 29575
diff changeset
723
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
724 QPointer<community_news> base_qobject::community_news_widget (int serial)
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
725 {
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
726 if (! m_community_news)
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
727 m_community_news
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
728 = QPointer<community_news> (new community_news (serial));
29835
a946d742fb97 allow community news window to be opened from command line
John W. Eaton <jwe@octave.org>
parents: 29822
diff changeset
729
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
730 return m_community_news;
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
731 }
29835
a946d742fb97 allow community news window to be opened from command line
John W. Eaton <jwe@octave.org>
parents: 29822
diff changeset
732
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
733 QPointer<release_notes> base_qobject::release_notes_widget ()
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
734 {
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
735 if (! m_release_notes)
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
736 m_release_notes = QPointer<release_notes> (new release_notes ());
29836
56465c0739fa allow release notes window to be opened from command line
John W. Eaton <jwe@octave.org>
parents: 29835
diff changeset
737
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
738 return m_release_notes;
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
739 }
29836
56465c0739fa allow release notes window to be opened from command line
John W. Eaton <jwe@octave.org>
parents: 29835
diff changeset
740
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
741 bool base_qobject::confirm_shutdown ()
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
742 {
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
743 // Currently, we forward to main_window::confirm_shutdown instead of
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
744 // just displaying a dialog box here because the main_window also
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
745 // knows about and is responsible for notifying the editor.
29153
02ee34a30351 eliminate separate cli_qobject and gui_qobject classes
John W. Eaton <jwe@octave.org>
parents: 28851
diff changeset
746
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
747 return m_main_window ? m_main_window->confirm_shutdown () : true;
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
748 }
27588
f0e3f3e28a8e move qt_interpreter_events object from interpreter_qobject to octave_qobject
John W. Eaton <jwe@octave.org>
parents: 27582
diff changeset
749
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
750 void base_qobject::start_gui (bool gui_app)
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
751 {
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
752 if (m_app_context.experimental_terminal_widget ())
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
753 {
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
754 if (m_main_window)
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
755 return;
29503
3bfec185c9e2 experimental command window widget with server loop
John W. Eaton <jwe@octave.org>
parents: 29359
diff changeset
756
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
757 m_gui_app = gui_app;
29503
3bfec185c9e2 experimental command window widget with server loop
John W. Eaton <jwe@octave.org>
parents: 29359
diff changeset
758
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
759 m_main_window = new main_window (*this);
29503
3bfec185c9e2 experimental command window widget with server loop
John W. Eaton <jwe@octave.org>
parents: 29359
diff changeset
760
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
761 connect (qt_link (), &qt_interpreter_events::focus_window_signal,
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
762 m_main_window, &main_window::focus_window);
29503
3bfec185c9e2 experimental command window widget with server loop
John W. Eaton <jwe@octave.org>
parents: 29359
diff changeset
763
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
764 connect (qt_link (), &qt_interpreter_events::close_gui_signal,
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
765 this, &base_qobject::close_gui);
29503
3bfec185c9e2 experimental command window widget with server loop
John W. Eaton <jwe@octave.org>
parents: 29359
diff changeset
766
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
767 connect (m_main_window, &main_window::close_gui_signal,
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
768 this, &base_qobject::close_gui);
29503
3bfec185c9e2 experimental command window widget with server loop
John W. Eaton <jwe@octave.org>
parents: 29359
diff changeset
769
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
770 connect (m_main_window, &main_window::show_community_news_signal,
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
771 this, &base_qobject::show_community_news);
29835
a946d742fb97 allow community news window to be opened from command line
John W. Eaton <jwe@octave.org>
parents: 29822
diff changeset
772
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
773 connect (m_main_window, &main_window::show_release_notes_signal,
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
774 this, &base_qobject::show_release_notes);
29836
56465c0739fa allow release notes window to be opened from command line
John W. Eaton <jwe@octave.org>
parents: 29835
diff changeset
775
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
776 if (m_interpreter_ready)
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
777 m_main_window->handle_octave_ready ();
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
778 else
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
779 connect (m_interpreter_qobj, &interpreter_qobject::ready,
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
780 m_main_window, &main_window::handle_octave_ready);
29503
3bfec185c9e2 experimental command window widget with server loop
John W. Eaton <jwe@octave.org>
parents: 29359
diff changeset
781
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
782 if (m_gui_app)
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
783 m_qapplication->setQuitOnLastWindowClosed (true);
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
784 else
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
785 {
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
786 // FIXME: Save current values of PS1 and PS2 so they can be
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
787 // restored when we return to the command line?
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
788 }
29503
3bfec185c9e2 experimental command window widget with server loop
John W. Eaton <jwe@octave.org>
parents: 29359
diff changeset
789
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
790 m_app_context.gui_running (true);
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
791 }
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
792 }
29503
3bfec185c9e2 experimental command window widget with server loop
John W. Eaton <jwe@octave.org>
parents: 29359
diff changeset
793
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
794 void base_qobject::show_terminal_window ()
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
795 {
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
796 terminal_dock_widget *widget
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
797 = (m_terminal_widget
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
798 ? m_terminal_widget : terminal_widget ());
29787
b4d2fa28d1d4 allow terminal window to be opened from command line
John W. Eaton <jwe@octave.org>
parents: 29786
diff changeset
799
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
800 if (! widget->isVisible ())
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
801 {
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
802 widget->show ();
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
803 widget->raise ();
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
804 }
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
805 }
29787
b4d2fa28d1d4 allow terminal window to be opened from command line
John W. Eaton <jwe@octave.org>
parents: 29786
diff changeset
806
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
807 void base_qobject::show_documentation_window (const QString& file)
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
808 {
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
809 documentation_dock_widget *widget
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
810 = (m_documentation_widget
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
811 ? m_documentation_widget : documentation_widget ());
29613
9367cba2a6d5 allow most dock widgets to be used from command line
John W. Eaton <jwe@octave.org>
parents: 29575
diff changeset
812
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
813 widget->showDoc (file);
29613
9367cba2a6d5 allow most dock widgets to be used from command line
John W. Eaton <jwe@octave.org>
parents: 29575
diff changeset
814
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
815 if (! widget->isVisible ())
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
816 {
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
817 widget->show ();
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
818 widget->raise ();
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
819 }
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
820 }
29613
9367cba2a6d5 allow most dock widgets to be used from command line
John W. Eaton <jwe@octave.org>
parents: 29575
diff changeset
821
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
822 void base_qobject::show_file_browser_window ()
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
823 {
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
824 files_dock_widget *widget
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
825 = m_file_browser_widget ? m_file_browser_widget : file_browser_widget ();
29613
9367cba2a6d5 allow most dock widgets to be used from command line
John W. Eaton <jwe@octave.org>
parents: 29575
diff changeset
826
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
827 if (! widget->isVisible ())
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
828 {
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
829 widget->show ();
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
830 widget->raise ();
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
831 }
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
832 }
29613
9367cba2a6d5 allow most dock widgets to be used from command line
John W. Eaton <jwe@octave.org>
parents: 29575
diff changeset
833
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
834 void base_qobject::show_command_history_window ()
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
835 {
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
836 history_dock_widget *widget
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
837 = m_history_widget ? m_history_widget : history_widget ();
29613
9367cba2a6d5 allow most dock widgets to be used from command line
John W. Eaton <jwe@octave.org>
parents: 29575
diff changeset
838
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
839 if (! widget->isVisible ())
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
840 {
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
841 widget->show ();
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
842 widget->raise ();
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
843 }
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
844 }
29613
9367cba2a6d5 allow most dock widgets to be used from command line
John W. Eaton <jwe@octave.org>
parents: 29575
diff changeset
845
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
846 void base_qobject::show_workspace_window ()
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
847 {
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
848 workspace_view *widget
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
849 = m_workspace_widget ? m_workspace_widget : workspace_widget ();
29613
9367cba2a6d5 allow most dock widgets to be used from command line
John W. Eaton <jwe@octave.org>
parents: 29575
diff changeset
850
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
851 if (! widget->isVisible ())
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
852 {
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
853 widget->show ();
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
854 widget->raise ();
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
855 }
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
856 }
29613
9367cba2a6d5 allow most dock widgets to be used from command line
John W. Eaton <jwe@octave.org>
parents: 29575
diff changeset
857
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
858 void base_qobject::show_variable_editor_window (const QString& name,
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
859 const octave_value& value)
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
860 {
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
861 variable_editor *widget
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
862 = (m_variable_editor_widget
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
863 ? m_variable_editor_widget : variable_editor_widget ());
29613
9367cba2a6d5 allow most dock widgets to be used from command line
John W. Eaton <jwe@octave.org>
parents: 29575
diff changeset
864
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
865 if (! widget->isVisible ())
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
866 {
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
867 widget->show ();
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
868 widget->raise ();
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
869 }
29754
4c569e386e9b improve behavior of dockable widgets (bug #60750)
John W. Eaton <jwe@octave.org>
parents: 29702
diff changeset
870
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
871 // FIXME: Should this be done with a signal/slot connection?
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
872 widget->edit_variable (name, value);
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
873 }
29613
9367cba2a6d5 allow most dock widgets to be used from command line
John W. Eaton <jwe@octave.org>
parents: 29575
diff changeset
874
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
875 void base_qobject::handle_variable_editor_update ()
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
876 {
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
877 // Called when the variable editor emits the updated signal. The size
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
878 // of a variable may have changed, so we refresh the workspace in the
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
879 // interpreter. That will eventually cause the workspace view in the
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
880 // GUI to be updated.
29613
9367cba2a6d5 allow most dock widgets to be used from command line
John W. Eaton <jwe@octave.org>
parents: 29575
diff changeset
881
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
882 interpreter_event
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
883 ([] (interpreter& interp)
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
884 {
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
885 // INTERPRETER THREAD
29613
9367cba2a6d5 allow most dock widgets to be used from command line
John W. Eaton <jwe@octave.org>
parents: 29575
diff changeset
886
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
887 tree_evaluator& tw = interp.get_evaluator ();
29613
9367cba2a6d5 allow most dock widgets to be used from command line
John W. Eaton <jwe@octave.org>
parents: 29575
diff changeset
888
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
889 event_manager& xevmgr = interp.get_event_manager ();
29613
9367cba2a6d5 allow most dock widgets to be used from command line
John W. Eaton <jwe@octave.org>
parents: 29575
diff changeset
890
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
891 xevmgr.set_workspace (true, tw.get_symbol_info (), false);
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
892 });
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
893 }
29613
9367cba2a6d5 allow most dock widgets to be used from command line
John W. Eaton <jwe@octave.org>
parents: 29575
diff changeset
894
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
895 void base_qobject::show_community_news (int serial)
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
896 {
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
897 // Ensure widget exists.
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
898 community_news_widget (serial);
29835
a946d742fb97 allow community news window to be opened from command line
John W. Eaton <jwe@octave.org>
parents: 29822
diff changeset
899
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
900 m_community_news->display ();
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
901 }
29835
a946d742fb97 allow community news window to be opened from command line
John W. Eaton <jwe@octave.org>
parents: 29822
diff changeset
902
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
903 void base_qobject::show_release_notes ()
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
904 {
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
905 // Ensure widget exists.
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
906 release_notes_widget ();
29836
56465c0739fa allow release notes window to be opened from command line
John W. Eaton <jwe@octave.org>
parents: 29835
diff changeset
907
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
908 m_release_notes->display ();
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
909 }
29836
56465c0739fa allow release notes window to be opened from command line
John W. Eaton <jwe@octave.org>
parents: 29835
diff changeset
910
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
911 void base_qobject::execute_command (const QString& command)
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
912 {
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
913 emit interpreter_event
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
914 ([=] (interpreter& interp)
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
915 {
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
916 // INTERPRETER THREAD
29762
84d7e1ace446 improve variable editor functionality when used without GUI main window
John W. Eaton <jwe@octave.org>
parents: 29758
diff changeset
917
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
918 // FIXME: Do we need to do anything special about errors here?
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
919 // Currently the eval function will just call error() in the
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
920 // interpreter event loop and throw an execution error. It will
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
921 // be caught, so shouldn't crash the interpreter, but the
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
922 // message may not go anywhere useful depending on how the GUI
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
923 // is being used or if Octave running server mode.
29762
84d7e1ace446 improve variable editor functionality when used without GUI main window
John W. Eaton <jwe@octave.org>
parents: 29758
diff changeset
924
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
925 interp.eval (command.toStdString (), 0);
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
926 });
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
927 }
29762
84d7e1ace446 improve variable editor functionality when used without GUI main window
John W. Eaton <jwe@octave.org>
parents: 29758
diff changeset
928
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
929 void base_qobject::close_gui ()
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
930 {
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
931 if (m_app_context.experimental_terminal_widget ())
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
932 {
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
933 if (! m_main_window)
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
934 return;
29503
3bfec185c9e2 experimental command window widget with server loop
John W. Eaton <jwe@octave.org>
parents: 29359
diff changeset
935
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
936 // FIXME: Restore previous values of PS1 and PS2 if we are
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
937 // returning to the command line?
29503
3bfec185c9e2 experimental command window widget with server loop
John W. Eaton <jwe@octave.org>
parents: 29359
diff changeset
938
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
939 interpreter_event
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
940 ([=] (interpreter& interp)
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
941 {
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
942 // INTERPRETER THREAD
29503
3bfec185c9e2 experimental command window widget with server loop
John W. Eaton <jwe@octave.org>
parents: 29359
diff changeset
943
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
944 application *app = interp.get_app_context ();
29503
3bfec185c9e2 experimental command window widget with server loop
John W. Eaton <jwe@octave.org>
parents: 29359
diff changeset
945
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
946 cmdline_options opts = app->options ();
29503
3bfec185c9e2 experimental command window widget with server loop
John W. Eaton <jwe@octave.org>
parents: 29359
diff changeset
947
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
948 if (opts.gui ())
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
949 interp.quit (0, false, false);
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
950 });
29503
3bfec185c9e2 experimental command window widget with server loop
John W. Eaton <jwe@octave.org>
parents: 29359
diff changeset
951
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
952 m_app_context.gui_running (false);
29503
3bfec185c9e2 experimental command window widget with server loop
John W. Eaton <jwe@octave.org>
parents: 29359
diff changeset
953
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
954 if (m_main_window)
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
955 {
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
956 m_main_window->deleteLater ();
29503
3bfec185c9e2 experimental command window widget with server loop
John W. Eaton <jwe@octave.org>
parents: 29359
diff changeset
957
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
958 m_main_window = nullptr;
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
959 }
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
960 }
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
961 }
29503
3bfec185c9e2 experimental command window widget with server loop
John W. Eaton <jwe@octave.org>
parents: 29359
diff changeset
962
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
963 void base_qobject::interpreter_ready ()
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
964 {
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
965 m_interpreter_ready = true;
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
966 }
28347
00a9a49c7670 improve interpreter shutdown process (bug #56952)
John W. Eaton <jwe@octave.org>
parents: 28063
diff changeset
967
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
968 void base_qobject::interpreter_event (const fcn_callback& fcn)
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
969 {
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
970 // The following is a direct function call across threads. It works
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
971 // because it is accessing a thread-safe queue of events that
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
972 // are later executed by the Octave interpreter in the other thread.
27302
5f170ea12fa1 use Qt signals to pass interpreter callbacks to octave-qobject
John W. Eaton <jwe@octave.org>
parents: 27263
diff changeset
973
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
974 // See also the comments in interpreter-qobject.h about
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
975 // interpreter_qobject slots.
27302
5f170ea12fa1 use Qt signals to pass interpreter callbacks to octave-qobject
John W. Eaton <jwe@octave.org>
parents: 27263
diff changeset
976
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
977 m_interpreter_qobj->interpreter_event (fcn);
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
978 }
27302
5f170ea12fa1 use Qt signals to pass interpreter callbacks to octave-qobject
John W. Eaton <jwe@octave.org>
parents: 27263
diff changeset
979
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
980 void base_qobject::interpreter_event (const meth_callback& meth)
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
981 {
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
982 // The following is a direct function call across threads. It works
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
983 // because it is accessing a thread-safe queue of events that
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
984 // are later executed by the Octave interpreter in the other thread.
27302
5f170ea12fa1 use Qt signals to pass interpreter callbacks to octave-qobject
John W. Eaton <jwe@octave.org>
parents: 27263
diff changeset
985
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
986 // See also the comments in interpreter-qobject.h about
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
987 // interpreter_qobject slots.
27302
5f170ea12fa1 use Qt signals to pass interpreter callbacks to octave-qobject
John W. Eaton <jwe@octave.org>
parents: 27263
diff changeset
988
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
989 m_interpreter_qobj->interpreter_event (meth);
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
990 }
27302
5f170ea12fa1 use Qt signals to pass interpreter callbacks to octave-qobject
John W. Eaton <jwe@octave.org>
parents: 27263
diff changeset
991
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
992 void base_qobject::interpreter_interrupt ()
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
993 {
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
994 m_interpreter_qobj->interrupt ();
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
995 }
29503
3bfec185c9e2 experimental command window widget with server loop
John W. Eaton <jwe@octave.org>
parents: 29359
diff changeset
996
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
997 // FIXME: Should we try to make the pause, stop, and resume actions
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
998 // work for both the old and new terminal widget?
29292
eb1e10abe9d5 use method in interpreter class to interrupt interpreter execution in GUI
John W. Eaton <jwe@octave.org>
parents: 29219
diff changeset
999
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
1000 void base_qobject::interpreter_pause ()
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
1001 {
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
1002 if (m_app_context.experimental_terminal_widget ())
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
1003 m_interpreter_qobj->pause ();
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
1004 }
29503
3bfec185c9e2 experimental command window widget with server loop
John W. Eaton <jwe@octave.org>
parents: 29359
diff changeset
1005
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
1006 void base_qobject::interpreter_stop ()
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
1007 {
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
1008 if (m_app_context.experimental_terminal_widget ())
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
1009 m_interpreter_qobj->stop ();
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
1010 }
29503
3bfec185c9e2 experimental command window widget with server loop
John W. Eaton <jwe@octave.org>
parents: 29359
diff changeset
1011
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
1012 void base_qobject::interpreter_resume ()
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
1013 {
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
1014 if (m_app_context.experimental_terminal_widget ())
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
1015 m_interpreter_qobj->resume ();
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
1016 }
29292
eb1e10abe9d5 use method in interpreter class to interrupt interpreter execution in GUI
John W. Eaton <jwe@octave.org>
parents: 29219
diff changeset
1017
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
1018 void base_qobject::copy_image_to_clipboard (const QString& file,
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
1019 bool remove_file)
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
1020 {
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
1021 QClipboard *clipboard = QApplication::clipboard ();
27197
b8c0d5ad024f refactor and rename some qt application objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
1022
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
1023 QImage img (file);
27197
b8c0d5ad024f refactor and rename some qt application objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
1024
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
1025 if (img.isNull ())
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
1026 {
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
1027 // Report error?
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
1028 return;
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
1029 }
27197
b8c0d5ad024f refactor and rename some qt application objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
1030
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
1031 clipboard->setImage (img);
27197
b8c0d5ad024f refactor and rename some qt application objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
1032
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
1033 if (remove_file)
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
1034 QFile::remove (file);
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
1035 }
31646
c6d54dd31a7e maint: Use macros to begin/end C++ namespaces.
John W. Eaton <jwe@octave.org>
parents: 31222
diff changeset
1036
c6d54dd31a7e maint: Use macros to begin/end C++ namespaces.
John W. Eaton <jwe@octave.org>
parents: 31222
diff changeset
1037 OCTAVE_END_NAMESPACE(octave)