/[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 486 by capela, Tue Mar 22 12:55:29 2005 UTC revision 487 by capela, Thu Mar 31 14:17:19 2005 UTC
# Line 36  Line 36 
36  void qsamplerDeviceForm::init (void)  void qsamplerDeviceForm::init (void)
37  {  {
38          // Initialize locals.          // Initialize locals.
39          m_pMainForm   = (qsamplerMainForm *) QWidget::parentWidget();          m_pMainForm   = NULL;
40          m_pClient     = NULL;          m_pClient     = NULL;
41          m_iDirtySetup = 0;          m_iDirtySetup = 0;
42          m_bNewDevice  = false;          m_bNewDevice  = false;
43          m_deviceType  = qsamplerDevice::None;          m_deviceType  = qsamplerDevice::None;
44          m_pAudioItems = NULL;          m_pAudioItems = NULL;
45          m_pMidiItems  = NULL;          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(changeDeviceParam(int,int)));                  this, SLOT(changeDeviceParam(int,int)));
# Line 85  void qsamplerDeviceForm::hideEvent ( QHi Line 85  void qsamplerDeviceForm::hideEvent ( QHi
85  }  }
86    
87    
88    // Application main form settler (life depends on it).
89    void qsamplerDeviceForm::setMainForm ( qsamplerMainForm *pMainForm )
90    {
91       m_pMainForm = pMainForm;
92    }
93    
94    
95  // Device configuration dialog setup formal initializer.  // Device configuration dialog setup formal initializer.
96  void qsamplerDeviceForm::setClient ( lscp_client_t *pClient )  void qsamplerDeviceForm::setClient ( lscp_client_t *pClient )
97  {  {
# Line 100  void qsamplerDeviceForm::setClient ( lsc Line 107  void qsamplerDeviceForm::setClient ( lsc
107  }  }
108    
109    
110    // Set current selected device by type and id.
111    void qsamplerDeviceForm::setDevice (
112            qsamplerDevice::qsamplerDeviceType deviceType, int iDeviceID )
113    {
114            // Get the device view root item...
115            qsamplerDeviceItem *pRootItem = NULL;
116            switch (deviceType) {
117            case qsamplerDevice::Audio:
118                    pRootItem = m_pAudioItems;
119                    break;
120            case qsamplerDevice::Midi:
121                    pRootItem = m_pMidiItems;
122                    break;
123            case qsamplerDevice::None:
124                    break;
125            }
126            
127            // Is the root present?
128            if (pRootItem == NULL)
129                return;
130    
131            // For each child, test for identity...
132            qsamplerDeviceItem *pDeviceItem =
133                    (qsamplerDeviceItem *) pRootItem->firstChild();
134            while (pDeviceItem) {
135                    // If identities match, select as current device item.
136                    if (pDeviceItem->device().deviceID() == iDeviceID) {
137                            DeviceListView->setSelected(pDeviceItem, true);
138                            break;
139                    }
140                    pDeviceItem = (qsamplerDeviceItem *) pDeviceItem->nextSibling();
141            }
142    }
143    
144    
145    
146  // Create a new device from current table view.  // Create a new device from current table view.
147  void qsamplerDeviceForm::createDevice (void)  void qsamplerDeviceForm::createDevice (void)
148  {  {
149            if (m_pMainForm == NULL)
150                return;
151    
152          QListViewItem *pItem = DeviceListView->selectedItem();          QListViewItem *pItem = DeviceListView->selectedItem();
153          if (pItem == NULL || pItem->rtti() != QSAMPLER_DEVICE_ITEM)          if (pItem == NULL || pItem->rtti() != QSAMPLER_DEVICE_ITEM)
154                  return;                  return;
# Line 136  void qsamplerDeviceForm::createDevice (v Line 182  void qsamplerDeviceForm::createDevice (v
182  // Delete current device in table view.  // Delete current device in table view.
183  void qsamplerDeviceForm::deleteDevice (void)  void qsamplerDeviceForm::deleteDevice (void)
184  {  {
185            if (m_pMainForm == NULL)
186                return;
187    
188          QListViewItem *pItem = DeviceListView->selectedItem();          QListViewItem *pItem = DeviceListView->selectedItem();
189          if (pItem == NULL || pItem->rtti() != QSAMPLER_DEVICE_ITEM)          if (pItem == NULL || pItem->rtti() != QSAMPLER_DEVICE_ITEM)
190                  return;                  return;
# Line 167  void qsamplerDeviceForm::deleteDevice (v Line 216  void qsamplerDeviceForm::deleteDevice (v
216  // Refresh all device list and views.  // Refresh all device list and views.
217  void qsamplerDeviceForm::refreshDevices (void)  void qsamplerDeviceForm::refreshDevices (void)
218  {  {
219            if (m_pMainForm == NULL)
220                return;
221    
222          // Avoid nested changes.          // Avoid nested changes.
223          m_iDirtySetup++;          m_iDirtySetup++;
224    
# Line 179  void qsamplerDeviceForm::refreshDevices Line 231  void qsamplerDeviceForm::refreshDevices
231          if (m_pClient) {          if (m_pClient) {
232                  int *piDeviceIDs;                  int *piDeviceIDs;
233                  // Grab and pop Audio devices...                  // Grab and pop Audio devices...
234                  m_pAudioItems = new qsamplerDeviceItem(DeviceListView, m_pMainForm,                  m_pAudioItems = new qsamplerDeviceItem(DeviceListView,
235                          qsamplerDevice::Audio);                          m_pMainForm, qsamplerDevice::Audio);
236                  if (m_pAudioItems) {                  if (m_pAudioItems) {
237                          piDeviceIDs = qsamplerDevice::getDevices(m_pClient, qsamplerDevice::Audio);                          piDeviceIDs = qsamplerDevice::getDevices(m_pClient, qsamplerDevice::Audio);
238                          for (int i = 0; piDeviceIDs && piDeviceIDs[i] >= 0; i++) {                          for (int i = 0; piDeviceIDs && piDeviceIDs[i] >= 0; i++) {
# Line 190  void qsamplerDeviceForm::refreshDevices Line 242  void qsamplerDeviceForm::refreshDevices
242                          m_pAudioItems->setOpen(true);                          m_pAudioItems->setOpen(true);
243                  }                  }
244                  // Grab and pop MIDI devices...                  // Grab and pop MIDI devices...
245                  m_pMidiItems = new qsamplerDeviceItem(DeviceListView, m_pMainForm,                  m_pMidiItems = new qsamplerDeviceItem(DeviceListView,
246                          qsamplerDevice::Midi);                          m_pMainForm, qsamplerDevice::Midi);
247                  if (m_pMidiItems) {                  if (m_pMidiItems) {
248                          piDeviceIDs = qsamplerDevice::getDevices(m_pClient, qsamplerDevice::Midi);                          piDeviceIDs = qsamplerDevice::getDevices(m_pClient, qsamplerDevice::Midi);
249                          for (int i = 0; piDeviceIDs && piDeviceIDs[i] >= 0; i++) {                          for (int i = 0; piDeviceIDs && piDeviceIDs[i] >= 0; i++) {
# Line 353  void qsamplerDeviceForm::selectDevicePor Line 405  void qsamplerDeviceForm::selectDevicePor
405  // Device parameter value change slot.  // Device parameter value change slot.
406  void qsamplerDeviceForm::changeDeviceParam ( int iRow, int iCol )  void qsamplerDeviceForm::changeDeviceParam ( int iRow, int iCol )
407  {  {
408            if (m_pMainForm == NULL)
409                return;
410          if (m_iDirtySetup > 0)          if (m_iDirtySetup > 0)
411                  return;                  return;
412          if (iRow < 0 || iCol < 0)          if (iRow < 0 || iCol < 0)
# Line 385  void qsamplerDeviceForm::changeDevicePar Line 439  void qsamplerDeviceForm::changeDevicePar
439  // Device port/channel parameter value change slot.  // Device port/channel parameter value change slot.
440  void qsamplerDeviceForm::changeDevicePortParam ( int iRow, int iCol )  void qsamplerDeviceForm::changeDevicePortParam ( int iRow, int iCol )
441  {  {
442            if (m_pMainForm == NULL)
443                return;
444          if (m_iDirtySetup > 0)          if (m_iDirtySetup > 0)
445                  return;                  return;
446          if (iRow < 0 || iCol < 0)          if (iRow < 0 || iCol < 0)

Legend:
Removed from v.486  
changed lines
  Added in v.487

  ViewVC Help
Powered by ViewVC