Mercurial > hg > octave-nkf
annotate gui/src/backend/OctaveLink.h @ 14599:97cb9286919c gui
Cleaned up code.
* .hgsub: Removed IRC Widget.
* gui.pro: Removed dependency on IRC Widget and removed files.
* class FileEditorMdiSubWindow: Renamed to FileEditor. File editor windows are now independent windows, thus removed the extra close button.
* MainWindow: Removed MDI Area and replaced it with the terminal instead.
* BrowserWidget: Removed browser widget.
* SettingsDialog: Rearranged settings for the editor, removed tab for shortcuts.
* OctaveCallbackThread: Raised update intervals from 0,5s to 1s.
* OctaveLink: Replaced signals names for triggering updates on the symbol table.
* WorkspaceView: Adjusted connect statements to fit the new signal names.
author | Jacob Dawid <jacob.dawid@googlemail.com> |
---|---|
date | Mon, 07 May 2012 00:53:54 +0200 |
parents | faece6b2ab90 |
children | 664f54233c98 |
rev | line source |
---|---|
13674
c0e66d6e3dc8
Updated license headers and moved to AGPLv3.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13595
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:
13595
diff
changeset
|
2 * Copyright (C) 2011 John P. Swensen, Jacob Dawid (jacob.dawid@googlemail.com) |
13501 | 3 * |
13674
c0e66d6e3dc8
Updated license headers and moved to AGPLv3.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13595
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:
13595
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:
13595
diff
changeset
|
7 * License, or (at your option) any later version. |
13501 | 8 * |
13674
c0e66d6e3dc8
Updated license headers and moved to AGPLv3.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13595
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:
13595
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:
13595
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. |
13501 | 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:
13595
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:
13595
diff
changeset
|
16 */ |
13501 | 17 |
18 #ifndef OCTAVELINK_H | |
19 #define OCTAVELINK_H | |
20 | |
21 // Octave includes | |
22 #undef PACKAGE_BUGREPORT | |
23 #undef PACKAGE_NAME | |
24 #undef PACKAGE_STRING | |
25 #undef PACKAGE_TARNAME | |
26 #undef PACKAGE_VERSION | |
27 #undef PACKAGE_URL | |
13595
56eb9348ff02
Added missing include flags.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13543
diff
changeset
|
28 #include "octave/config.h" |
13501 | 29 #include "octave/cmd-edit.h" |
30 #include "octave/error.h" | |
31 #include "octave/file-io.h" | |
32 #include "octave/input.h" | |
33 #include "octave/lex.h" | |
34 #include "octave/load-path.h" | |
35 #include "octave/octave.h" | |
36 #include "octave/oct-hist.h" | |
37 #include "octave/oct-map.h" | |
38 #include "octave/oct-obj.h" | |
39 #include "octave/ops.h" | |
40 #include "octave/ov.h" | |
41 #include "octave/ov-usr-fcn.h" | |
42 #include "octave/symtab.h" | |
43 #include "octave/pt.h" | |
44 #include "octave/pt-eval.h" | |
45 #include "octave/config.h" | |
46 #include "octave/Range.h" | |
47 #include "octave/toplev.h" | |
48 #include "octave/procstream.h" | |
49 #include "octave/sighandlers.h" | |
50 #include "octave/debug.h" | |
51 #include "octave/sysdep.h" | |
52 #include "octave/ov.h" | |
53 #include "octave/unwind-prot.h" | |
54 #include "octave/utils.h" | |
55 #include "octave/variables.h" | |
56 | |
57 // Standard includes | |
58 #include <iostream> | |
59 #include <string> | |
60 #include <vector> | |
61 #include <readline/readline.h> | |
62 | |
63 // Qt includes | |
64 #include <QMutexLocker> | |
65 #include <QMutex> | |
66 #include <QFileInfo> | |
67 #include <QList> | |
68 #include <QString> | |
13517
86adc9c4ec4b
History deactivated.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13513
diff
changeset
|
69 #include <QStringList> |
13501 | 70 #include <QVector> |
71 #include <QSemaphore> | |
72 #include <QObject> | |
13518
bace956a3724
Put history model part into OctaveLink.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13517
diff
changeset
|
73 #include <QStringListModel> |
13501 | 74 |
13541
b48ac9ad8de0
Highly improved separation of model and view classes.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13522
diff
changeset
|
75 #include "OctaveCallbackThread.h" |
b48ac9ad8de0
Highly improved separation of model and view classes.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13522
diff
changeset
|
76 #include "OctaveMainThread.h" |
b48ac9ad8de0
Highly improved separation of model and view classes.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13522
diff
changeset
|
77 |
13517
86adc9c4ec4b
History deactivated.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13513
diff
changeset
|
78 typedef symbol_table::symbol_record SymbolRecord; |
86adc9c4ec4b
History deactivated.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13513
diff
changeset
|
79 typedef octave_value OctaveValue; |
13501 | 80 |
81 /** | |
82 * \class OctaveLink | |
83 * Manages a link to an octave instance. | |
84 */ | |
13541
b48ac9ad8de0
Highly improved separation of model and view classes.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13522
diff
changeset
|
85 class OctaveLink:public QObject |
13501 | 86 { |
13506
c70511cf64ee
Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13504
diff
changeset
|
87 Q_OBJECT |
13501 | 88 public: |
13506
c70511cf64ee
Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13504
diff
changeset
|
89 static OctaveLink * |
c70511cf64ee
Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13504
diff
changeset
|
90 instance () |
c70511cf64ee
Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13504
diff
changeset
|
91 { |
c70511cf64ee
Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13504
diff
changeset
|
92 return &m_singleton; |
c70511cf64ee
Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13504
diff
changeset
|
93 } |
c70511cf64ee
Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13504
diff
changeset
|
94 static QString |
c70511cf64ee
Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13504
diff
changeset
|
95 octaveValueAsQString (OctaveValue octaveValue); |
13501 | 96 |
13541
b48ac9ad8de0
Highly improved separation of model and view classes.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13522
diff
changeset
|
97 void launchOctave (); |
b48ac9ad8de0
Highly improved separation of model and view classes.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13522
diff
changeset
|
98 void terminateOctave (); |
13683
25dc40d24a44
Renamed VariablesDockWidget to WorkspaceView and optimized memory footprint for 30%.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13674
diff
changeset
|
99 void acquireSymbolTable () { m_symbolTableSemaphore->acquire (); } |
25dc40d24a44
Renamed VariablesDockWidget to WorkspaceView and optimized memory footprint for 30%.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13674
diff
changeset
|
100 void releaseSymbolTable () { m_symbolTableSemaphore->release (); } |
25dc40d24a44
Renamed VariablesDockWidget to WorkspaceView and optimized memory footprint for 30%.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13674
diff
changeset
|
101 |
25dc40d24a44
Renamed VariablesDockWidget to WorkspaceView and optimized memory footprint for 30%.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13674
diff
changeset
|
102 /** |
25dc40d24a44
Renamed VariablesDockWidget to WorkspaceView and optimized memory footprint for 30%.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13674
diff
changeset
|
103 * For performance reasons this is not thread safe. Before you use this, |
25dc40d24a44
Renamed VariablesDockWidget to WorkspaceView and optimized memory footprint for 30%.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13674
diff
changeset
|
104 * acquire a lock with acquireSymbolTable and releaseSymbolTable. |
25dc40d24a44
Renamed VariablesDockWidget to WorkspaceView and optimized memory footprint for 30%.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13674
diff
changeset
|
105 */ |
25dc40d24a44
Renamed VariablesDockWidget to WorkspaceView and optimized memory footprint for 30%.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13674
diff
changeset
|
106 QList < SymbolRecord > symbolTable (); |
13541
b48ac9ad8de0
Highly improved separation of model and view classes.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13522
diff
changeset
|
107 |
13517
86adc9c4ec4b
History deactivated.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13513
diff
changeset
|
108 /** |
86adc9c4ec4b
History deactivated.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13513
diff
changeset
|
109 * Returns a copy of the current symbol table buffer. |
86adc9c4ec4b
History deactivated.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13513
diff
changeset
|
110 * \return Copy of the current symbol table buffer. |
86adc9c4ec4b
History deactivated.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13513
diff
changeset
|
111 */ |
13521
16b33b7ef1b3
Raised update interval to 500ms.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13520
diff
changeset
|
112 QList < SymbolRecord > copyCurrentSymbolTable (); |
13501 | 113 |
14599
97cb9286919c
Cleaned up code.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14290
diff
changeset
|
114 void triggerUpdateHistoryModel (); |
13683
25dc40d24a44
Renamed VariablesDockWidget to WorkspaceView and optimized memory footprint for 30%.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13674
diff
changeset
|
115 QStringListModel *historyModel (); |
14599
97cb9286919c
Cleaned up code.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14290
diff
changeset
|
116 void triggerUpdateSymbolTable() { emit updateSymbolTable(); } |
13501 | 117 |
118 signals: | |
14599
97cb9286919c
Cleaned up code.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14290
diff
changeset
|
119 void updateSymbolTable (); |
13501 | 120 |
121 private: | |
13506
c70511cf64ee
Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13504
diff
changeset
|
122 OctaveLink (); |
c70511cf64ee
Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13504
diff
changeset
|
123 ~OctaveLink (); |
13501 | 124 |
13517
86adc9c4ec4b
History deactivated.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13513
diff
changeset
|
125 /** Variable related member variables. */ |
13513
e19c454ed485
Added version script for Octave GUI.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13506
diff
changeset
|
126 QSemaphore * m_symbolTableSemaphore; |
13506
c70511cf64ee
Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13504
diff
changeset
|
127 QList < SymbolRecord > m_symbolTableBuffer; |
13501 | 128 |
13517
86adc9c4ec4b
History deactivated.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13513
diff
changeset
|
129 /** History related member variables. */ |
13518
bace956a3724
Put history model part into OctaveLink.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13517
diff
changeset
|
130 QStringListModel *m_historyModel; |
13519
35ecb6063c7b
Made the view connect with the history model.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13518
diff
changeset
|
131 |
13541
b48ac9ad8de0
Highly improved separation of model and view classes.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13522
diff
changeset
|
132 // Threads for running octave and managing the data interaction. |
b48ac9ad8de0
Highly improved separation of model and view classes.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13522
diff
changeset
|
133 OctaveMainThread *m_octaveMainThread; |
b48ac9ad8de0
Highly improved separation of model and view classes.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13522
diff
changeset
|
134 OctaveCallbackThread *m_octaveCallbackThread; |
b48ac9ad8de0
Highly improved separation of model and view classes.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13522
diff
changeset
|
135 |
13513
e19c454ed485
Added version script for Octave GUI.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13506
diff
changeset
|
136 static OctaveLink m_singleton; |
13501 | 137 }; |
138 #endif // OCTAVELINK_H |