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

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

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

revision 1514 by capela, Fri Nov 23 10:51:37 2007 UTC revision 1668 by schoenebeck, Tue Feb 5 15:42:33 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 25  Line 25 
25    
26  #include "qsamplerMainForm.h"  #include "qsamplerMainForm.h"
27    
28    #include "qsamplerChannelFxForm.h"
29    
30    #include <QMessageBox>
31  #include <QDragEnterEvent>  #include <QDragEnterEvent>
32  #include <QUrl>  #include <QUrl>
33    
# Line 47  static inline long lroundf ( float x ) Line 50  static inline long lroundf ( float x )
50    
51  namespace QSampler {  namespace QSampler {
52    
53    //-------------------------------------------------------------------------
54    // QSampler::ChannelStrip -- Channel strip form implementation.
55    //
56    
57  // Channel strip activation/selection.  // Channel strip activation/selection.
58  ChannelStrip *ChannelStrip::g_pSelectedStrip = NULL;  ChannelStrip *ChannelStrip::g_pSelectedStrip = NULL;
59    
   
60  ChannelStrip::ChannelStrip ( QWidget* pParent, Qt::WindowFlags wflags )  ChannelStrip::ChannelStrip ( QWidget* pParent, Qt::WindowFlags wflags )
61          : QWidget(pParent, wflags)          : QWidget(pParent, wflags)
62  {  {
# Line 63  ChannelStrip::ChannelStrip ( QWidget* pP Line 69  ChannelStrip::ChannelStrip ( QWidget* pP
69    
70          // Try to restore normal window positioning.          // Try to restore normal window positioning.
71          adjustSize();          adjustSize();
         setSelected(false);  
72    
73          QObject::connect(m_ui.ChannelSetupPushButton,          QObject::connect(m_ui.ChannelSetupPushButton,
74                  SIGNAL(clicked()),                  SIGNAL(clicked()),
# Line 83  ChannelStrip::ChannelStrip ( QWidget* pP Line 88  ChannelStrip::ChannelStrip ( QWidget* pP
88          QObject::connect(m_ui.ChannelEditPushButton,          QObject::connect(m_ui.ChannelEditPushButton,
89                  SIGNAL(clicked()),                  SIGNAL(clicked()),
90                  SLOT(channelEdit()));                  SLOT(channelEdit()));
91            QObject::connect(m_ui.FxPushButton,
92                    SIGNAL(clicked()),
93                    SLOT(channelFxEdit()));
94    
95            setSelected(false);
96  }  }
97    
98    
99  ChannelStrip::~ChannelStrip (void)  ChannelStrip::~ChannelStrip (void)
100  {  {
101            setSelected(false);
102    
103          // Destroy existing channel descriptor.          // Destroy existing channel descriptor.
104          if (m_pChannel)          if (m_pChannel)
105                  delete m_pChannel;                  delete m_pChannel;
# Line 110  void ChannelStrip::dragEnterEvent ( QDra Line 122  void ChannelStrip::dragEnterEvent ( QDra
122                          while (iter.hasNext()) {                          while (iter.hasNext()) {
123                                  const QString& sFilename = iter.next().toLocalFile();                                  const QString& sFilename = iter.next().toLocalFile();
124                                  if (!sFilename.isEmpty()) {                                  if (!sFilename.isEmpty()) {
125                                          bAccept = qsamplerChannel::isInstrumentFile(sFilename);                                          bAccept = Channel::isInstrumentFile(sFilename);
126                                          break;                                          break;
127                                  }                                  }
128                          }                          }
# Line 151  void ChannelStrip::dropEvent ( QDropEven Line 163  void ChannelStrip::dropEvent ( QDropEven
163    
164    
165  // Channel strip setup formal initializer.  // Channel strip setup formal initializer.
166  void ChannelStrip::setup ( qsamplerChannel *pChannel )  void ChannelStrip::setup ( Channel *pChannel )
167  {  {
168          // Destroy any previous channel descriptor;          // Destroy any previous channel descriptor;
169          // (remember that once setup we own it!)          // (remember that once setup we own it!)
# Line 171  void ChannelStrip::setup ( qsamplerChann Line 183  void ChannelStrip::setup ( qsamplerChann
183    
184    
185  // Channel secriptor accessor.  // Channel secriptor accessor.
186  qsamplerChannel *ChannelStrip::channel (void) const  Channel *ChannelStrip::channel (void) const
187  {  {
188          return m_pChannel;          return m_pChannel;
189  }  }
# Line 207  void ChannelStrip::setDisplayEffect ( bo Line 219  void ChannelStrip::setDisplayEffect ( bo
219                  pal.setColor(QPalette::Background, Qt::black);                  pal.setColor(QPalette::Background, Qt::black);
220          }          }
221          m_ui.ChannelInfoFrame->setPalette(pal);          m_ui.ChannelInfoFrame->setPalette(pal);
222            m_ui.InstrumentNameTextLabel->setPalette(pal);
223          m_ui.StreamVoiceCountTextLabel->setPalette(pal);          m_ui.StreamVoiceCountTextLabel->setPalette(pal);
224  }  }
225    
# Line 278  void ChannelStrip::channelEdit (void) Line 291  void ChannelStrip::channelEdit (void)
291          m_pChannel->editChannel();          m_pChannel->editChannel();
292  }  }
293    
294    bool ChannelStrip::channelFxEdit (void)
295    {
296            MainForm *pMainForm = MainForm::getInstance();
297            if (!pMainForm || !channel())
298                    return false;
299    
300            pMainForm->appendMessages(QObject::tr("channel fx sends..."));
301    
302            bool bResult = false;
303    
304    #if CONFIG_FXSEND
305            ChannelFxForm *pChannelFxForm =
306                    new ChannelFxForm(channel(), parentWidget());
307            if (pChannelFxForm) {
308                    //pChannelForm->setup(this);
309                    bResult = pChannelFxForm->exec();
310                    delete pChannelFxForm;
311            }
312    #else // CONFIG_FXSEND
313            QMessageBox::critical(this,
314                    QSAMPLER_TITLE ": " + tr("Unavailable"),
315                            tr("Sorry, QSampler was built without FX send support!\n\n"
316                               "(Make sure you have a recent liblscp when recompiling QSampler)"));
317    #endif // CONFIG_FXSEND
318    
319            return bResult;
320    }
321    
322  // Channel reset slot.  // Channel reset slot.
323  bool ChannelStrip::channelReset (void)  bool ChannelStrip::channelReset (void)
# Line 309  bool ChannelStrip::updateInstrumentName Line 349  bool ChannelStrip::updateInstrumentName
349          if (m_pChannel->instrumentName().isEmpty()) {          if (m_pChannel->instrumentName().isEmpty()) {
350                  if (m_pChannel->instrumentStatus() >= 0) {                  if (m_pChannel->instrumentStatus() >= 0) {
351                          m_ui.InstrumentNameTextLabel->setText(                          m_ui.InstrumentNameTextLabel->setText(
352                                  ' ' + qsamplerChannel::loadingInstrument());                                  ' ' + Channel::loadingInstrument());
353                  } else {                  } else {
354                          m_ui.InstrumentNameTextLabel->setText(                          m_ui.InstrumentNameTextLabel->setText(
355                                  ' ' + qsamplerChannel::noInstrumentName());                                  ' ' + Channel::noInstrumentName());
356                  }                  }
357          } else {          } else {
358                  m_ui.InstrumentNameTextLabel->setText(                  m_ui.InstrumentNameTextLabel->setText(
# Line 371  bool ChannelStrip::updateChannelInfo (vo Line 411  bool ChannelStrip::updateChannelInfo (vo
411          // Engine name...          // Engine name...
412          if (m_pChannel->engineName().isEmpty()) {          if (m_pChannel->engineName().isEmpty()) {
413                  m_ui.EngineNameTextLabel->setText(                  m_ui.EngineNameTextLabel->setText(
414                          ' ' + qsamplerChannel::noEngineName());                          ' ' + Channel::noEngineName());
415          } else {          } else {
416                  m_ui.EngineNameTextLabel->setText(                  m_ui.EngineNameTextLabel->setText(
417                          ' ' + m_pChannel->engineName());                          ' ' + m_pChannel->engineName());

Legend:
Removed from v.1514  
changed lines
  Added in v.1668

  ViewVC Help
Powered by ViewVC