/[svn]/qsampler/trunk/src/qsamplerDeviceForm.cpp
ViewVC logotype

Contents of /qsampler/trunk/src/qsamplerDeviceForm.cpp

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1509 - (show annotations) (download)
Thu Nov 22 11:10:44 2007 UTC (16 years, 4 months ago) by capela
File size: 19518 byte(s)
* Audio routing table is initially hidden in the dialog, when
  creating a new sampler channel.

* README requirements and configuration notes update.

1 // qsamplerDeviceForm.cpp
2 //
3 /****************************************************************************
4 Copyright (C) 2004-2007, rncbc aka Rui Nuno Capela. All rights reserved.
5 Copyright (C) 2007, Christian Schoenebeck
6
7 This program is free software; you can redistribute it and/or
8 modify it under the terms of the GNU General Public License
9 as published by the Free Software Foundation; either version 2
10 of the License, or (at your option) any later version.
11
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
16
17 You should have received a copy of the GNU General Public License along
18 with this program; if not, write to the Free Software Foundation, Inc.,
19 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
20
21 *****************************************************************************/
22
23 #include "qsamplerDeviceForm.h"
24
25 #include "qsamplerAbout.h"
26 #include "qsamplerMainForm.h"
27
28 #include <QHeaderView>
29 #include <QMessageBox>
30
31
32 namespace QSampler {
33
34 DeviceForm::DeviceForm ( QWidget *pParent, Qt::WindowFlags wflags )
35 : QDialog(pParent, wflags)
36 {
37 m_ui.setupUi(this);
38
39 // Initialize locals.
40 m_iDirtySetup = 0;
41 m_iDirtyCount = 0;
42 m_bNewDevice = false;
43 m_deviceType = qsamplerDevice::None;
44 m_pAudioItems = NULL;
45 m_pMidiItems = NULL;
46 // No exclusive mode as default.
47 m_deviceTypeMode = qsamplerDevice::None;
48
49 m_ui.DeviceListView->header()->hide();
50
51 m_ui.DeviceParamTable->setModel(&m_deviceParamModel);
52 m_ui.DeviceParamTable->setItemDelegate(&m_deviceParamDelegate);
53 m_ui.DeviceParamTable->horizontalHeader()->setResizeMode(2, QHeaderView::Stretch);
54 m_ui.DeviceParamTable->verticalHeader()->hide();
55
56 m_ui.DevicePortParamTable->setModel(&m_devicePortParamModel);
57 m_ui.DevicePortParamTable->setItemDelegate(&m_devicePortParamDelegate);
58 m_ui.DevicePortParamTable->horizontalHeader()->setResizeMode(2, QHeaderView::Stretch);
59 m_ui.DevicePortParamTable->verticalHeader()->hide();
60
61 // Initial contents.
62 refreshDevices();
63 // Try to restore normal window positioning.
64 adjustSize();
65
66 QObject::connect(m_ui.DeviceListView,
67 SIGNAL(currentItemChanged(QTreeWidgetItem*,QTreeWidgetItem*)),
68 SLOT(selectDevice()));
69 QObject::connect(m_ui.DeviceListView,
70 SIGNAL(customContextMenuRequested(const QPoint&)),
71 SLOT(deviceListViewContextMenu(const QPoint&)));
72 QObject::connect(m_ui.RefreshDevicesPushButton,
73 SIGNAL(clicked()),
74 SLOT(refreshDevices()));
75 QObject::connect(m_ui.DriverNameComboBox,
76 SIGNAL(activated(const QString&)),
77 SLOT(selectDriver(const QString&)));
78 QObject::connect(m_ui.DevicePortComboBox,
79 SIGNAL(activated(int)),
80 SLOT(selectDevicePort(int)));
81 QObject::connect(m_ui.CreateDevicePushButton,
82 SIGNAL(clicked()),
83 SLOT(createDevice()));
84 QObject::connect(m_ui.DeleteDevicePushButton,
85 SIGNAL(clicked()),
86 SLOT(deleteDevice()));
87 QObject::connect(m_ui.ClosePushButton,
88 SIGNAL(clicked()),
89 SLOT(close()));
90 QObject::connect(&m_deviceParamModel,
91 SIGNAL(modelReset()),
92 SLOT(updateCellRenderers()));
93 QObject::connect(&m_deviceParamModel,
94 SIGNAL(dataChanged(const QModelIndex&, const QModelIndex&)),
95 SLOT(updateCellRenderers(const QModelIndex&, const QModelIndex&)));
96 QObject::connect(&m_devicePortParamModel,
97 SIGNAL(modelReset()),
98 SLOT(updatePortCellRenderers()));
99 QObject::connect(&m_devicePortParamModel,
100 SIGNAL(dataChanged(const QModelIndex&, const QModelIndex&)),
101 SLOT(updatePortCellRenderers(const QModelIndex&, const QModelIndex&)));
102 }
103
104 DeviceForm::~DeviceForm() {
105 }
106
107
108 // Notify our parent that we're emerging.
109 void DeviceForm::showEvent ( QShowEvent *pShowEvent )
110 {
111 MainForm* pMainForm = MainForm::getInstance();
112 if (pMainForm)
113 pMainForm->stabilizeForm();
114
115 stabilizeForm();
116
117 QWidget::showEvent(pShowEvent);
118 }
119
120
121 // Notify our parent that we're closing.
122 void DeviceForm::hideEvent ( QHideEvent *pHideEvent )
123 {
124 QWidget::hideEvent(pHideEvent);
125
126 MainForm *pMainForm = MainForm::getInstance();
127 if (pMainForm)
128 pMainForm->stabilizeForm();
129
130 // Signal special whether we changed the device set.
131 if (m_iDirtyCount > 0) {
132 m_iDirtyCount = 0;
133 emit devicesChanged();
134 }
135 }
136
137
138 // Set device type spacial exclusive mode.
139 void DeviceForm::setDeviceTypeMode (
140 qsamplerDevice::DeviceType deviceTypeMode )
141 {
142 // If it has not changed, do nothing.
143 if (m_deviceTypeMode == deviceTypeMode)
144 return;
145
146 m_deviceTypeMode = deviceTypeMode;
147
148 // OK. Do a whole refresh around.
149 refreshDevices();
150 }
151
152
153 // Device driver name setup formal initializer.
154 void DeviceForm::setDriverName ( const QString& sDriverName )
155 {
156 if (m_ui.DriverNameComboBox->findText(sDriverName) < 0)
157 m_ui.DriverNameComboBox->insertItem(0, sDriverName);
158 m_ui.DriverNameComboBox->setItemText(
159 m_ui.DriverNameComboBox->currentIndex(),
160 sDriverName);
161 }
162
163
164 // Set current selected device by type and id.
165 void DeviceForm::setDevice ( qsamplerDevice *pDevice )
166 {
167 // In case no device is given...
168 qsamplerDevice::DeviceType deviceType = m_deviceTypeMode;
169 if (pDevice)
170 deviceType = pDevice->deviceType();
171
172 // Get the device view root item...
173 qsamplerDeviceItem *pRootItem = NULL;
174 switch (deviceType) {
175 case qsamplerDevice::Audio:
176 pRootItem = m_pAudioItems;
177 break;
178 case qsamplerDevice::Midi:
179 pRootItem = m_pMidiItems;
180 break;
181 case qsamplerDevice::None:
182 break;
183 }
184
185 // Is the root present?
186 if (pRootItem == NULL)
187 return;
188
189 // So there's no device huh?
190 if (pDevice == NULL) {
191 m_ui.DeviceListView->setCurrentItem(pRootItem);
192 return;
193 }
194
195 // For each child, test for identity...
196 for (int i = 0; i < pRootItem->childCount(); i++) {
197 qsamplerDeviceItem* pDeviceItem =
198 (qsamplerDeviceItem*) pRootItem->child(i);
199
200 // If identities match, select as current device item.
201 if (pDeviceItem->device().deviceID() == pDevice->deviceID()) {
202 pDeviceItem->setSelected(true);
203 break;
204 }
205 }
206 }
207
208
209
210 // Create a new device from current table view.
211 void DeviceForm::createDevice (void)
212 {
213 MainForm *pMainForm = MainForm::getInstance();
214 if (pMainForm == NULL)
215 return;
216
217 QTreeWidgetItem *pItem = m_ui.DeviceListView->currentItem();
218 if (pItem == NULL || pItem->type() != QSAMPLER_DEVICE_ITEM)
219 return;
220
221 // About a brand new device instance...
222 qsamplerDevice device(((qsamplerDeviceItem *) pItem)->device());
223 if (device.createDevice()) {
224 // Now it depends on the device type...
225 qsamplerDeviceItem *pRootItem = NULL;
226 switch (device.deviceType()) {
227 case qsamplerDevice::Audio:
228 pRootItem = m_pAudioItems;
229 break;
230 case qsamplerDevice::Midi:
231 pRootItem = m_pMidiItems;
232 break;
233 case qsamplerDevice::None:
234 break;
235 }
236 // Append the new device item.
237 qsamplerDeviceItem *pDeviceItem = new qsamplerDeviceItem(pRootItem,
238 device.deviceType(), device.deviceID());
239 // Just make it the new selection...
240 pDeviceItem->setSelected(true);
241 // Main session should be marked dirty.
242 pMainForm->sessionDirty();
243 m_iDirtyCount++;
244 }
245 }
246
247
248 // Delete current device in table view.
249 void DeviceForm::deleteDevice (void)
250 {
251 MainForm *pMainForm = MainForm::getInstance();
252 if (pMainForm == NULL)
253 return;
254
255 QTreeWidgetItem* pItem = m_ui.DeviceListView->currentItem();
256 if (pItem == NULL || pItem->type() != QSAMPLER_DEVICE_ITEM)
257 return;
258
259 qsamplerDevice& device = ((qsamplerDeviceItem *) pItem)->device();
260
261 // Prompt user if this is for real...
262 qsamplerOptions *pOptions = pMainForm->options();
263 if (pOptions && pOptions->bConfirmRemove) {
264 if (QMessageBox::warning(this,
265 QSAMPLER_TITLE ": " + tr("Warning"),
266 tr("Delete device:\n\n"
267 "%1\n\n"
268 "Are you sure?")
269 .arg(device.deviceName()),
270 tr("OK"), tr("Cancel")) > 0)
271 return;
272 }
273
274 // Go and destroy...
275 if (device.deleteDevice()) {
276 // Remove it from the device view...
277 delete pItem;
278 // Main session should be marked dirty.
279 pMainForm->sessionDirty();
280 m_iDirtyCount++;
281 }
282 }
283
284
285 // Refresh all device list and views.
286 void DeviceForm::refreshDevices (void)
287 {
288 MainForm *pMainForm = MainForm::getInstance();
289 if (pMainForm == NULL)
290 return;
291
292 // Avoid nested changes.
293 m_iDirtySetup++;
294
295 //
296 // (Re)Load complete device configuration data ...
297 //
298 m_pAudioItems = NULL;
299 m_pMidiItems = NULL;
300 m_ui.DeviceListView->clear();
301 if (pMainForm->client()) {
302 int *piDeviceIDs;
303 // Grab and pop Audio devices...
304 if (m_deviceTypeMode == qsamplerDevice::None ||
305 m_deviceTypeMode == qsamplerDevice::Audio) {
306 m_pAudioItems = new qsamplerDeviceItem(m_ui.DeviceListView,
307 qsamplerDevice::Audio);
308 }
309 if (m_pAudioItems) {
310 piDeviceIDs = qsamplerDevice::getDevices(pMainForm->client(),
311 qsamplerDevice::Audio);
312 for (int i = 0; piDeviceIDs && piDeviceIDs[i] >= 0; i++) {
313 new qsamplerDeviceItem(m_pAudioItems,
314 qsamplerDevice::Audio, piDeviceIDs[i]);
315 }
316 m_pAudioItems->setExpanded(true);
317 }
318 // Grab and pop MIDI devices...
319 if (m_deviceTypeMode == qsamplerDevice::None ||
320 m_deviceTypeMode == qsamplerDevice::Midi) {
321 m_pMidiItems = new qsamplerDeviceItem(m_ui.DeviceListView,
322 qsamplerDevice::Midi);
323 }
324 if (m_pMidiItems) {
325 piDeviceIDs = qsamplerDevice::getDevices(pMainForm->client(),
326 qsamplerDevice::Midi);
327 for (int i = 0; piDeviceIDs && piDeviceIDs[i] >= 0; i++) {
328 new qsamplerDeviceItem(m_pMidiItems,
329 qsamplerDevice::Midi, piDeviceIDs[i]);
330 }
331 m_pMidiItems->setExpanded(true);
332 }
333 }
334
335 // Done.
336 m_iDirtySetup--;
337
338 // Show something.
339 selectDevice();
340 }
341
342
343 // Driver selection slot.
344 void DeviceForm::selectDriver ( const QString& sDriverName )
345 {
346 if (m_iDirtySetup > 0)
347 return;
348
349 //
350 // Driver name has changed for a new device...
351 //
352
353 QTreeWidgetItem* pItem = m_ui.DeviceListView->currentItem();
354 if (pItem == NULL || pItem->type() != QSAMPLER_DEVICE_ITEM)
355 return;
356
357 qsamplerDevice& device = ((qsamplerDeviceItem *) pItem)->device();
358
359 // Driver change is only valid for scratch devices...
360 if (m_bNewDevice) {
361 m_iDirtySetup++;
362 device.setDriver(sDriverName);
363 m_deviceParamModel.refresh(&device, m_bNewDevice);
364 m_iDirtySetup--;
365 // Done.
366 stabilizeForm();
367 }
368 }
369
370
371 // Device selection slot.
372 void DeviceForm::selectDevice ()
373 {
374 MainForm *pMainForm = MainForm::getInstance();
375 if (pMainForm == NULL)
376 return;
377
378 if (m_iDirtySetup > 0)
379 return;
380
381 //
382 // Device selection has changed...
383 //
384
385 QTreeWidgetItem* pItem = m_ui.DeviceListView->currentItem();
386 if (pItem == NULL || pItem->type() != QSAMPLER_DEVICE_ITEM) {
387 m_deviceType = qsamplerDevice::None;
388 m_ui.DeviceNameTextLabel->setText(QString::null);
389 m_deviceParamModel.clear();
390 m_ui.DevicePortComboBox->clear();
391 m_devicePortParamModel.clear();
392 m_ui.DevicePortTextLabel->setEnabled(false);
393 m_ui.DevicePortComboBox->setEnabled(false);
394 m_ui.DevicePortParamTable->setEnabled(false);
395 stabilizeForm();
396 return;
397 }
398
399 qsamplerDevice& device = ((qsamplerDeviceItem *) pItem)->device();
400
401 m_iDirtySetup++;
402 // Flag whether this is a new device.
403 m_bNewDevice = (device.deviceID() < 0);
404
405 // Fill the device/driver heading...
406 m_ui.DeviceNameTextLabel->setText(device.deviceName());
407 // The driver combobox is only rebuilt if device type has changed...
408 if (device.deviceType() != m_deviceType) {
409 m_ui.DriverNameComboBox->clear();
410 m_ui.DriverNameComboBox->insertItems(0,
411 qsamplerDevice::getDrivers(pMainForm->client(), device.deviceType()));
412 m_deviceType = device.deviceType();
413 }
414 // Do we need a driver name?
415 if (m_bNewDevice || device.driverName().isEmpty())
416 device.setDriver(m_ui.DriverNameComboBox->currentText());
417 setDriverName(device.driverName());
418 m_ui.DriverNameTextLabel->setEnabled(m_bNewDevice);
419 m_ui.DriverNameComboBox->setEnabled(m_bNewDevice);
420 // Fill the device parameter table...
421 m_deviceParamModel.refresh(&device, m_bNewDevice);
422 // And now the device port/channel parameter table...
423 switch (device.deviceType()) {
424 case qsamplerDevice::Audio:
425 m_ui.DevicePortTextLabel->setText(tr("Ch&annel:"));
426 break;
427 case qsamplerDevice::Midi:
428 m_ui.DevicePortTextLabel->setText(tr("P&ort:"));
429 break;
430 case qsamplerDevice::None:
431 break;
432 }
433 m_ui.DevicePortComboBox->clear();
434 m_devicePortParamModel.clear();
435 if (m_bNewDevice) {
436 m_ui.DevicePortTextLabel->setEnabled(false);
437 m_ui.DevicePortComboBox->setEnabled(false);
438 m_ui.DevicePortParamTable->setEnabled(false);
439 } else {
440 QPixmap pixmap;
441 switch (device.deviceType()) {
442 case qsamplerDevice::Audio:
443 pixmap = QPixmap(":/icons/audio2.png");
444 break;
445 case qsamplerDevice::Midi:
446 pixmap = QPixmap(":/icons/midi2.png");
447 break;
448 case qsamplerDevice::None:
449 break;
450 }
451 qsamplerDevicePortList& ports = device.ports();
452 QListIterator<qsamplerDevicePort *> iter(ports);
453 while (iter.hasNext()) {
454 qsamplerDevicePort *pPort = iter.next();
455 m_ui.DevicePortComboBox->addItem(pixmap,
456 device.deviceTypeName()
457 + ' ' + device.driverName()
458 + ' ' + pPort->portName());
459 }
460 bool bEnabled = (ports.count() > 0);
461 m_ui.DevicePortTextLabel->setEnabled(bEnabled);
462 m_ui.DevicePortComboBox->setEnabled(bEnabled);
463 m_ui.DevicePortParamTable->setEnabled(bEnabled);
464 }
465 // Done.
466 m_iDirtySetup--;
467
468 // Make the device port/channel selection effective.
469 selectDevicePort(m_ui.DevicePortComboBox->currentIndex());
470 }
471
472
473 // Device port/channel selection slot.
474 void DeviceForm::selectDevicePort ( int iPort )
475 {
476 if (m_iDirtySetup > 0)
477 return;
478
479 //
480 // Device port/channel selection has changed...
481 //
482
483 QTreeWidgetItem* pItem = m_ui.DeviceListView->currentItem();
484 if (pItem == NULL || pItem->type() != QSAMPLER_DEVICE_ITEM)
485 return;
486
487 qsamplerDevice& device = ((qsamplerDeviceItem *) pItem)->device();
488 qsamplerDevicePort *pPort = NULL;
489 if (iPort >= 0 && iPort < device.ports().count())
490 pPort = device.ports().at(iPort);
491 if (pPort) {
492 m_iDirtySetup++;
493 m_devicePortParamModel.refresh(pPort, false);
494 m_iDirtySetup--;
495 }
496 // Done.
497 stabilizeForm();
498 }
499
500
501 // Device parameter value change slot.
502 void DeviceForm::changeDeviceParam ( int iRow, int iCol )
503 {
504 if (m_iDirtySetup > 0)
505 return;
506 if (iRow < 0 || iCol < 0)
507 return;
508
509 //
510 // Device parameter change...
511 //
512
513 /* we do that in the model class now ...
514 QTreeWidgetItem* pItem = m_ui.DeviceListView->currentItem();
515 if (pItem == NULL || pItem->type() != QSAMPLER_DEVICE_ITEM)
516 return;
517
518 qsamplerDevice& device = ((qsamplerDeviceItem *) pItem)->device();
519
520 // Table 1st column has the parameter name;
521 //const QString sParam = m_ui.DeviceParamTable->text(iRow, 0);
522 //const QString sValue = m_ui.DeviceParamTable->text(iRow, iCol);
523 const QString sParam = m_deviceParamModel.data(m_deviceParamModel.index(iRow, 0), Qt::DisplayRole).value<DeviceParameterRow>().name;
524 const QString sValue = m_deviceParamModel.data(m_deviceParamModel.index(iRow, iCol), Qt::DisplayRole).value<DeviceParameterRow>().param.value;
525 // Set the local device parameter value.
526 if (device.setParam(sParam, sValue)) {
527 selectDevice();
528 } else {
529 stabilizeForm();
530 }
531 */
532
533 // Main session should be dirtier...
534 MainForm *pMainForm = MainForm::getInstance();
535 if (pMainForm)
536 pMainForm->sessionDirty();
537 }
538
539
540 // Device port/channel parameter value change slot.
541 void DeviceForm::changeDevicePortParam ( int iRow, int iCol )
542 {
543 if (m_iDirtySetup > 0)
544 return;
545 if (iRow < 0 || iCol < 0)
546 return;
547
548 //
549 // Device port/channel parameter change...
550 //
551
552 /* we do that in the model class now ...
553 QTreeWidgetItem* pItem = m_ui.DeviceListView->currentItem();
554 if (pItem == NULL || pItem->type() != QSAMPLER_DEVICE_ITEM)
555 return;
556
557 qsamplerDevice& device = ((qsamplerDeviceItem *) pItem)->device();
558
559 int iPort = m_ui.DevicePortComboBox->currentIndex();
560 qsamplerDevicePort *pPort = NULL;
561 if (iPort >= 0 && iPort < device.ports().count())
562 pPort = device.ports().at(iPort);
563 if (pPort == NULL)
564 return;
565
566 // Table 1st column has the parameter name;
567 //const QString sParam = m_ui.DevicePortParamTable->text(iRow, 0);
568 //const QString sValue = m_ui.DevicePortParamTable->text(iRow, iCol);
569 const QString sParam = m_devicePortParamModel.data(m_devicePortParamModel.index(iRow, 0), Qt::DisplayRole).value<DeviceParameterRow>().name;
570 const QString sValue = m_devicePortParamModel.data(m_devicePortParamModel.index(iRow, iCol), Qt::DisplayRole).value<DeviceParameterRow>().param.value;
571
572 // Set the local device port/channel parameter value.
573 pPort->setParam(sParam, sValue);
574 */
575
576 // Done.
577 stabilizeForm();
578
579 // Main session should be dirtier...
580 MainForm* pMainForm = MainForm::getInstance();
581 if (pMainForm)
582 pMainForm->sessionDirty();
583 }
584
585
586 // Device list view context menu handler.
587 void DeviceForm::deviceListViewContextMenu ( const QPoint& pos )
588 {
589 MainForm *pMainForm = MainForm::getInstance();
590 if (pMainForm == NULL)
591 return;
592
593 QTreeWidgetItem* pItem = m_ui.DeviceListView->itemAt(pos);
594 if (pItem == NULL)
595 return;
596
597 // Build the device context menu...
598 QMenu menu(this);
599 QAction *pAction;
600
601 bool bClient = (pMainForm->client() != NULL);
602 bool bEnabled = (pItem != NULL);
603 pAction = menu.addAction(
604 QIcon(":/qsampler/pixmaps/deviceCreate.png"),
605 tr("&Create device"), this, SLOT(createDevice()));
606 pAction->setEnabled(bEnabled || (bClient && m_bNewDevice));
607 pAction = menu.addAction(
608 QIcon(":/qsampler/pixmaps/deviceDelete.png"),
609 tr("&Delete device"), this, SLOT(deleteDevice()));
610 pAction->setEnabled(bEnabled && !m_bNewDevice);
611 menu.addSeparator();
612 pAction = menu.addAction(
613 QIcon(":/qsampler/pixmaps/formRefresh.png"),
614 tr("&Refresh"), this, SLOT(refreshDevices()));
615 pAction->setEnabled(bClient);
616
617 menu.exec(pos);
618 }
619
620
621 // Stabilize current form state.
622 void DeviceForm::stabilizeForm (void)
623 {
624 MainForm* pMainForm = MainForm::getInstance();
625 QTreeWidgetItem* pItem = m_ui.DeviceListView->currentItem();
626 bool bClient = (pMainForm && pMainForm->client() != NULL);
627 bool bEnabled = (pItem != NULL);
628 m_ui.DeviceNameTextLabel->setEnabled(bEnabled && !m_bNewDevice);
629 m_ui.DriverNameTextLabel->setEnabled(bEnabled && m_bNewDevice);
630 m_ui.DriverNameComboBox->setEnabled(bEnabled && m_bNewDevice);
631 m_ui.DeviceParamTable->setEnabled(bEnabled);
632 m_ui.RefreshDevicesPushButton->setEnabled(bClient);
633 m_ui.CreateDevicePushButton->setEnabled(bEnabled || (bClient && m_bNewDevice));
634 m_ui.DeleteDevicePushButton->setEnabled(bEnabled && !m_bNewDevice);
635 }
636
637
638 void DeviceForm::updateCellRenderers (void)
639 {
640 const int rows = m_deviceParamModel.rowCount();
641 const int cols = m_deviceParamModel.columnCount();
642 updateCellRenderers(
643 m_deviceParamModel.index(0, 0),
644 m_deviceParamModel.index(rows - 1, cols - 1));
645 }
646
647
648 void DeviceForm::updateCellRenderers (
649 const QModelIndex& topLeft, const QModelIndex& bottomRight )
650 {
651 for (int r = topLeft.row(); r <= bottomRight.row(); r++) {
652 for (int c = topLeft.column(); c <= bottomRight.column(); c++) {
653 const QModelIndex index = m_deviceParamModel.index(r, c);
654 m_ui.DeviceParamTable->openPersistentEditor(index);
655 }
656 }
657 }
658
659
660 void DeviceForm::updatePortCellRenderers (void)
661 {
662 const int rows = m_devicePortParamModel.rowCount();
663 const int cols = m_devicePortParamModel.columnCount();
664 updatePortCellRenderers(
665 m_devicePortParamModel.index(0, 0),
666 m_devicePortParamModel.index(rows - 1, cols - 1));
667 }
668
669
670 void DeviceForm::updatePortCellRenderers (
671 const QModelIndex& topLeft, const QModelIndex& bottomRight )
672 {
673 for (int r = topLeft.row(); r <= bottomRight.row(); r++) {
674 for (int c = topLeft.column(); c <= bottomRight.column(); c++) {
675 const QModelIndex index = m_devicePortParamModel.index(r, c);
676 m_ui.DevicePortParamTable->openPersistentEditor(index);
677 }
678 }
679 }
680
681 } // namespace QSampler
682
683
684 // end of qsamplerDeviceForm.cpp

  ViewVC Help
Powered by ViewVC