Status: | Merged |
---|---|
Merged at revision: | 13 |
Proposed branch: | lp:dspatcher/1.01 |
Merge into: | lp:dspatcher |
Diff against target: |
775 lines (+306/-118) 9 files modified
dspatcher/CMakeLists.txt (+4/-0) dspatcher/include/DsprController.h (+9/-2) dspatcher/include/DsprParam.h (+7/-5) dspatcher/src/DsprController.cpp (+127/-22) dspatcher/src/DsprParam.cpp (+133/-43) dspatcher/src/main.cpp (+1/-42) dspatcher/update_install_names.sh (+9/-0) qtpatcher/include/QtpMain.h (+1/-0) qtpatcher/src/QtpMain.cpp (+15/-4) |
To merge this branch: | bzr merge lp:dspatcher/1.01 |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Marcus Tomlinson | Pending | ||
Review via email: mp+255604@code.launchpad.net |
Commit message
* Improved null / error checking
* Show construction menu when placing a component with constructor params
* Allow direct text input for Int, Float and FilePath parameter types
* Support for read-only component parameters
* Fixed component panel dynamic resizing
* Fixed build failures on Mac
Description of the change
To post a comment you must log in.
lp:dspatcher/1.01
updated
- 20. By Marcus Tomlinson
-
Disable auto loading of new plugins for now, somethings borked
- 21. By Marcus Tomlinson
-
Fixed Mac build
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'dspatcher/CMakeLists.txt' | |||
2 | --- dspatcher/CMakeLists.txt 2015-04-07 15:48:58 +0000 | |||
3 | +++ dspatcher/CMakeLists.txt 2015-04-09 13:24:26 +0000 | |||
4 | @@ -21,6 +21,10 @@ | |||
5 | 21 | QtPatcher | 21 | QtPatcher |
6 | 22 | ) | 22 | ) |
7 | 23 | 23 | ||
8 | 24 | if(APPLE) | ||
9 | 25 | execute_process(COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/update_install_names.sh) | ||
10 | 26 | endif(APPLE) | ||
11 | 27 | |||
12 | 24 | if(WIN32) | 28 | if(WIN32) |
13 | 25 | add_custom_command( | 29 | add_custom_command( |
14 | 26 | TARGET ${PROJECT_NAME} POST_BUILD | 30 | TARGET ${PROJECT_NAME} POST_BUILD |
15 | 27 | 31 | ||
16 | === modified file 'dspatcher/include/DsprController.h' | |||
17 | --- dspatcher/include/DsprController.h 2015-04-06 14:19:57 +0000 | |||
18 | +++ dspatcher/include/DsprController.h 2015-04-09 13:24:26 +0000 | |||
19 | @@ -29,14 +29,17 @@ | |||
20 | 29 | #include <DsprParam.h> | 29 | #include <DsprParam.h> |
21 | 30 | #include <QtpMain.h> | 30 | #include <QtpMain.h> |
22 | 31 | 31 | ||
23 | 32 | #include <QFileSystemWatcher> | ||
24 | 32 | #include <QObject> | 33 | #include <QObject> |
25 | 33 | 34 | ||
26 | 35 | #include <set> | ||
27 | 36 | |||
28 | 34 | class DsprController : public QObject | 37 | class DsprController : public QObject |
29 | 35 | { | 38 | { |
30 | 36 | Q_OBJECT | 39 | Q_OBJECT |
31 | 37 | 40 | ||
32 | 38 | public: | 41 | public: |
34 | 39 | DsprController(QtpDiag* diagram, std::vector<DspPluginLoader> const& pluginLoaders); | 42 | DsprController(QtpMain& mainWindow); |
35 | 40 | ~DsprController(); | 43 | ~DsprController(); |
36 | 41 | 44 | ||
37 | 42 | signals: | 45 | signals: |
38 | @@ -61,6 +64,8 @@ | |||
39 | 61 | void triggerUpdated(); | 64 | void triggerUpdated(); |
40 | 62 | 65 | ||
41 | 63 | private slots: | 66 | private slots: |
42 | 67 | void _loadPlugins(); | ||
43 | 68 | |||
44 | 64 | void _inputAdded(DspComponent* component, int index); | 69 | void _inputAdded(DspComponent* component, int index); |
45 | 65 | void _inputRemoved(DspComponent* component, int index); | 70 | void _inputRemoved(DspComponent* component, int index); |
46 | 66 | void _outputAdded(DspComponent* component, int index); | 71 | void _outputAdded(DspComponent* component, int index); |
47 | @@ -70,7 +75,9 @@ | |||
48 | 70 | void _parameterUpdated(DspComponent* component, int index); | 75 | void _parameterUpdated(DspComponent* component, int index); |
49 | 71 | 76 | ||
50 | 72 | private: | 77 | private: |
52 | 73 | bool _settingParam; | 78 | QFileSystemWatcher _fileWatcher; |
53 | 79 | QtpMain& _mainWindow; | ||
54 | 80 | std::set<int> _settingParams; | ||
55 | 74 | std::vector<DspPluginLoader> _pluginLoaders; | 81 | std::vector<DspPluginLoader> _pluginLoaders; |
56 | 75 | 82 | ||
57 | 76 | std::map<DspComponent const*, QtpComp*> _qtpComps; | 83 | std::map<DspComponent const*, QtpComp*> _qtpComps; |
58 | 77 | 84 | ||
59 | === modified file 'dspatcher/include/DsprParam.h' | |||
60 | --- dspatcher/include/DsprParam.h 2015-04-06 16:59:42 +0000 | |||
61 | +++ dspatcher/include/DsprParam.h 2015-04-09 13:24:26 +0000 | |||
62 | @@ -49,10 +49,11 @@ | |||
63 | 49 | public: | 49 | public: |
64 | 50 | DsprParam(int compId, int paramId, std::string const& name, DspParameter const& param, QMenu* contextMenu); | 50 | DsprParam(int compId, int paramId, std::string const& name, DspParameter const& param, QMenu* contextMenu); |
65 | 51 | QWidgetAction* action(); | 51 | QWidgetAction* action(); |
67 | 52 | DspParameter& param(); | 52 | DspParameter const& param(); |
68 | 53 | 53 | ||
71 | 54 | int compId(); | 54 | int compId() const; |
72 | 55 | int paramId(); | 55 | int paramId() const; |
73 | 56 | std::string name() const; | ||
74 | 56 | 57 | ||
75 | 57 | bool SetBool(bool const& value); | 58 | bool SetBool(bool const& value); |
76 | 58 | bool SetInt(int const& value); | 59 | bool SetInt(int const& value); |
77 | @@ -70,17 +71,19 @@ | |||
78 | 70 | void triggerUpdated(); | 71 | void triggerUpdated(); |
79 | 71 | 72 | ||
80 | 72 | private slots: | 73 | private slots: |
81 | 74 | void paramChanged(bool value); | ||
82 | 73 | void paramChanged(int value); | 75 | void paramChanged(int value); |
83 | 74 | void paramChanged(QString const&); | 76 | void paramChanged(QString const&); |
84 | 75 | void paramChanged(); | 77 | void paramChanged(); |
85 | 76 | 78 | ||
87 | 77 | void updateFloatSlider(int value); | 79 | void updateSlider(int value); |
88 | 78 | void browseForFile(); | 80 | void browseForFile(); |
89 | 79 | 81 | ||
90 | 80 | private: | 82 | private: |
91 | 81 | bool _settingParam; | 83 | bool _settingParam; |
92 | 82 | int _compId; | 84 | int _compId; |
93 | 83 | int _paramId; | 85 | int _paramId; |
94 | 86 | std::string _name; | ||
95 | 84 | DspParameter _param; | 87 | DspParameter _param; |
96 | 85 | QMenu* _contextMenu; | 88 | QMenu* _contextMenu; |
97 | 86 | QWidgetAction* _action; | 89 | QWidgetAction* _action; |
98 | @@ -90,7 +93,6 @@ | |||
99 | 90 | QLineEdit* _textBox; | 93 | QLineEdit* _textBox; |
100 | 91 | QComboBox* _listBox; | 94 | QComboBox* _listBox; |
101 | 92 | QPushButton* _button; | 95 | QPushButton* _button; |
102 | 93 | QLabel* _vlabel; | ||
103 | 94 | }; | 96 | }; |
104 | 95 | 97 | ||
105 | 96 | #endif // DSPRPARAM_H | 98 | #endif // DSPRPARAM_H |
106 | 97 | 99 | ||
107 | === removed directory 'dspatcher/link/Debug' | |||
108 | === renamed file 'dspatcher/link/Debug/libDSPatch.dylib' => 'dspatcher/link/libDSPatch.dylib' | |||
109 | === modified file 'dspatcher/src/DsprController.cpp' | |||
110 | --- dspatcher/src/DsprController.cpp 2015-04-06 14:19:57 +0000 | |||
111 | +++ dspatcher/src/DsprController.cpp 2015-04-09 13:24:26 +0000 | |||
112 | @@ -24,19 +24,26 @@ | |||
113 | 24 | 24 | ||
114 | 25 | #include <DsprController.h> | 25 | #include <DsprController.h> |
115 | 26 | 26 | ||
116 | 27 | #include <DSPatch.h> | ||
117 | 27 | #include <QtpDiag.h> | 28 | #include <QtpDiag.h> |
118 | 28 | 29 | ||
122 | 29 | DsprController::DsprController(QtpDiag* diagram, std::vector<DspPluginLoader> const& pluginLoaders) | 30 | #include <QDir> |
123 | 30 | : _settingParam(false) | 31 | |
124 | 31 | , _pluginLoaders(pluginLoaders) | 32 | DsprController::DsprController(QtpMain& mainWindow) |
125 | 33 | : _mainWindow(mainWindow) | ||
126 | 32 | { | 34 | { |
127 | 35 | _fileWatcher.addPath(PLUGIN_DIR); | ||
128 | 36 | ///!connect(&_fileWatcher, SIGNAL(directoryChanged(QString const&)), this, SLOT(_loadPlugins())); | ||
129 | 37 | |||
130 | 38 | _loadPlugins(); | ||
131 | 39 | |||
132 | 33 | _circuit.SetThreadCount(2); | 40 | _circuit.SetThreadCount(2); |
133 | 34 | _circuit.StartAutoTick(); | 41 | _circuit.StartAutoTick(); |
134 | 35 | 42 | ||
139 | 36 | connect(diagram, &QtpDiag::compInserted, this, &DsprController::compInserted); | 43 | connect(_mainWindow.diagram(), &QtpDiag::compInserted, this, &DsprController::compInserted); |
140 | 37 | connect(diagram, &QtpDiag::compRemoved, this, &DsprController::compRemoved); | 44 | connect(_mainWindow.diagram(), &QtpDiag::compRemoved, this, &DsprController::compRemoved); |
141 | 38 | connect(diagram, &QtpDiag::wireConnected, this, &DsprController::wireConnected); | 45 | connect(_mainWindow.diagram(), &QtpDiag::wireConnected, this, &DsprController::wireConnected); |
142 | 39 | connect(diagram, &QtpDiag::wireDisconnected, this, &DsprController::wireDisconnected); | 46 | connect(_mainWindow.diagram(), &QtpDiag::wireDisconnected, this, &DsprController::wireDisconnected); |
143 | 40 | 47 | ||
144 | 41 | connect(this, &DsprController::inputAdded, this, &DsprController::_inputAdded); | 48 | connect(this, &DsprController::inputAdded, this, &DsprController::_inputAdded); |
145 | 42 | connect(this, &DsprController::inputRemoved, this, &DsprController::_inputRemoved); | 49 | connect(this, &DsprController::inputRemoved, this, &DsprController::_inputRemoved); |
146 | @@ -108,7 +115,46 @@ | |||
147 | 108 | { | 115 | { |
148 | 109 | DspPluginLoader loader = _pluginLoaders[qtpComp->compInfo().typeId]; | 116 | DspPluginLoader loader = _pluginLoaders[qtpComp->compInfo().typeId]; |
149 | 110 | std::map<std::string, DspParameter> params = loader.GetCreateParams(); | 117 | std::map<std::string, DspParameter> params = loader.GetCreateParams(); |
150 | 118 | |||
151 | 119 | // Show construction menu | ||
152 | 120 | std::vector<DsprParam*> dsprParams; | ||
153 | 121 | typedef std::map<std::string, DspParameter>::iterator it_type; | ||
154 | 122 | for (it_type iterator = params.begin(); iterator != params.end(); iterator++) | ||
155 | 123 | { | ||
156 | 124 | DsprParam* param = new DsprParam(qtpComp->id(), 0, iterator->first, | ||
157 | 125 | iterator->second, qtpComp->contextMenu()); | ||
158 | 126 | qtpComp->contextMenu()->addAction(param->action()); | ||
159 | 127 | dsprParams.push_back(param); | ||
160 | 128 | } | ||
161 | 129 | if (params.size() > 0) | ||
162 | 130 | { | ||
163 | 131 | qtpComp->contextMenu()->exec(QCursor::pos()); | ||
164 | 132 | } | ||
165 | 133 | |||
166 | 134 | // Construct component with values from menu | ||
167 | 135 | foreach (DsprParam* dsprParam, dsprParams) | ||
168 | 136 | { | ||
169 | 137 | params[dsprParam->name()] = dsprParam->param(); | ||
170 | 138 | delete dsprParam; | ||
171 | 139 | } | ||
172 | 140 | qtpComp->contextMenu()->clear(); | ||
173 | 141 | |||
174 | 111 | DspComponent* component = loader.Create(params); | 142 | DspComponent* component = loader.Create(params); |
175 | 143 | if (component == NULL) | ||
176 | 144 | { | ||
177 | 145 | return; | ||
178 | 146 | } | ||
179 | 147 | |||
180 | 148 | qtpComp->removeInPins(); | ||
181 | 149 | qtpComp->removeOutPins(); | ||
182 | 150 | for (int i = 0; i < component->GetInputCount(); ++i) | ||
183 | 151 | { | ||
184 | 152 | qtpComp->addInPin(component->GetInputName(i).c_str()); | ||
185 | 153 | } | ||
186 | 154 | for (int i = 0; i < component->GetOutputCount(); ++i) | ||
187 | 155 | { | ||
188 | 156 | qtpComp->addOutPin(component->GetOutputName(i).c_str()); | ||
189 | 157 | } | ||
190 | 112 | 158 | ||
191 | 113 | component->SetCallback(callback, this); | 159 | component->SetCallback(callback, this); |
192 | 114 | _circuit.AddComponent(component); | 160 | _circuit.AddComponent(component); |
193 | @@ -162,42 +208,54 @@ | |||
194 | 162 | 208 | ||
195 | 163 | void DsprController::boolUpdated(bool value) | 209 | void DsprController::boolUpdated(bool value) |
196 | 164 | { | 210 | { |
197 | 165 | _settingParam = true; | ||
198 | 166 | DsprParam* param = dynamic_cast<DsprParam*>(sender()); | 211 | DsprParam* param = dynamic_cast<DsprParam*>(sender()); |
201 | 167 | _components[param->compId()]->SetParameter(param->paramId(), DspParameter(DspParameter::Bool, value)); | 212 | _settingParams.insert(param->paramId()); |
202 | 168 | _settingParam = false; | 213 | if (!_components[param->compId()]->SetParameter(param->paramId(), DspParameter(DspParameter::Bool, value))) |
203 | 214 | { | ||
204 | 215 | param->SetBool(*(_components[param->compId()]->GetParameter(param->paramId())->GetBool())); | ||
205 | 216 | } | ||
206 | 217 | _settingParams.erase(param->paramId()); | ||
207 | 169 | } | 218 | } |
208 | 170 | 219 | ||
209 | 171 | void DsprController::intUpdated(int value) | 220 | void DsprController::intUpdated(int value) |
210 | 172 | { | 221 | { |
211 | 173 | _settingParam = true; | ||
212 | 174 | DsprParam* param = dynamic_cast<DsprParam*>(sender()); | 222 | DsprParam* param = dynamic_cast<DsprParam*>(sender()); |
215 | 175 | _components[param->compId()]->SetParameter(param->paramId(), DspParameter(DspParameter::Int, value)); | 223 | _settingParams.insert(param->paramId()); |
216 | 176 | _settingParam = false; | 224 | if (!_components[param->compId()]->SetParameter(param->paramId(), DspParameter(DspParameter::Int, value))) |
217 | 225 | { | ||
218 | 226 | param->SetInt(*(_components[param->compId()]->GetParameter(param->paramId())->GetInt())); | ||
219 | 227 | } | ||
220 | 228 | _settingParams.erase(param->paramId()); | ||
221 | 177 | } | 229 | } |
222 | 178 | 230 | ||
223 | 179 | void DsprController::floatUpdated(float value) | 231 | void DsprController::floatUpdated(float value) |
224 | 180 | { | 232 | { |
225 | 181 | _settingParam = true; | ||
226 | 182 | DsprParam* param = dynamic_cast<DsprParam*>(sender()); | 233 | DsprParam* param = dynamic_cast<DsprParam*>(sender()); |
229 | 183 | _components[param->compId()]->SetParameter(param->paramId(), DspParameter(DspParameter::Float, value)); | 234 | _settingParams.insert(param->paramId()); |
230 | 184 | _settingParam = false; | 235 | if (!_components[param->compId()]->SetParameter(param->paramId(), DspParameter(DspParameter::Float, value))) |
231 | 236 | { | ||
232 | 237 | param->SetFloat(*(_components[param->compId()]->GetParameter(param->paramId())->GetFloat())); | ||
233 | 238 | } | ||
234 | 239 | _settingParams.erase(param->paramId()); | ||
235 | 185 | } | 240 | } |
236 | 186 | 241 | ||
237 | 187 | void DsprController::stringUpdated(std::string const& value) | 242 | void DsprController::stringUpdated(std::string const& value) |
238 | 188 | { | 243 | { |
239 | 189 | _settingParam = true; | ||
240 | 190 | DsprParam* param = dynamic_cast<DsprParam*>(sender()); | 244 | DsprParam* param = dynamic_cast<DsprParam*>(sender()); |
243 | 191 | _components[param->compId()]->SetParameter(param->paramId(), DspParameter(DspParameter::String, value)); | 245 | _settingParams.insert(param->paramId()); |
244 | 192 | _settingParam = false; | 246 | if (!_components[param->compId()]->SetParameter(param->paramId(), DspParameter(DspParameter::String, value))) |
245 | 247 | { | ||
246 | 248 | param->SetString(*(_components[param->compId()]->GetParameter(param->paramId())->GetString())); | ||
247 | 249 | } | ||
248 | 250 | _settingParams.erase(param->paramId()); | ||
249 | 193 | } | 251 | } |
250 | 194 | 252 | ||
251 | 195 | void DsprController::triggerUpdated() | 253 | void DsprController::triggerUpdated() |
252 | 196 | { | 254 | { |
253 | 197 | _settingParam = true; | ||
254 | 198 | DsprParam* param = dynamic_cast<DsprParam*>(sender()); | 255 | DsprParam* param = dynamic_cast<DsprParam*>(sender()); |
255 | 256 | _settingParams.insert(param->paramId()); | ||
256 | 199 | _components[param->compId()]->SetParameter(param->paramId(), DspParameter(DspParameter::Trigger)); | 257 | _components[param->compId()]->SetParameter(param->paramId(), DspParameter(DspParameter::Trigger)); |
258 | 200 | _settingParam = false; | 258 | _settingParams.erase(param->paramId()); |
259 | 201 | } | 259 | } |
260 | 202 | 260 | ||
261 | 203 | void DsprController::_inputAdded(DspComponent* component, int index) | 261 | void DsprController::_inputAdded(DspComponent* component, int index) |
262 | @@ -275,7 +333,8 @@ | |||
263 | 275 | 333 | ||
264 | 276 | void DsprController::_parameterUpdated(DspComponent* component, int index) | 334 | void DsprController::_parameterUpdated(DspComponent* component, int index) |
265 | 277 | { | 335 | { |
267 | 278 | if (_settingParam) | 336 | // don't react if we are the one setting the parameter |
268 | 337 | if (_settingParams.find(index) != _settingParams.end()) | ||
269 | 279 | { | 338 | { |
270 | 280 | return; | 339 | return; |
271 | 281 | } | 340 | } |
272 | @@ -314,3 +373,49 @@ | |||
273 | 314 | break; | 373 | break; |
274 | 315 | } | 374 | } |
275 | 316 | } | 375 | } |
276 | 376 | |||
277 | 377 | void DsprController::_loadPlugins() | ||
278 | 378 | { | ||
279 | 379 | _mainWindow.unregisterComponents(); | ||
280 | 380 | |||
281 | 381 | // Load DSPatch plugins from "dspatchables" folder | ||
282 | 382 | QDir dir(PLUGIN_DIR); | ||
283 | 383 | QFileInfoList files = dir.entryInfoList(); | ||
284 | 384 | foreach(QFileInfo const& file, files) | ||
285 | 385 | { | ||
286 | 386 | #ifdef _WIN32 | ||
287 | 387 | if (file.isFile() && file.fileName().endsWith(".dll")) | ||
288 | 388 | #else | ||
289 | 389 | if (file.isFile()) | ||
290 | 390 | #endif | ||
291 | 391 | { | ||
292 | 392 | QString path = file.absoluteFilePath(); | ||
293 | 393 | DspPluginLoader loader(path.toUtf8().constData()); | ||
294 | 394 | if (loader.IsLoaded()) | ||
295 | 395 | { | ||
296 | 396 | _pluginLoaders.push_back(loader); | ||
297 | 397 | std::map<std::string, DspParameter> params = loader.GetCreateParams(); | ||
298 | 398 | DspComponent* comp = loader.Create(params); | ||
299 | 399 | |||
300 | 400 | QtpComp::CompInfo compInfo; | ||
301 | 401 | compInfo.typeId = _pluginLoaders.size() - 1; | ||
302 | 402 | compInfo.typeName = file.baseName().mid(0, 3) == "lib" ? file.baseName().mid(3) : file.baseName(); | ||
303 | 403 | |||
304 | 404 | if (comp) | ||
305 | 405 | { | ||
306 | 406 | for (int i = 0; i < comp->GetInputCount(); ++i) | ||
307 | 407 | { | ||
308 | 408 | compInfo.inPins.append(comp->GetInputName(i).c_str()); | ||
309 | 409 | } | ||
310 | 410 | for (int i = 0; i < comp->GetOutputCount(); ++i) | ||
311 | 411 | { | ||
312 | 412 | compInfo.outPins.append(comp->GetOutputName(i).c_str()); | ||
313 | 413 | } | ||
314 | 414 | } | ||
315 | 415 | |||
316 | 416 | _mainWindow.registerComponent(compInfo); | ||
317 | 417 | delete comp; | ||
318 | 418 | } | ||
319 | 419 | } | ||
320 | 420 | } | ||
321 | 421 | } | ||
322 | 317 | 422 | ||
323 | === modified file 'dspatcher/src/DsprParam.cpp' | |||
324 | --- dspatcher/src/DsprParam.cpp 2015-04-06 16:59:42 +0000 | |||
325 | +++ dspatcher/src/DsprParam.cpp 2015-04-09 13:24:26 +0000 | |||
326 | @@ -28,18 +28,25 @@ | |||
327 | 28 | : _settingParam(false) | 28 | : _settingParam(false) |
328 | 29 | , _compId(compId) | 29 | , _compId(compId) |
329 | 30 | , _paramId(paramId) | 30 | , _paramId(paramId) |
330 | 31 | , _name(name) | ||
331 | 31 | , _param(param) | 32 | , _param(param) |
332 | 32 | , _contextMenu(contextMenu) | 33 | , _contextMenu(contextMenu) |
333 | 33 | { | 34 | { |
334 | 34 | if (_param.Type() == DspParameter::Bool) | 35 | if (_param.Type() == DspParameter::Bool) |
335 | 35 | { | 36 | { |
336 | 36 | _checkbox = new QCheckBox(_contextMenu); | 37 | _checkbox = new QCheckBox(_contextMenu); |
337 | 38 | |||
338 | 39 | if (_param.GetBool()) | ||
339 | 40 | { | ||
340 | 41 | _checkbox->setChecked(*_param.GetBool()); | ||
341 | 42 | } | ||
342 | 43 | |||
343 | 37 | _checkbox->setText(name.c_str()); | 44 | _checkbox->setText(name.c_str()); |
344 | 38 | QWidgetAction* customAction = new QWidgetAction(_contextMenu); | 45 | QWidgetAction* customAction = new QWidgetAction(_contextMenu); |
345 | 39 | customAction->setDefaultWidget(_checkbox); | 46 | customAction->setDefaultWidget(_checkbox); |
346 | 40 | _action = customAction; | 47 | _action = customAction; |
347 | 41 | 48 | ||
349 | 42 | connect(_checkbox, SIGNAL(stateChanged(int)), this, SLOT(paramChanged(int))); | 49 | connect(_checkbox, SIGNAL(toggled(bool)), this, SLOT(paramChanged(bool))); |
350 | 43 | } | 50 | } |
351 | 44 | else if (_param.Type() == DspParameter::Int) | 51 | else if (_param.Type() == DspParameter::Int) |
352 | 45 | { | 52 | { |
353 | @@ -50,31 +57,43 @@ | |||
354 | 50 | { | 57 | { |
355 | 51 | _slider->setRange(_param.GetIntRange()->first, _param.GetIntRange()->second); | 58 | _slider->setRange(_param.GetIntRange()->first, _param.GetIntRange()->second); |
356 | 52 | } | 59 | } |
358 | 53 | else | 60 | else if (_param.GetInt()) |
359 | 54 | { | 61 | { |
360 | 55 | _slider->setRange(0, *_param.GetInt() * 2); | 62 | _slider->setRange(0, *_param.GetInt() * 2); |
361 | 56 | } | 63 | } |
363 | 57 | _slider->setValue(*_param.GetInt()); | 64 | else |
364 | 65 | { | ||
365 | 66 | _slider->setRange(0, 10000); | ||
366 | 67 | } | ||
367 | 68 | |||
368 | 69 | if (_param.GetInt()) | ||
369 | 70 | { | ||
370 | 71 | _slider->setValue(*_param.GetInt()); | ||
371 | 72 | } | ||
372 | 73 | else | ||
373 | 74 | { | ||
374 | 75 | _slider->setValue(5000); | ||
375 | 76 | } | ||
376 | 58 | 77 | ||
377 | 59 | QLabel* label = new QLabel(intSlider); | 78 | QLabel* label = new QLabel(intSlider); |
378 | 60 | label->setText(name.c_str()); | 79 | label->setText(name.c_str()); |
379 | 61 | 80 | ||
383 | 62 | _vlabel = new QLabel(intSlider); | 81 | _textBox = new QLineEdit(intSlider); |
384 | 63 | _vlabel->setNum(_slider->sliderPosition()); | 82 | _textBox->setText(QString::number(_slider->sliderPosition())); |
385 | 64 | _vlabel->setFixedWidth(45); | 83 | _textBox->setFixedWidth(65); |
386 | 65 | 84 | ||
388 | 66 | connect(_slider, SIGNAL(valueChanged(int)), _vlabel, SLOT(setNum(int))); | 85 | connect(_slider, SIGNAL(valueChanged(int)), this, SLOT(updateSlider(int))); |
389 | 67 | 86 | ||
390 | 68 | QHBoxLayout* layout = new QHBoxLayout(intSlider); | 87 | QHBoxLayout* layout = new QHBoxLayout(intSlider); |
391 | 69 | layout->addWidget(label); | 88 | layout->addWidget(label); |
392 | 70 | layout->addWidget(_slider); | 89 | layout->addWidget(_slider); |
394 | 71 | layout->addWidget(_vlabel); | 90 | layout->addWidget(_textBox); |
395 | 72 | 91 | ||
396 | 73 | QWidgetAction* intSliderAction = new QWidgetAction(_contextMenu); | 92 | QWidgetAction* intSliderAction = new QWidgetAction(_contextMenu); |
397 | 74 | intSliderAction->setDefaultWidget(intSlider); | 93 | intSliderAction->setDefaultWidget(intSlider); |
398 | 75 | _action = intSliderAction; | 94 | _action = intSliderAction; |
399 | 76 | 95 | ||
401 | 77 | connect(_slider, SIGNAL(valueChanged(int)), this, SLOT(paramChanged(int))); | 96 | connect(_textBox, SIGNAL(textChanged(QString const&)), this, SLOT(paramChanged(QString const&))); |
402 | 78 | } | 97 | } |
403 | 79 | else if (_param.Type() == DspParameter::Float) | 98 | else if (_param.Type() == DspParameter::Float) |
404 | 80 | { | 99 | { |
405 | @@ -85,31 +104,43 @@ | |||
406 | 85 | { | 104 | { |
407 | 86 | _slider->setRange(_param.GetFloatRange()->first * 100, _param.GetFloatRange()->second * 100); | 105 | _slider->setRange(_param.GetFloatRange()->first * 100, _param.GetFloatRange()->second * 100); |
408 | 87 | } | 106 | } |
410 | 88 | else | 107 | else if (_param.GetFloat()) |
411 | 89 | { | 108 | { |
412 | 90 | _slider->setRange(0, *_param.GetFloat() * 200); | 109 | _slider->setRange(0, *_param.GetFloat() * 200); |
413 | 91 | } | 110 | } |
415 | 92 | _slider->setValue(*_param.GetFloat() * 100); | 111 | else |
416 | 112 | { | ||
417 | 113 | _slider->setRange(0, 10000 * 100); | ||
418 | 114 | } | ||
419 | 115 | |||
420 | 116 | if (_param.GetFloat()) | ||
421 | 117 | { | ||
422 | 118 | _slider->setValue(*_param.GetFloat() * 100); | ||
423 | 119 | } | ||
424 | 120 | else | ||
425 | 121 | { | ||
426 | 122 | _slider->setValue(5000 * 100); | ||
427 | 123 | } | ||
428 | 93 | 124 | ||
429 | 94 | QLabel* label = new QLabel(floatSlider); | 125 | QLabel* label = new QLabel(floatSlider); |
430 | 95 | label->setText(name.c_str()); | 126 | label->setText(name.c_str()); |
431 | 96 | 127 | ||
435 | 97 | _vlabel = new QLabel(floatSlider); | 128 | _textBox = new QLineEdit(floatSlider); |
436 | 98 | _vlabel->setNum(_slider->sliderPosition() / 100); | 129 | _textBox->setText(QString::number((float)_slider->sliderPosition() / 100)); |
437 | 99 | _vlabel->setFixedWidth(45); | 130 | _textBox->setFixedWidth(65); |
438 | 100 | 131 | ||
440 | 101 | connect(_slider, SIGNAL(valueChanged(int)), this, SLOT(updateFloatSlider(int))); | 132 | connect(_slider, SIGNAL(valueChanged(int)), this, SLOT(updateSlider(int))); |
441 | 102 | 133 | ||
442 | 103 | QHBoxLayout* layout = new QHBoxLayout(floatSlider); | 134 | QHBoxLayout* layout = new QHBoxLayout(floatSlider); |
443 | 104 | layout->addWidget(label); | 135 | layout->addWidget(label); |
444 | 105 | layout->addWidget(_slider); | 136 | layout->addWidget(_slider); |
446 | 106 | layout->addWidget(_vlabel); | 137 | layout->addWidget(_textBox); |
447 | 107 | 138 | ||
448 | 108 | QWidgetAction* intSliderAction = new QWidgetAction(_contextMenu); | 139 | QWidgetAction* intSliderAction = new QWidgetAction(_contextMenu); |
449 | 109 | intSliderAction->setDefaultWidget(floatSlider); | 140 | intSliderAction->setDefaultWidget(floatSlider); |
450 | 110 | _action = intSliderAction; | 141 | _action = intSliderAction; |
451 | 111 | 142 | ||
453 | 112 | connect(_slider, SIGNAL(valueChanged(int)), this, SLOT(paramChanged(int))); | 143 | connect(_textBox, SIGNAL(textChanged(QString const&)), this, SLOT(paramChanged(QString const&))); |
454 | 113 | } | 144 | } |
455 | 114 | else if (_param.Type() == DspParameter::String) | 145 | else if (_param.Type() == DspParameter::String) |
456 | 115 | { | 146 | { |
457 | @@ -119,7 +150,11 @@ | |||
458 | 119 | label->setText(name.c_str()); | 150 | label->setText(name.c_str()); |
459 | 120 | 151 | ||
460 | 121 | _textBox = new QLineEdit(textBox); | 152 | _textBox = new QLineEdit(textBox); |
462 | 122 | _textBox->setText(_param.GetString()->c_str()); | 153 | |
463 | 154 | if (_param.GetString()) | ||
464 | 155 | { | ||
465 | 156 | _textBox->setText(_param.GetString()->c_str()); | ||
466 | 157 | } | ||
467 | 123 | 158 | ||
468 | 124 | QHBoxLayout* layout = new QHBoxLayout(textBox); | 159 | QHBoxLayout* layout = new QHBoxLayout(textBox); |
469 | 125 | layout->addWidget(label); | 160 | layout->addWidget(label); |
470 | @@ -139,8 +174,11 @@ | |||
471 | 139 | label->setText(name.c_str()); | 174 | label->setText(name.c_str()); |
472 | 140 | 175 | ||
473 | 141 | _textBox = new QLineEdit(fileBrowser); | 176 | _textBox = new QLineEdit(fileBrowser); |
476 | 142 | _textBox->setEnabled(false); | 177 | |
477 | 143 | _textBox->setText(_param.GetString()->c_str()); | 178 | if (_param.GetString()) |
478 | 179 | { | ||
479 | 180 | _textBox->setText(_param.GetString()->c_str()); | ||
480 | 181 | } | ||
481 | 144 | 182 | ||
482 | 145 | QPushButton* btnBrowse = new QPushButton(fileBrowser); | 183 | QPushButton* btnBrowse = new QPushButton(fileBrowser); |
483 | 146 | btnBrowse->setText("Browse"); | 184 | btnBrowse->setText("Browse"); |
484 | @@ -165,9 +203,13 @@ | |||
485 | 165 | label->setText(name.c_str()); | 203 | label->setText(name.c_str()); |
486 | 166 | 204 | ||
487 | 167 | _listBox = new QComboBox(listBox); | 205 | _listBox = new QComboBox(listBox); |
489 | 168 | for (size_t i = 0; i < _param.GetList()->size(); ++i) | 206 | |
490 | 207 | if (_param.GetList()) | ||
491 | 169 | { | 208 | { |
493 | 170 | _listBox->addItem((*_param.GetList())[i].c_str()); | 209 | for (size_t i = 0; i < _param.GetList()->size(); ++i) |
494 | 210 | { | ||
495 | 211 | _listBox->addItem((*_param.GetList())[i].c_str()); | ||
496 | 212 | } | ||
497 | 171 | } | 213 | } |
498 | 172 | 214 | ||
499 | 173 | QHBoxLayout* layout = new QHBoxLayout(listBox); | 215 | QHBoxLayout* layout = new QHBoxLayout(listBox); |
500 | @@ -198,21 +240,26 @@ | |||
501 | 198 | return _action; | 240 | return _action; |
502 | 199 | } | 241 | } |
503 | 200 | 242 | ||
505 | 201 | DspParameter& DsprParam::param() | 243 | DspParameter const& DsprParam::param() |
506 | 202 | { | 244 | { |
507 | 203 | return _param; | 245 | return _param; |
508 | 204 | } | 246 | } |
509 | 205 | 247 | ||
511 | 206 | int DsprParam::compId() | 248 | int DsprParam::compId() const |
512 | 207 | { | 249 | { |
513 | 208 | return _compId; | 250 | return _compId; |
514 | 209 | } | 251 | } |
515 | 210 | 252 | ||
517 | 211 | int DsprParam::paramId() | 253 | int DsprParam::paramId() const |
518 | 212 | { | 254 | { |
519 | 213 | return _paramId; | 255 | return _paramId; |
520 | 214 | } | 256 | } |
521 | 215 | 257 | ||
522 | 258 | std::string DsprParam::name() const | ||
523 | 259 | { | ||
524 | 260 | return _name; | ||
525 | 261 | } | ||
526 | 262 | |||
527 | 216 | bool DsprParam::SetBool(bool const& value) | 263 | bool DsprParam::SetBool(bool const& value) |
528 | 217 | { | 264 | { |
529 | 218 | _settingParam = true; | 265 | _settingParam = true; |
530 | @@ -320,26 +367,28 @@ | |||
531 | 320 | return result; | 367 | return result; |
532 | 321 | } | 368 | } |
533 | 322 | 369 | ||
534 | 370 | void DsprParam::paramChanged(bool value) | ||
535 | 371 | { | ||
536 | 372 | if (_settingParam) | ||
537 | 373 | { | ||
538 | 374 | return; | ||
539 | 375 | } | ||
540 | 376 | if (_param.Type() == DspParameter::Bool) | ||
541 | 377 | { | ||
542 | 378 | _param.SetBool(value != 0); | ||
543 | 379 | emit boolUpdated(value != 0); | ||
544 | 380 | } | ||
545 | 381 | } | ||
546 | 382 | |||
547 | 323 | void DsprParam::paramChanged(int value) | 383 | void DsprParam::paramChanged(int value) |
548 | 324 | { | 384 | { |
549 | 325 | if (_settingParam) | 385 | if (_settingParam) |
550 | 326 | { | 386 | { |
551 | 327 | return; | 387 | return; |
552 | 328 | } | 388 | } |
567 | 329 | if (_param.Type() == DspParameter::Bool) | 389 | if (_param.Type() == DspParameter::List) |
568 | 330 | { | 390 | { |
569 | 331 | emit boolUpdated(value != 0); | 391 | _param.SetInt(value); |
556 | 332 | } | ||
557 | 333 | else if (_param.Type() == DspParameter::Int) | ||
558 | 334 | { | ||
559 | 335 | emit intUpdated(value); | ||
560 | 336 | } | ||
561 | 337 | else if (_param.Type() == DspParameter::Float) | ||
562 | 338 | { | ||
563 | 339 | emit floatUpdated((float)value / 100.f); | ||
564 | 340 | } | ||
565 | 341 | else if (_param.Type() == DspParameter::List) | ||
566 | 342 | { | ||
570 | 343 | emit intUpdated(value); | 392 | emit intUpdated(value); |
571 | 344 | } | 393 | } |
572 | 345 | } | 394 | } |
573 | @@ -350,12 +399,46 @@ | |||
574 | 350 | { | 399 | { |
575 | 351 | return; | 400 | return; |
576 | 352 | } | 401 | } |
579 | 353 | if (_param.Type() == DspParameter::String) | 402 | if (_param.Type() == DspParameter::Int) |
580 | 354 | { | 403 | { |
581 | 404 | int value = newString.toInt(); | ||
582 | 405 | |||
583 | 406 | _settingParam = true; | ||
584 | 407 | _slider->setValue(value); | ||
585 | 408 | if (value < _slider->minimum() || value > _slider->maximum()) | ||
586 | 409 | { | ||
587 | 410 | value = _slider->sliderPosition(); | ||
588 | 411 | _textBox->setText(QString::number(value)); | ||
589 | 412 | } | ||
590 | 413 | _settingParam = false; | ||
591 | 414 | |||
592 | 415 | _param.SetInt(value); | ||
593 | 416 | emit intUpdated(value); | ||
594 | 417 | } | ||
595 | 418 | else if (_param.Type() == DspParameter::Float) | ||
596 | 419 | { | ||
597 | 420 | float value = newString.toFloat(); | ||
598 | 421 | |||
599 | 422 | _settingParam = true; | ||
600 | 423 | _slider->setValue(value * 100); | ||
601 | 424 | if (value * 100 < _slider->minimum() || value * 100 > _slider->maximum()) | ||
602 | 425 | { | ||
603 | 426 | value = (float)_slider->sliderPosition() / 100; | ||
604 | 427 | _textBox->setText(QString::number(value)); | ||
605 | 428 | } | ||
606 | 429 | _settingParam = false; | ||
607 | 430 | |||
608 | 431 | _param.SetFloat(value); | ||
609 | 432 | emit floatUpdated(value); | ||
610 | 433 | } | ||
611 | 434 | else if (_param.Type() == DspParameter::String) | ||
612 | 435 | { | ||
613 | 436 | _param.SetString(newString.toUtf8().constData()); | ||
614 | 355 | emit stringUpdated(newString.toUtf8().constData()); | 437 | emit stringUpdated(newString.toUtf8().constData()); |
615 | 356 | } | 438 | } |
616 | 357 | else if (_param.Type() == DspParameter::FilePath) | 439 | else if (_param.Type() == DspParameter::FilePath) |
617 | 358 | { | 440 | { |
618 | 441 | _param.SetString(newString.toUtf8().constData()); | ||
619 | 359 | emit stringUpdated(newString.toUtf8().constData()); | 442 | emit stringUpdated(newString.toUtf8().constData()); |
620 | 360 | } | 443 | } |
621 | 361 | } | 444 | } |
622 | @@ -372,9 +455,16 @@ | |||
623 | 372 | } | 455 | } |
624 | 373 | } | 456 | } |
625 | 374 | 457 | ||
627 | 375 | void DsprParam::updateFloatSlider(int value) | 458 | void DsprParam::updateSlider(int value) |
628 | 376 | { | 459 | { |
630 | 377 | _vlabel->setNum((float)value / 100); | 460 | if (_param.Type() == DspParameter::Int) |
631 | 461 | { | ||
632 | 462 | _textBox->setText(QString::number(value)); | ||
633 | 463 | } | ||
634 | 464 | else if (_param.Type() == DspParameter::Float) | ||
635 | 465 | { | ||
636 | 466 | _textBox->setText(QString::number((float)value / 100)); | ||
637 | 467 | } | ||
638 | 378 | } | 468 | } |
639 | 379 | 469 | ||
640 | 380 | void DsprParam::browseForFile() | 470 | void DsprParam::browseForFile() |
641 | 381 | 471 | ||
642 | === modified file 'dspatcher/src/main.cpp' | |||
643 | --- dspatcher/src/main.cpp 2015-04-06 17:02:27 +0000 | |||
644 | +++ dspatcher/src/main.cpp 2015-04-09 13:24:26 +0000 | |||
645 | @@ -22,12 +22,10 @@ | |||
646 | 22 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 22 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
647 | 23 | ************************************************************************/ | 23 | ************************************************************************/ |
648 | 24 | 24 | ||
649 | 25 | #include <DSPatch.h> | ||
650 | 26 | #include <DsprController.h> | 25 | #include <DsprController.h> |
651 | 27 | #include <QtpMain.h> | 26 | #include <QtpMain.h> |
652 | 28 | 27 | ||
653 | 29 | #include <QApplication> | 28 | #include <QApplication> |
654 | 30 | #include <QDir> | ||
655 | 31 | 29 | ||
656 | 32 | int main(int argv, char* args[]) | 30 | int main(int argv, char* args[]) |
657 | 33 | { | 31 | { |
658 | @@ -35,46 +33,7 @@ | |||
659 | 35 | QtpMain mainWindow; | 33 | QtpMain mainWindow; |
660 | 36 | mainWindow.show(); | 34 | mainWindow.show(); |
661 | 37 | 35 | ||
702 | 38 | std::vector<DspPluginLoader> pluginLoaders; | 36 | DsprController controller(mainWindow); |
663 | 39 | |||
664 | 40 | // Load DSPatch plugins from "dspatchables" folder | ||
665 | 41 | QDir dir(PLUGIN_DIR); | ||
666 | 42 | QFileInfoList files = dir.entryInfoList(); | ||
667 | 43 | foreach(QFileInfo const& file, files) | ||
668 | 44 | { | ||
669 | 45 | #ifdef _WIN32 | ||
670 | 46 | if (file.isFile() && file.fileName().endsWith(".dll")) | ||
671 | 47 | #else | ||
672 | 48 | if (file.isFile()) | ||
673 | 49 | #endif | ||
674 | 50 | { | ||
675 | 51 | QString path = file.absoluteFilePath(); | ||
676 | 52 | DspPluginLoader loader(path.toUtf8().constData()); | ||
677 | 53 | if (loader.IsLoaded()) | ||
678 | 54 | { | ||
679 | 55 | pluginLoaders.push_back(loader); | ||
680 | 56 | std::map<std::string, DspParameter> params = loader.GetCreateParams(); | ||
681 | 57 | DspComponent* comp = loader.Create(params); | ||
682 | 58 | |||
683 | 59 | QtpComp::CompInfo compInfo; | ||
684 | 60 | compInfo.typeId = pluginLoaders.size() - 1; | ||
685 | 61 | compInfo.typeName = file.baseName().mid(0, 3) == "lib" ? file.baseName().mid(3) : file.baseName(); | ||
686 | 62 | for (int i = 0; i < comp->GetInputCount(); ++i) | ||
687 | 63 | { | ||
688 | 64 | compInfo.inPins.append(comp->GetInputName(i).c_str()); | ||
689 | 65 | } | ||
690 | 66 | for (int i = 0; i < comp->GetOutputCount(); ++i) | ||
691 | 67 | { | ||
692 | 68 | compInfo.outPins.append(comp->GetOutputName(i).c_str()); | ||
693 | 69 | } | ||
694 | 70 | mainWindow.registerComponent(compInfo); | ||
695 | 71 | |||
696 | 72 | delete comp; | ||
697 | 73 | } | ||
698 | 74 | } | ||
699 | 75 | } | ||
700 | 76 | |||
701 | 77 | DsprController controller(mainWindow.diagram(), pluginLoaders); | ||
703 | 78 | 37 | ||
704 | 79 | return app.exec(); | 38 | return app.exec(); |
705 | 80 | } | 39 | } |
706 | 81 | 40 | ||
707 | === added file 'dspatcher/update_install_names.sh' | |||
708 | --- dspatcher/update_install_names.sh 1970-01-01 00:00:00 +0000 | |||
709 | +++ dspatcher/update_install_names.sh 2015-04-09 13:24:26 +0000 | |||
710 | @@ -0,0 +1,9 @@ | |||
711 | 1 | #!/bin/bash | ||
712 | 2 | dir=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd ) | ||
713 | 3 | |||
714 | 4 | install_name_tool -id $dir/link/libDSPatch.dylib $dir/link/libDSPatch.dylib | ||
715 | 5 | |||
716 | 6 | for file in $dir/dspatchables/*.dylib; do | ||
717 | 7 | install_name_tool -id $file $file | ||
718 | 8 | install_name_tool -change $(cut -d ' ' -f 1 <<< $(otool -L $file | grep libDSPatch.dylib)) $dir/link/libDSPatch.dylib $file | ||
719 | 9 | done | ||
720 | 0 | \ No newline at end of file | 10 | \ No newline at end of file |
721 | 1 | 11 | ||
722 | === modified file 'qtpatcher/include/QtpMain.h' | |||
723 | --- qtpatcher/include/QtpMain.h 2015-04-07 16:21:36 +0000 | |||
724 | +++ qtpatcher/include/QtpMain.h 2015-04-09 13:24:26 +0000 | |||
725 | @@ -46,6 +46,7 @@ | |||
726 | 46 | QtpDiag* diagram(); | 46 | QtpDiag* diagram(); |
727 | 47 | 47 | ||
728 | 48 | void registerComponent(QtpComp::CompInfo const& compInfo); | 48 | void registerComponent(QtpComp::CompInfo const& compInfo); |
729 | 49 | void unregisterComponents(); | ||
730 | 49 | 50 | ||
731 | 50 | private slots: | 51 | private slots: |
732 | 51 | void buttonGroupClicked(int id); | 52 | void buttonGroupClicked(int id); |
733 | 52 | 53 | ||
734 | === modified file 'qtpatcher/src/QtpMain.cpp' | |||
735 | --- qtpatcher/src/QtpMain.cpp 2015-04-07 16:21:36 +0000 | |||
736 | +++ qtpatcher/src/QtpMain.cpp 2015-04-09 13:24:26 +0000 | |||
737 | @@ -71,8 +71,7 @@ | |||
738 | 71 | 71 | ||
739 | 72 | _toolBox->deleteLater(); | 72 | _toolBox->deleteLater(); |
740 | 73 | _toolBox = new QToolBox; | 73 | _toolBox = new QToolBox; |
743 | 74 | _toolBox->setSizePolicy(QSizePolicy(QSizePolicy::Maximum, QSizePolicy::Ignored)); | 74 | _toolBox->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Ignored); |
742 | 75 | _toolBox->setMinimumWidth(_compWidget->sizeHint().width() + 15); | ||
744 | 76 | _toolBox->addItem(_compWidget, tr("Components")); | 75 | _toolBox->addItem(_compWidget, tr("Components")); |
745 | 77 | 76 | ||
746 | 78 | centralWidget()->layout()->removeWidget(_view); | 77 | centralWidget()->layout()->removeWidget(_view); |
747 | @@ -80,6 +79,19 @@ | |||
748 | 80 | centralWidget()->layout()->addWidget(_view); | 79 | centralWidget()->layout()->addWidget(_view); |
749 | 81 | } | 80 | } |
750 | 82 | 81 | ||
751 | 82 | void QtpMain::unregisterComponents() | ||
752 | 83 | { | ||
753 | 84 | _buttonGroup->deleteLater(); | ||
754 | 85 | _compWidget->deleteLater(); | ||
755 | 86 | _toolBox->deleteLater(); | ||
756 | 87 | |||
757 | 88 | createToolBox(); | ||
758 | 89 | |||
759 | 90 | centralWidget()->layout()->removeWidget(_view); | ||
760 | 91 | centralWidget()->layout()->addWidget(_toolBox); | ||
761 | 92 | centralWidget()->layout()->addWidget(_view); | ||
762 | 93 | } | ||
763 | 94 | |||
764 | 83 | void QtpMain::buttonGroupClicked(int id) | 95 | void QtpMain::buttonGroupClicked(int id) |
765 | 84 | { | 96 | { |
766 | 85 | QList<QAbstractButton*> buttons = _buttonGroup->buttons(); | 97 | QList<QAbstractButton*> buttons = _buttonGroup->buttons(); |
767 | @@ -128,8 +140,7 @@ | |||
768 | 128 | _compWidget->setLayout(compLayout); | 140 | _compWidget->setLayout(compLayout); |
769 | 129 | 141 | ||
770 | 130 | _toolBox = new QToolBox; | 142 | _toolBox = new QToolBox; |
773 | 131 | _toolBox->setSizePolicy(QSizePolicy(QSizePolicy::Maximum, QSizePolicy::Ignored)); | 143 | _toolBox->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Ignored); |
772 | 132 | _toolBox->setMinimumWidth(150); | ||
774 | 133 | _toolBox->addItem(_compWidget, tr("Components")); | 144 | _toolBox->addItem(_compWidget, tr("Components")); |
775 | 134 | } | 145 | } |
776 | 135 | 146 |