Mercurial > octave
changeset 29786:63c515ff762f
eliminate more signal connections to parent objects
* octave-qobject.cc (base_qobject::base_qobject): Connect
interpreter_qobject::ready to base_qobject::interpreter_ready here.
* interpreter-qobject.cc (interpreter_qobject::interpreter_qobject):
Not here.
* command-widget.h, command-widget.cc
(command_widget::interpreter_pause, command_widget::interpreter_stop,
command_widget::interpreter_resume): New signals.
(command_widget::command_widget): Connect pause_button, stop_button,
and resume_button to new signals instead of to base_qobject slots.
* main-window.cc (main_window::main_window): If using new terminal
widget, connect new signals to base_qobject slots here.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Sat, 19 Jun 2021 10:33:37 -0400 |
parents | 8ba6f4d0373c |
children | b4d2fa28d1d4 |
files | libgui/src/command-widget.cc libgui/src/command-widget.h libgui/src/interpreter-qobject.cc libgui/src/main-window.cc libgui/src/octave-qobject.cc |
diffstat | 5 files changed, 22 insertions(+), 12 deletions(-) [+] |
line wrap: on
line diff
--- a/libgui/src/command-widget.cc Sat Jun 19 01:15:34 2021 -0400 +++ b/libgui/src/command-widget.cc Sat Jun 19 10:33:37 2021 -0400 @@ -47,10 +47,7 @@ namespace octave { - // FIXME: this class needs a different name and should probably be - // defined in a separate file. - - command_widget::command_widget (base_qobject& oct_qobj, QWidget *p) + command_widget::command_widget (base_qobject&, QWidget *p) : QWidget (p), m_incomplete_parse (false), m_prompt (new QLabel ("", this)), m_line_edit (new QLineEdit (this)), @@ -90,13 +87,13 @@ m_line_edit, &QLineEdit::clear); connect (pause_button, &QPushButton::clicked, - &oct_qobj, &base_qobject::interpreter_pause); + this, &command_widget::interpreter_pause); + + connect (resume_button, &QPushButton::clicked, + this, &command_widget::interpreter_resume); connect (stop_button, &QPushButton::clicked, - &oct_qobj, &base_qobject::interpreter_stop); - - connect (resume_button, &QPushButton::clicked, - &oct_qobj, &base_qobject::interpreter_resume); + this, &command_widget::interpreter_stop); connect (p, SIGNAL (update_prompt_signal (const QString&)), m_prompt, SLOT (setText (const QSTring&)));
--- a/libgui/src/command-widget.h Sat Jun 19 01:15:34 2021 -0400 +++ b/libgui/src/command-widget.h Sat Jun 19 10:33:37 2021 -0400 @@ -52,6 +52,10 @@ void clear_line_edit (void); + void interpreter_pause (void); + void interpreter_resume (void); + void interpreter_stop (void); + void interpreter_event (const fcn_callback& fcn); void interpreter_event (const meth_callback& meth);
--- a/libgui/src/interpreter-qobject.cc Sat Jun 19 01:15:34 2021 -0400 +++ b/libgui/src/interpreter-qobject.cc Sat Jun 19 10:33:37 2021 -0400 @@ -56,9 +56,6 @@ evmgr.install_qt_event_handlers (m_octave_qobj.get_qt_interpreter_events ()); evmgr.enable (); - connect (this, &interpreter_qobject::ready, - &m_octave_qobj, &base_qobject::interpreter_ready); - int exit_status = 0; try
--- a/libgui/src/main-window.cc Sat Jun 19 01:15:34 2021 -0400 +++ b/libgui/src/main-window.cc Sat Jun 19 10:33:37 2021 -0400 @@ -178,6 +178,15 @@ connect (m_command_window, &terminal_dock_widget::settings_changed, cmd_widget, &command_widget::notice_settings); + connect (cmd_widget, &command_widget::interpreter_pause, + &m_octave_qobj, &base_qobject::interpreter_pause); + + connect (cmd_widget, &command_widget::interpreter_resume, + &m_octave_qobj, &base_qobject::interpreter_resume); + + connect (cmd_widget, &command_widget::interpreter_stop, + &m_octave_qobj, &base_qobject::interpreter_stop); + m_octave_qobj.connect_interpreter_events (cmd_widget); } else
--- a/libgui/src/octave-qobject.cc Sat Jun 19 01:15:34 2021 -0400 +++ b/libgui/src/octave-qobject.cc Sat Jun 19 10:33:37 2021 -0400 @@ -224,6 +224,9 @@ m_qapplication, &octave_qapplication::exit, Qt::QueuedConnection); + connect (m_interpreter_qobj, &interpreter_qobject::ready, + this, &base_qobject::interpreter_ready); + connect (m_main_thread, &QThread::finished, m_main_thread, &QThread::deleteLater);