Mercurial > hg > octave-nkf
diff libgui/src/main-window.h @ 19978:034bcac0b61c
use of C++ API for running a file (bug #42307)
* octave-cmd.cc: New file providing the new command class octave_cmd;
(prepare_command_editor): common action that all derived command classes
use for method execute;
(octave_cmd_exec::execute): execute method of derived class for executing
ordinary commands in the terminal;
(octave_cmd_eval::execute): execute method of derived class for running a
file (as function if it is a valid identifier or as script)
* octave-cmd.h: providing base and derived classes
* main-window.cc (main_window): _cmd_queue is not a pointer anymore;
(~main_window): _cmd_queue is not a pointer anymore;
(execute_command_in_terminal): use new command class for queuing a command;
(run_file_in_terminal): check for valid identifier moved from here to
the execute method of the related command class;
(run_file_callback): use new class for queuing command, path check moved
from here into the execute method of the command class;
(queue_command): gets new command class instead of a string as input;
(closeEvent): queue command class instead of string;
(execute_command_callback): command queue contains command class instances;
* main-window.h: use new octave-cmd class for queue_command,
the command queue is not a pointer anymore
* module.mk: new files octave-cmd.cc and octave-cmd.h
author | Torsten <ttl@justmail.de> |
---|---|
date | Thu, 19 Feb 2015 22:05:12 +0100 |
parents | 21015ca26566 |
children | 72fe9df87fe8 |
line wrap: on
line diff
--- a/libgui/src/main-window.h +++ b/libgui/src/main-window.h @@ -57,6 +57,7 @@ #include "octave-qt-link.h" #include "octave-dock-widget.h" #include "find-files-dialog.h" +#include "octave-cmd.h" class settings_dialog; @@ -276,7 +277,7 @@ void change_directory_callback (const std::string& directory); - void queue_command (QString command); + void queue_command (octave_cmd *cmd); void queue_debug (QString command); @@ -396,8 +397,12 @@ // Flag for closing whole application. bool _closing; - // semaphore to synchronize execution signals and related callback - QStringList *_cmd_queue; + // command queue and semaphore to synchronize execution signals + // and related callback + + // the queue for the command structures + QList<octave_cmd *> _cmd_queue; + // semaphores used for handling the queue QSemaphore _cmd_processing; QMutex _cmd_queue_mutex;