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

Diff of /qsampler/trunk/src/qsamplerChannelForm.cpp

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

revision 1509 by capela, Thu Nov 22 11:10:44 2007 UTC revision 1510 by capela, Thu Nov 22 14:17:24 2007 UTC
# Line 41  namespace QSampler { Line 41  namespace QSampler {
41  ChannelForm::ChannelForm ( QWidget* pParent )  ChannelForm::ChannelForm ( QWidget* pParent )
42          : QDialog(pParent)          : QDialog(pParent)
43  {  {
44      m_ui.setupUi(this);          m_ui.setupUi(this);
45    
46          // Initialize locals.          // Initialize locals.
47          m_pChannel = NULL;          m_pChannel = NULL;
# Line 60  ChannelForm::ChannelForm ( QWidget* pPar Line 60  ChannelForm::ChannelForm ( QWidget* pPar
60  //      m_ui.AudioRoutingTable->verticalHeader()->hide();  //      m_ui.AudioRoutingTable->verticalHeader()->hide();
61    
62          // This goes initially hidden, and will be shown          // This goes initially hidden, and will be shown
63      // on setup() for currently existing channels...          // on setup() for currently existing channels...
64          m_ui.AudioRoutingTable->hide();          m_ui.AudioRoutingTable->hide();
65    
66          // Try to restore normal window positioning.          // Try to restore normal window positioning.
# Line 218  void ChannelForm::setup ( qsamplerChanne Line 218  void ChannelForm::setup ( qsamplerChanne
218          m_ui.InstrumentNrComboBox->insertItems(0,          m_ui.InstrumentNrComboBox->insertItems(0,
219                  qsamplerChannel::getInstrumentList(sInstrumentFile,                  qsamplerChannel::getInstrumentList(sInstrumentFile,
220                  pOptions->bInstrumentNames));                  pOptions->bInstrumentNames));
221          m_ui.InstrumentNrComboBox->setCurrentIndex(pChannel->instrumentNr());          int iInstrumentNr = pChannel->instrumentNr();
222            if (iInstrumentNr < 0)
223                    iInstrumentNr = 0;
224            m_ui.InstrumentNrComboBox->setCurrentIndex(iInstrumentNr);
225    
226          // MIDI input device...          // MIDI input device...
227          qsamplerDevice midiDevice(qsamplerDevice::Midi, m_pChannel->midiDevice());          qsamplerDevice midiDevice(qsamplerDevice::Midi, m_pChannel->midiDevice());
# Line 386  void ChannelForm::accept (void) Line 389  void ChannelForm::accept (void)
389                  if (!m_pChannel->setMidiMap(m_ui.MidiMapComboBox->currentIndex()))                  if (!m_pChannel->setMidiMap(m_ui.MidiMapComboBox->currentIndex()))
390                          iErrors++;                          iErrors++;
391                  // Show error messages?                  // Show error messages?
392                  if (iErrors > 0)                  if (iErrors > 0) {
393                          m_pChannel->appendMessagesError(tr("Some channel settings could not be set.\n\nSorry."));                          m_pChannel->appendMessagesError(
394                                    tr("Some channel settings could not be set.\n\nSorry."));
395                    }
396          }          }
397    
398          // Save default engine name, instrument directory and history...          // Save default engine name, instrument directory and history...
# Line 504  void ChannelForm::setupDevice ( qsampler Line 509  void ChannelForm::setupDevice ( qsampler
509          // Create the device form if not already...          // Create the device form if not already...
510          if (m_pDeviceForm == NULL) {          if (m_pDeviceForm == NULL) {
511                  m_pDeviceForm = new DeviceForm(this, Qt::Dialog);                  m_pDeviceForm = new DeviceForm(this, Qt::Dialog);
512          m_pDeviceForm->setAttribute(Qt::WA_ShowModal);                  m_pDeviceForm->setAttribute(Qt::WA_ShowModal);
513                  QObject::connect(m_pDeviceForm, SIGNAL(devicesChanged()),                  QObject::connect(m_pDeviceForm, SIGNAL(devicesChanged()),
514                          this, SLOT(updateDevices()));                          this, SLOT(updateDevices()));
515          }          }
# Line 553  void ChannelForm::selectMidiDriverItem ( Line 558  void ChannelForm::selectMidiDriverItem (
558          for (int i = 0; piDeviceIDs && piDeviceIDs[i] >= 0; i++) {          for (int i = 0; piDeviceIDs && piDeviceIDs[i] >= 0; i++) {
559                  pDevice = new qsamplerDevice(qsamplerDevice::Midi, piDeviceIDs[i]);                  pDevice = new qsamplerDevice(qsamplerDevice::Midi, piDeviceIDs[i]);
560                  if (pDevice->driverName().toUpper() == sDriverName) {                  if (pDevice->driverName().toUpper() == sDriverName) {
561                          m_ui.MidiDeviceComboBox->insertItem(0, midiPixmap, pDevice->deviceName());                          m_ui.MidiDeviceComboBox->insertItem(0,
562                                    midiPixmap, pDevice->deviceName());
563                          m_midiDevices.append(pDevice);                          m_midiDevices.append(pDevice);
564                  } else {                  } else {
565                          delete pDevice;                          delete pDevice;
# Line 667  void ChannelForm::selectAudioDriverItem Line 673  void ChannelForm::selectAudioDriverItem
673          for (int i = 0; piDeviceIDs && piDeviceIDs[i] >= 0; i++) {          for (int i = 0; piDeviceIDs && piDeviceIDs[i] >= 0; i++) {
674                  pDevice = new qsamplerDevice(qsamplerDevice::Audio, piDeviceIDs[i]);                  pDevice = new qsamplerDevice(qsamplerDevice::Audio, piDeviceIDs[i]);
675                  if (pDevice->driverName().toUpper() == sDriverName) {                  if (pDevice->driverName().toUpper() == sDriverName) {
676                          m_ui.AudioDeviceComboBox->insertItem(0, audioPixmap, pDevice->deviceName());                          m_ui.AudioDeviceComboBox->insertItem(0,
677                                    audioPixmap, pDevice->deviceName());
678                          m_audioDevices.append(pDevice);                          m_audioDevices.append(pDevice);
679                  } else {                  } else {
680                          delete pDevice;                          delete pDevice;
# Line 776  void ChannelForm::stabilizeForm (void) Line 783  void ChannelForm::stabilizeForm (void)
783  {  {
784          const bool bValid =          const bool bValid =
785                  m_ui.EngineNameComboBox->currentIndex() >= 0 &&                  m_ui.EngineNameComboBox->currentIndex() >= 0 &&
786                  m_ui.EngineNameComboBox->currentText() !=                  m_ui.EngineNameComboBox->currentText()
787                  qsamplerChannel::noEngineName();                          != qsamplerChannel::noEngineName();
788  #if 0  #if 0
789          const QString& sPath = InstrumentFileComboBox->currentText();          const QString& sPath = InstrumentFileComboBox->currentText();
790          bValid = bValid && !sPath.isEmpty() && QFileInfo(sPath).exists();          bValid = bValid && !sPath.isEmpty() && QFileInfo(sPath).exists();
# Line 788  void ChannelForm::stabilizeForm (void) Line 795  void ChannelForm::stabilizeForm (void)
795    
796  void ChannelForm::updateTableCellRenderers (void)  void ChannelForm::updateTableCellRenderers (void)
797  {  {
798      const int rows = m_routingModel.rowCount();          const int rows = m_routingModel.rowCount();
799      const int cols = m_routingModel.columnCount();          const int cols = m_routingModel.columnCount();
800      updateTableCellRenderers(          updateTableCellRenderers(
801                  m_routingModel.index(0, 0),                  m_routingModel.index(0, 0),
802                  m_routingModel.index(rows - 1, cols - 1));                  m_routingModel.index(rows - 1, cols - 1));
803  }  }
# Line 799  void ChannelForm::updateTableCellRendere Line 806  void ChannelForm::updateTableCellRendere
806  void ChannelForm::updateTableCellRenderers (  void ChannelForm::updateTableCellRenderers (
807          const QModelIndex& topLeft, const QModelIndex& bottomRight )          const QModelIndex& topLeft, const QModelIndex& bottomRight )
808  {  {
809      for (int r = topLeft.row(); r <= bottomRight.row(); r++) {          for (int r = topLeft.row(); r <= bottomRight.row(); r++) {
810          for (int c = topLeft.column(); c <= bottomRight.column(); c++) {                  for (int c = topLeft.column(); c <= bottomRight.column(); c++) {
811              const QModelIndex index = m_routingModel.index(r, c);                          const QModelIndex index = m_routingModel.index(r, c);
812              m_ui.AudioRoutingTable->openPersistentEditor(index);                          m_ui.AudioRoutingTable->openPersistentEditor(index);
813          }                  }
814      }          }
815  }  }
816    
817  } // namespace QSampler  } // namespace QSampler

Legend:
Removed from v.1509  
changed lines
  Added in v.1510

  ViewVC Help
Powered by ViewVC