annotate libgui/src/workspace-model.h @ 16468:0f143f68078d

use signal/slot for updating workspace instead of using event listener * main-window.h, main-window.cc: Clean up list of include files. (main_window::prepare_to_exit): Rename from prepare_to_quit. Change all uses. (main_window::update_workspace): Delete. (main_window::construct): Don't connect _octave_qt_event_listener:update_workspace_signal to main_window::update_workspace. (main_window::construct_octave_qt_link): Connect _octave_qt_link::set_workspace_signal to _workspace_model::set_workspace. Connect _octave_qt_link::clear_workspace_signal to _workspace_model::clear_workspace. * symbol-information.h, symbol-information.cc: Delete * libgui/src/module.mk (noinst_HEADERS, src_libgui_src_la_SOURCES): Remove them from the lists. * octave-qt-link.h, octave-qt-link.cc: Don't use symbol_information to store workspace info. (octave_qt_link::do_update_workspace): Delete. (octave_qt_link::do_set_workspace, octave_qt_link::do_clear_workspace): New functions. (octave_qt_link::do_pre_input_event): Don't call do_update_workspace. (octave_qt_link::set_workspace_signal, octave_qt_link::clear_workspace_signal): New signals. * workspace-model.h, workspace-model.cc: Don't use symbol_information to store workspace info. Accept workspace info through a signal/slot combination, not by asking the symbol table. (workspace_model::request_update_workspace, (workspace_model::update_workspace_callback): Delete. (workspace_model::set_workspace, workspace_model::clear_workspace, workspace_model::clear_data, workspace_model::clear_tree, workspace_model::update_tree, workspace_model::append_tree): New functions. * workspace-view.h, workspace-view.cc (workspace_view::model_changed): Don't call update_workspace_callback. The model now signals the view when it has changed. * input.cc (octave_base_reader::octave_gets, get_debug_input): Call octave_link::set_workspace just prior to prompting for input. * workspace-element.h: New file. * libinterp/interpfcn/module.mk (INTERPFCN_INC): Include it in the list. * octave-link.cc: Don't include symtab.h. * octave-link.h (octave_link::update_workspace): Delete. (octave_link::set_workspace, octave_link::do_set_workspace, * octave_link::clear_workspace, octave_link::do_clear_workspace): New functions. * symtab.h, symtab.cc (symbol_table::workspace_info, symbol_table::do_workspace_info): New functions. * ov.h (octave_value::short_disp): New function. * ov-base.h, ov-base.cc (octave_base_value::short_disp): New function. * ov-base-scalar.h, ov-base-scalar.cc (octave_base_scalar<ST>::short_disp): New function. * ov-range.h, ov-range.cc (octave_range::short_disp): New function.
author John W. Eaton <jwe@octave.org>
date Mon, 08 Apr 2013 12:01:24 -0400
parents 6cd66a5a76e8
children 64727ed135cb
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
15204
359098ad343e update copyright notices in libgui directory
John W. Eaton <jwe@octave.org>
parents: 15196
diff changeset
1 /*
359098ad343e update copyright notices in libgui directory
John W. Eaton <jwe@octave.org>
parents: 15196
diff changeset
2
16468
0f143f68078d use signal/slot for updating workspace instead of using event listener
John W. Eaton <jwe@octave.org>
parents: 16444
diff changeset
3 Copyright (C) 2013 John W. Eaton
15204
359098ad343e update copyright notices in libgui directory
John W. Eaton <jwe@octave.org>
parents: 15196
diff changeset
4 Copyright (C) 2011-2012 Jacob Dawid
359098ad343e update copyright notices in libgui directory
John W. Eaton <jwe@octave.org>
parents: 15196
diff changeset
5
359098ad343e update copyright notices in libgui directory
John W. Eaton <jwe@octave.org>
parents: 15196
diff changeset
6 This file is part of Octave.
359098ad343e update copyright notices in libgui directory
John W. Eaton <jwe@octave.org>
parents: 15196
diff changeset
7
359098ad343e update copyright notices in libgui directory
John W. Eaton <jwe@octave.org>
parents: 15196
diff changeset
8 Octave is free software; you can redistribute it and/or modify it
359098ad343e update copyright notices in libgui directory
John W. Eaton <jwe@octave.org>
parents: 15196
diff changeset
9 under the terms of the GNU General Public License as published by the
359098ad343e update copyright notices in libgui directory
John W. Eaton <jwe@octave.org>
parents: 15196
diff changeset
10 Free Software Foundation; either version 3 of the License, or (at your
359098ad343e update copyright notices in libgui directory
John W. Eaton <jwe@octave.org>
parents: 15196
diff changeset
11 option) any later version.
359098ad343e update copyright notices in libgui directory
John W. Eaton <jwe@octave.org>
parents: 15196
diff changeset
12
359098ad343e update copyright notices in libgui directory
John W. Eaton <jwe@octave.org>
parents: 15196
diff changeset
13 Octave is distributed in the hope that it will be useful, but WITHOUT
359098ad343e update copyright notices in libgui directory
John W. Eaton <jwe@octave.org>
parents: 15196
diff changeset
14 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
359098ad343e update copyright notices in libgui directory
John W. Eaton <jwe@octave.org>
parents: 15196
diff changeset
15 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
359098ad343e update copyright notices in libgui directory
John W. Eaton <jwe@octave.org>
parents: 15196
diff changeset
16 for more details.
359098ad343e update copyright notices in libgui directory
John W. Eaton <jwe@octave.org>
parents: 15196
diff changeset
17
359098ad343e update copyright notices in libgui directory
John W. Eaton <jwe@octave.org>
parents: 15196
diff changeset
18 You should have received a copy of the GNU General Public License
359098ad343e update copyright notices in libgui directory
John W. Eaton <jwe@octave.org>
parents: 15196
diff changeset
19 along with Octave; see the file COPYING. If not, see
359098ad343e update copyright notices in libgui directory
John W. Eaton <jwe@octave.org>
parents: 15196
diff changeset
20 <http://www.gnu.org/licenses/>.
359098ad343e update copyright notices in libgui directory
John W. Eaton <jwe@octave.org>
parents: 15196
diff changeset
21
359098ad343e update copyright notices in libgui directory
John W. Eaton <jwe@octave.org>
parents: 15196
diff changeset
22 */
14664
664f54233c98 Extracted model code from the WorkspaceView and rearranged it in a new model class.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
23
16468
0f143f68078d use signal/slot for updating workspace instead of using event listener
John W. Eaton <jwe@octave.org>
parents: 16444
diff changeset
24 #if !defined (workspace_model_h)
0f143f68078d use signal/slot for updating workspace instead of using event listener
John W. Eaton <jwe@octave.org>
parents: 16444
diff changeset
25 #define workspace_model_h 1
14664
664f54233c98 Extracted model code from the WorkspaceView and rearranged it in a new model class.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
26
664f54233c98 Extracted model code from the WorkspaceView and rearranged it in a new model class.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
27 #include <QAbstractItemModel>
14669
7605e7136b50 Discarded initFileEditor, instead put that in the constructor. Speedup for updating the symbol table by lowering complexity from n² to n. Fixed problem with hangup on quit.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14668
diff changeset
28 #include <QVector>
14671
f346343654a4 Settings readline event hook and fixed race condition.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14669
diff changeset
29 #include <QSemaphore>
16468
0f143f68078d use signal/slot for updating workspace instead of using event listener
John W. Eaton <jwe@octave.org>
parents: 16444
diff changeset
30 #include <QStringList>
14720
cecc7da96e2a Added update events for the command history model and workspace model.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14719
diff changeset
31
14712
5cb54cca8a06 Completion of code reformatting.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14709
diff changeset
32 class tree_item
14664
664f54233c98 Extracted model code from the WorkspaceView and rearranged it in a new model class.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
33 {
664f54233c98 Extracted model code from the WorkspaceView and rearranged it in a new model class.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
34 public:
15368
36ececf69385 avoid some GCC warnings in the libgui code
John W. Eaton <jwe@octave.org>
parents: 15367
diff changeset
35 tree_item (const QList<QVariant> &d, tree_item *p = 0) {
36ececf69385 avoid some GCC warnings in the libgui code
John W. Eaton <jwe@octave.org>
parents: 15367
diff changeset
36 _parent_item = p;
36ececf69385 avoid some GCC warnings in the libgui code
John W. Eaton <jwe@octave.org>
parents: 15367
diff changeset
37 _item_data = d;
14664
664f54233c98 Extracted model code from the WorkspaceView and rearranged it in a new model class.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
38 }
664f54233c98 Extracted model code from the WorkspaceView and rearranged it in a new model class.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
39
15368
36ececf69385 avoid some GCC warnings in the libgui code
John W. Eaton <jwe@octave.org>
parents: 15367
diff changeset
40 tree_item (QVariant d = QVariant(), tree_item *p = 0) {
14664
664f54233c98 Extracted model code from the WorkspaceView and rearranged it in a new model class.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
41 QList<QVariant> variantList;
15368
36ececf69385 avoid some GCC warnings in the libgui code
John W. Eaton <jwe@octave.org>
parents: 15367
diff changeset
42 variantList << d << QVariant () << QVariant () << QVariant ();
36ececf69385 avoid some GCC warnings in the libgui code
John W. Eaton <jwe@octave.org>
parents: 15367
diff changeset
43 _parent_item = p;
14712
5cb54cca8a06 Completion of code reformatting.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14709
diff changeset
44 _item_data = variantList;
14664
664f54233c98 Extracted model code from the WorkspaceView and rearranged it in a new model class.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
45 }
664f54233c98 Extracted model code from the WorkspaceView and rearranged it in a new model class.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
46
15045
1ffaad442161 Source code formatting (80-column lines, mostly whitespace changes)
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 14879
diff changeset
47 ~tree_item () {
15367
501a9cc2c68f maint: whitespace cleanup in GUI code
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 15204
diff changeset
48 qDeleteAll (_child_items);
14664
664f54233c98 Extracted model code from the WorkspaceView and rearranged it in a new model class.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
49 }
664f54233c98 Extracted model code from the WorkspaceView and rearranged it in a new model class.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
50
15045
1ffaad442161 Source code formatting (80-column lines, mostly whitespace changes)
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 14879
diff changeset
51 void insert_child_item (int at, tree_item *item) {
14712
5cb54cca8a06 Completion of code reformatting.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14709
diff changeset
52 item->_parent_item = this;
15045
1ffaad442161 Source code formatting (80-column lines, mostly whitespace changes)
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 14879
diff changeset
53 _child_items.insert (at, item);
14664
664f54233c98 Extracted model code from the WorkspaceView and rearranged it in a new model class.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
54 }
664f54233c98 Extracted model code from the WorkspaceView and rearranged it in a new model class.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
55
15045
1ffaad442161 Source code formatting (80-column lines, mostly whitespace changes)
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 14879
diff changeset
56 void add_child (tree_item *item) {
14712
5cb54cca8a06 Completion of code reformatting.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14709
diff changeset
57 item->_parent_item = this;
15045
1ffaad442161 Source code formatting (80-column lines, mostly whitespace changes)
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 14879
diff changeset
58 _child_items.append (item);
14664
664f54233c98 Extracted model code from the WorkspaceView and rearranged it in a new model class.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
59 }
664f54233c98 Extracted model code from the WorkspaceView and rearranged it in a new model class.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
60
15045
1ffaad442161 Source code formatting (80-column lines, mostly whitespace changes)
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 14879
diff changeset
61 void delete_child_items () {
15367
501a9cc2c68f maint: whitespace cleanup in GUI code
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 15204
diff changeset
62 qDeleteAll (_child_items);
501a9cc2c68f maint: whitespace cleanup in GUI code
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 15204
diff changeset
63 _child_items.clear ();
14669
7605e7136b50 Discarded initFileEditor, instead put that in the constructor. Speedup for updating the symbol table by lowering complexity from n² to n. Fixed problem with hangup on quit.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14668
diff changeset
64 }
7605e7136b50 Discarded initFileEditor, instead put that in the constructor. Speedup for updating the symbol table by lowering complexity from n² to n. Fixed problem with hangup on quit.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14668
diff changeset
65
15045
1ffaad442161 Source code formatting (80-column lines, mostly whitespace changes)
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 14879
diff changeset
66 void remove_child (tree_item *item) {
1ffaad442161 Source code formatting (80-column lines, mostly whitespace changes)
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 14879
diff changeset
67 _child_items.removeAll (item);
14664
664f54233c98 Extracted model code from the WorkspaceView and rearranged it in a new model class.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
68 }
664f54233c98 Extracted model code from the WorkspaceView and rearranged it in a new model class.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
69
15045
1ffaad442161 Source code formatting (80-column lines, mostly whitespace changes)
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 14879
diff changeset
70 QVariant data (int column) const
14664
664f54233c98 Extracted model code from the WorkspaceView and rearranged it in a new model class.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
71 {
14712
5cb54cca8a06 Completion of code reformatting.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14709
diff changeset
72 return _item_data[column];
14664
664f54233c98 Extracted model code from the WorkspaceView and rearranged it in a new model class.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
73 }
664f54233c98 Extracted model code from the WorkspaceView and rearranged it in a new model class.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
74
15368
36ececf69385 avoid some GCC warnings in the libgui code
John W. Eaton <jwe@octave.org>
parents: 15367
diff changeset
75 void set_data (int column, QVariant d)
14664
664f54233c98 Extracted model code from the WorkspaceView and rearranged it in a new model class.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
76 {
15368
36ececf69385 avoid some GCC warnings in the libgui code
John W. Eaton <jwe@octave.org>
parents: 15367
diff changeset
77 _item_data[column] = d;
14664
664f54233c98 Extracted model code from the WorkspaceView and rearranged it in a new model class.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
78 }
664f54233c98 Extracted model code from the WorkspaceView and rearranged it in a new model class.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
79
15368
36ececf69385 avoid some GCC warnings in the libgui code
John W. Eaton <jwe@octave.org>
parents: 15367
diff changeset
80 tree_item *child (int r) {
36ececf69385 avoid some GCC warnings in the libgui code
John W. Eaton <jwe@octave.org>
parents: 15367
diff changeset
81 return _child_items[r];
14664
664f54233c98 Extracted model code from the WorkspaceView and rearranged it in a new model class.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
82 }
664f54233c98 Extracted model code from the WorkspaceView and rearranged it in a new model class.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
83
15045
1ffaad442161 Source code formatting (80-column lines, mostly whitespace changes)
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 14879
diff changeset
84 int child_count () const {
14712
5cb54cca8a06 Completion of code reformatting.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14709
diff changeset
85 return _child_items.count();
14664
664f54233c98 Extracted model code from the WorkspaceView and rearranged it in a new model class.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
86 }
664f54233c98 Extracted model code from the WorkspaceView and rearranged it in a new model class.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
87
15045
1ffaad442161 Source code formatting (80-column lines, mostly whitespace changes)
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 14879
diff changeset
88 int column_count () const
14664
664f54233c98 Extracted model code from the WorkspaceView and rearranged it in a new model class.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
89 {
14712
5cb54cca8a06 Completion of code reformatting.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14709
diff changeset
90 return _item_data.count();
14664
664f54233c98 Extracted model code from the WorkspaceView and rearranged it in a new model class.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
91 }
664f54233c98 Extracted model code from the WorkspaceView and rearranged it in a new model class.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
92
15045
1ffaad442161 Source code formatting (80-column lines, mostly whitespace changes)
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 14879
diff changeset
93 int row () const {
14712
5cb54cca8a06 Completion of code reformatting.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14709
diff changeset
94 if (_parent_item)
15045
1ffaad442161 Source code formatting (80-column lines, mostly whitespace changes)
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 14879
diff changeset
95 return _parent_item->_child_items.indexOf (const_cast<tree_item*>(this));
14664
664f54233c98 Extracted model code from the WorkspaceView and rearranged it in a new model class.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
96
664f54233c98 Extracted model code from the WorkspaceView and rearranged it in a new model class.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
97 return 0;
664f54233c98 Extracted model code from the WorkspaceView and rearranged it in a new model class.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
98 }
664f54233c98 Extracted model code from the WorkspaceView and rearranged it in a new model class.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
99
15045
1ffaad442161 Source code formatting (80-column lines, mostly whitespace changes)
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 14879
diff changeset
100 tree_item *parent ()
14664
664f54233c98 Extracted model code from the WorkspaceView and rearranged it in a new model class.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
101 {
14712
5cb54cca8a06 Completion of code reformatting.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14709
diff changeset
102 return _parent_item;
14664
664f54233c98 Extracted model code from the WorkspaceView and rearranged it in a new model class.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
103 }
664f54233c98 Extracted model code from the WorkspaceView and rearranged it in a new model class.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
104
664f54233c98 Extracted model code from the WorkspaceView and rearranged it in a new model class.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
105 private:
14712
5cb54cca8a06 Completion of code reformatting.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14709
diff changeset
106 QList<tree_item*> _child_items;
5cb54cca8a06 Completion of code reformatting.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14709
diff changeset
107 QList<QVariant> _item_data;
5cb54cca8a06 Completion of code reformatting.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14709
diff changeset
108 tree_item *_parent_item;
14664
664f54233c98 Extracted model code from the WorkspaceView and rearranged it in a new model class.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
109 };
664f54233c98 Extracted model code from the WorkspaceView and rearranged it in a new model class.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
110
14720
cecc7da96e2a Added update events for the command history model and workspace model.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14719
diff changeset
111 class workspace_model
15402
7f423c6111c6 refactor GUI event handling to use new event_queue class
John W. Eaton <jwe@octave.org>
parents: 15388
diff changeset
112 : public QAbstractItemModel
14664
664f54233c98 Extracted model code from the WorkspaceView and rearranged it in a new model class.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
113 {
664f54233c98 Extracted model code from the WorkspaceView and rearranged it in a new model class.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
114 Q_OBJECT
664f54233c98 Extracted model code from the WorkspaceView and rearranged it in a new model class.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
115
16468
0f143f68078d use signal/slot for updating workspace instead of using event listener
John W. Eaton <jwe@octave.org>
parents: 16444
diff changeset
116 public:
0f143f68078d use signal/slot for updating workspace instead of using event listener
John W. Eaton <jwe@octave.org>
parents: 16444
diff changeset
117
14720
cecc7da96e2a Added update events for the command history model and workspace model.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14719
diff changeset
118 workspace_model (QObject *parent = 0);
16468
0f143f68078d use signal/slot for updating workspace instead of using event listener
John W. Eaton <jwe@octave.org>
parents: 16444
diff changeset
119
0f143f68078d use signal/slot for updating workspace instead of using event listener
John W. Eaton <jwe@octave.org>
parents: 16444
diff changeset
120 ~workspace_model (void);
14720
cecc7da96e2a Added update events for the command history model and workspace model.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14719
diff changeset
121
15045
1ffaad442161 Source code formatting (80-column lines, mostly whitespace changes)
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 14879
diff changeset
122 QVariant data (const QModelIndex &index, int role) const;
16468
0f143f68078d use signal/slot for updating workspace instead of using event listener
John W. Eaton <jwe@octave.org>
parents: 16444
diff changeset
123
15045
1ffaad442161 Source code formatting (80-column lines, mostly whitespace changes)
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 14879
diff changeset
124 Qt::ItemFlags flags (const QModelIndex &index) const;
16468
0f143f68078d use signal/slot for updating workspace instead of using event listener
John W. Eaton <jwe@octave.org>
parents: 16444
diff changeset
125
15045
1ffaad442161 Source code formatting (80-column lines, mostly whitespace changes)
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 14879
diff changeset
126 QVariant headerData (int section, Qt::Orientation orientation,
1ffaad442161 Source code formatting (80-column lines, mostly whitespace changes)
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 14879
diff changeset
127 int role = Qt::DisplayRole) const;
16468
0f143f68078d use signal/slot for updating workspace instead of using event listener
John W. Eaton <jwe@octave.org>
parents: 16444
diff changeset
128
15045
1ffaad442161 Source code formatting (80-column lines, mostly whitespace changes)
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 14879
diff changeset
129 QModelIndex index (int row, int column,
15367
501a9cc2c68f maint: whitespace cleanup in GUI code
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 15204
diff changeset
130 const QModelIndex &parent = QModelIndex ()) const;
16468
0f143f68078d use signal/slot for updating workspace instead of using event listener
John W. Eaton <jwe@octave.org>
parents: 16444
diff changeset
131
15045
1ffaad442161 Source code formatting (80-column lines, mostly whitespace changes)
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 14879
diff changeset
132 QModelIndex parent (const QModelIndex &index) const;
16468
0f143f68078d use signal/slot for updating workspace instead of using event listener
John W. Eaton <jwe@octave.org>
parents: 16444
diff changeset
133
15045
1ffaad442161 Source code formatting (80-column lines, mostly whitespace changes)
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 14879
diff changeset
134 int rowCount (const QModelIndex &parent = QModelIndex ()) const;
16468
0f143f68078d use signal/slot for updating workspace instead of using event listener
John W. Eaton <jwe@octave.org>
parents: 16444
diff changeset
135
15045
1ffaad442161 Source code formatting (80-column lines, mostly whitespace changes)
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 14879
diff changeset
136 int columnCount (const QModelIndex &parent = QModelIndex ()) const;
14664
664f54233c98 Extracted model code from the WorkspaceView and rearranged it in a new model class.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
137
14712
5cb54cca8a06 Completion of code reformatting.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14709
diff changeset
138 void insert_top_level_item (int at, tree_item *treeItem);
16468
0f143f68078d use signal/slot for updating workspace instead of using event listener
John W. Eaton <jwe@octave.org>
parents: 16444
diff changeset
139
14712
5cb54cca8a06 Completion of code reformatting.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14709
diff changeset
140 tree_item *top_level_item (int at);
14664
664f54233c98 Extracted model code from the WorkspaceView and rearranged it in a new model class.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
141
14671
f346343654a4 Settings readline event hook and fixed race condition.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14669
diff changeset
142 public slots:
16468
0f143f68078d use signal/slot for updating workspace instead of using event listener
John W. Eaton <jwe@octave.org>
parents: 16444
diff changeset
143
0f143f68078d use signal/slot for updating workspace instead of using event listener
John W. Eaton <jwe@octave.org>
parents: 16444
diff changeset
144 void set_workspace (const QString& scopes,
0f143f68078d use signal/slot for updating workspace instead of using event listener
John W. Eaton <jwe@octave.org>
parents: 16444
diff changeset
145 const QStringList& symbols,
0f143f68078d use signal/slot for updating workspace instead of using event listener
John W. Eaton <jwe@octave.org>
parents: 16444
diff changeset
146 const QStringList& class_names,
0f143f68078d use signal/slot for updating workspace instead of using event listener
John W. Eaton <jwe@octave.org>
parents: 16444
diff changeset
147 const QStringList& dimensions,
0f143f68078d use signal/slot for updating workspace instead of using event listener
John W. Eaton <jwe@octave.org>
parents: 16444
diff changeset
148 const QStringList& values);
0f143f68078d use signal/slot for updating workspace instead of using event listener
John W. Eaton <jwe@octave.org>
parents: 16444
diff changeset
149
0f143f68078d use signal/slot for updating workspace instead of using event listener
John W. Eaton <jwe@octave.org>
parents: 16444
diff changeset
150 void clear_workspace (void);
14671
f346343654a4 Settings readline event hook and fixed race condition.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14669
diff changeset
151
14668
6a6733a55982 Removed unused classes and added octave loop hook.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14664
diff changeset
152 signals:
16468
0f143f68078d use signal/slot for updating workspace instead of using event listener
John W. Eaton <jwe@octave.org>
parents: 16444
diff changeset
153
0f143f68078d use signal/slot for updating workspace instead of using event listener
John W. Eaton <jwe@octave.org>
parents: 16444
diff changeset
154 void model_changed (void);
14664
664f54233c98 Extracted model code from the WorkspaceView and rearranged it in a new model class.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
155
664f54233c98 Extracted model code from the WorkspaceView and rearranged it in a new model class.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
156 private:
15402
7f423c6111c6 refactor GUI event handling to use new event_queue class
John W. Eaton <jwe@octave.org>
parents: 15388
diff changeset
157
16468
0f143f68078d use signal/slot for updating workspace instead of using event listener
John W. Eaton <jwe@octave.org>
parents: 16444
diff changeset
158 void clear_data (void);
0f143f68078d use signal/slot for updating workspace instead of using event listener
John W. Eaton <jwe@octave.org>
parents: 16444
diff changeset
159
0f143f68078d use signal/slot for updating workspace instead of using event listener
John W. Eaton <jwe@octave.org>
parents: 16444
diff changeset
160 void clear_tree (void);
0f143f68078d use signal/slot for updating workspace instead of using event listener
John W. Eaton <jwe@octave.org>
parents: 16444
diff changeset
161
0f143f68078d use signal/slot for updating workspace instead of using event listener
John W. Eaton <jwe@octave.org>
parents: 16444
diff changeset
162 void update_tree (void);
0f143f68078d use signal/slot for updating workspace instead of using event listener
John W. Eaton <jwe@octave.org>
parents: 16444
diff changeset
163
0f143f68078d use signal/slot for updating workspace instead of using event listener
John W. Eaton <jwe@octave.org>
parents: 16444
diff changeset
164 void append_tree (QChar scope, const QString& symbol,
0f143f68078d use signal/slot for updating workspace instead of using event listener
John W. Eaton <jwe@octave.org>
parents: 16444
diff changeset
165 const QString& class_name, const QString& dimension,
0f143f68078d use signal/slot for updating workspace instead of using event listener
John W. Eaton <jwe@octave.org>
parents: 16444
diff changeset
166 const QString& value);
0f143f68078d use signal/slot for updating workspace instead of using event listener
John W. Eaton <jwe@octave.org>
parents: 16444
diff changeset
167
0f143f68078d use signal/slot for updating workspace instead of using event listener
John W. Eaton <jwe@octave.org>
parents: 16444
diff changeset
168 QString _scopes;
0f143f68078d use signal/slot for updating workspace instead of using event listener
John W. Eaton <jwe@octave.org>
parents: 16444
diff changeset
169 QStringList _symbols;
0f143f68078d use signal/slot for updating workspace instead of using event listener
John W. Eaton <jwe@octave.org>
parents: 16444
diff changeset
170 QStringList _class_names;
0f143f68078d use signal/slot for updating workspace instead of using event listener
John W. Eaton <jwe@octave.org>
parents: 16444
diff changeset
171 QStringList _dimensions;
0f143f68078d use signal/slot for updating workspace instead of using event listener
John W. Eaton <jwe@octave.org>
parents: 16444
diff changeset
172 QStringList _values;
0f143f68078d use signal/slot for updating workspace instead of using event listener
John W. Eaton <jwe@octave.org>
parents: 16444
diff changeset
173
14712
5cb54cca8a06 Completion of code reformatting.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14709
diff changeset
174 tree_item *_rootItem;
14664
664f54233c98 Extracted model code from the WorkspaceView and rearranged it in a new model class.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
175 };
664f54233c98 Extracted model code from the WorkspaceView and rearranged it in a new model class.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
176
664f54233c98 Extracted model code from the WorkspaceView and rearranged it in a new model class.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
177 #endif // WORKSPACEMODEL_H