GNU Octave  3.8.0
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
workspace-model.h
Go to the documentation of this file.
1 /*
2 
3 Copyright (C) 2013 John W. Eaton
4 Copyright (C) 2011-2013 Jacob Dawid
5 
6 This file is part of Octave.
7 
8 Octave is free software; you can redistribute it and/or modify it
9 under the terms of the GNU General Public License as published by the
10 Free Software Foundation; either version 3 of the License, or (at your
11 option) any later version.
12 
13 Octave is distributed in the hope that it will be useful, but WITHOUT
14 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
15 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
16 for more details.
17 
18 You should have received a copy of the GNU General Public License
19 along with Octave; see the file COPYING. If not, see
20 <http://www.gnu.org/licenses/>.
21 
22 */
23 
24 #if !defined (octave_workspace_model_h)
25 #define octave_workspace_model_h 1
26 
27 #include <QAbstractTableModel>
28 #include <QVector>
29 #include <QSemaphore>
30 #include <QStringList>
31 #include <QChar>
32 #include <QList>
33 #include <QColor>
34 #include <QSettings>
35 
36 // Defined for purposes of sending QList<int> as part of signal.
38 
40  : public QAbstractTableModel
41 {
42  Q_OBJECT
43 
44 public:
45 
46  workspace_model (QObject *parent = 0);
47 
48  ~workspace_model (void) { }
49 
51 
52  static QStringList storage_class_names (void);
53 
54  QVariant data (const QModelIndex& index, int role) const;
55 
56  bool setData (const QModelIndex& index, const QVariant& value,
57  int role = Qt::EditRole);
58 
59  Qt::ItemFlags flags (const QModelIndex& index) const;
60 
61  QVariant headerData (int section, Qt::Orientation orientation,
62  int role = Qt::DisplayRole) const;
63 
64  int rowCount (const QModelIndex& parent = QModelIndex ()) const;
65 
66  int columnCount (const QModelIndex& parent = QModelIndex ()) const;
67 
68  bool is_top_level (void) const { return _top_level; }
69 
70  QColor storage_class_color (int s_class)
71  { return _storage_class_colors.at (s_class); }
72 
73 public slots:
74 
75  void set_workspace (bool top_level,
76  const QString& scopes,
77  const QStringList& symbols,
78  const QStringList& class_names,
79  const QStringList& dimensions,
80  const QStringList& values,
81  const QIntList& complex_flags);
82 
83  void clear_workspace (void);
84 
85  void notice_settings (const QSettings *);
86 
87 signals:
88 
89  void model_changed (void);
90 
91  void rename_variable (const QString& old_name, const QString& new_name);
92 
93 private:
94 
95  void clear_data (void);
96  void update_table (void);
97 
98  bool _top_level;
99  QString _scopes;
100  QStringList _symbols;
101  QStringList _class_names;
102  QStringList _dimensions;
103  QStringList _values;
105 
106  QStringList _columnNames;
107 
109 
110 };
111 
112 #endif