comparison libgui/src/main-window.h @ 17337: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
comparison
equal deleted inserted replaced
17336:4daf633100db 17337:352b442a72a5
34 #include <QQueue> 34 #include <QQueue>
35 #include <QMdiSubWindow> 35 #include <QMdiSubWindow>
36 #include <QCloseEvent> 36 #include <QCloseEvent>
37 #include <QToolButton> 37 #include <QToolButton>
38 #include <QComboBox> 38 #include <QComboBox>
39 #include <QSemaphore>
39 40
40 // Editor includes 41 // Editor includes
41 #include "file-editor-interface.h" 42 #include "file-editor-interface.h"
42 43
43 // QTerminal includes 44 // QTerminal includes
231 232
232 void clear_workspace_callback (void); 233 void clear_workspace_callback (void);
233 234
234 void clear_history_callback (void); 235 void clear_history_callback (void);
235 236
236 void execute_command_callback (const std::string& command); 237 void execute_command_callback ();
237 void run_file_callback (const QFileInfo& info); 238 void run_file_callback (const QFileInfo& info);
238 239
239 void new_figure_callback (void); 240 void new_figure_callback (void);
240 241
241 void change_directory_callback (const std::string& directory); 242 void change_directory_callback (const std::string& directory);
250 251
251 void debug_quit_callback (void); 252 void debug_quit_callback (void);
252 253
253 void exit_callback (void); 254 void exit_callback (void);
254 255
255 // Data models. 256 void queue_command (QString command); // Data models.
257
256 workspace_model *_workspace_model; 258 workspace_model *_workspace_model;
257 259
258 // Toolbars. 260 // Toolbars.
259 QStatusBar *status_bar; 261 QStatusBar *status_bar;
260 262
315 317
316 QClipboard *_clipboard; 318 QClipboard *_clipboard;
317 319
318 // Flag for closing whole application. 320 // Flag for closing whole application.
319 bool _closing; 321 bool _closing;
322
323 // semaphore to synchronize execution signals and related callback
324 QStringList *_cmd_queue;
325 QSemaphore _cmd_processing;
326 QMutex _cmd_queue_mutex;
320 }; 327 };
321 328
322 #endif // MAINWINDOW_H 329 #endif // MAINWINDOW_H