/[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 1506 by schoenebeck, Wed Nov 21 19:57:18 2007 UTC revision 1710 by schoenebeck, Tue Feb 26 16:00:00 2008 UTC
# Line 2  Line 2 
2  //  //
3  /****************************************************************************  /****************************************************************************
4     Copyright (C) 2004-2007, rncbc aka Rui Nuno Capela. All rights reserved.     Copyright (C) 2004-2007, rncbc aka Rui Nuno Capela. All rights reserved.
5     Copyright (C) 2007, Christian Schoenebeck     Copyright (C) 2007, 2008 Christian Schoenebeck
6    
7     This program is free software; you can redistribute it and/or     This program is free software; you can redistribute it and/or
8     modify it under the terms of the GNU General Public License     modify it under the terms of the GNU General Public License
# Line 38  Line 38 
38    
39  namespace QSampler {  namespace QSampler {
40    
41  ChannelForm::ChannelForm(QWidget* parent) : QDialog(parent) {  //-------------------------------------------------------------------------
42      ui.setupUi(this);  // QSampler::Channelform -- Channel form implementation.
43    //
44    
45    ChannelForm::ChannelForm ( QWidget* pParent )
46            : QDialog(pParent)
47    {
48            m_ui.setupUi(this);
49    
50          // Initialize locals.          // Initialize locals.
51          m_pChannel = NULL;          m_pChannel = NULL;
# Line 52  ChannelForm::ChannelForm(QWidget* parent Line 58  ChannelForm::ChannelForm(QWidget* parent
58    
59          m_pDeviceForm = NULL;          m_pDeviceForm = NULL;
60    
61            int iRowHeight = m_ui.AudioRoutingTable->fontMetrics().height() + 4;
62            m_ui.AudioRoutingTable->verticalHeader()->setDefaultSectionSize(iRowHeight);
63            m_ui.AudioRoutingTable->horizontalHeader()->setDefaultAlignment(Qt::AlignLeft);
64    
65            m_ui.AudioRoutingTable->setModel(&m_routingModel);
66            m_ui.AudioRoutingTable->setItemDelegate(&m_routingDelegate);
67            m_ui.AudioRoutingTable->horizontalHeader()->setResizeMode(0, QHeaderView::Stretch);
68    //      m_ui.AudioRoutingTable->verticalHeader()->hide();
69    
70            // This goes initially hidden, and will be shown
71            // on setup() for currently existing channels...
72            m_ui.AudioRoutingTable->hide();
73    
74          // Try to restore normal window positioning.          // Try to restore normal window positioning.
75          adjustSize();          adjustSize();
76    
77          ui.AudioRoutingTable->setModel(&routingModel);          QObject::connect(m_ui.EngineNameComboBox,
         ui.AudioRoutingTable->setItemDelegate(&routingDelegate);  
         ui.AudioRoutingTable->horizontalHeader()->setResizeMode(0, QHeaderView::Stretch);  
   
         QObject::connect(ui.EngineNameComboBox,  
78                  SIGNAL(activated(int)),                  SIGNAL(activated(int)),
79                  SLOT(optionsChanged()));                  SLOT(optionsChanged()));
80          QObject::connect(ui.InstrumentFileComboBox,          QObject::connect(m_ui.InstrumentFileComboBox,
81                  SIGNAL(activated(const QString&)),                  SIGNAL(activated(const QString&)),
82                  SLOT(updateInstrumentName()));                  SLOT(updateInstrumentName()));
83          QObject::connect(ui.InstrumentFileToolButton,          QObject::connect(m_ui.InstrumentFileToolButton,
84                  SIGNAL(clicked()),                  SIGNAL(clicked()),
85                  SLOT(openInstrumentFile()));                  SLOT(openInstrumentFile()));
86          QObject::connect(ui.InstrumentNrComboBox,          QObject::connect(m_ui.InstrumentNrComboBox,
87                  SIGNAL(activated(int)),                  SIGNAL(activated(int)),
88                  SLOT(optionsChanged()));                  SLOT(optionsChanged()));
89          QObject::connect(ui.MidiDriverComboBox,          QObject::connect(m_ui.MidiDriverComboBox,
90                  SIGNAL(activated(const QString&)),                  SIGNAL(activated(const QString&)),
91                  SLOT(selectMidiDriver(const QString&)));                  SLOT(selectMidiDriver(const QString&)));
92          QObject::connect(ui.MidiDeviceComboBox,          QObject::connect(m_ui.MidiDeviceComboBox,
93                  SIGNAL(activated(int)),                  SIGNAL(activated(int)),
94                  SLOT(selectMidiDevice(int)));                  SLOT(selectMidiDevice(int)));
95          QObject::connect(ui.MidiPortSpinBox,          QObject::connect(m_ui.MidiPortSpinBox,
96                  SIGNAL(valueChanged(int)),                  SIGNAL(valueChanged(int)),
97                  SLOT(optionsChanged()));                  SLOT(optionsChanged()));
98          QObject::connect(ui.MidiChannelComboBox,          QObject::connect(m_ui.MidiChannelComboBox,
99                  SIGNAL(activated(int)),                  SIGNAL(activated(int)),
100                  SLOT(optionsChanged()));                  SLOT(optionsChanged()));
101          QObject::connect(ui.MidiMapComboBox,          QObject::connect(m_ui.MidiMapComboBox,
102                  SIGNAL(activated(int)),                  SIGNAL(activated(int)),
103                  SLOT(optionsChanged()));                  SLOT(optionsChanged()));
104          QObject::connect(ui.AudioDriverComboBox,          QObject::connect(m_ui.AudioDriverComboBox,
105                  SIGNAL(activated(const QString&)),                  SIGNAL(activated(const QString&)),
106                  SLOT(selectAudioDriver(const QString&)));                  SLOT(selectAudioDriver(const QString&)));
107          QObject::connect(ui.AudioDeviceComboBox,          QObject::connect(m_ui.AudioDeviceComboBox,
108                  SIGNAL(activated(int)),                  SIGNAL(activated(int)),
109                  SLOT(selectAudioDevice(int)));                  SLOT(selectAudioDevice(int)));
110          QObject::connect(ui.OkPushButton,          QObject::connect(m_ui.OkPushButton,
111                  SIGNAL(clicked()),                  SIGNAL(clicked()),
112                  SLOT(accept()));                  SLOT(accept()));
113          QObject::connect(ui.CancelPushButton,          QObject::connect(m_ui.CancelPushButton,
114                  SIGNAL(clicked()),                  SIGNAL(clicked()),
115                  SLOT(reject()));                  SLOT(reject()));
116          QObject::connect(ui.MidiDeviceToolButton,          QObject::connect(m_ui.MidiDeviceToolButton,
117                  SIGNAL(clicked()),                  SIGNAL(clicked()),
118                  SLOT(setupMidiDevice()));                  SLOT(setupMidiDevice()));
119          QObject::connect(ui.AudioDeviceToolButton,          QObject::connect(m_ui.AudioDeviceToolButton,
120                  SIGNAL(clicked()),                  SIGNAL(clicked()),
121                  SLOT(setupAudioDevice()));                  SLOT(setupAudioDevice()));
122          QObject::connect(&routingModel,          QObject::connect(&m_routingModel,
123                  SIGNAL(dataChanged(const QModelIndex&, const QModelIndex&)),                  SIGNAL(dataChanged(const QModelIndex&, const QModelIndex&)),
124                  SLOT(optionsChanged()));                  SLOT(optionsChanged()));
125          QObject::connect(&routingModel,          QObject::connect(&m_routingModel,
126                  SIGNAL(dataChanged(const QModelIndex&, const QModelIndex&)),                  SIGNAL(dataChanged(const QModelIndex&, const QModelIndex&)),
127                  SLOT(updateTableCellRenderers(const QModelIndex&, const QModelIndex&)));                  SLOT(updateTableCellRenderers(const QModelIndex&, const QModelIndex&)));
128          QObject::connect(&routingModel,          QObject::connect(&m_routingModel,
129                  SIGNAL(modelReset()),                  SIGNAL(modelReset()),
130                  SLOT(updateTableCellRenderers()));                  SLOT(updateTableCellRenderers()));
131  }  }
# Line 130  ChannelForm::~ChannelForm() Line 145  ChannelForm::~ChannelForm()
145    
146    
147  // Channel dialog setup formal initializer.  // Channel dialog setup formal initializer.
148  void ChannelForm::setup ( qsamplerChannel *pChannel )  void ChannelForm::setup ( Channel *pChannel )
149  {  {
150          m_pChannel = pChannel;          m_pChannel = pChannel;
151    
# Line 141  void ChannelForm::setup ( qsamplerChanne Line 156  void ChannelForm::setup ( qsamplerChanne
156                  return;                  return;
157    
158          // It can be a brand new channel, remember?          // It can be a brand new channel, remember?
159          bool bNew = (m_pChannel->channelID() < 0);          const bool bNew = (m_pChannel->channelID() < 0);
160          setWindowTitle(QSAMPLER_TITLE ": " + m_pChannel->channelName());          setWindowTitle(QSAMPLER_TITLE ": " + m_pChannel->channelName());
161    
162          // Check if we're up and connected.          // Check if we're up and connected.
# Line 151  void ChannelForm::setup ( qsamplerChanne Line 166  void ChannelForm::setup ( qsamplerChanne
166          if (pMainForm->client() == NULL)          if (pMainForm->client() == NULL)
167                  return;                  return;
168    
169          qsamplerOptions *pOptions = pMainForm->options();          Options *pOptions = pMainForm->options();
170          if (pOptions == NULL)          if (pOptions == NULL)
171                  return;                  return;
172    
# Line 159  void ChannelForm::setup ( qsamplerChanne Line 174  void ChannelForm::setup ( qsamplerChanne
174          m_iDirtySetup++;          m_iDirtySetup++;
175    
176          // Load combo box history...          // Load combo box history...
177          pOptions->loadComboBoxHistory(ui.InstrumentFileComboBox);          pOptions->loadComboBoxHistory(m_ui.InstrumentFileComboBox);
178    
179          // Populate Engines list.          // Populate Engines list.
180          const char **ppszEngines = ::lscp_list_available_engines(pMainForm->client());          const char **ppszEngines = ::lscp_list_available_engines(pMainForm->client());
181          if (ppszEngines) {          if (ppszEngines) {
182                  ui.EngineNameComboBox->clear();                  m_ui.EngineNameComboBox->clear();
183                  for (int iEngine = 0; ppszEngines[iEngine]; iEngine++)                  for (int iEngine = 0; ppszEngines[iEngine]; iEngine++)
184                          ui.EngineNameComboBox->addItem(QString(ppszEngines[iEngine]));                          m_ui.EngineNameComboBox->addItem(QString(ppszEngines[iEngine]));
185          }          }
186          else m_pChannel->appendMessagesClient("lscp_list_available_engines");          else m_pChannel->appendMessagesClient("lscp_list_available_engines");
187    
188          // Populate Audio output type list.          // Populate Audio output type list.
189          ui.AudioDriverComboBox->clear();          m_ui.AudioDriverComboBox->clear();
190          ui.AudioDriverComboBox->insertItems(0,          m_ui.AudioDriverComboBox->insertItems(0,
191                  qsamplerDevice::getDrivers(pMainForm->client(), qsamplerDevice::Audio));                  Device::getDrivers(pMainForm->client(), Device::Audio));
192    
193          // Populate MIDI input type list.          // Populate MIDI input type list.
194          ui.MidiDriverComboBox->clear();          m_ui.MidiDriverComboBox->clear();
195          ui.MidiDriverComboBox->insertItems(0,          m_ui.MidiDriverComboBox->insertItems(0,
196                  qsamplerDevice::getDrivers(pMainForm->client(), qsamplerDevice::Midi));                  Device::getDrivers(pMainForm->client(), Device::Midi));
197    
198          // Populate Maps list.          // Populate Maps list.
199          ui.MidiMapComboBox->clear();          m_ui.MidiMapComboBox->clear();
200          ui.MidiMapComboBox->insertItems(0,          m_ui.MidiMapComboBox->insertItems(0,
201                  qsamplerInstrument::getMapNames());                  Instrument::getMapNames());
202    
203          // Read proper channel information,          // Read proper channel information,
204          // and populate the channel form fields.          // and populate the channel form fields.
# Line 193  void ChannelForm::setup ( qsamplerChanne Line 208  void ChannelForm::setup ( qsamplerChanne
208          if (sEngineName.isEmpty() || bNew)          if (sEngineName.isEmpty() || bNew)
209                  sEngineName = pOptions->sEngineName;                  sEngineName = pOptions->sEngineName;
210          if (sEngineName.isEmpty())          if (sEngineName.isEmpty())
211                  sEngineName = qsamplerChannel::noEngineName();                  sEngineName = Channel::noEngineName();
212          if (ui.EngineNameComboBox->findText(sEngineName,          if (m_ui.EngineNameComboBox->findText(sEngineName,
213                          Qt::MatchExactly | Qt::MatchCaseSensitive) < 0) {                          Qt::MatchExactly | Qt::MatchCaseSensitive) < 0) {
214                  ui.EngineNameComboBox->addItem(sEngineName);                  m_ui.EngineNameComboBox->addItem(sEngineName);
215          }          }
216          ui.EngineNameComboBox->setCurrentIndex(          m_ui.EngineNameComboBox->setCurrentIndex(
217                  ui.EngineNameComboBox->findText(sEngineName,                  m_ui.EngineNameComboBox->findText(sEngineName,
218                          Qt::MatchExactly | Qt::MatchCaseSensitive));                          Qt::MatchExactly | Qt::MatchCaseSensitive));
219    
220          // Instrument filename and index...          // Instrument filename and index...
221          QString sInstrumentFile = pChannel->instrumentFile();          QString sInstrumentFile = pChannel->instrumentFile();
222          if (sInstrumentFile.isEmpty())          if (sInstrumentFile.isEmpty())
223                  sInstrumentFile = qsamplerChannel::noInstrumentName();                  sInstrumentFile = Channel::noInstrumentName();
224          ui.InstrumentFileComboBox->setEditText(sInstrumentFile);          m_ui.InstrumentFileComboBox->setEditText(sInstrumentFile);
225          ui.InstrumentNrComboBox->clear();          m_ui.InstrumentNrComboBox->clear();
226          ui.InstrumentNrComboBox->insertItems(0,          m_ui.InstrumentNrComboBox->insertItems(0,
227                  qsamplerChannel::getInstrumentList(sInstrumentFile,                  Channel::getInstrumentList(sInstrumentFile,
228                  pOptions->bInstrumentNames));                  pOptions->bInstrumentNames));
229          ui.InstrumentNrComboBox->setCurrentIndex(pChannel->instrumentNr());          int iInstrumentNr = pChannel->instrumentNr();
230            if (iInstrumentNr < 0)
231                    iInstrumentNr = 0;
232            m_ui.InstrumentNrComboBox->setCurrentIndex(iInstrumentNr);
233    
234          // MIDI input device...          // MIDI input device...
235          qsamplerDevice midiDevice(qsamplerDevice::Midi, m_pChannel->midiDevice());          Device midiDevice(Device::Midi, m_pChannel->midiDevice());
236          // MIDI input driver...          // MIDI input driver...
237          QString sMidiDriver = midiDevice.driverName();          QString sMidiDriver = midiDevice.driverName();
238          if (sMidiDriver.isEmpty() || bNew)          if (sMidiDriver.isEmpty() || bNew)
239                  sMidiDriver = pOptions->sMidiDriver.toUpper();                  sMidiDriver = pOptions->sMidiDriver.toUpper();
240          if (!sMidiDriver.isEmpty()) {          if (!sMidiDriver.isEmpty()) {
241                  if (ui.MidiDriverComboBox->findText(sMidiDriver,                  if (m_ui.MidiDriverComboBox->findText(sMidiDriver,
242                                  Qt::MatchExactly | Qt::MatchCaseSensitive) < 0) {                                  Qt::MatchExactly | Qt::MatchCaseSensitive) < 0) {
243                          ui.MidiDriverComboBox->insertItem(0, sMidiDriver);                          m_ui.MidiDriverComboBox->insertItem(0, sMidiDriver);
244                  }                  }
245                  ui.MidiDriverComboBox->setItemText(                  m_ui.MidiDriverComboBox->setCurrentIndex(
246                          ui.MidiDriverComboBox->currentIndex(),                          m_ui.MidiDriverComboBox->findText(sMidiDriver,
247                          sMidiDriver);                                  Qt::MatchExactly | Qt::MatchCaseSensitive)
248                    );
249          }          }
250          selectMidiDriverItem(sMidiDriver);          selectMidiDriverItem(sMidiDriver);
251          if (!bNew) {          if (!bNew) {
252                  ui.MidiDeviceComboBox->setItemText(                  m_ui.MidiDeviceComboBox->setItemText(
253                          ui.MidiDeviceComboBox->currentIndex(),                          m_ui.MidiDeviceComboBox->currentIndex(),
254                          midiDevice.deviceName());                          midiDevice.deviceName());
255          }          }
256          selectMidiDeviceItem(ui.MidiDeviceComboBox->currentIndex());          selectMidiDeviceItem(m_ui.MidiDeviceComboBox->currentIndex());
257          // MIDI input port...          // MIDI input port...
258          ui.MidiPortSpinBox->setValue(pChannel->midiPort());          m_ui.MidiPortSpinBox->setValue(pChannel->midiPort());
259          // MIDI input channel...          // MIDI input channel...
260          int iMidiChannel = pChannel->midiChannel();          int iMidiChannel = pChannel->midiChannel();
261          // When new, try to suggest a sensible MIDI channel...          // When new, try to suggest a sensible MIDI channel...
262          if (iMidiChannel < 0)          if (iMidiChannel < 0)
263                  iMidiChannel = (::lscp_get_channels(pMainForm->client()) % 16);                  iMidiChannel = (::lscp_get_channels(pMainForm->client()) % 16);
264          ui.MidiChannelComboBox->setCurrentIndex(iMidiChannel);          m_ui.MidiChannelComboBox->setCurrentIndex(iMidiChannel);
265          // MIDI instrument map...          // MIDI instrument map...
266          int iMidiMap = (bNew ? pOptions->iMidiMap : pChannel->midiMap());          int iMidiMap = (bNew ? pOptions->iMidiMap : pChannel->midiMap());
267          // When new, try to suggest a sensible MIDI map...          // When new, try to suggest a sensible MIDI map...
268          if (iMidiMap < 0)          if (iMidiMap < 0)
269                  iMidiMap = 0;                  iMidiMap = 0;
270          const QString& sMapName = qsamplerInstrument::getMapName(iMidiMap);          const QString& sMapName = Instrument::getMapName(iMidiMap);
271          if (!sMapName.isEmpty()) {          if (!sMapName.isEmpty()) {
272                  ui.MidiMapComboBox->setItemText(                  m_ui.MidiMapComboBox->setItemText(
273                          ui.MidiMapComboBox->currentIndex(),                          m_ui.MidiMapComboBox->currentIndex(),
274                          sMapName);                          sMapName);
275          }          }
276          // It might be no maps around...          // It might be no maps around...
277          bool bMidiMapEnabled = (ui.MidiMapComboBox->count() > 0);          bool bMidiMapEnabled = (m_ui.MidiMapComboBox->count() > 0);
278          ui.MidiMapTextLabel->setEnabled(bMidiMapEnabled);          m_ui.MidiMapTextLabel->setEnabled(bMidiMapEnabled);
279          ui.MidiMapComboBox->setEnabled(bMidiMapEnabled);          m_ui.MidiMapComboBox->setEnabled(bMidiMapEnabled);
280    
281          // Audio output device...          // Audio output device...
282          qsamplerDevice audioDevice(qsamplerDevice::Audio, m_pChannel->audioDevice());          Device audioDevice(Device::Audio, m_pChannel->audioDevice());
283          // Audio output driver...          // Audio output driver...
284          QString sAudioDriver = audioDevice.driverName();          QString sAudioDriver = audioDevice.driverName();
285          if (sAudioDriver.isEmpty() || bNew)          if (sAudioDriver.isEmpty() || bNew)
286                  sAudioDriver = pOptions->sAudioDriver.toUpper();                  sAudioDriver = pOptions->sAudioDriver.toUpper();
287          if (!sAudioDriver.isEmpty()) {          if (!sAudioDriver.isEmpty()) {
288                  if (ui.AudioDriverComboBox->findText(sAudioDriver,                  if (m_ui.AudioDriverComboBox->findText(sAudioDriver,
289                                  Qt::MatchExactly | Qt::MatchCaseSensitive) < 0) {                                  Qt::MatchExactly | Qt::MatchCaseSensitive) < 0) {
290                          ui.AudioDriverComboBox->insertItem(0, sAudioDriver);                          m_ui.AudioDriverComboBox->insertItem(0, sAudioDriver);
291                  }                  }
292                  ui.AudioDriverComboBox->setItemText(                  m_ui.AudioDriverComboBox->setCurrentIndex(
293                          ui.AudioDriverComboBox->currentIndex(),                          m_ui.AudioDriverComboBox->findText(sAudioDriver,
294                          sAudioDriver);                                  Qt::MatchExactly | Qt::MatchCaseSensitive)
295                    );
296          }          }
297          selectAudioDriverItem(sAudioDriver);          selectAudioDriverItem(sAudioDriver);
298          if (!bNew) {          if (!bNew) {
299                  ui.AudioDeviceComboBox->setItemText(                  m_ui.AudioDeviceComboBox->setItemText(
300                          ui.AudioDeviceComboBox->currentIndex(),                          m_ui.AudioDeviceComboBox->currentIndex(),
301                          audioDevice.deviceName());                          audioDevice.deviceName());
302          }          }
303          selectAudioDeviceItem(ui.AudioDeviceComboBox->currentIndex());          selectAudioDeviceItem(m_ui.AudioDeviceComboBox->currentIndex());
304    
305            // Let the audio routing table see the light,
306            // if we're editing an existing sampler channel...
307            m_ui.AudioRoutingTable->setVisible(!bNew);
308    
309            const QString sInstrumentNrToolTip =
310                    (pOptions->bInstrumentNames) ?
311                            "Select an instrument of the file" :
312                            "You might want to enable instrument name retrieval in the "
313                            "settings dialog";
314            m_ui.InstrumentNrComboBox->setToolTip(
315                    QObject::tr(sInstrumentNrToolTip.toUtf8().data())
316            );
317    
318          // As convenient, make it ready on stabilizeForm() for          // As convenient, make it ready on stabilizeForm() for
319          // prompt acceptance, if we got the minimum required...          // prompt acceptance, if we got the minimum required...
320  /*      if (sEngineName != qsamplerChannel::noEngineName() &&  /*      if (sEngineName != Channel::noEngineName() &&
321                  sInstrumentFile != qsamplerChannel::noInstrumentName())                  sInstrumentFile != Channel::noInstrumentName())
322                  m_iDirtyCount++; */                  m_iDirtyCount++; */
323          // Done.          // Done.
324          m_iDirtySetup--;          m_iDirtySetup--;
# Line 305  void ChannelForm::accept (void) Line 338  void ChannelForm::accept (void)
338          if (pMainForm->client() == NULL)          if (pMainForm->client() == NULL)
339                  return;                  return;
340    
341          qsamplerOptions *pOptions = pMainForm->options();          Options *pOptions = pMainForm->options();
342          if (pOptions == NULL)          if (pOptions == NULL)
343                  return;                  return;
344    
345          // Flush any pending editing...          // Flush any pending editing...
346          //ui.AudioRoutingTable->flush();          //m_ui.AudioRoutingTable->flush();
347    
348          // We'll go for it!          // We'll go for it!
349          if (m_iDirtyCount > 0) {          if (m_iDirtyCount > 0) {
# Line 320  void ChannelForm::accept (void) Line 353  void ChannelForm::accept (void)
353                          iErrors++;                          iErrors++;
354                  // Accept Audio driver or device selection...                  // Accept Audio driver or device selection...
355                  if (m_audioDevices.isEmpty()) {                  if (m_audioDevices.isEmpty()) {
356                          if (!m_pChannel->setAudioDriver(ui.AudioDriverComboBox->currentText()))                          if (!m_pChannel->setAudioDriver(m_ui.AudioDriverComboBox->currentText()))
357                                  iErrors++;                                  iErrors++;
358                  } else {                  } else {
359                          qsamplerDevice *pDevice = NULL;                          Device *pDevice = NULL;
360                          int iAudioItem = ui.AudioDeviceComboBox->currentIndex();                          int iAudioItem = m_ui.AudioDeviceComboBox->currentIndex();
361                          if (iAudioItem >= 0 && iAudioItem < m_audioDevices.count())                          if (iAudioItem >= 0 && iAudioItem < m_audioDevices.count())
362                                  pDevice = m_audioDevices.at(iAudioItem);                                  pDevice = m_audioDevices.at(iAudioItem);
363                          qsamplerChannelRoutingMap routingMap = routingModel.routingMap();                          ChannelRoutingMap routingMap = m_routingModel.routingMap();
364                          if (pDevice == NULL)                          if (pDevice == NULL)
365                                  iErrors++;                                  iErrors++;
366                          else if (!m_pChannel->setAudioDevice(pDevice->deviceID()))                          else if (!m_pChannel->setAudioDevice(pDevice->deviceID()))
367                                  iErrors++;                                  iErrors++;
368                          else if (!routingMap.isEmpty()) {                          else if (!routingMap.isEmpty()) {
369                                  // Set the audio route changes...                                  // Set the audio route changes...
370                                  qsamplerChannelRoutingMap::ConstIterator iter;                                  ChannelRoutingMap::ConstIterator iter;
371                                  for (iter = routingMap.begin();                                  for (iter = routingMap.begin();
372                                                  iter != routingMap.end(); ++iter) {                                                  iter != routingMap.end(); ++iter) {
373                                          if (!m_pChannel->setAudioChannel(iter.key(), iter.value()))                                          if (!m_pChannel->setAudioChannel(iter.key(), iter.value()))
# Line 344  void ChannelForm::accept (void) Line 377  void ChannelForm::accept (void)
377                  }                  }
378                  // Accept MIDI driver or device selection...                  // Accept MIDI driver or device selection...
379                  if (m_midiDevices.isEmpty()) {                  if (m_midiDevices.isEmpty()) {
380                          if (!m_pChannel->setMidiDriver(ui.MidiDriverComboBox->currentText()))                          if (!m_pChannel->setMidiDriver(m_ui.MidiDriverComboBox->currentText()))
381                                  iErrors++;                                  iErrors++;
382                  } else {                  } else {
383                          qsamplerDevice *pDevice = NULL;                          Device *pDevice = NULL;
384                          int iMidiItem = ui.MidiDeviceComboBox->currentIndex();                          int iMidiItem = m_ui.MidiDeviceComboBox->currentIndex();
385                          if (iMidiItem >= 0 && iMidiItem < m_midiDevices.count())                          if (iMidiItem >= 0 && iMidiItem < m_midiDevices.count())
386                                  pDevice = m_midiDevices.at(iMidiItem);                                  pDevice = m_midiDevices.at(iMidiItem);
387                          if (pDevice == NULL)                          if (pDevice == NULL)
# Line 357  void ChannelForm::accept (void) Line 390  void ChannelForm::accept (void)
390                                  iErrors++;                                  iErrors++;
391                  }                  }
392                  // MIDI input port number...                  // MIDI input port number...
393                  if (!m_pChannel->setMidiPort(ui.MidiPortSpinBox->value()))                  if (!m_pChannel->setMidiPort(m_ui.MidiPortSpinBox->value()))
394                          iErrors++;                          iErrors++;
395                  // MIDI input channel...                  // MIDI input channel...
396                  if (!m_pChannel->setMidiChannel(ui.MidiChannelComboBox->currentIndex()))                  if (!m_pChannel->setMidiChannel(m_ui.MidiChannelComboBox->currentIndex()))
397                          iErrors++;                          iErrors++;
398                  // Engine name...                  // Engine name...
399                  if (!m_pChannel->loadEngine(ui.EngineNameComboBox->currentText()))                  if (!m_pChannel->loadEngine(m_ui.EngineNameComboBox->currentText()))
400                          iErrors++;                          iErrors++;
401                  // Instrument file and index...                  // Instrument file and index...
402                  const QString& sPath = ui.InstrumentFileComboBox->currentText();                  const QString& sPath = m_ui.InstrumentFileComboBox->currentText();
403                  if (!sPath.isEmpty() && QFileInfo(sPath).exists()) {                  if (!sPath.isEmpty() && QFileInfo(sPath).exists()) {
404                          if (!m_pChannel->loadInstrument(sPath, ui.InstrumentNrComboBox->currentIndex()))                          if (!m_pChannel->loadInstrument(sPath, m_ui.InstrumentNrComboBox->currentIndex()))
405                                  iErrors++;                                  iErrors++;
406                  }                  }
407                  // MIDI intrument map...                  // MIDI intrument map...
408                  if (!m_pChannel->setMidiMap(ui.MidiMapComboBox->currentIndex()))                  if (!m_pChannel->setMidiMap(m_ui.MidiMapComboBox->currentIndex()))
409                          iErrors++;                          iErrors++;
410                  // Show error messages?                  // Show error messages?
411                  if (iErrors > 0)                  if (iErrors > 0) {
412                          m_pChannel->appendMessagesError(tr("Some channel settings could not be set.\n\nSorry."));                          m_pChannel->appendMessagesError(
413                                    tr("Some channel settings could not be set.\n\nSorry."));
414                    }
415          }          }
416    
417          // Save default engine name, instrument directory and history...          // Save default engine name, instrument directory and history...
418          pOptions->sInstrumentDir = QFileInfo(          pOptions->sInstrumentDir = QFileInfo(
419                  ui.InstrumentFileComboBox->currentText()).dir().absolutePath();                  m_ui.InstrumentFileComboBox->currentText()).dir().absolutePath();
420          pOptions->sEngineName  = ui.EngineNameComboBox->currentText();          pOptions->sEngineName  = m_ui.EngineNameComboBox->currentText();
421          pOptions->sAudioDriver = ui.AudioDriverComboBox->currentText();          pOptions->sAudioDriver = m_ui.AudioDriverComboBox->currentText();
422          pOptions->sMidiDriver  = ui.MidiDriverComboBox->currentText();          pOptions->sMidiDriver  = m_ui.MidiDriverComboBox->currentText();
423          pOptions->iMidiMap     = ui.MidiMapComboBox->currentIndex();          pOptions->iMidiMap     = m_ui.MidiMapComboBox->currentIndex();
424          pOptions->saveComboBoxHistory(ui.InstrumentFileComboBox);          pOptions->saveComboBoxHistory(m_ui.InstrumentFileComboBox);
425    
426          // Just go with dialog acceptance.          // Just go with dialog acceptance.
427          QDialog::accept();          QDialog::accept();
# Line 399  void ChannelForm::reject (void) Line 434  void ChannelForm::reject (void)
434          bool bReject = true;          bool bReject = true;
435    
436          // Check if there's any pending changes...          // Check if there's any pending changes...
437          if (m_iDirtyCount > 0 && ui.OkPushButton->isEnabled()) {          if (m_iDirtyCount > 0 && m_ui.OkPushButton->isEnabled()) {
438                  switch (QMessageBox::warning(this,                  switch (QMessageBox::warning(this,
439                          QSAMPLER_TITLE ": " + tr("Warning"),                          QSAMPLER_TITLE ": " + tr("Warning"),
440                          tr("Some channel settings have been changed.\n\n"                          tr("Some channel settings have been changed.\n\n"
# Line 430  void ChannelForm::openInstrumentFile (vo Line 465  void ChannelForm::openInstrumentFile (vo
465          if (pMainForm->client() == NULL)          if (pMainForm->client() == NULL)
466                  return;                  return;
467    
468          qsamplerOptions *pOptions = pMainForm->options();          Options *pOptions = pMainForm->options();
469          if (pOptions == NULL)          if (pOptions == NULL)
470                  return;                  return;
471    
# Line 445  void ChannelForm::openInstrumentFile (vo Line 480  void ChannelForm::openInstrumentFile (vo
480          if (sInstrumentFile.isEmpty())          if (sInstrumentFile.isEmpty())
481                  return;                  return;
482    
483          ui.InstrumentFileComboBox->setEditText(sInstrumentFile);          m_ui.InstrumentFileComboBox->setEditText(sInstrumentFile);
484          updateInstrumentName();          updateInstrumentName();
485  }  }
486    
# Line 459  void ChannelForm::updateInstrumentName ( Line 494  void ChannelForm::updateInstrumentName (
494          if (pMainForm->client() == NULL)          if (pMainForm->client() == NULL)
495                  return;                  return;
496    
497          qsamplerOptions *pOptions = pMainForm->options();          Options *pOptions = pMainForm->options();
498          if (pOptions == NULL)          if (pOptions == NULL)
499                  return;                  return;
500    
501          // Finally this better idea would be to use libgig          // Finally this better idea would be to use libgig
502          // to retrieve the REAL instrument names.          // to retrieve the REAL instrument names.
503          ui.InstrumentNrComboBox->clear();          m_ui.InstrumentNrComboBox->clear();
504          ui.InstrumentNrComboBox->insertItems(0,          m_ui.InstrumentNrComboBox->insertItems(0,
505                  qsamplerChannel::getInstrumentList(                  Channel::getInstrumentList(
506                          ui.InstrumentFileComboBox->currentText(),                          m_ui.InstrumentFileComboBox->currentText(),
507                          pOptions->bInstrumentNames)                          pOptions->bInstrumentNames)
508          );          );
509    
# Line 477  void ChannelForm::updateInstrumentName ( Line 512  void ChannelForm::updateInstrumentName (
512    
513    
514  // Show device options dialog.  // Show device options dialog.
515  void ChannelForm::setupDevice ( qsamplerDevice *pDevice,  void ChannelForm::setupDevice ( Device *pDevice,
516          qsamplerDevice::qsamplerDeviceType deviceTypeMode,          Device::DeviceType deviceTypeMode,
517          const QString& sDriverName )          const QString& sDriverName )
518  {  {
         if (pDevice == NULL)  
                 return;  
   
519          MainForm *pMainForm = MainForm::getInstance();          MainForm *pMainForm = MainForm::getInstance();
520          if (pMainForm == NULL)          if (pMainForm == NULL)
521                  return;                  return;
# Line 493  void ChannelForm::setupDevice ( qsampler Line 525  void ChannelForm::setupDevice ( qsampler
525          // Create the device form if not already...          // Create the device form if not already...
526          if (m_pDeviceForm == NULL) {          if (m_pDeviceForm == NULL) {
527                  m_pDeviceForm = new DeviceForm(this, Qt::Dialog);                  m_pDeviceForm = new DeviceForm(this, Qt::Dialog);
528          m_pDeviceForm->setAttribute(Qt::WA_ShowModal);                  m_pDeviceForm->setAttribute(Qt::WA_ShowModal);
529                  QObject::connect(m_pDeviceForm, SIGNAL(devicesChanged()),                  QObject::connect(m_pDeviceForm, SIGNAL(devicesChanged()),
530                          this, SLOT(updateDevices()));                          this, SLOT(updateDevices()));
531          }          }
# Line 523  void ChannelForm::selectMidiDriverItem ( Line 555  void ChannelForm::selectMidiDriverItem (
555          // Save current device id.          // Save current device id.
556          // Save current device id.          // Save current device id.
557          int iDeviceID = 0;          int iDeviceID = 0;
558          qsamplerDevice *pDevice = NULL;          Device *pDevice = NULL;
559          int iMidiItem = ui.MidiDeviceComboBox->currentIndex();          int iMidiItem = m_ui.MidiDeviceComboBox->currentIndex();
560          if (iMidiItem >= 0 && iMidiItem < m_midiDevices.count())          if (iMidiItem >= 0 && iMidiItem < m_midiDevices.count())
561                  pDevice = m_midiDevices.at(iMidiItem);                  pDevice = m_midiDevices.at(iMidiItem);
562          if (pDevice)          if (pDevice)
563                  iDeviceID = pDevice->deviceID();                  iDeviceID = pDevice->deviceID();
564    
565          // Clean maplist.          // Clean maplist.
566          ui.MidiDeviceComboBox->clear();          m_ui.MidiDeviceComboBox->clear();
567          qDeleteAll(m_midiDevices);          qDeleteAll(m_midiDevices);
568          m_midiDevices.clear();          m_midiDevices.clear();
569    
570          // Populate with the current ones...          // Populate with the current ones...
571          const QPixmap midiPixmap(":/icons/midi2.png");          const QPixmap midiPixmap(":/icons/midi2.png");
572          int *piDeviceIDs = qsamplerDevice::getDevices(pMainForm->client(),          int *piDeviceIDs = Device::getDevices(pMainForm->client(),
573                  qsamplerDevice::Midi);                  Device::Midi);
574          for (int i = 0; piDeviceIDs && piDeviceIDs[i] >= 0; i++) {          for (int i = 0; piDeviceIDs && piDeviceIDs[i] >= 0; i++) {
575                  pDevice = new qsamplerDevice(qsamplerDevice::Midi, piDeviceIDs[i]);                  pDevice = new Device(Device::Midi, piDeviceIDs[i]);
576                  if (pDevice->driverName().toUpper() == sDriverName) {                  if (pDevice->driverName().toUpper() == sDriverName) {
577                          ui.MidiDeviceComboBox->insertItem(0, midiPixmap, pDevice->deviceName());                          m_ui.MidiDeviceComboBox->insertItem(0,
578                                    midiPixmap, pDevice->deviceName());
579                          m_midiDevices.append(pDevice);                          m_midiDevices.append(pDevice);
580                  } else {                  } else {
581                          delete pDevice;                          delete pDevice;
# Line 554  void ChannelForm::selectMidiDriverItem ( Line 587  void ChannelForm::selectMidiDriverItem (
587          if (bEnabled) {          if (bEnabled) {
588                  // Select the previous current device...                  // Select the previous current device...
589                  iMidiItem = 0;                  iMidiItem = 0;
590                  QListIterator<qsamplerDevice *> iter(m_midiDevices);                  QListIterator<Device *> iter(m_midiDevices);
591                  while (iter.hasNext()) {                  while (iter.hasNext()) {
592                          pDevice = iter.next();                          pDevice = iter.next();
593                          if (pDevice->deviceID() == iDeviceID) {                          if (pDevice->deviceID() == iDeviceID) {
594                                  ui.MidiDeviceComboBox->setCurrentIndex(iMidiItem);                                  m_ui.MidiDeviceComboBox->setCurrentIndex(iMidiItem);
595                                  selectMidiDeviceItem(iMidiItem);                                  selectMidiDeviceItem(iMidiItem);
596                                  break;                                  break;
597                          }                          }
598                          iMidiItem++;                          iMidiItem++;
599                  }                  }
600          } else {          } else {
601                  ui.MidiDeviceComboBox->insertItem(0,                  m_ui.MidiDeviceComboBox->insertItem(0,
602                          tr("(New MIDI %1 device)").arg(sMidiDriver));                          tr("(New MIDI %1 device)").arg(sMidiDriver));
603          }          }
604          ui.MidiDeviceTextLabel->setEnabled(bEnabled);          m_ui.MidiDeviceTextLabel->setEnabled(bEnabled);
605          ui.MidiDeviceComboBox->setEnabled(bEnabled);          m_ui.MidiDeviceComboBox->setEnabled(bEnabled);
606  }  }
607    
608    
# Line 587  void ChannelForm::selectMidiDriver ( con Line 620  void ChannelForm::selectMidiDriver ( con
620  // Select MIDI device item.  // Select MIDI device item.
621  void ChannelForm::selectMidiDeviceItem ( int iMidiItem )  void ChannelForm::selectMidiDeviceItem ( int iMidiItem )
622  {  {
623          qsamplerDevice *pDevice = NULL;          Device *pDevice = NULL;
624          if (iMidiItem >= 0 && iMidiItem < m_midiDevices.count())          if (iMidiItem >= 0 && iMidiItem < m_midiDevices.count())
625                  pDevice = m_midiDevices.at(iMidiItem);                  pDevice = m_midiDevices.at(iMidiItem);
626          if (pDevice) {          if (pDevice) {
627                  const qsamplerDeviceParamMap& params = pDevice->params();                  const DeviceParamMap& params = pDevice->params();
628                  int iPorts = params["PORTS"].value.toInt();                  int iPorts = params["PORTS"].value.toInt();
629                  ui.MidiPortTextLabel->setEnabled(iPorts > 0);                  m_ui.MidiPortTextLabel->setEnabled(iPorts > 0);
630                  ui.MidiPortSpinBox->setEnabled(iPorts > 0);                  m_ui.MidiPortSpinBox->setEnabled(iPorts > 0);
631                  if (iPorts > 0)                  if (iPorts > 0)
632                          ui.MidiPortSpinBox->setMaximum(iPorts - 1);                          m_ui.MidiPortSpinBox->setMaximum(iPorts - 1);
633          }          }
634  }  }
635    
# Line 615  void ChannelForm::selectMidiDevice ( int Line 648  void ChannelForm::selectMidiDevice ( int
648  // MIDI device options.  // MIDI device options.
649  void ChannelForm::setupMidiDevice (void)  void ChannelForm::setupMidiDevice (void)
650  {  {
651          qsamplerDevice *pDevice = NULL;          Device *pDevice = NULL;
652          int iMidiItem = ui.MidiDeviceComboBox->currentIndex();          int iMidiItem = m_ui.MidiDeviceComboBox->currentIndex();
653          if (iMidiItem >= 0 && iMidiItem < m_midiDevices.count())          if (iMidiItem >= 0 && iMidiItem < m_midiDevices.count())
654                  pDevice = m_midiDevices.at(iMidiItem);                  pDevice = m_midiDevices.at(iMidiItem);
655          setupDevice(pDevice,          setupDevice(pDevice,
656                  qsamplerDevice::Midi, ui.MidiDriverComboBox->currentText());                  Device::Midi, m_ui.MidiDriverComboBox->currentText());
657  }  }
658    
659    
# Line 637  void ChannelForm::selectAudioDriverItem Line 670  void ChannelForm::selectAudioDriverItem
670    
671          // Save current device id.          // Save current device id.
672          int iDeviceID = 0;          int iDeviceID = 0;
673          qsamplerDevice *pDevice = NULL;          Device *pDevice = NULL;
674          int iAudioItem = ui.AudioDeviceComboBox->currentIndex();          int iAudioItem = m_ui.AudioDeviceComboBox->currentIndex();
675          if (iAudioItem >= 0 && iAudioItem < m_audioDevices.count())          if (iAudioItem >= 0 && iAudioItem < m_audioDevices.count())
676                  pDevice = m_audioDevices.at(iAudioItem);                  pDevice = m_audioDevices.at(iAudioItem);
677          if (pDevice)          if (pDevice)
678                  iDeviceID = pDevice->deviceID();                  iDeviceID = pDevice->deviceID();
679    
680          // Clean maplist.          // Clean maplist.
681          ui.AudioDeviceComboBox->clear();          m_ui.AudioDeviceComboBox->clear();
682          qDeleteAll(m_audioDevices);          qDeleteAll(m_audioDevices);
683          m_audioDevices.clear();          m_audioDevices.clear();
684    
685          // Populate with the current ones...          // Populate with the current ones...
686          const QPixmap audioPixmap(":/icons/audio2.png");          const QPixmap audioPixmap(":/icons/audio2.png");
687          int *piDeviceIDs = qsamplerDevice::getDevices(pMainForm->client(),          int *piDeviceIDs = Device::getDevices(pMainForm->client(),
688                  qsamplerDevice::Audio);                  Device::Audio);
689          for (int i = 0; piDeviceIDs && piDeviceIDs[i] >= 0; i++) {          for (int i = 0; piDeviceIDs && piDeviceIDs[i] >= 0; i++) {
690                  pDevice = new qsamplerDevice(qsamplerDevice::Audio, piDeviceIDs[i]);                  pDevice = new Device(Device::Audio, piDeviceIDs[i]);
691                  if (pDevice->driverName().toUpper() == sDriverName) {                  if (pDevice->driverName().toUpper() == sDriverName) {
692                          ui.AudioDeviceComboBox->insertItem(0, audioPixmap, pDevice->deviceName());                          m_ui.AudioDeviceComboBox->insertItem(0,
693                                    audioPixmap, pDevice->deviceName());
694                          m_audioDevices.append(pDevice);                          m_audioDevices.append(pDevice);
695                  } else {                  } else {
696                          delete pDevice;                          delete pDevice;
# Line 668  void ChannelForm::selectAudioDriverItem Line 702  void ChannelForm::selectAudioDriverItem
702          if (bEnabled) {          if (bEnabled) {
703                  // Select the previous current device...                  // Select the previous current device...
704                  iAudioItem = 0;                  iAudioItem = 0;
705                  QListIterator<qsamplerDevice *> iter(m_audioDevices);                  QListIterator<Device *> iter(m_audioDevices);
706                  while (iter.hasNext()) {                  while (iter.hasNext()) {
707                          pDevice = iter.next();                          pDevice = iter.next();
708                          if (pDevice->deviceID() == iDeviceID) {                          if (pDevice->deviceID() == iDeviceID) {
709                                  ui.AudioDeviceComboBox->setCurrentIndex(iAudioItem);                                  m_ui.AudioDeviceComboBox->setCurrentIndex(iAudioItem);
710                                  selectAudioDeviceItem(iAudioItem);                                  selectAudioDeviceItem(iAudioItem);
711                                  break;                                  break;
712                          }                          }
713                          iAudioItem++;                          iAudioItem++;
714                  }                  }
715          } else {          } else {
716                  ui.AudioDeviceComboBox->insertItem(0,                  m_ui.AudioDeviceComboBox->insertItem(0,
717                          tr("(New Audio %1 device)").arg(sAudioDriver));                          tr("(New Audio %1 device)").arg(sAudioDriver));
718                  //ui.AudioRoutingTable->setNumRows(0);                  //m_ui.AudioRoutingTable->setNumRows(0);
719          }          }
720          ui.AudioDeviceTextLabel->setEnabled(bEnabled);          m_ui.AudioDeviceTextLabel->setEnabled(bEnabled);
721          ui.AudioDeviceComboBox->setEnabled(bEnabled);          m_ui.AudioDeviceComboBox->setEnabled(bEnabled);
722          ui.AudioRoutingTable->setEnabled(bEnabled);          m_ui.AudioRoutingTable->setEnabled(bEnabled);
723  }  }
724    
725    
# Line 703  void ChannelForm::selectAudioDriver ( co Line 737  void ChannelForm::selectAudioDriver ( co
737  // Select Audio device item.  // Select Audio device item.
738  void ChannelForm::selectAudioDeviceItem ( int iAudioItem )  void ChannelForm::selectAudioDeviceItem ( int iAudioItem )
739  {  {
740          qsamplerDevice *pDevice = NULL;          Device *pDevice = NULL;
741          if (iAudioItem >= 0 && iAudioItem < m_audioDevices.count())          if (iAudioItem >= 0 && iAudioItem < m_audioDevices.count())
742                  pDevice = m_audioDevices.at(iAudioItem);                  pDevice = m_audioDevices.at(iAudioItem);
743          if (pDevice) {          if (pDevice) {
744                  // Refresh the audio routing table.                  // Refresh the audio routing table.
745                  routingModel.refresh(pDevice, m_pChannel->audioRouting());                  m_routingModel.refresh(pDevice, m_pChannel->audioRouting());
746                  // Reset routing change map.                  // Reset routing change map.
747                  routingModel.clear();                  m_routingModel.clear();
748          }          }
749  }  }
750    
# Line 729  void ChannelForm::selectAudioDevice ( in Line 763  void ChannelForm::selectAudioDevice ( in
763  // Audio device options.  // Audio device options.
764  void ChannelForm::setupAudioDevice (void)  void ChannelForm::setupAudioDevice (void)
765  {  {
766          qsamplerDevice *pDevice = NULL;          Device *pDevice = NULL;
767          int iAudioItem = ui.AudioDeviceComboBox->currentIndex();          int iAudioItem = m_ui.AudioDeviceComboBox->currentIndex();
768          if (iAudioItem >= 0 && iAudioItem < m_audioDevices.count())          if (iAudioItem >= 0 && iAudioItem < m_audioDevices.count())
769                  pDevice = m_audioDevices.at(iAudioItem);                  pDevice = m_audioDevices.at(iAudioItem);
770          setupDevice(pDevice,          setupDevice(pDevice,
771                  qsamplerDevice::Audio, ui.AudioDriverComboBox->currentText());                  Device::Audio, m_ui.AudioDriverComboBox->currentText());
772  }  }
773    
774  // UPdate all device lists slot.  // UPdate all device lists slot.
# Line 743  void ChannelForm::updateDevices (void) Line 777  void ChannelForm::updateDevices (void)
777          if (m_iDirtySetup > 0)          if (m_iDirtySetup > 0)
778                  return;                  return;
779    
780          selectMidiDriverItem(ui.MidiDriverComboBox->currentText());          selectMidiDriverItem(m_ui.MidiDriverComboBox->currentText());
781          selectAudioDriverItem(ui.AudioDriverComboBox->currentText());          selectAudioDriverItem(m_ui.AudioDriverComboBox->currentText());
782          optionsChanged();          optionsChanged();
783  }  }
784    
# Line 764  void ChannelForm::optionsChanged (void) Line 798  void ChannelForm::optionsChanged (void)
798  void ChannelForm::stabilizeForm (void)  void ChannelForm::stabilizeForm (void)
799  {  {
800          const bool bValid =          const bool bValid =
801                  ui.EngineNameComboBox->currentIndex() >= 0 &&                  m_ui.EngineNameComboBox->currentIndex() >= 0 &&
802                  ui.EngineNameComboBox->currentText() !=                  m_ui.EngineNameComboBox->currentText()
803                  qsamplerChannel::noEngineName();                          != Channel::noEngineName();
804  #if 0  #if 0
805          const QString& sPath = InstrumentFileComboBox->currentText();          const QString& sPath = InstrumentFileComboBox->currentText();
806          bValid = bValid && !sPath.isEmpty() && QFileInfo(sPath).exists();          bValid = bValid && !sPath.isEmpty() && QFileInfo(sPath).exists();
807  #endif  #endif
808          ui.OkPushButton->setEnabled(m_iDirtyCount > 0 && bValid);          m_ui.OkPushButton->setEnabled(m_iDirtyCount > 0 && bValid);
809    }
810    
811    
812    void ChannelForm::updateTableCellRenderers (void)
813    {
814            const int rows = m_routingModel.rowCount();
815            const int cols = m_routingModel.columnCount();
816            updateTableCellRenderers(
817                    m_routingModel.index(0, 0),
818                    m_routingModel.index(rows - 1, cols - 1));
819  }  }
820    
821  void ChannelForm::updateTableCellRenderers() {  
822      const int rows = routingModel.rowCount();  void ChannelForm::updateTableCellRenderers (
823      const int cols = routingModel.columnCount();          const QModelIndex& topLeft, const QModelIndex& bottomRight )
824      updateTableCellRenderers(routingModel.index(0,0),routingModel.index(rows-1,cols-1));  {
825  }          for (int r = topLeft.row(); r <= bottomRight.row(); r++) {
826                    for (int c = topLeft.column(); c <= bottomRight.column(); c++) {
827  void ChannelForm::updateTableCellRenderers(const QModelIndex& topLeft, const QModelIndex& bottomRight) {                          const QModelIndex index = m_routingModel.index(r, c);
828      for (int r = topLeft.row(); r <= bottomRight.row(); r++) {                          m_ui.AudioRoutingTable->openPersistentEditor(index);
829          for (int c = topLeft.column(); c <= bottomRight.column(); c++) {                  }
830              const QModelIndex index = routingModel.index(r,c);          }
             ui.AudioRoutingTable->openPersistentEditor(index);  
         }  
     }  
831  }  }
832    
833  } // namespace QSampler  } // namespace QSampler

Legend:
Removed from v.1506  
changed lines
  Added in v.1710

  ViewVC Help
Powered by ViewVC