/[svn]/qsampler/trunk/src/qsamplerInstrumentForm.cpp
ViewVC logotype

Diff of /qsampler/trunk/src/qsamplerInstrumentForm.cpp

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

revision 1557 by capela, Mon Nov 26 10:58:23 2007 UTC revision 1558 by capela, Thu Dec 6 09:35:33 2007 UTC
# Line 46  static inline long lroundf ( float x ) Line 46  static inline long lroundf ( float x )
46    
47  namespace QSampler {  namespace QSampler {
48    
49    //-------------------------------------------------------------------------
50    // QSampler::InstrumentForm -- Instrument map item form implementation.
51    //
52    
53  InstrumentForm::InstrumentForm ( QWidget* pParent )  InstrumentForm::InstrumentForm ( QWidget* pParent )
54          : QDialog(pParent)          : QDialog(pParent)
55  {  {
# Line 107  InstrumentForm::~InstrumentForm (void) Line 111  InstrumentForm::~InstrumentForm (void)
111    
112    
113  // Channel dialog setup formal initializer.  // Channel dialog setup formal initializer.
114  void InstrumentForm::setup ( qsamplerInstrument *pInstrument )  void InstrumentForm::setup ( Instrument *pInstrument )
115  {  {
116          m_pInstrument = pInstrument;          m_pInstrument = pInstrument;
117    
# Line 125  void InstrumentForm::setup ( qsamplerIns Line 129  void InstrumentForm::setup ( qsamplerIns
129          if (pMainForm->client() == NULL)          if (pMainForm->client() == NULL)
130                  return;                  return;
131    
132          qsamplerOptions *pOptions = pMainForm->options();          Options *pOptions = pMainForm->options();
133          if (pOptions == NULL)          if (pOptions == NULL)
134                  return;                  return;
135    
# Line 144  void InstrumentForm::setup ( qsamplerIns Line 148  void InstrumentForm::setup ( qsamplerIns
148    
149          // Populate maps list.          // Populate maps list.
150          m_ui.MapComboBox->clear();          m_ui.MapComboBox->clear();
151          m_ui.MapComboBox->insertItems(0, qsamplerInstrument::getMapNames());          m_ui.MapComboBox->insertItems(0, Instrument::getMapNames());
152    
153          // Populate Engines list.          // Populate Engines list.
154          const char **ppszEngines          const char **ppszEngines
# Line 163  void InstrumentForm::setup ( qsamplerIns Line 167  void InstrumentForm::setup ( qsamplerIns
167          int iMap = (bNew ? pOptions->iMidiMap : m_pInstrument->map());          int iMap = (bNew ? pOptions->iMidiMap : m_pInstrument->map());
168          if (iMap < 0)          if (iMap < 0)
169                  iMap = 0;                  iMap = 0;
170          const QString& sMapName = qsamplerInstrument::getMapName(iMap);          const QString& sMapName = Instrument::getMapName(iMap);
171          if (!sMapName.isEmpty()) {          if (!sMapName.isEmpty()) {
172                  m_ui.MapComboBox->setCurrentIndex(                  m_ui.MapComboBox->setCurrentIndex(
173                          m_ui.MapComboBox->findText(sMapName,                          m_ui.MapComboBox->findText(sMapName,
# Line 193  void InstrumentForm::setup ( qsamplerIns Line 197  void InstrumentForm::setup ( qsamplerIns
197          if (sEngineName.isEmpty() || bNew)          if (sEngineName.isEmpty() || bNew)
198                  sEngineName = pOptions->sEngineName;                  sEngineName = pOptions->sEngineName;
199          if (sEngineName.isEmpty())          if (sEngineName.isEmpty())
200                  sEngineName = qsamplerChannel::noEngineName();                  sEngineName = Channel::noEngineName();
201          if (m_ui.EngineNameComboBox->findText(sEngineName,          if (m_ui.EngineNameComboBox->findText(sEngineName,
202                          Qt::MatchExactly | Qt::MatchCaseSensitive) < 0) {                          Qt::MatchExactly | Qt::MatchCaseSensitive) < 0) {
203                  m_ui.EngineNameComboBox->addItem(sEngineName);                  m_ui.EngineNameComboBox->addItem(sEngineName);
# Line 205  void InstrumentForm::setup ( qsamplerIns Line 209  void InstrumentForm::setup ( qsamplerIns
209          // Instrument filename and index...          // Instrument filename and index...
210          QString sInstrumentFile = m_pInstrument->instrumentFile();          QString sInstrumentFile = m_pInstrument->instrumentFile();
211          if (sInstrumentFile.isEmpty())          if (sInstrumentFile.isEmpty())
212                  sInstrumentFile = qsamplerChannel::noInstrumentName();                  sInstrumentFile = Channel::noInstrumentName();
213          m_ui.InstrumentFileComboBox->setEditText(sInstrumentFile);          m_ui.InstrumentFileComboBox->setEditText(sInstrumentFile);
214          m_ui.InstrumentNrComboBox->clear();          m_ui.InstrumentNrComboBox->clear();
215          m_ui.InstrumentNrComboBox->insertItems(0,          m_ui.InstrumentNrComboBox->insertItems(0,
216                  qsamplerChannel::getInstrumentList(sInstrumentFile,                  Channel::getInstrumentList(sInstrumentFile,
217                  pOptions->bInstrumentNames));                  pOptions->bInstrumentNames));
218          m_ui.InstrumentNrComboBox->setCurrentIndex(m_pInstrument->instrumentNr());          m_ui.InstrumentNrComboBox->setCurrentIndex(m_pInstrument->instrumentNr());
219    
# Line 251  void InstrumentForm::openInstrumentFile Line 255  void InstrumentForm::openInstrumentFile
255          if (pMainForm == NULL)          if (pMainForm == NULL)
256                  return;                  return;
257    
258          qsamplerOptions *pOptions = pMainForm->options();          Options *pOptions = pMainForm->options();
259          if (pOptions == NULL)          if (pOptions == NULL)
260                  return;                  return;
261    
# Line 278  void InstrumentForm::updateInstrumentNam Line 282  void InstrumentForm::updateInstrumentNam
282          if (pMainForm == NULL)          if (pMainForm == NULL)
283                  return;                  return;
284    
285          qsamplerOptions *pOptions = pMainForm->options();          Options *pOptions = pMainForm->options();
286          if (pOptions == NULL)          if (pOptions == NULL)
287                  return;                  return;
288    
# Line 286  void InstrumentForm::updateInstrumentNam Line 290  void InstrumentForm::updateInstrumentNam
290          // to retrieve the REAL instrument names.          // to retrieve the REAL instrument names.
291          m_ui.InstrumentNrComboBox->clear();          m_ui.InstrumentNrComboBox->clear();
292          m_ui.InstrumentNrComboBox->insertItems(0,          m_ui.InstrumentNrComboBox->insertItems(0,
293                  qsamplerChannel::getInstrumentList(                  Channel::getInstrumentList(
294                          m_ui.InstrumentFileComboBox->currentText(),                          m_ui.InstrumentFileComboBox->currentText(),
295                          pOptions->bInstrumentNames)                          pOptions->bInstrumentNames)
296          );          );
# Line 322  void InstrumentForm::accept (void) Line 326  void InstrumentForm::accept (void)
326          if (pMainForm->client() == NULL)          if (pMainForm->client() == NULL)
327                  return;                  return;
328    
329          qsamplerOptions *pOptions = pMainForm->options();          Options *pOptions = pMainForm->options();
330          if (pOptions == NULL)          if (pOptions == NULL)
331                  return;                  return;
332    
# Line 400  void InstrumentForm::stabilizeForm (void Line 404  void InstrumentForm::stabilizeForm (void
404                  !m_ui.NameLineEdit->text().isEmpty() &&                  !m_ui.NameLineEdit->text().isEmpty() &&
405                  m_ui.EngineNameComboBox->currentIndex() >= 0 &&                  m_ui.EngineNameComboBox->currentIndex() >= 0 &&
406                  m_ui.EngineNameComboBox->currentText() !=                  m_ui.EngineNameComboBox->currentText() !=
407                  qsamplerChannel::noEngineName();                  Channel::noEngineName();
408    
409          const QString& sPath = m_ui.InstrumentFileComboBox->currentText();          const QString& sPath = m_ui.InstrumentFileComboBox->currentText();
410          bValid = bValid && !sPath.isEmpty() && QFileInfo(sPath).exists();          bValid = bValid && !sPath.isEmpty() && QFileInfo(sPath).exists();

Legend:
Removed from v.1557  
changed lines
  Added in v.1558

  ViewVC Help
Powered by ViewVC