/[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 1513 by capela, Fri Nov 23 09:32:06 2007 UTC revision 1637 by capela, Mon Jan 7 20:00:13 2008 UTC
# Line 34  Line 34 
34  // Needed for lroundf()  // Needed for lroundf()
35  #include <math.h>  #include <math.h>
36    
 namespace QSampler {  
   
37  #ifndef CONFIG_ROUND  #ifndef CONFIG_ROUND
38  static inline long lroundf ( float x )  static inline long lroundf ( float x )
39  {  {
# Line 46  static inline long lroundf ( float x ) Line 44  static inline long lroundf ( float x )
44  }  }
45  #endif  #endif
46    
47    
48    namespace QSampler {
49    
50    //-------------------------------------------------------------------------
51    // QSampler::ChannelStrip -- Channel strip form implementation.
52    //
53    
54    // Channel strip activation/selection.
55    ChannelStrip *ChannelStrip::g_pSelectedStrip = NULL;
56    
57  ChannelStrip::ChannelStrip ( QWidget* pParent, Qt::WindowFlags wflags )  ChannelStrip::ChannelStrip ( QWidget* pParent, Qt::WindowFlags wflags )
58          : QWidget(pParent, wflags)          : QWidget(pParent, wflags)
59  {  {
# Line 77  ChannelStrip::ChannelStrip ( QWidget* pP Line 85  ChannelStrip::ChannelStrip ( QWidget* pP
85          QObject::connect(m_ui.ChannelEditPushButton,          QObject::connect(m_ui.ChannelEditPushButton,
86                  SIGNAL(clicked()),                  SIGNAL(clicked()),
87                  SLOT(channelEdit()));                  SLOT(channelEdit()));
88    
89            setSelected(false);
90  }  }
91    
92    
93  ChannelStrip::~ChannelStrip (void)  ChannelStrip::~ChannelStrip (void)
94  {  {
95            setSelected(false);
96    
97          // Destroy existing channel descriptor.          // Destroy existing channel descriptor.
98          if (m_pChannel)          if (m_pChannel)
99                  delete m_pChannel;                  delete m_pChannel;
# Line 104  void ChannelStrip::dragEnterEvent ( QDra Line 116  void ChannelStrip::dragEnterEvent ( QDra
116                          while (iter.hasNext()) {                          while (iter.hasNext()) {
117                                  const QString& sFilename = iter.next().toLocalFile();                                  const QString& sFilename = iter.next().toLocalFile();
118                                  if (!sFilename.isEmpty()) {                                  if (!sFilename.isEmpty()) {
119                                          bAccept = qsamplerChannel::isInstrumentFile(sFilename);                                          bAccept = Channel::isInstrumentFile(sFilename);
120                                          break;                                          break;
121                                  }                                  }
122                          }                          }
# Line 145  void ChannelStrip::dropEvent ( QDropEven Line 157  void ChannelStrip::dropEvent ( QDropEven
157    
158    
159  // Channel strip setup formal initializer.  // Channel strip setup formal initializer.
160  void ChannelStrip::setup ( qsamplerChannel *pChannel )  void ChannelStrip::setup ( Channel *pChannel )
161  {  {
162          // Destroy any previous channel descriptor;          // Destroy any previous channel descriptor;
163          // (remember that once setup we own it!)          // (remember that once setup we own it!)
# Line 165  void ChannelStrip::setup ( qsamplerChann Line 177  void ChannelStrip::setup ( qsamplerChann
177    
178    
179  // Channel secriptor accessor.  // Channel secriptor accessor.
180  qsamplerChannel *ChannelStrip::channel (void) const  Channel *ChannelStrip::channel (void) const
181  {  {
182          return m_pChannel;          return m_pChannel;
183  }  }
# Line 201  void ChannelStrip::setDisplayEffect ( bo Line 213  void ChannelStrip::setDisplayEffect ( bo
213                  pal.setColor(QPalette::Background, Qt::black);                  pal.setColor(QPalette::Background, Qt::black);
214          }          }
215          m_ui.ChannelInfoFrame->setPalette(pal);          m_ui.ChannelInfoFrame->setPalette(pal);
216            m_ui.InstrumentNameTextLabel->setPalette(pal);
217          m_ui.StreamVoiceCountTextLabel->setPalette(pal);          m_ui.StreamVoiceCountTextLabel->setPalette(pal);
218  }  }
219    
# Line 303  bool ChannelStrip::updateInstrumentName Line 316  bool ChannelStrip::updateInstrumentName
316          if (m_pChannel->instrumentName().isEmpty()) {          if (m_pChannel->instrumentName().isEmpty()) {
317                  if (m_pChannel->instrumentStatus() >= 0) {                  if (m_pChannel->instrumentStatus() >= 0) {
318                          m_ui.InstrumentNameTextLabel->setText(                          m_ui.InstrumentNameTextLabel->setText(
319                                  ' ' + qsamplerChannel::loadingInstrument());                                  ' ' + Channel::loadingInstrument());
320                  } else {                  } else {
321                          m_ui.InstrumentNameTextLabel->setText(                          m_ui.InstrumentNameTextLabel->setText(
322                                  ' ' + qsamplerChannel::noInstrumentName());                                  ' ' + Channel::noInstrumentName());
323                  }                  }
324          } else {          } else {
325                  m_ui.InstrumentNameTextLabel->setText(                  m_ui.InstrumentNameTextLabel->setText(
# Line 365  bool ChannelStrip::updateChannelInfo (vo Line 378  bool ChannelStrip::updateChannelInfo (vo
378          // Engine name...          // Engine name...
379          if (m_pChannel->engineName().isEmpty()) {          if (m_pChannel->engineName().isEmpty()) {
380                  m_ui.EngineNameTextLabel->setText(                  m_ui.EngineNameTextLabel->setText(
381                          ' ' + qsamplerChannel::noEngineName());                          ' ' + Channel::noEngineName());
382          } else {          } else {
383                  m_ui.EngineNameTextLabel->setText(                  m_ui.EngineNameTextLabel->setText(
384                          ' ' + m_pChannel->engineName());                          ' ' + m_pChannel->engineName());
# Line 503  void ChannelStrip::resetErrorCount (void Line 516  void ChannelStrip::resetErrorCount (void
516          m_iErrorCount = 0;          m_iErrorCount = 0;
517  }  }
518    
519    
520    // Channel strip activation/selection.
521    void ChannelStrip::setSelected ( bool bSelected )
522    {
523            if (bSelected) {
524                    if (g_pSelectedStrip == this)
525                            return;
526                    if (g_pSelectedStrip)
527                            g_pSelectedStrip->setSelected(false);
528                    g_pSelectedStrip = this;
529            } else {
530                    if (g_pSelectedStrip == this)
531                            g_pSelectedStrip = NULL;
532            }
533    
534            QPalette pal;
535            if (bSelected) {
536                    const QColor& color = pal.midlight().color();
537                    pal.setColor(QPalette::Background, color.dark(150));
538                    pal.setColor(QPalette::Foreground, color.light(150));
539            }
540            QWidget::setPalette(pal);
541    }
542    
543    
544    bool ChannelStrip::isSelected (void) const
545    {
546            return (this == g_pSelectedStrip);
547    }
548    
549    
550  } // namespace QSampler  } // namespace QSampler
551    
552    

Legend:
Removed from v.1513  
changed lines
  Added in v.1637

  ViewVC Help
Powered by ViewVC