/[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 104 by capela, Fri Jun 4 14:42:45 2004 UTC revision 264 by capela, Wed Sep 29 13:12:45 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, bool bNew )
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());      setCaption(tr("Channel %1").arg(m_pChannel->channelID()));
64    
65      // Check if we're up and connected.      // Check if we're up and connected.
66      if (m_pChannel->client() == NULL)      if (m_pChannel->client() == NULL)
# Line 87  void qsamplerChannelForm::setup ( qsampl Line 84  void qsamplerChannelForm::setup ( qsampl
84              EngineNameComboBox->insertItem(ppszEngines[iEngine]);              EngineNameComboBox->insertItem(ppszEngines[iEngine]);
85      }      }
86      else m_pChannel->appendMessagesClient("lscp_get_available_engines");      else m_pChannel->appendMessagesClient("lscp_get_available_engines");
87  /*  
88      // Populate Audio output type list.      // Populate Audio output type list.
89      const char **ppszAudioDrivers = ::lscp_get_available_audio_drivers(m_pChannel->client());      const char **ppszAudioDrivers = ::lscp_get_available_audio_drivers(m_pChannel->client());
90      if (ppszAudioDrivers) {      if (ppszAudioDrivers) {
# Line 105  void qsamplerChannelForm::setup ( qsampl Line 102  void qsamplerChannelForm::setup ( qsampl
102              MidiDriverComboBox->insertItem(ppszMidiDrivers[iMidiDriver]);              MidiDriverComboBox->insertItem(ppszMidiDrivers[iMidiDriver]);
103      }      }
104      else m_pChannel->appendMessagesClient("lscp_get_available_midi_drivers");      else m_pChannel->appendMessagesClient("lscp_get_available_midi_drivers");
105  */  
106      // Read proper channel information,      // Read proper channel information,
107      // and populate the channel form fields.      // and populate the channel form fields.
108    
109      // Engine name...      // Engine name...
110      const QString& sEngineName = pChannel->engineName();      QString sEngineName = pChannel->engineName();
111      if (!sEngineName.isEmpty()) {      if (sEngineName.isEmpty() && bNew)
112          if (EngineNameComboBox->listBox()->findItem(sEngineName, Qt::ExactMatch) == NULL)          sEngineName = pOptions->sEngineName;
113              EngineNameComboBox->insertItem(sEngineName);      if (sEngineName.isEmpty())
114          EngineNameComboBox->setCurrentText(sEngineName);          sEngineName = tr("(No engine)");
115      }      if (EngineNameComboBox->listBox()->findItem(sEngineName, Qt::ExactMatch) == NULL)
116            EngineNameComboBox->insertItem(sEngineName);
117        EngineNameComboBox->setCurrentText(sEngineName);
118      // Instrument filename and index...      // Instrument filename and index...
119      InstrumentFileComboBox->setCurrentText(pChannel->instrumentFile());      QString sInstrumentFile = pChannel->instrumentFile();
120        if (sInstrumentFile.isEmpty())
121            sInstrumentFile = tr("(No instrument)");
122        InstrumentFileComboBox->setCurrentText(sInstrumentFile);
123      InstrumentNrSpinBox->setValue(pChannel->instrumentNr());      InstrumentNrSpinBox->setValue(pChannel->instrumentNr());
124      // MIDI input...      // MIDI input driver...
125      const QString& sMidiDriver = pChannel->midiDriver();      QString sMidiDriver = pChannel->midiDriver();
126        if (sMidiDriver.isEmpty() && bNew)
127            sMidiDriver = pOptions->sMidiDriver;
128      if (!sMidiDriver.isEmpty()) {      if (!sMidiDriver.isEmpty()) {
129          if (MidiDriverComboBox->listBox()->findItem(sMidiDriver, Qt::ExactMatch) == NULL)          if (MidiDriverComboBox->listBox()->findItem(sMidiDriver, Qt::ExactMatch) == NULL)
130              MidiDriverComboBox->insertItem(sMidiDriver);              MidiDriverComboBox->insertItem(sMidiDriver);
131          MidiDriverComboBox->setCurrentText(sMidiDriver);          MidiDriverComboBox->setCurrentText(sMidiDriver);
132      }      }
133        // MIDI input port...
134      MidiPortSpinBox->setValue(pChannel->midiPort());      MidiPortSpinBox->setValue(pChannel->midiPort());
135      MidiChannelSpinBox->setValue(pChannel->midiChannel());      // MIDI input channel...
136      // Audio output...      int iMidiChannel = pChannel->midiChannel();
137      const QString& sAudioDriver = pChannel->audioDriver();      if (bNew)
138            iMidiChannel = (pChannel->channelID() + 1) % 16;
139        MidiChannelComboBox->setCurrentItem(iMidiChannel);
140        // Audio output driver...
141        QString sAudioDriver = pChannel->audioDriver();
142        if (sAudioDriver.isEmpty() && bNew)
143            sAudioDriver = pOptions->sAudioDriver;
144      if (!sAudioDriver.isEmpty()) {      if (!sAudioDriver.isEmpty()) {
145          if (AudioDriverComboBox->listBox()->findItem(sAudioDriver, Qt::ExactMatch) == NULL)          if (AudioDriverComboBox->listBox()->findItem(sAudioDriver, Qt::ExactMatch) == NULL)
146              AudioDriverComboBox->insertItem(sAudioDriver);              AudioDriverComboBox->insertItem(sAudioDriver);
147          AudioDriverComboBox->setCurrentText(sAudioDriver);          AudioDriverComboBox->setCurrentText(sAudioDriver);
148      }      }
     // FIXME: Disable this while we don't know what to do.  
     MidiPortTextLabel->setEnabled(false);  
     MidiPortSpinBox->setEnabled(false);  
