changeset 24632:e9f7cfd40f85

rename some signals and slots for consistency and clarity * main-window.h, main-window.cc (main_window::refresh_variable_editor): Rename from main_window::clear_variable_editor_cache. Change all uses. (main_window::handle_variable_editor_update): Rename from main_window::variable_editor_callback. Change all uses. (main_window::refresh_workspace_callback): Rename from main_window::force_refresh_workspace. Change all uses. * octave-qt-link.h, octave-qt-link.cc (octave_qt_link::open_variable_signal): Rename from octave_qt_link::open_variable. Change all uses. (octave_qt_link::refresh_variable_editor_signal): Rename from octave_qt_link::refresh_variable_editor. Change all uses.
author John W. Eaton <jwe@octave.org>
date Mon, 22 Jan 2018 01:31:53 -0500
parents 6de74d95a7a1
children 428780eec08a
files libgui/src/main-window.cc libgui/src/main-window.h libgui/src/octave-qt-link.cc libgui/src/octave-qt-link.h
diffstat 4 files changed, 32 insertions(+), 28 deletions(-) [+]
line wrap: on
line diff
--- a/libgui/src/main-window.cc	Mon Jan 22 01:25:06 2018 -0500
+++ b/libgui/src/main-window.cc	Mon Jan 22 01:31:53 2018 -0500
@@ -1749,16 +1749,20 @@
 }
 
 void
-main_window::clear_variable_editor_cache (void)
+main_window::refresh_variable_editor (void)
 {
   m_variable_editor_window->clear_data_cache ();
 }
 
 void
-main_window::variable_editor_callback (void)
+main_window::handle_variable_editor_update (void)
 {
-  // Called when the variable editor makes changes.
-  octave_link::post_event(this, &main_window::force_refresh_workspace);
+  // Called when the variable editor emits the updated signal.  The size
+  // of a variable may have changed, so we refresh the workspace in the
+  // interpreter.  That will eventually cause the workspace view in the
+  // GUI to be updated.
+
+  octave_link::post_event (this, &main_window::refresh_workspace_callback);
 }
 
 void
@@ -1800,11 +1804,11 @@
       connect (m_workspace_model, SIGNAL (model_changed (void)),
                m_workspace_window, SLOT (handle_model_changed (void)));
 
-      connect (m_octave_qt_link, SIGNAL (open_variable (const QString&)),
+      connect (m_octave_qt_link, SIGNAL (open_variable_signal (const QString&)),
                this, SLOT (edit_variable (const QString&)));
 
-      connect (m_octave_qt_link, SIGNAL (refresh_variable_editor (void)),
-               this, SLOT (clear_variable_editor_cache (void)));
+      connect (m_octave_qt_link, SIGNAL (refresh_variable_editor_signal (void)),
+               this, SLOT (refresh_variable_editor (void)));
 
       connect (m_workspace_model,
                SIGNAL (rename_variable (const QString&, const QString&)),
@@ -1813,7 +1817,7 @@
                                                      const QString&)));
 
       connect (m_variable_editor_window, SIGNAL (updated (void)),
-               this, SLOT (variable_editor_callback (void)));
+               this, SLOT (handle_variable_editor_update (void)));
 
       connect (m_command_window, SIGNAL (interrupt_signal (void)),
                this, SLOT (interrupt_interpreter (void)));
@@ -2618,6 +2622,18 @@
   Fhistory (ovl ("-c"));
 }
 
+void
+main_window::refresh_workspace_callback (void)
+{
+  // INTERPRETER THREAD
+
+  octave::symbol_scope scope
+   = octave::__get_current_scope__ ("main_window::force_refresh_workspace");
+
+  if (scope)
+    octave_link::set_workspace (true, scope.workspace_info (), false);
+}
+
 bool
 main_window::focus_console_after_command (void)
 {
@@ -2722,18 +2738,6 @@
                                   "main_news:community_news");
 }
 
-void
-main_window::force_refresh_workspace (void)
-{
-  // INTERPRETER THREAD
-
-  octave::symbol_scope scope
-   = octave::__get_current_scope__ ("main_window::load_workspace_callback");
-
-  if (scope)
-    octave_link::set_workspace (true, scope.workspace_info (), false);
-}
-
 QList<octave_dock_widget *>
 main_window::dock_widget_list (void)
 {
--- a/libgui/src/main-window.h	Mon Jan 22 01:25:06 2018 -0500
+++ b/libgui/src/main-window.h	Mon Jan 22 01:31:53 2018 -0500
@@ -284,9 +284,9 @@
 
   void edit_variable (const QString &name);
 
-  void clear_variable_editor_cache (void);
+  void refresh_variable_editor (void);
 
-  void variable_editor_callback (void);
+  void handle_variable_editor_update (void);
 
 protected:
 
@@ -337,6 +337,8 @@
 
   void clear_history_callback (void);
 
+  void refresh_workspace_callback (void);
+
   bool focus_console_after_command (void);
 
   void new_figure_callback (void);
@@ -345,8 +347,6 @@
 
   void configure_shortcuts (void);
 
-  void force_refresh_workspace (void);
-
   QList<octave_dock_widget *> dock_widget_list (void);
 
   octave::gui_application *m_app_context;
--- a/libgui/src/octave-qt-link.cc	Mon Jan 22 01:25:06 2018 -0500
+++ b/libgui/src/octave-qt-link.cc	Mon Jan 22 01:31:53 2018 -0500
@@ -446,7 +446,7 @@
                              dimensions, values, complex_flags);
 
   if (update_variable_editor)
-    emit refresh_variable_editor ();
+    emit refresh_variable_editor_signal ();
 }
 
 void
@@ -618,7 +618,7 @@
 void
 octave_qt_link::do_openvar (const std::string &expr)
 {
-  emit open_variable (QString::fromStdString (expr));
+  emit open_variable_signal (QString::fromStdString (expr));
 }
 
 void
--- a/libgui/src/octave-qt-link.h	Mon Jan 22 01:25:06 2018 -0500
+++ b/libgui/src/octave-qt-link.h	Mon Jan 22 01:31:53 2018 -0500
@@ -197,9 +197,9 @@
 
   void show_doc_signal (const QString& file);
 
-  void open_variable (const QString &name);
+  void open_variable_signal (const QString &name);
 
-  void refresh_variable_editor();
+  void refresh_variable_editor_signal (void);
 
   void confirm_shutdown_signal (void);
 };