/[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 489 by capela, Thu Mar 31 16:26:40 2005 UTC revision 490 by capela, Fri Apr 1 00:34:58 2005 UTC
# Line 44  void qsamplerDeviceForm::init (void) Line 44  void qsamplerDeviceForm::init (void)
44          m_deviceType  = qsamplerDevice::None;          m_deviceType  = qsamplerDevice::None;
45          m_pAudioItems = NULL;          m_pAudioItems = NULL;
46          m_pMidiItems  = NULL;          m_pMidiItems  = NULL;
47                    // No exclusive mode as default.
48            m_deviceTypeMode = qsamplerDevice::None;
49    
50          // This an outsider (from designer), but rather important.          // This an outsider (from designer), but rather important.
51          QObject::connect(DeviceParamTable, SIGNAL(valueChanged(int,int)),          QObject::connect(DeviceParamTable, SIGNAL(valueChanged(int,int)),
52                  this, SLOT(changeDeviceParam(int,int)));                  this, SLOT(changeDeviceParam(int,int)));
# Line 83  void qsamplerDeviceForm::hideEvent ( QHi Line 85  void qsamplerDeviceForm::hideEvent ( QHi
85    
86          if (m_pMainForm)          if (m_pMainForm)
87                  m_pMainForm->stabilizeForm();                  m_pMainForm->stabilizeForm();
88                    
89          // Signal special whether we changed the device set.          // Signal special whether we changed the device set.
90          if (m_iDirtyCount > 0) {          if (m_iDirtyCount > 0) {
91                  m_iDirtyCount = 0;                  m_iDirtyCount = 0;
# Line 95  void qsamplerDeviceForm::hideEvent ( QHi Line 97  void qsamplerDeviceForm::hideEvent ( QHi
97  // Application main form settler (life depends on it).  // Application main form settler (life depends on it).
98  void qsamplerDeviceForm::setMainForm ( qsamplerMainForm *pMainForm )  void qsamplerDeviceForm::setMainForm ( qsamplerMainForm *pMainForm )
99  {  {
100     m_pMainForm = pMainForm;          m_pMainForm = pMainForm;
101    }
102    
103    
104    // Set device type spacial exclusive mode.
105    void qsamplerDeviceForm::setDeviceTypeMode (
106            qsamplerDevice::qsamplerDeviceType deviceTypeMode )
107    {
108            // If it has not changed, do nothing.
109            if (m_deviceTypeMode == deviceTypeMode)
110                    return;
111    
112            m_deviceTypeMode = deviceTypeMode;
113    
114            // OK. Do a whole refresh around.
115            refreshDevices();
116  }  }
117    
118    
# Line 108  void qsamplerDeviceForm::setClient ( lsc Line 125  void qsamplerDeviceForm::setClient ( lsc
125    
126          // Set new reference.          // Set new reference.
127          m_pClient = pClient;          m_pClient = pClient;
128            
129          // OK. Do a whole refresh around.          // OK. Do a whole refresh around.
130          refreshDevices();          refreshDevices();
131  }  }
132    
133    
134    // Device driver name setup formal initializer.
135    void qsamplerDeviceForm::setDriverName ( const QString& sDriverName )
136    {
137            if (DriverNameComboBox->listBox()->findItem(sDriverName,
138                            Qt::ExactMatch | Qt::CaseSensitive) == NULL) {
139                    DriverNameComboBox->insertItem(sDriverName);
140            }
141            DriverNameComboBox->setCurrentText(sDriverName);
142    }
143    
144    
145  // Set current selected device by type and id.  // Set current selected device by type and id.
146  void qsamplerDeviceForm::setDevice (  void qsamplerDeviceForm::setDevice ( qsamplerDevice *pDevice )
         qsamplerDevice::qsamplerDeviceType deviceType, int iDeviceID )  
147  {  {
148            // In case no device is given...
149            qsamplerDevice::qsamplerDeviceType deviceType = m_deviceTypeMode;
150            if (pDevice)
151                    deviceType = pDevice->deviceType();
152    
153          // Get the device view root item...          // Get the device view root item...
154          qsamplerDeviceItem *pRootItem = NULL;          qsamplerDeviceItem *pRootItem = NULL;
155          switch (deviceType) {          switch (deviceType) {
# Line 130  void qsamplerDeviceForm::setDevice ( Line 162  void qsamplerDeviceForm::setDevice (
162          case qsamplerDevice::None:          case qsamplerDevice::None:
163                  break;                  break;
164          }          }
165            
166          // Is the root present?          // Is the root present?
167          if (pRootItem == NULL)          if (pRootItem == NULL)
168              return;                  return;
169    
170            // So there's no device huh?
171            if (pDevice == NULL) {
172                    DeviceListView->setSelected(pRootItem, true);
173                    return;
174            }
175    
176          // For each child, test for identity...          // For each child, test for identity...
177          qsamplerDeviceItem *pDeviceItem =          qsamplerDeviceItem *pDeviceItem =
178                  (qsamplerDeviceItem *) pRootItem->firstChild();                  (qsamplerDeviceItem *) pRootItem->firstChild();
179          while (pDeviceItem) {          while (pDeviceItem) {
180                  // If identities match, select as current device item.                  // If identities match, select as current device item.
181                  if (pDeviceItem->device().deviceID() == iDeviceID) {                  if (pDeviceItem->device().deviceID() == pDevice->deviceID()) {
182                          DeviceListView->setSelected(pDeviceItem, true);                          DeviceListView->setSelected(pDeviceItem, true);
183                          break;                          break;
184                  }                  }
# Line 154  void qsamplerDeviceForm::setDevice ( Line 192  void qsamplerDeviceForm::setDevice (
192  void qsamplerDeviceForm::createDevice (void)  void qsamplerDeviceForm::createDevice (void)
193  {  {
194          if (m_pMainForm == NULL)          if (m_pMainForm == NULL)
195              return;                  return;
196    
197          QListViewItem *pItem = DeviceListView->selectedItem();          QListViewItem *pItem = DeviceListView->selectedItem();
198          if (pItem == NULL || pItem->rtti() != QSAMPLER_DEVICE_ITEM)          if (pItem == NULL || pItem->rtti() != QSAMPLER_DEVICE_ITEM)
# Line 191  void qsamplerDeviceForm::createDevice (v Line 229  void qsamplerDeviceForm::createDevice (v
229  void qsamplerDeviceForm::deleteDevice (void)  void qsamplerDeviceForm::deleteDevice (void)
230  {  {
231          if (m_pMainForm == NULL)          if (m_pMainForm == NULL)
232              return;                  return;
233    
234          QListViewItem *pItem = DeviceListView->selectedItem();          QListViewItem *pItem = DeviceListView->selectedItem();
235          if (pItem == NULL || pItem->rtti() != QSAMPLER_DEVICE_ITEM)          if (pItem == NULL || pItem->rtti() != QSAMPLER_DEVICE_ITEM)
# Line 226  void qsamplerDeviceForm::deleteDevice (v Line 264  void qsamplerDeviceForm::deleteDevice (v
264  void qsamplerDeviceForm::refreshDevices (void)  void qsamplerDeviceForm::refreshDevices (void)
265  {  {
266          if (m_pMainForm == NULL)          if (m_pMainForm == NULL)
267              return;                  return;
268    
269          // Avoid nested changes.          // Avoid nested changes.
270          m_iDirtySetup++;          m_iDirtySetup++;
# Line 240  void qsamplerDeviceForm::refreshDevices Line 278  void qsamplerDeviceForm::refreshDevices
278          if (m_pClient) {          if (m_pClient) {
279                  int *piDeviceIDs;                  int *piDeviceIDs;
280                  // Grab and pop Audio devices...                  // Grab and pop Audio devices...
281                  m_pAudioItems = new qsamplerDeviceItem(DeviceListView,                  if (m_deviceTypeMode == qsamplerDevice::None ||
282                          m_pMainForm, qsamplerDevice::Audio);                          m_deviceTypeMode == qsamplerDevice::Audio) {
283                            m_pAudioItems = new qsamplerDeviceItem(DeviceListView,
284                                    m_pMainForm, qsamplerDevice::Audio);
285                    }
286                  if (m_pAudioItems) {                  if (m_pAudioItems) {
287                          piDeviceIDs = qsamplerDevice::getDevices(m_pClient, qsamplerDevice::Audio);                          piDeviceIDs = qsamplerDevice::getDevices(m_pClient, qsamplerDevice::Audio);
288                          for (int i = 0; piDeviceIDs && piDeviceIDs[i] >= 0; i++) {                          for (int i = 0; piDeviceIDs && piDeviceIDs[i] >= 0; i++) {
# Line 251  void qsamplerDeviceForm::refreshDevices Line 292  void qsamplerDeviceForm::refreshDevices
292                          m_pAudioItems->setOpen(true);                          m_pAudioItems->setOpen(true);
293                  }                  }
294                  // Grab and pop MIDI devices...                  // Grab and pop MIDI devices...
295                  m_pMidiItems = new qsamplerDeviceItem(DeviceListView,                  if (m_deviceTypeMode == qsamplerDevice::None ||
296                          m_pMainForm, qsamplerDevice::Midi);                          m_deviceTypeMode == qsamplerDevice::Midi) {
297                            m_pMidiItems = new qsamplerDeviceItem(DeviceListView,
298                                    m_pMainForm, qsamplerDevice::Midi);
299                    }
300                  if (m_pMidiItems) {                  if (m_pMidiItems) {
301                          piDeviceIDs = qsamplerDevice::getDevices(m_pClient, qsamplerDevice::Midi);                          piDeviceIDs = qsamplerDevice::getDevices(m_pClient, qsamplerDevice::Midi);
302                          for (int i = 0; piDeviceIDs && piDeviceIDs[i] >= 0; i++) {                          for (int i = 0; piDeviceIDs && piDeviceIDs[i] >= 0; i++) {
# Line 340  void qsamplerDeviceForm::selectDevice (v Line 384  void qsamplerDeviceForm::selectDevice (v
384          // Do we need a driver name?          // Do we need a driver name?
385          if (m_bNewDevice || device.driverName().isEmpty())          if (m_bNewDevice || device.driverName().isEmpty())
386                  device.setDriver(DriverNameComboBox->currentText());                  device.setDriver(DriverNameComboBox->currentText());
387          const QString& sDriverName = device.driverName();          setDriverName(device.driverName());
         if (DriverNameComboBox->listBox()->findItem(sDriverName, Qt::ExactMatch) == NULL)  
                 DriverNameComboBox->insertItem(sDriverName);  
         DriverNameComboBox->setCurrentText(sDriverName);  
388          DriverNameTextLabel->setEnabled(m_bNewDevice);          DriverNameTextLabel->setEnabled(m_bNewDevice);
389          DriverNameComboBox->setEnabled(m_bNewDevice);          DriverNameComboBox->setEnabled(m_bNewDevice);
390          // Fill the device parameter table...          // Fill the device parameter table...
# Line 358  void qsamplerDeviceForm::selectDevice (v Line 399  void qsamplerDeviceForm::selectDevice (v
399                  QPixmap pixmap;                  QPixmap pixmap;
400                  switch (device.deviceType()) {                  switch (device.deviceType()) {
401                  case qsamplerDevice::Audio:                  case qsamplerDevice::Audio:
402                      pixmap = QPixmap::fromMimeSource("audio2.png");                          pixmap = QPixmap::fromMimeSource("audio2.png");
403                      break;                          break;
404                  case qsamplerDevice::Midi:                  case qsamplerDevice::Midi:
405                      pixmap = QPixmap::fromMimeSource("midi2.png");                          pixmap = QPixmap::fromMimeSource("midi2.png");
406                      break;                          break;
407                  case qsamplerDevice::None:                  case qsamplerDevice::None:
408                      break;                          break;
409                  }                  }
410                  qsamplerDevicePortList& ports = device.ports();                  qsamplerDevicePortList& ports = device.ports();
411                  qsamplerDevicePort *pPort;                  qsamplerDevicePort *pPort;
412                  for (pPort = ports.first(); pPort; pPort = ports.next()) {                  for (pPort = ports.first(); pPort; pPort = ports.next()) {
413              DevicePortComboBox->insertItem(pixmap, device.deviceTypeName()                          DevicePortComboBox->insertItem(pixmap, device.deviceTypeName()
414                                  + ' ' + device.driverName()                                  + ' ' + device.driverName()
415                                  + ' ' + pPort->portName());                                  + ' ' + pPort->portName());
416                  }                  }
# Line 379  void qsamplerDeviceForm::selectDevice (v Line 420  void qsamplerDeviceForm::selectDevice (v
420          }          }
421          // Done.          // Done.
422          m_iDirtySetup--;          m_iDirtySetup--;
423            
424          // Make the device port/channel selection effective.          // Make the device port/channel selection effective.
425          selectDevicePort(DevicePortComboBox->currentItem());          selectDevicePort(DevicePortComboBox->currentItem());
426  }  }
# Line 415  void qsamplerDeviceForm::selectDevicePor Line 456  void qsamplerDeviceForm::selectDevicePor
456  void qsamplerDeviceForm::changeDeviceParam ( int iRow, int iCol )  void qsamplerDeviceForm::changeDeviceParam ( int iRow, int iCol )
457  {  {
458          if (m_pMainForm == NULL)          if (m_pMainForm == NULL)
459              return;                  return;
460          if (m_iDirtySetup > 0)          if (m_iDirtySetup > 0)
461                  return;                  return;
462          if (iRow < 0 || iCol < 0)          if (iRow < 0 || iCol < 0)
463                  return;                  return;
464                    
465          //          //
466          //  Device parameter change...          //  Device parameter change...
467          //          //
# Line 449  void qsamplerDeviceForm::changeDevicePar Line 490  void qsamplerDeviceForm::changeDevicePar
490  void qsamplerDeviceForm::changeDevicePortParam ( int iRow, int iCol )  void qsamplerDeviceForm::changeDevicePortParam ( int iRow, int iCol )
491  {  {
492          if (m_pMainForm == NULL)          if (m_pMainForm == NULL)
493              return;                  return;
494          if (m_iDirtySetup > 0)          if (m_iDirtySetup > 0)
495                  return;                  return;
496          if (iRow < 0 || iCol < 0)          if (iRow < 0 || iCol < 0)
# Line 468  void qsamplerDeviceForm::changeDevicePor Line 509  void qsamplerDeviceForm::changeDevicePor
509          int iPort = DevicePortComboBox->currentItem();          int iPort = DevicePortComboBox->currentItem();
510          qsamplerDevicePort *pPort = device.ports().at(iPort);          qsamplerDevicePort *pPort = device.ports().at(iPort);
511          if (pPort == NULL)          if (pPort == NULL)
512              return;                  return;
513    
514          // Table 1st column has the parameter name;          // Table 1st column has the parameter name;
515          const QString sParam = DevicePortParamTable->text(iRow, 0);          const QString sParam = DevicePortParamTable->text(iRow, 0);
# Line 486  void qsamplerDeviceForm::changeDevicePor Line 527  void qsamplerDeviceForm::changeDevicePor
527  void qsamplerDeviceForm::contextMenu ( QListViewItem *pItem, const QPoint& pos, int )  void qsamplerDeviceForm::contextMenu ( QListViewItem *pItem, const QPoint& pos, int )
528  {  {
529          int iItemID;          int iItemID;
530            
531          // Build the device context menu...          // Build the device context menu...
532          QPopupMenu* pContextMenu = new QPopupMenu(this);          QPopupMenu* pContextMenu = new QPopupMenu(this);
533            
534          bool bClient = (m_pClient != NULL);          bool bClient = (m_pClient != NULL);
535          bool bEnabled = (pItem != NULL);          bool bEnabled = (pItem != NULL);
536          iItemID = pContextMenu->insertItem(          iItemID = pContextMenu->insertItem(
# Line 505  void qsamplerDeviceForm::contextMenu ( Q Line 546  void qsamplerDeviceForm::contextMenu ( Q
546                  QIconSet(QPixmap::fromMimeSource("formRefresh.png")),                  QIconSet(QPixmap::fromMimeSource("formRefresh.png")),
547                  tr("&Refresh"), this, SLOT(refreshDevices()));                  tr("&Refresh"), this, SLOT(refreshDevices()));
548          pContextMenu->setItemEnabled(iItemID, bClient);          pContextMenu->setItemEnabled(iItemID, bClient);
549            
550          pContextMenu->exec(pos);          pContextMenu->exec(pos);
551            
552          delete pContextMenu;          delete pContextMenu;
553  }  }
554    
# Line 529  void qsamplerDeviceForm::stabilizeForm ( Line 570  void qsamplerDeviceForm::stabilizeForm (
570    
571    
572  // end of qsamplerDeviceForm.ui.h  // end of qsamplerDeviceForm.ui.h
   
   
   

Legend:
Removed from v.489  
changed lines
  Added in v.490

  ViewVC Help
Powered by ViewVC