149      // Done.      // Done.
150      m_iDirtySetup--;      m_iDirtySetup--;
151      stabilizeForm();      stabilizeForm();
# Line 157  void qsamplerChannelForm::accept (void) Line 165  void qsamplerChannelForm::accept (void)
165      // We'll go for it!      // We'll go for it!
166      if (m_iDirtyCount > 0) {      if (m_iDirtyCount > 0) {
167          int iErrors = 0;          int iErrors = 0;
168          // Engine name...          // Audio output driver type...
169          if (!m_pChannel->loadEngine(EngineNameComboBox->currentText()))          if (!m_pChannel->setAudioDriver(AudioDriverComboBox->currentText()))
170              iErrors++;              iErrors++;
171          // MIDI input driver type...          // MIDI input driver type...
172          if (!m_pChannel->setMidiDriver(MidiDriverComboBox->currentText()))          if (!m_pChannel->setMidiDriver(MidiDriverComboBox->currentText()))
# Line 167  void qsamplerChannelForm::accept (void) Line 175  void qsamplerChannelForm::accept (void)
175          if (!m_pChannel->setMidiPort(MidiPortSpinBox->value()))          if (!m_pChannel->setMidiPort(MidiPortSpinBox->value()))
176              iErrors++;              iErrors++;
177          // MIDI input channel...          // MIDI input channel...
178          if (!m_pChannel->setMidiChannel(MidiChannelSpinBox->value()))          if (!m_pChannel->setMidiChannel(MidiChannelComboBox->currentItem()))
179              iErrors++;              iErrors++;
180          // Audio output driver type...          // Engine name...
181          if (!m_pChannel->setAudioDriver(AudioDriverComboBox->currentText()))          if (!m_pChannel->loadEngine(EngineNameComboBox->currentText()))
182              iErrors++;              iErrors++;
183          // Instrument file and index...          // Instrument file and index...
184          if (!m_pChannel->loadInstrument(InstrumentFileComboBox->currentText(), InstrumentNrSpinBox->value()))          if (!m_pChannel->loadInstrument(InstrumentFileComboBox->currentText(), InstrumentNrSpinBox->value()))
# Line 180  void qsamplerChannelForm::accept (void) Line 188  void qsamplerChannelForm::accept (void)
188              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."));
189      }      }
190    
191      // Save default instrument directory and history...      // Save default engine name, instrument directory and history...
192      pOptions->sInstrumentDir = QFileInfo(InstrumentFileComboBox->currentText()).dirPath(true);      pOptions->sInstrumentDir = QFileInfo(InstrumentFileComboBox->currentText()).dirPath(true);
193        pOptions->sEngineName  = EngineNameComboBox->currentText();
194        pOptions->sAudioDriver = AudioDriverComboBox->currentText();
195        pOptions->sMidiDriver  = MidiDriverComboBox->currentText();
196      pOptions->saveComboBoxHistory(InstrumentFileComboBox);      pOptions->saveComboBoxHistory(InstrumentFileComboBox);
197    
198      // Just go with dialog acceptance.      // Just go with dialog acceptance.
# Line 195  void qsamplerChannelForm::reject (void) Line 206  void qsamplerChannelForm::reject (void)
206      bool bReject = true;      bool bReject = true;
207    
208      // Check if there's any pending changes...      // Check if there's any pending changes...
209      if (m_iDirtyCount > 0) {      if (m_iDirtyCount > 0 && OkPushButton->isEnabled()) {
210          switch (QMessageBox::warning(this, tr("Warning"),          switch (QMessageBox::warning(this, tr("Warning"),
211              tr("Some channel settings have been changed.\n\n"              tr("Some channel settings have been changed.\n\n"
212                 "Do you want to apply the changes?"),                 "Do you want to apply the changes?"),
# Line 265  void qsamplerChannelForm::optionsChanged Line 276  void qsamplerChannelForm::optionsChanged
276  // Stabilize current form state.  // Stabilize current form state.
277  void qsamplerChannelForm::stabilizeForm (void)  void qsamplerChannelForm::stabilizeForm (void)
278  {  {
279      const QString sFilename = InstrumentFileComboBox->currentText();      const QString& sFilename = InstrumentFileComboBox->currentText();
280      OkPushButton->setEnabled(m_iDirtyCount > 0 && !sFilename.isEmpty() && QFileInfo(sFilename).exists());      OkPushButton->setEnabled(m_iDirtyCount > 0 && !sFilename.isEmpty() && QFileInfo(sFilename).exists());
281  }  }
282    

Legend:
Removed from v.104  
changed lines
  Added in v.264

  ViewVC Help
Powered by ViewVC