diff gui/src/workspace-model.h @ 14720:cecc7da96e2a gui

Added update events for the command history model and workspace model. * history-dockwidget.cc: Moved string list model to dock widget. * octave-event-observer.h: Removed constness from accepted and rejected methods. * octave-event.h: Removed constness from accepted and rejected methods, add new event types. * octave-link: Almost removed all Qt code. * workspace-model: Moved update timer to model. * workspace-view: Model workspace model to widget.
author Jacob Dawid <jacob.dawid@googlemail.com>
date Mon, 04 Jun 2012 21:28:08 +0200
parents 89c64340e9ab
children 8c4d5029d933
line wrap: on
line diff
--- a/gui/src/workspace-model.h	Mon Jun 04 16:08:44 2012 +0200
+++ b/gui/src/workspace-model.h	Mon Jun 04 21:28:08 2012 +0200
@@ -24,6 +24,9 @@
 #include <QSemaphore>
 #include <QTimer>
 
+#include "symbol-information.h"
+#include "octave-event-observer.h"
+
 class tree_item
 {
 public:
@@ -103,13 +106,17 @@
   tree_item *_parent_item;
 };
 
-class workspace_model : public QAbstractItemModel
+class workspace_model
+    : public QAbstractItemModel, public octave_event_observer
 {
   Q_OBJECT
 
 public:
-  workspace_model(QObject *parent = 0);
-  ~workspace_model();
+  workspace_model (QObject *parent = 0);
+  ~workspace_model ();
+
+  void event_accepted (octave_event *e);
+  void event_reject (octave_event *e);
 
   QVariant data(const QModelIndex &index, int role) const;
   Qt::ItemFlags flags(const QModelIndex &index) const;
@@ -125,12 +132,18 @@
   tree_item *top_level_item (int at);
 
 public slots:
-  void update_from_symbol_table ();
+  void request_update_workspace ();
 
 signals:
   void expand_request();
 
 private:
+  /** Timer for periodically updating the workspace model from the current
+    * symbol information. */
+  QTimer _update_workspace_model_timer;
+
+  /** Stores the current symbol information. */
+  QList <symbol_information> _symbol_information;
   tree_item *_rootItem;
 };