changeset 24629:57f36275e605

handle run file and execute command in terminal in the same way * main-window.h, main-window.cc (main_window::run_file_in_terminal): Similar to the execute_command_in_terminal function, add octave_cmd_eval object to m_cmd_queue here instead of posting an event in the octave_link queue. (main_window::run_file_callback): Delete.
author John W. Eaton <jwe@octave.org>
date Mon, 22 Jan 2018 00:45:11 -0500
parents 55da6c4f1382
children 81c84fd1ae57
files libgui/src/main-window.cc libgui/src/main-window.h
diffstat 2 files changed, 6 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/libgui/src/main-window.cc	Sun Jan 21 17:33:20 2018 -0500
+++ b/libgui/src/main-window.cc	Mon Jan 22 00:45:11 2018 -0500
@@ -902,7 +902,9 @@
 main_window::execute_command_in_terminal (const QString& command)
 {
   octave_cmd_exec *cmd = new octave_cmd_exec (command);
+
   m_cmd_queue.add_cmd (cmd);
+
   if (focus_console_after_command ())
     focus_command_window ();
 }
@@ -910,7 +912,10 @@
 void
 main_window::run_file_in_terminal (const QFileInfo& info)
 {
-  octave_link::post_event (this, &main_window::run_file_callback, info);
+  octave_cmd_eval *cmd = new octave_cmd_eval (info);
+
+  m_cmd_queue.add_cmd (cmd);
+
   if (focus_console_after_command ())
     focus_command_window ();
 }
@@ -2595,13 +2600,6 @@
   Fhistory (ovl ("-c"));
 }
 
-void
-main_window::run_file_callback (const QFileInfo& info)
-{
-  octave_cmd_eval *cmd = new octave_cmd_eval (info);
-  m_cmd_queue.add_cmd (cmd);
-}
-
 bool
 main_window::focus_console_after_command (void)
 {
--- a/libgui/src/main-window.h	Sun Jan 21 17:33:20 2018 -0500
+++ b/libgui/src/main-window.h	Mon Jan 22 00:45:11 2018 -0500
@@ -337,8 +337,6 @@
 
   void clear_history_callback (void);
 
-  void run_file_callback (const QFileInfo& info);
-
   bool focus_console_after_command (void);
 
   void new_figure_callback (void);