GNU Octave  4.0.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-2015 John W. Eaton
4 Copyright (C) 2011-2015 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  bool debug,
77  const QString& scopes,
78  const QStringList& symbols,
79  const QStringList& class_names,
80  const QStringList& dimensions,
81  const QStringList& values,
82  const QIntList& complex_flags);
83 
84  void clear_workspace (void);
85 
86  void notice_settings (const QSettings *);
87 
88 signals:
89 
90  void model_changed (void);
91 
92  void rename_variable (const QString& old_name, const QString& new_name);
93 
94 private:
95 
96  void clear_data (void);
97  void update_table (void);
98 
99  bool _top_level;
100  QString _scopes;
101  QStringList _symbols;
102  QStringList _class_names;
103  QStringList _dimensions;
104  QStringList _values;
106 
107  QStringList _columnNames;
108 
110 
111 };
112 
113 #endif
static QStringList storage_class_names(void)
QList< int > QIntList
QList< QColor > _storage_class_colors
void rename_variable(const QString &old_name, const QString &new_name)
QColor storage_class_color(int s_class)
QStringList _symbols
Qt::ItemFlags flags(const QModelIndex &index) const
int rowCount(const QModelIndex &parent=QModelIndex()) const
QIntList _complex_flags
static QList< QColor > storage_class_default_colors(void)
bool setData(const QModelIndex &index, const QVariant &value, int role=Qt::EditRole)
QStringList _columnNames
QVariant headerData(int section, Qt::Orientation orientation, int role=Qt::DisplayRole) const
QStringList _dimensions
void notice_settings(const QSettings *)
void set_workspace(bool top_level, bool debug, const QString &scopes, const QStringList &symbols, const QStringList &class_names, const QStringList &dimensions, const QStringList &values, const QIntList &complex_flags)
QStringList _values
workspace_model(QObject *parent=0)
static bool debug
Definition: mkoctfile.cc:227
QVariant data(const QModelIndex &index, int role) const
void clear_data(void)
QList< int > QIntList
Definition: dialog.h:38
void update_table(void)
int columnCount(const QModelIndex &parent=QModelIndex()) const
void clear_workspace(void)
QStringList _class_names
bool is_top_level(void) const