diff gui/src/WorkspaceModel.h @ 14671:f346343654a4 gui

Settings readline event hook and fixed race condition. * WorkspaceModel: Decoupled writing and reading the symbol table. * OctaveLink: Added timer to periodically query for symbol table changes.
author Jacob Dawid <jacob.dawid@googlemail.com>
date Tue, 22 May 2012 17:29:34 +0200
parents 7605e7136b50
children 79c9a6d06590
line wrap: on
line diff
--- a/gui/src/WorkspaceModel.h
+++ b/gui/src/WorkspaceModel.h
@@ -57,6 +57,7 @@
 // Qt includes
 #include <QAbstractItemModel>
 #include <QVector>
+#include <QSemaphore>
 
 class TreeItem
 {
@@ -158,15 +159,21 @@
   void insertTopLevelItem (int at, TreeItem *treeItem);
   TreeItem *topLevelItem (int at);
 
-  void updateFromSymbolTable ();
+
+  void cacheSymbolTable ();
   void updateTreeEntry (TreeItem * treeItem, symbol_table::symbol_record *symbolRecord);
   void updateCategory (int topLevelItemIndex, const QList < symbol_table::symbol_record *> &symbolTable);
   QString octaveValueAsQString (const octave_value &octaveValue);
 
+public slots:
+  void updateFromSymbolTable ();
+
 signals:
   void expandRequest();
 
 private:
+  QSemaphore *_cachedSymbolTableSemaphore;
+  std::list < symbol_table::symbol_record > _cachedSymbolTable;
   TreeItem *_rootItem;
 };