/[svn]/qsampler/trunk/src/qsamplerDeviceForm.ui.h
ViewVC logotype

Diff of /qsampler/trunk/src/qsamplerDeviceForm.ui.h

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 433 by capela, Wed Mar 9 16:44:04 2005 UTC revision 484 by capela, Tue Mar 22 12:55:29 2005 UTC
# Line 24  Line 24 
24  #include <qfiledialog.h>  #include <qfiledialog.h>
25  #include <qfileinfo.h>  #include <qfileinfo.h>
26  #include <qlistbox.h>  #include <qlistbox.h>
27    #include <qptrlist.h>
28    #include <qpopupmenu.h>
29    
30  #include "qsamplerMainForm.h"  #include "qsamplerMainForm.h"
31    
# Line 37  void qsamplerDeviceForm::init (void) Line 39  void qsamplerDeviceForm::init (void)
39          m_pMainForm   = (qsamplerMainForm *) QWidget::parentWidget();          m_pMainForm   = (qsamplerMainForm *) QWidget::parentWidget();
40          m_pClient     = NULL;          m_pClient     = NULL;
41          m_iDirtySetup = 0;          m_iDirtySetup = 0;
         m_iDirtyCount = 0;  
42          m_bNewDevice  = false;          m_bNewDevice  = false;
43            m_deviceType  = qsamplerDevice::None;
44            m_pAudioItems = NULL;
45            m_pMidiItems  = NULL;
46    
47          // This an outsider (from designer), but rather important.          // This an outsider (from designer), but rather important.
48          QObject::connect(DeviceParamTable, SIGNAL(valueChanged(int,int)),          QObject::connect(DeviceParamTable, SIGNAL(valueChanged(int,int)),
49              this, SLOT(changeValue(int,int)));                  this, SLOT(changeDeviceParam(int,int)));
50                    QObject::connect(DevicePortParamTable, SIGNAL(valueChanged(int,int)),
51                    this, SLOT(changeDevicePortParam(int,int)));
52    
53            // Initial contents.
54            refreshDevices();
55          // Try to restore normal window positioning.          // Try to restore normal window positioning.
56          adjustSize();          adjustSize();
57  }  }
# Line 95  void qsamplerDeviceForm::setClient ( lsc Line 103  void qsamplerDeviceForm::setClient ( lsc
103  // Create a new device from current table view.  // Create a new device from current table view.
104  void qsamplerDeviceForm::createDevice (void)  void qsamplerDeviceForm::createDevice (void)
105  {  {
         //  
         // TODO: Create a new device from current table view...  
         //  
         m_pMainForm->appendMessages("qsamplerDeviceForm::createDevice()");  
   
106          QListViewItem *pItem = DeviceListView->selectedItem();          QListViewItem *pItem = DeviceListView->selectedItem();
107          if (pItem == NULL || pItem->rtti() != QSAMPLER_DEVICE_ITEM)          if (pItem == NULL || pItem->rtti() != QSAMPLER_DEVICE_ITEM)
108                  return;                  return;
109    
110          qsamplerDevice& device = ((qsamplerDeviceItem *) pItem)->device();          // About a brand new device instance...
111            qsamplerDevice device(((qsamplerDeviceItem *) pItem)->device());
112          // Build the parameter list...          if (device.createDevice()) {
113          qsamplerDeviceParamMap& params = device.params();                  // Now it depends on the device type...
114          lscp_param_t *pParams = new lscp_param_t [params.count() + 1];                  qsamplerDeviceItem *pRootItem = NULL;
115          int i = 0;                  switch (device.deviceType()) {
116          qsamplerDeviceParamMap::ConstIterator iter;                  case qsamplerDevice::Audio:
117          for (iter = params.begin(); iter != params.end(); ++iter) {                          pRootItem = m_pAudioItems;
118                  pParams[i].key   = (char *) iter.key().latin1();                          break;
119                  pParams[i].value = (char *) iter.data().value.latin1();                  case qsamplerDevice::Midi:
120          }                          pRootItem = m_pMidiItems;
121          // Null terminated.                          break;
122          pParams[i].key   = NULL;                  case qsamplerDevice::None:
123          pParams[i].value = NULL;                          break;
124                    }
125          // Now it depends on the device type...                  // Append the new device item.
126          int iDeviceID = -1;                  qsamplerDeviceItem *pDeviceItem = new qsamplerDeviceItem(pRootItem,
127          switch (device.deviceType()) {                          m_pMainForm, device.deviceType(), device.deviceID());
128          case qsamplerDevice::Audio:                  // Just make it the new selection...
129              if ((iDeviceID = ::lscp_create_audio_device(m_pClient,                  DeviceListView->setSelected(pDeviceItem, true);
                                 device.driverName().latin1(), pParams)) < 0)  
                         m_pMainForm->appendMessagesClient("lscp_create_audio_device");  
                 break;  
         case qsamplerDevice::Midi:  
             if ((iDeviceID = ::lscp_create_midi_device(m_pClient,  
                                 device.driverName().latin1(), pParams)) < 0)  
                         m_pMainForm->appendMessagesClient("lscp_create_midi_device");  
                 break;  
         }  
   
         // Free used parameter array.  
         delete [] pParams;  
   
         // Show result.  
         if (iDeviceID >= 0) {  
                 m_pMainForm->appendMessages(device.deviceName() + ' ' + tr("created."));  
                 // Done.  
                 refreshDevices();  
130                  // Main session should be marked dirty.                  // Main session should be marked dirty.
131                  m_pMainForm->sessionDirty();                  m_pMainForm->sessionDirty();
132          }          }
# Line 151  void qsamplerDeviceForm::createDevice (v Line 136  void qsamplerDeviceForm::createDevice (v
136  // Delete current device in table view.  // Delete current device in table view.
137  void qsamplerDeviceForm::deleteDevice (void)  void qsamplerDeviceForm::deleteDevice (void)
138  {  {
         //  
         // TODO: Delete current device in table view...  
         //  
         m_pMainForm->appendMessages("qsamplerDeviceForm::deleteDevice()");  
   
139          QListViewItem *pItem = DeviceListView->selectedItem();          QListViewItem *pItem = DeviceListView->selectedItem();
140          if (pItem == NULL || pItem->rtti() != QSAMPLER_DEVICE_ITEM)          if (pItem == NULL || pItem->rtti() != QSAMPLER_DEVICE_ITEM)
141                  return;                  return;
142    
143          qsamplerDevice& device = ((qsamplerDeviceItem *) pItem)->device();          qsamplerDevice& device = ((qsamplerDeviceItem *) pItem)->device();
144    
145          // Now it depends on the device type...          // Prompt user if this is for real...
146          lscp_status_t ret = LSCP_FAILED;          qsamplerOptions *pOptions = m_pMainForm->options();
147          switch (device.deviceType()) {          if (pOptions && pOptions->bConfirmRemove) {
148          case qsamplerDevice::Audio:                  if (QMessageBox::warning(this, tr("Warning"),
149              if ((ret = ::lscp_destroy_audio_device(m_pClient,                          tr("Delete device:\n\n"
150                                  device.deviceID())) != LSCP_OK)                          "%1\n\n"
151                          m_pMainForm->appendMessagesClient("lscp_destroy_audio_device");                          "Are you sure?")
152                  break;                          .arg(device.deviceName()),
153          case qsamplerDevice::Midi:                          tr("OK"), tr("Cancel")) > 0)
154              if ((ret = ::lscp_destroy_midi_device(m_pClient,                          return;
                                 device.deviceID())) != LSCP_OK)  
                         m_pMainForm->appendMessagesClient("lscp_destroy_midi_device");  
                 break;  
155          }          }
156    
157          // Show result.          // Go and destroy...
158          if (ret == LSCP_OK) {          if (device.deleteDevice()) {
159                  m_pMainForm->appendMessages(device.deviceName() + ' ' + tr("deleted."));                  // Remove it from the device view...
160                  // Done.                  delete pItem;
                 refreshDevices();  
161                  // Main session should be marked dirty.                  // Main session should be marked dirty.
162                  m_pMainForm->sessionDirty();                  m_pMainForm->sessionDirty();
163          }          }
# Line 195  void qsamplerDeviceForm::refreshDevices Line 171  void qsamplerDeviceForm::refreshDevices
171          m_iDirtySetup++;          m_iDirtySetup++;
172    
173          //          //
174          // TODO: Load device configuration data ...          // (Re)Load complete device configuration data ...
175          //          //
176          m_pMainForm->appendMessages("qsamplerDeviceForm::refreshDevices()");          m_pAudioItems = NULL;
177            m_pMidiItems = NULL;
178          DeviceListView->clear();          DeviceListView->clear();
179          if (m_pClient) {          if (m_pClient) {
                 qsamplerDeviceItem *pItem;  
180                  int *piDeviceIDs;                  int *piDeviceIDs;
181                  // Grab and pop Audio devices...                  // Grab and pop Audio devices...
182                  pItem = new qsamplerDeviceItem(DeviceListView, m_pClient,                  m_pAudioItems = new qsamplerDeviceItem(DeviceListView, m_pMainForm,
183                          qsamplerDevice::Audio);                          qsamplerDevice::Audio);
184                  if (pItem) {                  if (m_pAudioItems) {
                         pItem->setText(0, tr("Audio"));  
185                          piDeviceIDs = qsamplerDevice::getDevices(m_pClient, qsamplerDevice::Audio);                          piDeviceIDs = qsamplerDevice::getDevices(m_pClient, qsamplerDevice::Audio);
186                          for (int i = 0; piDeviceIDs && piDeviceIDs[i] >= 0; i++) {                          for (int i = 0; piDeviceIDs && piDeviceIDs[i] >= 0; i++) {
187                                  new qsamplerDeviceItem(pItem, m_pClient,                                  new qsamplerDeviceItem(m_pAudioItems, m_pMainForm,
188                                          qsamplerDevice::Audio, piDeviceIDs[i]);                                          qsamplerDevice::Audio, piDeviceIDs[i]);
189                          }                          }
190                          pItem->setOpen(true);                          m_pAudioItems->setOpen(true);
191                  }                  }
192                  // Grab and pop MIDI devices...                  // Grab and pop MIDI devices...
193                  pItem = new qsamplerDeviceItem(DeviceListView, m_pClient,                  m_pMidiItems = new qsamplerDeviceItem(DeviceListView, m_pMainForm,
194                          qsamplerDevice::Midi);                          qsamplerDevice::Midi);
195                  if (pItem) {                  if (m_pMidiItems) {
                         pItem->setText(0, tr("MIDI"));  
196                          piDeviceIDs = qsamplerDevice::getDevices(m_pClient, qsamplerDevice::Midi);                          piDeviceIDs = qsamplerDevice::getDevices(m_pClient, qsamplerDevice::Midi);
197                          for (int i = 0; piDeviceIDs && piDeviceIDs[i] >= 0; i++) {                          for (int i = 0; piDeviceIDs && piDeviceIDs[i] >= 0; i++) {
198                                  new qsamplerDeviceItem(pItem, m_pClient,                                  new qsamplerDeviceItem(m_pMidiItems, m_pMainForm,
199                                          qsamplerDevice::Midi, piDeviceIDs[i]);                                          qsamplerDevice::Midi, piDeviceIDs[i]);
200                          }                          }
201                          pItem->setOpen(true);                          m_pMidiItems->setOpen(true);
202                  }                  }
203          }          }
204    
205          // Done.          // Done.
         m_iDirtyCount = 0;  
206          m_iDirtySetup--;          m_iDirtySetup--;
207            
208          // Show something.          // Show something.
209          selectDevice();          selectDevice();
210  }  }
# Line 242  void qsamplerDeviceForm::refreshDevices Line 214  void qsamplerDeviceForm::refreshDevices
214  void qsamplerDeviceForm::selectDriver ( const QString& sDriverName )  void qsamplerDeviceForm::selectDriver ( const QString& sDriverName )
215  {  {
216          if (m_iDirtySetup > 0)          if (m_iDirtySetup > 0)
217              return;                  return;
218    
219          //          //
220          //  TODO: Driver name has changed for a new device...          //  Driver name has changed for a new device...
221          //          //
         m_pMainForm->appendMessages("qsamplerDeviceForm::selectDriver()");  
222    
223          QListViewItem *pItem = DeviceListView->selectedItem();          QListViewItem *pItem = DeviceListView->selectedItem();
224          if (pItem == NULL || pItem->rtti() != QSAMPLER_DEVICE_ITEM)          if (pItem == NULL || pItem->rtti() != QSAMPLER_DEVICE_ITEM)
225                  return;                  return;
226    
227          qsamplerDevice& device = ((qsamplerDeviceItem *) pItem)->device();          qsamplerDevice& device = ((qsamplerDeviceItem *) pItem)->device();
228    
229            // Driver change is only valid for scratch devices...
230          if (m_bNewDevice) {          if (m_bNewDevice) {
231                  device.setDriver(m_pClient, sDriverName);                  m_iDirtySetup++;
232                  m_iDirtyCount++;                  device.setDriver(sDriverName);
233                    DeviceParamTable->refresh(device.params(), m_bNewDevice);
234                    m_iDirtySetup--;
235                    // Done.
236                    stabilizeForm();
237          }          }
   
         // Done.  
         stabilizeForm();  
238  }  }
239    
240    
# Line 268  void qsamplerDeviceForm::selectDriver ( Line 242  void qsamplerDeviceForm::selectDriver (
242  void qsamplerDeviceForm::selectDevice (void)  void qsamplerDeviceForm::selectDevice (void)
243  {  {
244          if (m_iDirtySetup > 0)          if (m_iDirtySetup > 0)
245              return;                  return;
246    
247          //          //
248          //  TODO: Device selection has changed...          //  Device selection has changed...
249          //          //
         m_pMainForm->appendMessages("qsamplerDeviceForm::selectDevice()");  
250    
251          QListViewItem *pItem = DeviceListView->selectedItem();          QListViewItem *pItem = DeviceListView->selectedItem();
252          if (pItem == NULL || pItem->rtti() != QSAMPLER_DEVICE_ITEM) {          if (pItem == NULL || pItem->rtti() != QSAMPLER_DEVICE_ITEM) {
253              DeviceNameTextLabel->setText(QString::null);                  m_deviceType = qsamplerDevice::None;
254              DeviceParamTable->setNumRows(0);                  DeviceNameTextLabel->setText(QString::null);
255                    DeviceParamTable->setNumRows(0);
256                    DevicePortComboBox->clear();
257                    DevicePortParamTable->setNumRows(0);
258                    DevicePortComboBox->setEnabled(false);
259                    DevicePortParamTable->setEnabled(false);
260                  stabilizeForm();                  stabilizeForm();
261                  return;                  return;
262          }          }
263    
264          qsamplerDevice& device = ((qsamplerDeviceItem *) pItem)->device();          qsamplerDevice& device = ((qsamplerDeviceItem *) pItem)->device();
265    
266            m_iDirtySetup++;
267            // Flag whether this is a new device.
268          m_bNewDevice = (device.deviceID() < 0);          m_bNewDevice = (device.deviceID() < 0);
269    
270          // Fill the device/driver heading...          // Fill the device/driver heading...
271          DeviceNameTextLabel->setText(device.deviceTypeName() + ' ' + device.deviceName());          DeviceNameTextLabel->setText(device.deviceName());
272          DriverNameComboBox->clear();          // The driver combobox is only rebuilt if device type has changed...
273          DriverNameComboBox->insertStringList(          if (device.deviceType() != m_deviceType) {
274                  qsamplerDevice::getDrivers(m_pClient, device.deviceType()));                  DriverNameComboBox->clear();
275          const QString& sDriverName = device.driverName();                  DriverNameComboBox->insertStringList(
276          if (m_bNewDevice || sDriverName.isEmpty()) {                          qsamplerDevice::getDrivers(m_pClient, device.deviceType()));
277                  device.setDriver(m_pClient, DriverNameComboBox->currentText());                  m_deviceType = device.deviceType();
         } else {  
                 if (DriverNameComboBox->listBox()->findItem(sDriverName, Qt::ExactMatch) == NULL)  
                         DriverNameComboBox->insertItem(sDriverName);  
                 DriverNameComboBox->setCurrentText(sDriverName);  
278          }          }
279            // Do we need a driver name?
280            if (m_bNewDevice || device.driverName().isEmpty())
281                    device.setDriver(DriverNameComboBox->currentText());
282            const QString& sDriverName = device.driverName();
283            if (DriverNameComboBox->listBox()->findItem(sDriverName, Qt::ExactMatch) == NULL)
284                    DriverNameComboBox->insertItem(sDriverName);
285            DriverNameComboBox->setCurrentText(sDriverName);
286          DriverNameTextLabel->setEnabled(m_bNewDevice);          DriverNameTextLabel->setEnabled(m_bNewDevice);
287          DriverNameComboBox->setEnabled(m_bNewDevice);          DriverNameComboBox->setEnabled(m_bNewDevice);
   
288          // Fill the device parameter table...          // Fill the device parameter table...
289          DeviceParamTable->refresh(device);          DeviceParamTable->refresh(device.params(), m_bNewDevice);
290            // And now the device port/channel parameter table...
291            DevicePortComboBox->clear();
292            DevicePortParamTable->setNumRows(0);
293            if (m_bNewDevice) {
294                    DevicePortComboBox->setEnabled(false);
295                    DevicePortParamTable->setEnabled(false);
296            } else {
297                    QPixmap pixmap;
298                    switch (device.deviceType()) {
299                    case qsamplerDevice::Audio:
300                        pixmap = QPixmap::fromMimeSource("audio2.png");
301                        break;
302                    case qsamplerDevice::Midi:
303                        pixmap = QPixmap::fromMimeSource("midi2.png");
304                        break;
305                    case qsamplerDevice::None:
306                        break;
307                    }
308                    qsamplerDevicePortList& ports = device.ports();
309                    qsamplerDevicePort *pPort;
310                    for (pPort = ports.first(); pPort; pPort = ports.next()) {
311                DevicePortComboBox->insertItem(pixmap, device.deviceTypeName()
312                                    + ' ' + device.driverName()
313                                    + ' ' + pPort->portName());
314                    }
315                    bool bEnabled = (ports.count() > 0);
316                    DevicePortComboBox->setEnabled(bEnabled);
317                    DevicePortParamTable->setEnabled(bEnabled);
318            }
319            // Done.
320            m_iDirtySetup--;
321            
322            // Make the device port/channel selection effective.
323            selectDevicePort(DevicePortComboBox->currentItem());
324    }
325    
326    
327    // Device port/channel selection slot.
328    void qsamplerDeviceForm::selectDevicePort ( int iPort )
329    {
330            if (m_iDirtySetup > 0)
331                    return;
332    
333            //
334            //  Device port/channel selection has changed...
335            //
336    
337            QListViewItem *pItem = DeviceListView->selectedItem();
338            if (pItem == NULL || pItem->rtti() != QSAMPLER_DEVICE_ITEM)
339                    return;
340    
341            qsamplerDevice& device = ((qsamplerDeviceItem *) pItem)->device();
342            qsamplerDevicePort *pPort = device.ports().at(iPort);
343            if (pPort) {
344                    m_iDirtySetup++;
345                    DevicePortParamTable->refresh(pPort->params(), false);
346                    m_iDirtySetup--;
347            }
348          // Done.          // Done.
349          stabilizeForm();          stabilizeForm();
350  }  }
351    
352    
353  // parameter value change slot.  // Device parameter value change slot.
354  void qsamplerDeviceForm::changeValue ( int iRow, int iCol )  void qsamplerDeviceForm::changeDeviceParam ( int iRow, int iCol )
355  {  {
356            if (m_iDirtySetup > 0)
357                    return;
358            if (iRow < 0 || iCol < 0)
359                    return;
360                    
361          //          //
362          //  TODO: Device parameter change...          //  Device parameter change...
363          //          //
364          m_pMainForm->appendMessages("qsamplerDeviceForm::changeValue()");  
           
365          QListViewItem *pItem = DeviceListView->selectedItem();          QListViewItem *pItem = DeviceListView->selectedItem();
366          if (pItem == NULL || pItem->rtti() != QSAMPLER_DEVICE_ITEM)          if (pItem == NULL || pItem->rtti() != QSAMPLER_DEVICE_ITEM)
367                  return;                  return;
368    
369          qsamplerDevice& device = ((qsamplerDeviceItem *) pItem)->device();          qsamplerDevice& device = ((qsamplerDeviceItem *) pItem)->device();
370    
371          // Table 3rd column has the parameter name;          // Table 1st column has the parameter name;
372          qsamplerDeviceParamMap& params = device.params();          const QString sParam = DeviceParamTable->text(iRow, 0);
         const QString sParam = DeviceParamTable->text(iRow, 2);  
373          const QString sValue = DeviceParamTable->text(iRow, iCol);          const QString sValue = DeviceParamTable->text(iRow, iCol);
374          params[sParam].value = sValue;          // Set the local device parameter value.
375            if (device.setParam(sParam, sValue)) {
376          // Set proper device parameter, on existing device ...                  selectDevice();
377          if (device.deviceID() >= 0) {          } else {
378                  // Prepare parameter struct.                  stabilizeForm();
                 lscp_param_t param;  
                 param.key   = (char *) sParam.latin1();  
                 param.value = (char *) sValue.latin1();  
                 // Now it depends on the device type...  
                 lscp_status_t ret = LSCP_FAILED;  
                 switch (device.deviceType()) {  
                 case qsamplerDevice::Audio:  
                     if ((ret = ::lscp_set_audio_device_param(m_pClient,  
                                         device.deviceID(), &param)) != LSCP_OK)  
                                 m_pMainForm->appendMessagesClient("lscp_set_audio_device_param");  
                         break;  
                 case qsamplerDevice::Midi:  
                     if ((ret = ::lscp_set_midi_device_param(m_pClient,  
                                         device.deviceID(), &param)) != LSCP_OK)  
                                 m_pMainForm->appendMessagesClient("lscp_set_midi_device_param");  
                         break;  
                 }  
                 // Show result.  
                 if (ret == LSCP_OK) {  
                         m_pMainForm->appendMessages(device.deviceName() + ' ' +  
                                 QString("%1: %2.").arg(sParam).arg(sValue));  
                 }  
379          }          }
380                    // Main session should be dirtier...
381            m_pMainForm->sessionDirty();
382    }
383    
384    
385    // Device port/channel parameter value change slot.
386    void qsamplerDeviceForm::changeDevicePortParam ( int iRow, int iCol )
387    {
388            if (m_iDirtySetup > 0)
389                    return;
390            if (iRow < 0 || iCol < 0)
391                    return;
392    
393            //
394            //  Device port/channel parameter change...
395            //
396    
397            QListViewItem *pItem = DeviceListView->selectedItem();
398            if (pItem == NULL || pItem->rtti() != QSAMPLER_DEVICE_ITEM)
399                    return;
400    
401            qsamplerDevice& device = ((qsamplerDeviceItem *) pItem)->device();
402    
403            int iPort = DevicePortComboBox->currentItem();
404            qsamplerDevicePort *pPort = device.ports().at(iPort);
405            if (pPort == NULL)
406                return;
407    
408            // Table 1st column has the parameter name;
409            const QString sParam = DevicePortParamTable->text(iRow, 0);
410            const QString sValue = DevicePortParamTable->text(iRow, iCol);
411            // Set the local device port/channel parameter value.
412            pPort->setParam(sParam, sValue);
413          // Done.          // Done.
         m_iDirtyCount++;  
414          stabilizeForm();          stabilizeForm();
415          // Main session should be dirtier...          // Main session should be dirtier...
416          m_pMainForm->sessionDirty();          m_pMainForm->sessionDirty();
417  }  }
418    
419    
420    // Device list view context menu handler.
421    void qsamplerDeviceForm::contextMenu ( QListViewItem *pItem, const QPoint& pos, int )
422    {
423            int iItemID;
424            
425            // Build the device context menu...
426            QPopupMenu* pContextMenu = new QPopupMenu(this);
427            
428            bool bClient = (m_pClient != NULL);
429            bool bEnabled = (pItem != NULL);
430            iItemID = pContextMenu->insertItem(
431                    QIconSet(QPixmap::fromMimeSource("deviceCreate.png")),
432                    tr("&Create device"), this, SLOT(createDevice()));
433            pContextMenu->setItemEnabled(iItemID, bEnabled || (bClient && m_bNewDevice));
434            iItemID = pContextMenu->insertItem(
435                    QIconSet(QPixmap::fromMimeSource("deviceDelete.png")),
436                    tr("&Delete device"), this, SLOT(deleteDevice()));
437            pContextMenu->setItemEnabled(iItemID, bEnabled && !m_bNewDevice);
438            pContextMenu->insertSeparator();
439            iItemID = pContextMenu->insertItem(
440                    QIconSet(QPixmap::fromMimeSource("formRefresh.png")),
441                    tr("&Refresh"), this, SLOT(refreshDevices()));
442            pContextMenu->setItemEnabled(iItemID, bClient);
443            
444            pContextMenu->exec(pos);
445            
446            delete pContextMenu;
447    }
448    
449    
450  // Stabilize current form state.  // Stabilize current form state.
451  void qsamplerDeviceForm::stabilizeForm (void)  void qsamplerDeviceForm::stabilizeForm (void)
452  {  {
453          QListViewItem *pItem = DeviceListView->selectedItem();          QListViewItem *pItem = DeviceListView->selectedItem();
454            bool bClient = (m_pClient != NULL);
455          bool bEnabled = (pItem != NULL);          bool bEnabled = (pItem != NULL);
456          DeviceNameTextLabel->setEnabled(bEnabled && !m_bNewDevice);          DeviceNameTextLabel->setEnabled(bEnabled && !m_bNewDevice);
457          DriverNameTextLabel->setEnabled(bEnabled &&  m_bNewDevice);          DriverNameTextLabel->setEnabled(bEnabled &&  m_bNewDevice);
458          DriverNameComboBox->setEnabled(bEnabled && m_bNewDevice);          DriverNameComboBox->setEnabled(bEnabled && m_bNewDevice);
459          DeviceParamTable->setEnabled(bEnabled);          DeviceParamTable->setEnabled(bEnabled);
460          CreateDevicePushButton->setEnabled(bEnabled ||  m_bNewDevice);          RefreshDevicesPushButton->setEnabled(bClient);
461            CreateDevicePushButton->setEnabled(bEnabled || (bClient && m_bNewDevice));
462          DeleteDevicePushButton->setEnabled(bEnabled && !m_bNewDevice);          DeleteDevicePushButton->setEnabled(bEnabled && !m_bNewDevice);
463  }  }
464    
465    
466  // end of qsamplerDeviceForm.ui.h  // end of qsamplerDeviceForm.ui.h
467    
468    
469    

Legend:
Removed from v.433  
changed lines
  Added in v.484

  ViewVC Help
Powered by ViewVC