/[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 1519 by capela, Sat Nov 24 13:06:19 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 54  ChannelForm::ChannelForm ( QWidget* pPar Line 54  ChannelForm::ChannelForm ( QWidget* pPar
54    
55          m_pDeviceForm = NULL;          m_pDeviceForm = NULL;
56    
57            int iRowHeight = m_ui.AudioRoutingTable->fontMetrics().height() + 4;
58            m_ui.AudioRoutingTable->verticalHeader()->setDefaultSectionSize(iRowHeight);
59            m_ui.AudioRoutingTable->horizontalHeader()->setDefaultAlignment(Qt::AlignLeft);
60    
61          m_ui.AudioRoutingTable->setModel(&m_routingModel);          m_ui.AudioRoutingTable->setModel(&m_routingModel);
62          m_ui.AudioRoutingTable->setItemDelegate(&m_routingDelegate);          m_ui.AudioRoutingTable->setItemDelegate(&m_routingDelegate);
63          m_ui.AudioRoutingTable->horizontalHeader()->setResizeMode(0, QHeaderView::Stretch);          m_ui.AudioRoutingTable->horizontalHeader()->setResizeMode(0, QHeaderView::Stretch);
64  //      m_ui.AudioRoutingTable->verticalHeader()->hide();  //      m_ui.AudioRoutingTable->verticalHeader()->hide();
65    
66          // This goes initially hidden, and will be shown          // This goes initially hidden, and will be shown
67      // on setup() for currently existing channels...          // on setup() for currently existing channels...
68          m_ui.AudioRoutingTable->hide();          m_ui.AudioRoutingTable->hide();
69    
70          // Try to restore normal window positioning.          // Try to restore normal window positioning.
# Line 218  void ChannelForm::setup ( qsamplerChanne Line 222  void ChannelForm::setup ( qsamplerChanne
222          m_ui.InstrumentNrComboBox->insertItems(0,          m_ui.InstrumentNrComboBox->insertItems(0,
223                  qsamplerChannel::getInstrumentList(sInstrumentFile,                  qsamplerChannel::getInstrumentList(sInstrumentFile,
224                  pOptions->bInstrumentNames));                  pOptions->bInstrumentNames));
225          m_ui.InstrumentNrComboBox->setCurrentIndex(pChannel->instrumentNr());          int iInstrumentNr = pChannel->instrumentNr();
226            if (iInstrumentNr < 0)
227                    iInstrumentNr = 0;
228            m_ui.InstrumentNrComboBox->setCurrentIndex(iInstrumentNr);
229    
230          // MIDI input device...          // MIDI input device...
231          qsamplerDevice midiDevice(qsamplerDevice::Midi, m_pChannel->midiDevice());          qsamplerDevice midiDevice(qsamplerDevice::Midi, m_pChannel->midiDevice());
# Line 386  void ChannelForm::accept (void) Line 393  void ChannelForm::accept (void)
393                  if (!m_pChannel->setMidiMap(m_ui.MidiMapComboBox->currentIndex()))                  if (!m_pChannel->setMidiMap(m_ui.MidiMapComboBox->currentIndex()))
394                          iErrors++;                          iErrors++;
395                  // Show error messages?                  // Show error messages?
396                  if (iErrors > 0)                  if (iErrors > 0) {
397                          m_pChannel->appendMessagesError(tr("Some channel settings could not be set.\n\nSorry."));                          m_pChannel->appendMessagesError(
398                                    tr("Some channel settings could not be set.\n\nSorry."));
399                    }
400          }          }
401    
402          // Save default engine name, instrument directory and history...          // Save default engine name, instrument directory and history...
# Line 504  void ChannelForm::setupDevice ( qsampler Line 513  void ChannelForm::setupDevice ( qsampler
513          // Create the device form if not already...          // Create the device form if not already...
514          if (m_pDeviceForm == NULL) {          if (m_pDeviceForm == NULL) {
515                  m_pDeviceForm = new DeviceForm(this, Qt::Dialog);                  m_pDeviceForm = new DeviceForm(this, Qt::Dialog);
516          m_pDeviceForm->setAttribute(Qt::WA_ShowModal);                  m_pDeviceForm->setAttribute(Qt::WA_ShowModal);
517                  QObject::connect(m_pDeviceForm, SIGNAL(devicesChanged()),                  QObject::connect(m_pDeviceForm, SIGNAL(devicesChanged()),
518                          this, SLOT(updateDevices()));                          this, SLOT(updateDevices()));
519          }          }
# Line 553  void ChannelForm::selectMidiDriverItem ( Line 562  void ChannelForm::selectMidiDriverItem (
562          for (int i = 0; piDeviceIDs && piDeviceIDs[i] >= 0; i++) {          for (int i = 0; piDeviceIDs && piDeviceIDs[i] >= 0; i++) {
563                  pDevice = new qsamplerDevice(qsamplerDevice::Midi, piDeviceIDs[i]);                  pDevice = new qsamplerDevice(qsamplerDevice::Midi, piDeviceIDs[i]);
564                  if (pDevice->driverName().toUpper() == sDriverName) {                  if (pDevice->driverName().toUpper() == sDriverName) {
565                          m_ui.MidiDeviceComboBox->insertItem(0, midiPixmap, pDevice->deviceName());                          m_ui.MidiDeviceComboBox->insertItem(0,
566                                    midiPixmap, pDevice->deviceName());
567                          m_midiDevices.append(pDevice);                          m_midiDevices.append(pDevice);
568                  } else {                  } else {
569                          delete pDevice;                          delete pDevice;
# Line 667  void ChannelForm::selectAudioDriverItem Line 677  void ChannelForm::selectAudioDriverItem
677          for (int i = 0; piDeviceIDs && piDeviceIDs[i] >= 0; i++) {          for (int i = 0; piDeviceIDs && piDeviceIDs[i] >= 0; i++) {
678                  pDevice = new qsamplerDevice(qsamplerDevice::Audio, piDeviceIDs[i]);                  pDevice = new qsamplerDevice(qsamplerDevice::Audio, piDeviceIDs[i]);
679                  if (pDevice->driverName().toUpper() == sDriverName) {                  if (pDevice->driverName().toUpper() == sDriverName) {
680                          m_ui.AudioDeviceComboBox->insertItem(0, audioPixmap, pDevice->deviceName());                          m_ui.AudioDeviceComboBox->insertItem(0,
681                                    audioPixmap, pDevice->deviceName());
682                          m_audioDevices.append(pDevice);                          m_audioDevices.append(pDevice);
683                  } else {                  } else {
684                          delete pDevice;                          delete pDevice;
# Line 776  void ChannelForm::stabilizeForm (void) Line 787  void ChannelForm::stabilizeForm (void)
787  {  {
788          const bool bValid =          const bool bValid =
789                  m_ui.EngineNameComboBox->currentIndex() >= 0 &&                  m_ui.EngineNameComboBox->currentIndex() >= 0 &&
790                  m_ui.EngineNameComboBox->currentText() !=                  m_ui.EngineNameComboBox->currentText()
791                  qsamplerChannel::noEngineName();                          != qsamplerChannel::noEngineName();
792  #if 0  #if 0
793          const QString& sPath = InstrumentFileComboBox->currentText();          const QString& sPath = InstrumentFileComboBox->currentText();
794          bValid = bValid && !sPath.isEmpty() && QFileInfo(sPath).exists();          bValid = bValid && !sPath.isEmpty() && QFileInfo(sPath).exists();
# Line 788  void ChannelForm::stabilizeForm (void) Line 799  void ChannelForm::stabilizeForm (void)
799    
800  void ChannelForm::updateTableCellRenderers (void)  void ChannelForm::updateTableCellRenderers (void)
801  {  {
802      const int rows = m_routingModel.rowCount();          const int rows = m_routingModel.rowCount();
803      const int cols = m_routingModel.columnCount();          const int cols = m_routingModel.columnCount();
804      updateTableCellRenderers(          updateTableCellRenderers(
805                  m_routingModel.index(0, 0),                  m_routingModel.index(0, 0),
806                  m_routingModel.index(rows - 1, cols - 1));                  m_routingModel.index(rows - 1, cols - 1));
807  }  }
# Line 799  void ChannelForm::updateTableCellRendere Line 810  void ChannelForm::updateTableCellRendere
810  void ChannelForm::updateTableCellRenderers (  void ChannelForm::updateTableCellRenderers (
811          const QModelIndex& topLeft, const QModelIndex& bottomRight )          const QModelIndex& topLeft, const QModelIndex& bottomRight )
812  {  {
813      for (int r = topLeft.row(); r <= bottomRight.row(); r++) {          for (int r = topLeft.row(); r <= bottomRight.row(); r++) {
814          for (int c = topLeft.column(); c <= bottomRight.column(); c++) {                  for (int c = topLeft.column(); c <= bottomRight.column(); c++) {
815              const QModelIndex index = m_routingModel.index(r, c);                          const QModelIndex index = m_routingModel.index(r, c);
816              m_ui.AudioRoutingTable->openPersistentEditor(index);                          m_ui.AudioRoutingTable->openPersistentEditor(index);
817          }                  }
818      }          }
819  }  }
820    
821  } // namespace QSampler  } // namespace QSampler

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

  ViewVC Help
Powered by ViewVC