annotate gui/src/backend/OctaveLink.cpp @ 14700:7623bece76df gui

Implemented logic for current directory bar. * MainWindow: Changed current working directory line edit to combo box. Added various signals and slots. * OctaveLink: Added signal that will be emitted whenever a current directory change occurs.
author Jacob Dawid <jacob.dawid@googlemail.com>
date Tue, 29 May 2012 19:08:05 +0200
parents 79c9a6d06590
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
13674
c0e66d6e3dc8 Updated license headers and moved to AGPLv3.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13601
diff changeset
1 /* OctaveGUI - A graphical user interface for Octave
c0e66d6e3dc8 Updated license headers and moved to AGPLv3.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13601
diff changeset
2 * Copyright (C) 2011 John P. Swensen, Jacob Dawid (jacob.dawid@googlemail.com)
c0e66d6e3dc8 Updated license headers and moved to AGPLv3.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13601
diff changeset
3 *
c0e66d6e3dc8 Updated license headers and moved to AGPLv3.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13601
diff changeset
4 * This program is free software: you can redistribute it and/or modify
14290
faece6b2ab90 Corrected license headers in all files to GPL.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13683
diff changeset
5 * it under the terms of the GNU General Public License as
13674
c0e66d6e3dc8 Updated license headers and moved to AGPLv3.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13601
diff changeset
6 * published by the Free Software Foundation, either version 3 of the
c0e66d6e3dc8 Updated license headers and moved to AGPLv3.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13601
diff changeset
7 * License, or (at your option) any later version.
c0e66d6e3dc8 Updated license headers and moved to AGPLv3.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13601
diff changeset
8 *
c0e66d6e3dc8 Updated license headers and moved to AGPLv3.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13601
diff changeset
9 * This program is distributed in the hope that it will be useful,
c0e66d6e3dc8 Updated license headers and moved to AGPLv3.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13601
diff changeset
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
c0e66d6e3dc8 Updated license headers and moved to AGPLv3.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13601
diff changeset
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14290
faece6b2ab90 Corrected license headers in all files to GPL.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13683
diff changeset
12 * GNU General Public License for more details.
13674
c0e66d6e3dc8 Updated license headers and moved to AGPLv3.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13601
diff changeset
13 *
14290
faece6b2ab90 Corrected license headers in all files to GPL.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13683
diff changeset
14 * You should have received a copy of the GNU General Public License
13674
c0e66d6e3dc8 Updated license headers and moved to AGPLv3.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13601
diff changeset
15 * along with this program. If not, see <http://www.gnu.org/licenses/>.
c0e66d6e3dc8 Updated license headers and moved to AGPLv3.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13601
diff changeset
16 */
13501
86d6c3b90ad7 Added new gui files.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
17
86d6c3b90ad7 Added new gui files.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
18 #include "OctaveLink.h"
14673
adad007cd018 Fixed bug with querying wrong matrix dimensions (bug #36421).
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14671
diff changeset
19 #include "load-path.h"
14700
7623bece76df Implemented logic for current directory bar.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14698
diff changeset
20 #include "oct-env.h"
14673
adad007cd018 Fixed bug with querying wrong matrix dimensions (bug #36421).
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14671
diff changeset
21 #include <QDir>
14689
dd19de736ee4 Fixed crash on exit. Typing exit in the terminal works, too.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14673
diff changeset
22 #include <QApplication>
13501
86d6c3b90ad7 Added new gui files.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
23
14689
dd19de736ee4 Fixed crash on exit. Typing exit in the terminal works, too.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14673
diff changeset
24 int octave_readline_hook ()
14668
6a6733a55982 Removed unused classes and added octave loop hook.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14664
diff changeset
25 {
14689
dd19de736ee4 Fixed crash on exit. Typing exit in the terminal works, too.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14673
diff changeset
26 OctaveLink::instance ()->triggerUpdateHistoryModel ();
14698
79c9a6d06590 Wrote SymbolInformation struct and refactored code that updates the symbol table.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14694
diff changeset
27 OctaveLink::instance ()->buildSymbolInformation ();
14700
7623bece76df Implemented logic for current directory bar.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14698
diff changeset
28 OctaveLink::instance ()->updateCurrentWorkingDirectory ();
14671
f346343654a4 Settings readline event hook and fixed race condition.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14670
diff changeset
29 return 0;
14668
6a6733a55982 Removed unused classes and added octave loop hook.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14664
diff changeset
30 }
6a6733a55982 Removed unused classes and added octave loop hook.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14664
diff changeset
31
14689
dd19de736ee4 Fixed crash on exit. Typing exit in the terminal works, too.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14673
diff changeset
32 void octave_exit_hook (int status)
dd19de736ee4 Fixed crash on exit. Typing exit in the terminal works, too.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14673
diff changeset
33 {
14693
c952f1e35e50 Added patch from Marco Atzeri for QTerminal to build with cygwin. Removed some compiler warnings.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14689
diff changeset
34 Q_UNUSED (status);
14689
dd19de736ee4 Fixed crash on exit. Typing exit in the terminal works, too.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14673
diff changeset
35 OctaveLink::instance ()->terminateOctave ();
dd19de736ee4 Fixed crash on exit. Typing exit in the terminal works, too.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14673
diff changeset
36 }
dd19de736ee4 Fixed crash on exit. Typing exit in the terminal works, too.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14673
diff changeset
37
13520
17bb8974577b Repaired history list.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13519
diff changeset
38 OctaveLink OctaveLink::m_singleton;
13501
86d6c3b90ad7 Added new gui files.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
39
13519
35ecb6063c7b Made the view connect with the history model.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13518
diff changeset
40 OctaveLink::OctaveLink ():QObject ()
13506
c70511cf64ee Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13501
diff changeset
41 {
13518
bace956a3724 Put history model part into OctaveLink.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13517
diff changeset
42 m_historyModel = new QStringListModel (this);
14664
664f54233c98 Extracted model code from the WorkspaceView and rearranged it in a new model class.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14606
diff changeset
43 m_workspaceModel = new WorkspaceModel (this);
664f54233c98 Extracted model code from the WorkspaceView and rearranged it in a new model class.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14606
diff changeset
44
664f54233c98 Extracted model code from the WorkspaceView and rearranged it in a new model class.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14606
diff changeset
45 m_workspaceModel->insertTopLevelItem(0, new TreeItem ("Local"));
664f54233c98 Extracted model code from the WorkspaceView and rearranged it in a new model class.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14606
diff changeset
46 m_workspaceModel->insertTopLevelItem(1, new TreeItem ("Global"));
664f54233c98 Extracted model code from the WorkspaceView and rearranged it in a new model class.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14606
diff changeset
47 m_workspaceModel->insertTopLevelItem(2, new TreeItem ("Persistent"));
664f54233c98 Extracted model code from the WorkspaceView and rearranged it in a new model class.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14606
diff changeset
48 m_workspaceModel->insertTopLevelItem(3, new TreeItem ("Hidden"));
14671
f346343654a4 Settings readline event hook and fixed race condition.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14670
diff changeset
49
f346343654a4 Settings readline event hook and fixed race condition.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14670
diff changeset
50 _updateWorkspaceModelTimer.setInterval (1000);
f346343654a4 Settings readline event hook and fixed race condition.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14670
diff changeset
51 _updateWorkspaceModelTimer.setSingleShot (false);
f346343654a4 Settings readline event hook and fixed race condition.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14670
diff changeset
52 connect(&_updateWorkspaceModelTimer, SIGNAL (timeout ()),
f346343654a4 Settings readline event hook and fixed race condition.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14670
diff changeset
53 m_workspaceModel, SLOT (updateFromSymbolTable ()));
14698
79c9a6d06590 Wrote SymbolInformation struct and refactored code that updates the symbol table.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14694
diff changeset
54
79c9a6d06590 Wrote SymbolInformation struct and refactored code that updates the symbol table.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14694
diff changeset
55 _symbolInformationSemaphore = new QSemaphore (1);
14700
7623bece76df Implemented logic for current directory bar.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14698
diff changeset
56 _currentWorkingDirectory = "";
13501
86d6c3b90ad7 Added new gui files.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
57 }
86d6c3b90ad7 Added new gui files.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
58
13506
c70511cf64ee Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13501
diff changeset
59 OctaveLink::~OctaveLink ()
c70511cf64ee Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13501
diff changeset
60 {
13501
86d6c3b90ad7 Added new gui files.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
61 }
86d6c3b90ad7 Added new gui files.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
62
13506
c70511cf64ee Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13501
diff changeset
63 void
13541
b48ac9ad8de0 Highly improved separation of model and view classes.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13528
diff changeset
64 OctaveLink::launchOctave ()
b48ac9ad8de0 Highly improved separation of model and view classes.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13528
diff changeset
65 {
13677
f27573828e92 Properly implemented shutdown of callback thread.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13674
diff changeset
66 // Create both threads.
13541
b48ac9ad8de0 Highly improved separation of model and view classes.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13528
diff changeset
67 m_octaveMainThread = new OctaveMainThread (this);
14689
dd19de736ee4 Fixed crash on exit. Typing exit in the terminal works, too.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14673
diff changeset
68 command_editor::add_event_hook (octave_readline_hook);
dd19de736ee4 Fixed crash on exit. Typing exit in the terminal works, too.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14673
diff changeset
69 octave_exit = octave_exit_hook;
dd19de736ee4 Fixed crash on exit. Typing exit in the terminal works, too.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14673
diff changeset
70
13677
f27573828e92 Properly implemented shutdown of callback thread.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13674
diff changeset
71 // Start the first one.
f27573828e92 Properly implemented shutdown of callback thread.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13674
diff changeset
72 m_octaveMainThread->start ();
14671
f346343654a4 Settings readline event hook and fixed race condition.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14670
diff changeset
73 _updateWorkspaceModelTimer.start ();
13541
b48ac9ad8de0 Highly improved separation of model and view classes.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13528
diff changeset
74 }
b48ac9ad8de0 Highly improved separation of model and view classes.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13528
diff changeset
75
b48ac9ad8de0 Highly improved separation of model and view classes.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13528
diff changeset
76 void
b48ac9ad8de0 Highly improved separation of model and view classes.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13528
diff changeset
77 OctaveLink::terminateOctave ()
b48ac9ad8de0 Highly improved separation of model and view classes.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13528
diff changeset
78 {
14694
ea11c9d8aa47 Calling qApp->quit () via QMetaObject::invoke caused a segfault, now exits cleanly.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14693
diff changeset
79 qApp->quit ();
13541
b48ac9ad8de0 Highly improved separation of model and view classes.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13528
diff changeset
80 }
b48ac9ad8de0 Highly improved separation of model and view classes.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13528
diff changeset
81
13518
bace956a3724 Put history model part into OctaveLink.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13517
diff changeset
82 void
14599
97cb9286919c Cleaned up code.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14500
diff changeset
83 OctaveLink::triggerUpdateHistoryModel ()
13506
c70511cf64ee Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13501
diff changeset
84 {
13519
35ecb6063c7b Made the view connect with the history model.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13518
diff changeset
85 // Determine the client's (our) history length and the one of the server.
13520
17bb8974577b Repaired history list.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13519
diff changeset
86 int clientHistoryLength = m_historyModel->rowCount ();
13519
35ecb6063c7b Made the view connect with the history model.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13518
diff changeset
87 int serverHistoryLength = command_history::length ();
35ecb6063c7b Made the view connect with the history model.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13518
diff changeset
88
35ecb6063c7b Made the view connect with the history model.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13518
diff changeset
89 // If were behind the server, iterate through all new entries and add them to our history.
35ecb6063c7b Made the view connect with the history model.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13518
diff changeset
90 if (clientHistoryLength < serverHistoryLength)
13518
bace956a3724 Put history model part into OctaveLink.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13517
diff changeset
91 {
13519
35ecb6063c7b Made the view connect with the history model.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13518
diff changeset
92 for (int i = clientHistoryLength; i < serverHistoryLength; i++)
13518
bace956a3724 Put history model part into OctaveLink.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13517
diff changeset
93 {
13520
17bb8974577b Repaired history list.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13519
diff changeset
94 m_historyModel->insertRow (0);
17bb8974577b Repaired history list.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13519
diff changeset
95 m_historyModel->setData (m_historyModel->index (0), QString (command_history::get_entry (i).c_str ()));
13518
bace956a3724 Put history model part into OctaveLink.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13517
diff changeset
96 }
13528
8b116446a904 Fixed race condition.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13527
diff changeset
97 }
13518
bace956a3724 Put history model part into OctaveLink.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13517
diff changeset
98 }
bace956a3724 Put history model part into OctaveLink.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13517
diff changeset
99
14664
664f54233c98 Extracted model code from the WorkspaceView and rearranged it in a new model class.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14606
diff changeset
100 void
14700
7623bece76df Implemented logic for current directory bar.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14698
diff changeset
101 OctaveLink::updateCurrentWorkingDirectory ()
7623bece76df Implemented logic for current directory bar.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14698
diff changeset
102 {
7623bece76df Implemented logic for current directory bar.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14698
diff changeset
103 QString _queriedWorkingDirectory = octave_env::get_current_directory ().c_str();
7623bece76df Implemented logic for current directory bar.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14698
diff changeset
104 if (_currentWorkingDirectory != _queriedWorkingDirectory)
7623bece76df Implemented logic for current directory bar.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14698
diff changeset
105 {
7623bece76df Implemented logic for current directory bar.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14698
diff changeset
106 _currentWorkingDirectory = _queriedWorkingDirectory;
7623bece76df Implemented logic for current directory bar.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14698
diff changeset
107 QDir::setCurrent (_currentWorkingDirectory);
7623bece76df Implemented logic for current directory bar.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14698
diff changeset
108 emit workingDirectoryChanged (_currentWorkingDirectory);
7623bece76df Implemented logic for current directory bar.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14698
diff changeset
109 }
7623bece76df Implemented logic for current directory bar.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14698
diff changeset
110 }
7623bece76df Implemented logic for current directory bar.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14698
diff changeset
111
7623bece76df Implemented logic for current directory bar.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14698
diff changeset
112 void
14698
79c9a6d06590 Wrote SymbolInformation struct and refactored code that updates the symbol table.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14694
diff changeset
113 OctaveLink::acquireSymbolInformation ()
79c9a6d06590 Wrote SymbolInformation struct and refactored code that updates the symbol table.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14694
diff changeset
114 {
79c9a6d06590 Wrote SymbolInformation struct and refactored code that updates the symbol table.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14694
diff changeset
115 _symbolInformationSemaphore->acquire (1);
79c9a6d06590 Wrote SymbolInformation struct and refactored code that updates the symbol table.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14694
diff changeset
116 }
79c9a6d06590 Wrote SymbolInformation struct and refactored code that updates the symbol table.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14694
diff changeset
117
79c9a6d06590 Wrote SymbolInformation struct and refactored code that updates the symbol table.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14694
diff changeset
118 void
79c9a6d06590 Wrote SymbolInformation struct and refactored code that updates the symbol table.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14694
diff changeset
119 OctaveLink::releaseSymbolInformation ()
79c9a6d06590 Wrote SymbolInformation struct and refactored code that updates the symbol table.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14694
diff changeset
120 {
79c9a6d06590 Wrote SymbolInformation struct and refactored code that updates the symbol table.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14694
diff changeset
121 _symbolInformationSemaphore->release (1);
79c9a6d06590 Wrote SymbolInformation struct and refactored code that updates the symbol table.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14694
diff changeset
122 }
79c9a6d06590 Wrote SymbolInformation struct and refactored code that updates the symbol table.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14694
diff changeset
123
79c9a6d06590 Wrote SymbolInformation struct and refactored code that updates the symbol table.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14694
diff changeset
124 void
79c9a6d06590 Wrote SymbolInformation struct and refactored code that updates the symbol table.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14694
diff changeset
125 OctaveLink::buildSymbolInformation ()
14664
664f54233c98 Extracted model code from the WorkspaceView and rearranged it in a new model class.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14606
diff changeset
126 {
14698
79c9a6d06590 Wrote SymbolInformation struct and refactored code that updates the symbol table.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14694
diff changeset
127 std::list < symbol_table::symbol_record > symbolTable = symbol_table::all_variables ();
79c9a6d06590 Wrote SymbolInformation struct and refactored code that updates the symbol table.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14694
diff changeset
128
79c9a6d06590 Wrote SymbolInformation struct and refactored code that updates the symbol table.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14694
diff changeset
129 acquireSymbolInformation ();
79c9a6d06590 Wrote SymbolInformation struct and refactored code that updates the symbol table.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14694
diff changeset
130 _symbolInformation.clear ();
79c9a6d06590 Wrote SymbolInformation struct and refactored code that updates the symbol table.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14694
diff changeset
131 for (std::list < symbol_table::symbol_record > ::iterator iterator = symbolTable.begin ();
79c9a6d06590 Wrote SymbolInformation struct and refactored code that updates the symbol table.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14694
diff changeset
132 iterator != symbolTable.end (); iterator++)
79c9a6d06590 Wrote SymbolInformation struct and refactored code that updates the symbol table.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14694
diff changeset
133 {
79c9a6d06590 Wrote SymbolInformation struct and refactored code that updates the symbol table.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14694
diff changeset
134 SymbolInformation symbolInformation;
79c9a6d06590 Wrote SymbolInformation struct and refactored code that updates the symbol table.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14694
diff changeset
135 symbolInformation.fromSymbolRecord (*iterator);
79c9a6d06590 Wrote SymbolInformation struct and refactored code that updates the symbol table.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14694
diff changeset
136 _symbolInformation.push_back (symbolInformation);
79c9a6d06590 Wrote SymbolInformation struct and refactored code that updates the symbol table.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14694
diff changeset
137 }
79c9a6d06590 Wrote SymbolInformation struct and refactored code that updates the symbol table.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14694
diff changeset
138 releaseSymbolInformation ();
79c9a6d06590 Wrote SymbolInformation struct and refactored code that updates the symbol table.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14694
diff changeset
139 }
79c9a6d06590 Wrote SymbolInformation struct and refactored code that updates the symbol table.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14694
diff changeset
140
79c9a6d06590 Wrote SymbolInformation struct and refactored code that updates the symbol table.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14694
diff changeset
141 const QList <SymbolInformation>&
79c9a6d06590 Wrote SymbolInformation struct and refactored code that updates the symbol table.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14694
diff changeset
142 OctaveLink::symbolInformation () const
79c9a6d06590 Wrote SymbolInformation struct and refactored code that updates the symbol table.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14694
diff changeset
143 {
79c9a6d06590 Wrote SymbolInformation struct and refactored code that updates the symbol table.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14694
diff changeset
144 return _symbolInformation;
14664
664f54233c98 Extracted model code from the WorkspaceView and rearranged it in a new model class.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14606
diff changeset
145 }
664f54233c98 Extracted model code from the WorkspaceView and rearranged it in a new model class.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14606
diff changeset
146
13518
bace956a3724 Put history model part into OctaveLink.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13517
diff changeset
147 QStringListModel *
bace956a3724 Put history model part into OctaveLink.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13517
diff changeset
148 OctaveLink::historyModel ()
bace956a3724 Put history model part into OctaveLink.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13517
diff changeset
149 {
bace956a3724 Put history model part into OctaveLink.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13517
diff changeset
150 return m_historyModel;
13501
86d6c3b90ad7 Added new gui files.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
151 }
14664
664f54233c98 Extracted model code from the WorkspaceView and rearranged it in a new model class.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14606
diff changeset
152
664f54233c98 Extracted model code from the WorkspaceView and rearranged it in a new model class.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14606
diff changeset
153 WorkspaceModel *
664f54233c98 Extracted model code from the WorkspaceView and rearranged it in a new model class.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14606
diff changeset
154 OctaveLink::workspaceModel ()
664f54233c98 Extracted model code from the WorkspaceView and rearranged it in a new model class.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14606
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: 14606
diff changeset
156 return m_workspaceModel;
664f54233c98 Extracted model code from the WorkspaceView and rearranged it in a new model class.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14606
diff changeset
157 }