Mercurial > octave-nkf
annotate gui/src/backend/OctaveLink.cpp @ 14606:eeddf586cf0f gui
Added parameter to dup, so that it compiles with the changed API of 3.7.0+.
* OctaveLink: Added global_scope parameter.
author | Jacob Dawid <jacob.dawid@googlemail.com> |
---|---|
date | Mon, 07 May 2012 21:44:32 +0200 |
parents | 97cb9286919c |
children | 664f54233c98 |
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 | 17 |
18 #include "OctaveLink.h" | |
19 | |
13520
17bb8974577b
Repaired history list.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13519
diff
changeset
|
20 OctaveLink OctaveLink::m_singleton; |
13501 | 21 |
13519
35ecb6063c7b
Made the view connect with the history model.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13518
diff
changeset
|
22 OctaveLink::OctaveLink ():QObject () |
13506
c70511cf64ee
Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13501
diff
changeset
|
23 { |
c70511cf64ee
Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13501
diff
changeset
|
24 m_symbolTableSemaphore = new QSemaphore (1); |
13518
bace956a3724
Put history model part into OctaveLink.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13517
diff
changeset
|
25 m_historyModel = new QStringListModel (this); |
13501 | 26 } |
27 | |
13506
c70511cf64ee
Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13501
diff
changeset
|
28 OctaveLink::~OctaveLink () |
c70511cf64ee
Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13501
diff
changeset
|
29 { |
13501 | 30 } |
31 | |
13506
c70511cf64ee
Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13501
diff
changeset
|
32 QString |
c70511cf64ee
Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13501
diff
changeset
|
33 OctaveLink::octaveValueAsQString (OctaveValue octaveValue) |
c70511cf64ee
Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13501
diff
changeset
|
34 { |
c70511cf64ee
Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13501
diff
changeset
|
35 // Convert single qouted string. |
c70511cf64ee
Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13501
diff
changeset
|
36 if (octaveValue.is_sq_string ()) |
c70511cf64ee
Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13501
diff
changeset
|
37 { |
c70511cf64ee
Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13501
diff
changeset
|
38 return QString ("\'%1\'").arg (octaveValue.string_value ().c_str ()); |
13501 | 39 |
13506
c70511cf64ee
Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13501
diff
changeset
|
40 // Convert double qouted string. |
c70511cf64ee
Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13501
diff
changeset
|
41 } |
c70511cf64ee
Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13501
diff
changeset
|
42 else if (octaveValue.is_dq_string ()) |
c70511cf64ee
Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13501
diff
changeset
|
43 { |
c70511cf64ee
Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13501
diff
changeset
|
44 return QString ("\"%1\"").arg (octaveValue.string_value ().c_str ()); |
13501 | 45 |
13506
c70511cf64ee
Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13501
diff
changeset
|
46 // Convert real scalar. |
c70511cf64ee
Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13501
diff
changeset
|
47 } |
c70511cf64ee
Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13501
diff
changeset
|
48 else if (octaveValue.is_real_scalar ()) |
c70511cf64ee
Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13501
diff
changeset
|
49 { |
c70511cf64ee
Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13501
diff
changeset
|
50 return QString ("%1").arg (octaveValue.scalar_value ()); |
13501 | 51 |
13506
c70511cf64ee
Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13501
diff
changeset
|
52 // Convert complex scalar. |
c70511cf64ee
Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13501
diff
changeset
|
53 } |
c70511cf64ee
Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13501
diff
changeset
|
54 else if (octaveValue.is_complex_scalar ()) |
c70511cf64ee
Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13501
diff
changeset
|
55 { |
c70511cf64ee
Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13501
diff
changeset
|
56 return QString ("%1 + %2i").arg (octaveValue.scalar_value ()). |
c70511cf64ee
Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13501
diff
changeset
|
57 arg (octaveValue.complex_value ().imag ()); |
13501 | 58 |
13506
c70511cf64ee
Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13501
diff
changeset
|
59 // Convert range. |
c70511cf64ee
Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13501
diff
changeset
|
60 } |
c70511cf64ee
Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13501
diff
changeset
|
61 else if (octaveValue.is_range ()) |
c70511cf64ee
Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13501
diff
changeset
|
62 { |
c70511cf64ee
Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13501
diff
changeset
|
63 return QString ("%1 : %2 : %3").arg (octaveValue.range_value (). |
c70511cf64ee
Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13501
diff
changeset
|
64 base ()).arg (octaveValue. |
c70511cf64ee
Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13501
diff
changeset
|
65 range_value (). |
c70511cf64ee
Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13501
diff
changeset
|
66 inc ()). |
c70511cf64ee
Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13501
diff
changeset
|
67 arg (octaveValue.range_value ().limit ()); |
13501 | 68 |
13506
c70511cf64ee
Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13501
diff
changeset
|
69 // Convert real matrix. |
c70511cf64ee
Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13501
diff
changeset
|
70 } |
c70511cf64ee
Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13501
diff
changeset
|
71 else if (octaveValue.is_real_matrix ()) |
c70511cf64ee
Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13501
diff
changeset
|
72 { |
13681
ee7f4294d162
Variables view now showing matrix size.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13677
diff
changeset
|
73 return QString ("%1x%2 matrix") |
ee7f4294d162
Variables view now showing matrix size.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13677
diff
changeset
|
74 .arg (octaveValue.matrix_value ().rows ()) |
ee7f4294d162
Variables view now showing matrix size.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13677
diff
changeset
|
75 .arg (octaveValue.matrix_value ().cols ()); |
13501 | 76 |
13506
c70511cf64ee
Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13501
diff
changeset
|
77 // Convert complex matrix. |
c70511cf64ee
Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13501
diff
changeset
|
78 } |
c70511cf64ee
Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13501
diff
changeset
|
79 else if (octaveValue.is_complex_matrix ()) |
c70511cf64ee
Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13501
diff
changeset
|
80 { |
13681
ee7f4294d162
Variables view now showing matrix size.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13677
diff
changeset
|
81 return QString ("%1x%2 complex matrix") |
ee7f4294d162
Variables view now showing matrix size.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13677
diff
changeset
|
82 .arg (octaveValue.matrix_value ().rows ()) |
ee7f4294d162
Variables view now showing matrix size.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13677
diff
changeset
|
83 .arg (octaveValue.matrix_value ().cols ()); |
13501 | 84 |
13506
c70511cf64ee
Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13501
diff
changeset
|
85 // If everything else does not fit, we could not recognize the type. |
c70511cf64ee
Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13501
diff
changeset
|
86 } |
c70511cf64ee
Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13501
diff
changeset
|
87 else |
c70511cf64ee
Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13501
diff
changeset
|
88 { |
c70511cf64ee
Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13501
diff
changeset
|
89 return QString ("<Type not recognized>"); |
13501 | 90 } |
91 } | |
92 | |
13506
c70511cf64ee
Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13501
diff
changeset
|
93 void |
13541
b48ac9ad8de0
Highly improved separation of model and view classes.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13528
diff
changeset
|
94 OctaveLink::launchOctave () |
b48ac9ad8de0
Highly improved separation of model and view classes.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13528
diff
changeset
|
95 { |
13677
f27573828e92
Properly implemented shutdown of callback thread.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13674
diff
changeset
|
96 // Create both threads. |
13541
b48ac9ad8de0
Highly improved separation of model and view classes.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13528
diff
changeset
|
97 m_octaveMainThread = new OctaveMainThread (this); |
13677
f27573828e92
Properly implemented shutdown of callback thread.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13674
diff
changeset
|
98 m_octaveCallbackThread = new OctaveCallbackThread (this); |
13541
b48ac9ad8de0
Highly improved separation of model and view classes.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13528
diff
changeset
|
99 |
13677
f27573828e92
Properly implemented shutdown of callback thread.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13674
diff
changeset
|
100 // Launch the second as soon as the first ist ready. |
13541
b48ac9ad8de0
Highly improved separation of model and view classes.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13528
diff
changeset
|
101 connect (m_octaveMainThread, SIGNAL(ready()), m_octaveCallbackThread, SLOT(start())); |
13677
f27573828e92
Properly implemented shutdown of callback thread.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13674
diff
changeset
|
102 |
f27573828e92
Properly implemented shutdown of callback thread.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13674
diff
changeset
|
103 // Start the first one. |
f27573828e92
Properly implemented shutdown of callback thread.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13674
diff
changeset
|
104 m_octaveMainThread->start (); |
13541
b48ac9ad8de0
Highly improved separation of model and view classes.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13528
diff
changeset
|
105 } |
b48ac9ad8de0
Highly improved separation of model and view classes.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13528
diff
changeset
|
106 |
b48ac9ad8de0
Highly improved separation of model and view classes.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13528
diff
changeset
|
107 void |
b48ac9ad8de0
Highly improved separation of model and view classes.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13528
diff
changeset
|
108 OctaveLink::terminateOctave () |
b48ac9ad8de0
Highly improved separation of model and view classes.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13528
diff
changeset
|
109 { |
13677
f27573828e92
Properly implemented shutdown of callback thread.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13674
diff
changeset
|
110 m_octaveCallbackThread->halt(); |
13541
b48ac9ad8de0
Highly improved separation of model and view classes.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13528
diff
changeset
|
111 m_octaveCallbackThread->wait (); |
b48ac9ad8de0
Highly improved separation of model and view classes.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13528
diff
changeset
|
112 |
b48ac9ad8de0
Highly improved separation of model and view classes.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13528
diff
changeset
|
113 m_octaveMainThread->terminate (); |
13601
26956bb3c927
Terminating octave main thread instantly.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13543
diff
changeset
|
114 //m_octaveMainThread->wait(); |
13541
b48ac9ad8de0
Highly improved separation of model and view classes.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13528
diff
changeset
|
115 } |
b48ac9ad8de0
Highly improved separation of model and view classes.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13528
diff
changeset
|
116 |
13683
25dc40d24a44
Renamed VariablesDockWidget to WorkspaceView and optimized memory footprint for 30%.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13681
diff
changeset
|
117 QList < SymbolRecord > OctaveLink::symbolTable () |
13506
c70511cf64ee
Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13501
diff
changeset
|
118 { |
c70511cf64ee
Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13501
diff
changeset
|
119 m_symbolTableBuffer.clear (); |
c70511cf64ee
Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13501
diff
changeset
|
120 std::list < SymbolRecord > allVariables = symbol_table::all_variables (); |
c70511cf64ee
Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13501
diff
changeset
|
121 std::list < SymbolRecord >::iterator iterator; |
c70511cf64ee
Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13501
diff
changeset
|
122 for (iterator = allVariables.begin (); iterator != allVariables.end (); |
c70511cf64ee
Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13501
diff
changeset
|
123 iterator++) |
14599
97cb9286919c
Cleaned up code.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14500
diff
changeset
|
124 { |
14606
eeddf586cf0f
Added parameter to dup, so that it compiles with the changed API of 3.7.0+.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14599
diff
changeset
|
125 SymbolRecord s = iterator->dup (symbol_table::global_scope ()); |
14599
97cb9286919c
Cleaned up code.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14500
diff
changeset
|
126 m_symbolTableBuffer.append (s); |
97cb9286919c
Cleaned up code.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14500
diff
changeset
|
127 } |
13683
25dc40d24a44
Renamed VariablesDockWidget to WorkspaceView and optimized memory footprint for 30%.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13681
diff
changeset
|
128 return m_symbolTableBuffer; |
13501 | 129 } |
130 | |
13518
bace956a3724
Put history model part into OctaveLink.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13517
diff
changeset
|
131 void |
14599
97cb9286919c
Cleaned up code.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14500
diff
changeset
|
132 OctaveLink::triggerUpdateHistoryModel () |
13506
c70511cf64ee
Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13501
diff
changeset
|
133 { |
13519
35ecb6063c7b
Made the view connect with the history model.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13518
diff
changeset
|
134 // 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
|
135 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
|
136 int serverHistoryLength = command_history::length (); |
35ecb6063c7b
Made the view connect with the history model.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13518
diff
changeset
|
137 |
35ecb6063c7b
Made the view connect with the history model.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13518
diff
changeset
|
138 // 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
|
139 if (clientHistoryLength < serverHistoryLength) |
13518
bace956a3724
Put history model part into OctaveLink.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13517
diff
changeset
|
140 { |
13519
35ecb6063c7b
Made the view connect with the history model.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13518
diff
changeset
|
141 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
|
142 { |
13520
17bb8974577b
Repaired history list.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13519
diff
changeset
|
143 m_historyModel->insertRow (0); |
17bb8974577b
Repaired history list.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13519
diff
changeset
|
144 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
|
145 } |
13528
8b116446a904
Fixed race condition.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13527
diff
changeset
|
146 } |
13518
bace956a3724
Put history model part into OctaveLink.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13517
diff
changeset
|
147 } |
bace956a3724
Put history model part into OctaveLink.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13517
diff
changeset
|
148 |
bace956a3724
Put history model part into OctaveLink.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13517
diff
changeset
|
149 QStringListModel * |
bace956a3724
Put history model part into OctaveLink.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13517
diff
changeset
|
150 OctaveLink::historyModel () |
bace956a3724
Put history model part into OctaveLink.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13517
diff
changeset
|
151 { |
bace956a3724
Put history model part into OctaveLink.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13517
diff
changeset
|
152 return m_historyModel; |
13501 | 153 } |