diff libgui/src/main-window.h @ 17329:352b442a72a5

queue and synchronize mutliple commands executed fro history (bug #39723) * main-window.cc(constructor): Initialization of new class variables for the command queue, its mutex and a counting semaphore for handling the queue; (destructor): delete command queue; (execute_command_in_terinal): only call new function for queuing the command; (run_file_in_terminal): checking the path and building the cresulting ommand is done here and not in the callback, the command is finally queued (queue_command): new function for queuing commands and posteing the event for the execution callback if the callback is not already active; (execute_command_callback): no parameter because working on the command queue, reposting own event if the queue si not empty, releasing a semaphore if empty; (run_file_callback): removed, code is in run_file_in_terminal now * main-window.h: execute_command_callback without parameters, new function queue_command, new variables for the command queue, its mutex and for a semaphore handling the queue
author Torsten <ttl@justmail.de>
date Sat, 24 Aug 2013 23:29:42 +0200
parents 756bb4b58ad0
children d0fa3568eb5d
line wrap: on
line diff
--- a/libgui/src/main-window.h	Sat Aug 24 14:47:13 2013 -0400
+++ b/libgui/src/main-window.h	Sat Aug 24 23:29:42 2013 +0200
@@ -36,6 +36,7 @@
 #include <QCloseEvent>
 #include <QToolButton>
 #include <QComboBox>
+#include <QSemaphore>
 
 // Editor includes
 #include "file-editor-interface.h"
@@ -233,7 +234,7 @@
 
   void clear_history_callback (void);
 
-  void execute_command_callback (const std::string& command);
+  void execute_command_callback ();
   void run_file_callback (const QFileInfo& info);
 
   void new_figure_callback (void);
@@ -252,7 +253,8 @@
 
   void exit_callback (void);
 
-  // Data models.
+  void queue_command (QString command);  // Data models.
+
   workspace_model *_workspace_model;
 
   // Toolbars.
@@ -317,6 +319,11 @@
 
   // Flag for closing whole application.
   bool _closing;
+
+  // semaphore to synchronize execution signals and related callback
+  QStringList *_cmd_queue;
+  QSemaphore   _cmd_processing;
+  QMutex       _cmd_queue_mutex;
 };
 
 #endif // MAINWINDOW_H