/[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 149 by capela, Sat Jun 26 14:27:25 2004 UTC revision 295 by capela, Tue Nov 16 15:26:18 2004 UTC
# Line 26  Line 26 
26  #include <qfileinfo.h>  #include <qfileinfo.h>
27  #include <qlistbox.h>  #include <qlistbox.h>
28    
 #include "qsamplerOptions.h"  
 #include "qsamplerChannelStrip.h"  
   
29  #include "config.h"  #include "config.h"
30    
31    
# Line 53  void qsamplerChannelForm::destroy (void) Line 50  void qsamplerChannelForm::destroy (void)
50    
51    
52  // Channel dialog setup formal initializer.  // Channel dialog setup formal initializer.
53  void qsamplerChannelForm::setup ( qsamplerChannelStrip *pChannel )  void qsamplerChannelForm::setup ( qsamplerChannel *pChannel )
54  {  {
55      m_pChannel = pChannel;      m_pChannel = pChannel;
56    
# Line 63  void qsamplerChannelForm::setup ( qsampl Line 60  void qsamplerChannelForm::setup ( qsampl
60      if (m_pChannel == NULL)      if (m_pChannel == NULL)
61          return;          return;
62    
63      setCaption(m_pChannel->caption());      // It can be a brand new channel, remember?
64        bool bNew = (m_pChannel->channelID() < 0);
65        setCaption(m_pChannel->channelName());
66    
67      // Check if we're up and connected.      // Check if we're up and connected.
68      if (m_pChannel->client() == NULL)      if (m_pChannel->client() == NULL)
# Line 111  void qsamplerChannelForm::setup ( qsampl Line 110  void qsamplerChannelForm::setup ( qsampl
110    
111      // Engine name...      // Engine name...
112      QString sEngineName = pChannel->engineName();      QString sEngineName = pChannel->engineName();
113        if (sEngineName.isEmpty() && bNew)
114            sEngineName = pOptions->sEngineName;
115      if (sEngineName.isEmpty())      if (sEngineName.isEmpty())
116          sEngineName = tr("(No engine)");          sEngineName = tr("(No engine)");
117      if (EngineNameComboBox->listBox()->findItem(sEngineName, Qt::ExactMatch) == NULL)      if (EngineNameComboBox->listBox()->findItem(sEngineName, Qt::ExactMatch) == NULL)
# Line 122  void qsamplerChannelForm::setup ( qsampl Line 123  void qsamplerChannelForm::setup ( qsampl
123          sInstrumentFile = tr("(No instrument)");          sInstrumentFile = tr("(No instrument)");
124      InstrumentFileComboBox->setCurrentText(sInstrumentFile);      InstrumentFileComboBox->setCurrentText(sInstrumentFile);
125      InstrumentNrSpinBox->setValue(pChannel->instrumentNr());      InstrumentNrSpinBox->setValue(pChannel->instrumentNr());
126      // MIDI input...      // MIDI input driver...
127      const QString& sMidiDriver = pChannel->midiDriver();      QString sMidiDriver = pChannel->midiDriver();
128        if (sMidiDriver.isEmpty() || bNew)
129            sMidiDriver = pOptions->sMidiDriver;
130      if (!sMidiDriver.isEmpty()) {      if (!sMidiDriver.isEmpty()) {
131          if (MidiDriverComboBox->listBox()->findItem(sMidiDriver, Qt::ExactMatch) == NULL)          if (MidiDriverComboBox->listBox()->findItem(sMidiDriver, Qt::ExactMatch) == NULL)
132              MidiDriverComboBox->insertItem(sMidiDriver);              MidiDriverComboBox->insertItem(sMidiDriver);
133          MidiDriverComboBox->setCurrentText(sMidiDriver);          MidiDriverComboBox->setCurrentText(sMidiDriver);
134      }      }
135        // MIDI input port...
136      MidiPortSpinBox->setValue(pChannel->midiPort());      MidiPortSpinBox->setValue(pChannel->midiPort());
137      MidiChannelSpinBox->setValue(pChannel->midiChannel());      // MIDI input channel...
138      // Audio output...      int iMidiChannel = pChannel->midiChannel();
139      const QString& sAudioDriver = pChannel->audioDriver();      // When new, try to suggest a sensible MIDI channel...
140        if (iMidiChannel < 0)
141            iMidiChannel = (::lscp_get_channels(m_pChannel->client()) % 16);
142        MidiChannelComboBox->setCurrentItem(iMidiChannel);
143        // Audio output driver...
144        QString sAudioDriver = pChannel->audioDriver();
145        if (sAudioDriver.isEmpty() || bNew)
146            sAudioDriver = pOptions->sAudioDriver;
147      if (!sAudioDriver.isEmpty()) {      if (!sAudioDriver.isEmpty()) {
148          if (AudioDriverComboBox->listBox()->findItem(sAudioDriver, Qt::ExactMatch) == NULL)          if (AudioDriverComboBox->listBox()->findItem(sAudioDriver, Qt::ExactMatch) == NULL)
149              AudioDriverComboBox->insertItem(sAudioDriver);              AudioDriverComboBox->insertItem(sAudioDriver);
# Line 157  void qsamplerChannelForm::accept (void) Line 168  void qsamplerChannelForm::accept (void)
168      // We'll go for it!      // We'll go for it!
169      if (m_iDirtyCount > 0) {      if (m_iDirtyCount > 0) {
170          int iErrors = 0;          int iErrors = 0;
171            // Are we a new channel?
172            if (!m_pChannel->addChannel())
173                iErrors++;
174          // Audio output driver type...          // Audio output driver type...
175          if (!m_pChannel->setAudioDriver(AudioDriverComboBox->currentText()))          if (!m_pChannel->setAudioDriver(AudioDriverComboBox->currentText()))
176              iErrors++;              iErrors++;
# Line 164  void qsamplerChannelForm::accept (void) Line 178  void qsamplerChannelForm::accept (void)
178          if (!m_pChannel->setMidiDriver(MidiDriverComboBox->currentText()))          if (!m_pChannel->setMidiDriver(MidiDriverComboBox->currentText()))
179              iErrors++;              iErrors++;
180          // MIDI input port number...          // MIDI input port number...
         // FIXME: Should increment error count, when properly implemented.  
181          if (!m_pChannel->setMidiPort(MidiPortSpinBox->value()))          if (!m_pChannel->setMidiPort(MidiPortSpinBox->value()))
182          /*  iErrors++ */;              iErrors++;
183          // MIDI input channel...          // MIDI input channel...
184          if (!m_pChannel->setMidiChannel(MidiChannelSpinBox->value()))          if (!m_pChannel->setMidiChannel(MidiChannelComboBox->currentItem()))
185              iErrors++;              iErrors++;
186          // Engine name...          // Engine name...
187          if (!m_pChannel->loadEngine(EngineNameComboBox->currentText()))          if (!m_pChannel->loadEngine(EngineNameComboBox->currentText()))
# Line 181  void qsamplerChannelForm::accept (void) Line 194  void qsamplerChannelForm::accept (void)
194              m_pChannel->appendMessagesError(tr("Some channel settings could not be set.\n\nSorry."));              m_pChannel->appendMessagesError(tr("Some channel settings could not be set.\n\nSorry."));
195      }      }
196    
197      // Save default instrument directory and history...      // Save default engine name, instrument directory and history...
198      pOptions->sInstrumentDir = QFileInfo(InstrumentFileComboBox->currentText()).dirPath(true);      pOptions->sInstrumentDir = QFileInfo(InstrumentFileComboBox->currentText()).dirPath(true);
199        pOptions->sEngineName  = EngineNameComboBox->currentText();
200        pOptions->sAudioDriver = AudioDriverComboBox->currentText();
201        pOptions->sMidiDriver  = MidiDriverComboBox->currentText();
202      pOptions->saveComboBoxHistory(InstrumentFileComboBox);      pOptions->saveComboBoxHistory(InstrumentFileComboBox);
203    
204      // Just go with dialog acceptance.      // Just go with dialog acceptance.
# Line 196  void qsamplerChannelForm::reject (void) Line 212  void qsamplerChannelForm::reject (void)
212      bool bReject = true;      bool bReject = true;
213    
214      // Check if there's any pending changes...      // Check if there's any pending changes...
215      if (m_iDirtyCount > 0) {      if (m_iDirtyCount > 0 && OkPushButton->isEnabled()) {
216          switch (QMessageBox::warning(this, tr("Warning"),          switch (QMessageBox::warning(this, tr("Warning"),
217              tr("Some channel settings have been changed.\n\n"              tr("Some channel settings have been changed.\n\n"
218                 "Do you want to apply the changes?"),                 "Do you want to apply the changes?"),

Legend:
Removed from v.149  
changed lines
  Added in v.295

  ViewVC Help
Powered by ViewVC