/[svn]/qsampler/trunk/src/qsamplerChannelForm.ui.h
ViewVC logotype

Diff of /qsampler/trunk/src/qsamplerChannelForm.ui.h

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

revision 979 by capela, Sun Dec 3 18:26:13 2006 UTC revision 980 by capela, Sun Dec 17 22:29:29 2006 UTC
# Line 24  Line 24 
24  #include "qsamplerDeviceForm.h"  #include "qsamplerDeviceForm.h"
25    
26  #include "qsamplerMainForm.h"  #include "qsamplerMainForm.h"
27    #include "qsamplerInstrument.h"
28    
29    
30  #include <qvalidator.h>  #include <qvalidator.h>
31  #include <qmessagebox.h>  #include <qmessagebox.h>
# Line 115  void qsamplerChannelForm::setup ( qsampl Line 117  void qsamplerChannelForm::setup ( qsampl
117          MidiDriverComboBox->insertStringList(          MidiDriverComboBox->insertStringList(
118                  qsamplerDevice::getDrivers(pMainForm->client(), qsamplerDevice::Midi));                  qsamplerDevice::getDrivers(pMainForm->client(), qsamplerDevice::Midi));
119    
120            // Populate Maps list.
121            MidiMapComboBox->clear();
122            MidiMapComboBox->insertStringList(qsamplerInstrument::getMapNames());
123    
124          // Read proper channel information,          // Read proper channel information,
125          // and populate the channel form fields.          // and populate the channel form fields.
126    
# Line 165  void qsamplerChannelForm::setup ( qsampl Line 171  void qsamplerChannelForm::setup ( qsampl
171          if (iMidiChannel < 0)          if (iMidiChannel < 0)
172                  iMidiChannel = (::lscp_get_channels(pMainForm->client()) % 16);                  iMidiChannel = (::lscp_get_channels(pMainForm->client()) % 16);
173          MidiChannelComboBox->setCurrentItem(iMidiChannel);          MidiChannelComboBox->setCurrentItem(iMidiChannel);
174            // MIDI instrument map...
175            int iMidiMap = (bNew ? pOptions->iMidiMap : pChannel->midiMap());
176            // When new, try to suggest a sensible MIDI map...
177            if (iMidiMap < 0)
178                    iMidiMap = 0;
179            const QString& sMapName = qsamplerInstrument::getMapName(iMidiMap);
180            if (!sMapName.isEmpty())
181                    MidiMapComboBox->setCurrentText(sMapName);
182            // It might be no maps around...
183            bool bMidiMapEnabled = (MidiMapComboBox->count() > 0);
184            MidiMapTextLabel->setEnabled(bMidiMapEnabled);
185            MidiMapComboBox->setEnabled(bMidiMapEnabled);
186    
187          // Audio output device...          // Audio output device...
188          qsamplerDevice audioDevice(qsamplerDevice::Audio, m_pChannel->audioDevice());          qsamplerDevice audioDevice(qsamplerDevice::Audio, m_pChannel->audioDevice());
# Line 261  void qsamplerChannelForm::accept (void) Line 279  void qsamplerChannelForm::accept (void)
279                  if (!m_pChannel->loadEngine(EngineNameComboBox->currentText()))                  if (!m_pChannel->loadEngine(EngineNameComboBox->currentText()))
280                          iErrors++;                          iErrors++;
281                  // Instrument file and index...                  // Instrument file and index...
282                  if (!m_pChannel->loadInstrument(InstrumentFileComboBox->currentText(), InstrumentNrComboBox->currentItem()))                  const QString& sPath = InstrumentFileComboBox->currentText();
283                    if (!sPath.isEmpty() && QFileInfo(sPath).exists()) {
284                            if (!m_pChannel->loadInstrument(sPath, InstrumentNrComboBox->currentItem()))
285                                    iErrors++;
286                    }
287                    // MIDI intrument map...
288                    if (!m_pChannel->setMidiMap(MidiMapComboBox->currentItem()))
289                          iErrors++;                          iErrors++;
290                  // Show error messages?                  // Show error messages?
291                  if (iErrors > 0)                  if (iErrors > 0)
# Line 273  void qsamplerChannelForm::accept (void) Line 297  void qsamplerChannelForm::accept (void)
297          pOptions->sEngineName  = EngineNameComboBox->currentText();          pOptions->sEngineName  = EngineNameComboBox->currentText();
298          pOptions->sAudioDriver = AudioDriverComboBox->currentText();          pOptions->sAudioDriver = AudioDriverComboBox->currentText();
299          pOptions->sMidiDriver  = MidiDriverComboBox->currentText();          pOptions->sMidiDriver  = MidiDriverComboBox->currentText();
300            pOptions->iMidiMap     = MidiMapComboBox->currentItem();
301          pOptions->saveComboBoxHistory(InstrumentFileComboBox);          pOptions->saveComboBoxHistory(InstrumentFileComboBox);
302    
303          // Just go with dialog acceptance.          // Just go with dialog acceptance.
# Line 651  void qsamplerChannelForm::optionsChanged Line 676  void qsamplerChannelForm::optionsChanged
676  // Stabilize current form state.  // Stabilize current form state.
677  void qsamplerChannelForm::stabilizeForm (void)  void qsamplerChannelForm::stabilizeForm (void)
678  {  {
679          const QString& sFilename = InstrumentFileComboBox->currentText();          bool bValid = true;
680          OkPushButton->setEnabled(m_iDirtyCount > 0 && !sFilename.isEmpty() && QFileInfo(sFilename).exists());  
681            const QString& sPath = InstrumentFileComboBox->currentText();
682            bValid = bValid && !sPath.isEmpty() && QFileInfo(sPath).exists();
683    
684            OkPushButton->setEnabled(m_iDirtyCount > 0 && bValid);
685  }  }
686    
687    

Legend:
Removed from v.979  
changed lines
  Added in v.980

  ViewVC Help
Powered by ViewVC