/[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 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 34  Line 37 
37  // Needed for lroundf()  // Needed for lroundf()
38  #include <math.h>  #include <math.h>
39    
 namespace QSampler {  
   
40  #ifndef CONFIG_ROUND  #ifndef CONFIG_ROUND
41  static inline long lroundf ( float x )  static inline long lroundf ( float x )
42  {  {
# Line 46  static inline long lroundf ( float x ) Line 47  static inline long lroundf ( float x )
47  }  }
48  #endif  #endif
49    
50    
51    namespace QSampler {
52    
53    //-------------------------------------------------------------------------
54    // QSampler::ChannelStrip -- Channel strip form implementation.
55    //
56    
57    // Channel strip activation/selection.
58    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 77  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 104  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 145  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 165  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 201  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 272  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 303  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 365  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());
# Line 503  void ChannelStrip::resetErrorCount (void Line 549  void ChannelStrip::resetErrorCount (void
549          m_iErrorCount = 0;          m_iErrorCount = 0;
550  }  }
551    
552    
553    // Channel strip activation/selection.
554    void ChannelStrip::setSelected ( bool bSelected )
555    {
556            if (bSelected) {
557                    if (g_pSelectedStrip == this)
558                            return;
559                    if (g_pSelectedStrip)
560                            g_pSelectedStrip->setSelected(false);
561                    g_pSelectedStrip = this;
562            } else {
563                    if (g_pSelectedStrip == this)
564                            g_pSelectedStrip = NULL;
565            }
566    
567            QPalette pal;
568            if (bSelected) {
569                    const QColor& color = pal.midlight().color();
570                    pal.setColor(QPalette::Background, color.dark(150));
571                    pal.setColor(QPalette::Foreground, color.light(150));
572            }
573            QWidget::setPalette(pal);
574    }
575    
576    
577    bool ChannelStrip::isSelected (void) const
578    {
579            return (this == g_pSelectedStrip);
580    }
581    
582    
583  } // namespace QSampler  } // namespace QSampler
584    
585    

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

  ViewVC Help
Powered by ViewVC