/[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 3554 by capela, Mon Jul 1 10:53:41 2019 UTC revision 3555 by capela, Tue Aug 13 10:19:32 2019 UTC
# Line 63  namespace QSampler { Line 63  namespace QSampler {
63    
64  // MIDI activity pixmap common resources.  // MIDI activity pixmap common resources.
65  int      ChannelStrip::g_iMidiActivityRefCount = 0;  int      ChannelStrip::g_iMidiActivityRefCount = 0;
66  QPixmap *ChannelStrip::g_pMidiActivityLedOn    = NULL;  QPixmap *ChannelStrip::g_pMidiActivityLedOn    = nullptr;
67  QPixmap *ChannelStrip::g_pMidiActivityLedOff   = NULL;  QPixmap *ChannelStrip::g_pMidiActivityLedOff   = nullptr;
68    
69  // Channel strip activation/selection.  // Channel strip activation/selection.
70  ChannelStrip *ChannelStrip::g_pSelectedStrip = NULL;  ChannelStrip *ChannelStrip::g_pSelectedStrip = nullptr;
71    
72  ChannelStrip::ChannelStrip ( QWidget* pParent, Qt::WindowFlags wflags )  ChannelStrip::ChannelStrip ( QWidget* pParent, Qt::WindowFlags wflags )
73          : QWidget(pParent, wflags)          : QWidget(pParent, wflags)
# Line 75  ChannelStrip::ChannelStrip ( QWidget* pP Line 75  ChannelStrip::ChannelStrip ( QWidget* pP
75          m_ui.setupUi(this);          m_ui.setupUi(this);
76    
77          // Initialize locals.          // Initialize locals.
78          m_pChannel     = NULL;          m_pChannel     = nullptr;
79          m_iDirtyChange = 0;          m_iDirtyChange = 0;
80          m_iErrorCount  = 0;          m_iErrorCount  = 0;
81          m_instrumentListPopupMenu = NULL;          m_instrumentListPopupMenu = nullptr;
82    
83          if (++g_iMidiActivityRefCount == 1) {          if (++g_iMidiActivityRefCount == 1) {
84                  g_pMidiActivityLedOn  = new QPixmap(":/images/ledon1.png");                  g_pMidiActivityLedOn  = new QPixmap(":/images/ledon1.png");
# Line 135  ChannelStrip::~ChannelStrip (void) Line 135  ChannelStrip::~ChannelStrip (void)
135          // Destroy existing channel descriptor.          // Destroy existing channel descriptor.
136          if (m_pChannel)          if (m_pChannel)
137                  delete m_pChannel;                  delete m_pChannel;
138          m_pChannel = NULL;          m_pChannel = nullptr;
139    
140          if (--g_iMidiActivityRefCount == 0) {          if (--g_iMidiActivityRefCount == 0) {
141                  if (g_pMidiActivityLedOn)                  if (g_pMidiActivityLedOn)
142                          delete g_pMidiActivityLedOn;                          delete g_pMidiActivityLedOn;
143                  g_pMidiActivityLedOn = NULL;                  g_pMidiActivityLedOn = nullptr;
144                  if (g_pMidiActivityLedOff)                  if (g_pMidiActivityLedOff)
145                          delete g_pMidiActivityLedOff;                          delete g_pMidiActivityLedOff;
146                  g_pMidiActivityLedOff = NULL;                  g_pMidiActivityLedOff = nullptr;
147          }          }
148  }  }
149    
# Line 151  ChannelStrip::~ChannelStrip (void) Line 151  ChannelStrip::~ChannelStrip (void)
151  // Window drag-n-drop event handlers.  // Window drag-n-drop event handlers.
152  void ChannelStrip::dragEnterEvent ( QDragEnterEvent* pDragEnterEvent )  void ChannelStrip::dragEnterEvent ( QDragEnterEvent* pDragEnterEvent )
153  {  {
154          if (m_pChannel == NULL)          if (m_pChannel == nullptr)
155                  return;                  return;
156    
157          bool bAccept = false;          bool bAccept = false;
158    
159          if (pDragEnterEvent->source() == NULL) {          if (pDragEnterEvent->source() == nullptr) {
160                  const QMimeData *pMimeData = pDragEnterEvent->mimeData();                  const QMimeData *pMimeData = pDragEnterEvent->mimeData();
161                  if (pMimeData && pMimeData->hasUrls()) {                  if (pMimeData && pMimeData->hasUrls()) {
162                          QListIterator<QUrl> iter(pMimeData->urls());                          QListIterator<QUrl> iter(pMimeData->urls());
# Line 180  void ChannelStrip::dragEnterEvent ( QDra Line 180  void ChannelStrip::dragEnterEvent ( QDra
180    
181  void ChannelStrip::dropEvent ( QDropEvent* pDropEvent )  void ChannelStrip::dropEvent ( QDropEvent* pDropEvent )
182  {  {
183          if (m_pChannel == NULL)          if (m_pChannel == nullptr)
184                  return;                  return;
185    
186          if (pDropEvent->source())          if (pDropEvent->source())
# Line 282  void ChannelStrip::setMaxVolume ( int iM Line 282  void ChannelStrip::setMaxVolume ( int iM
282  // Channel setup dialog slot.  // Channel setup dialog slot.
283  bool ChannelStrip::channelSetup (void)  bool ChannelStrip::channelSetup (void)
284  {  {
285          if (m_pChannel == NULL)          if (m_pChannel == nullptr)
286                  return false;                  return false;
287    
288          // Invoke the channel setup dialog.          // Invoke the channel setup dialog.
# Line 298  bool ChannelStrip::channelSetup (void) Line 298  bool ChannelStrip::channelSetup (void)
298  // Channel mute slot.  // Channel mute slot.
299  bool ChannelStrip::channelMute ( bool bMute )  bool ChannelStrip::channelMute ( bool bMute )
300  {  {
301          if (m_pChannel == NULL)          if (m_pChannel == nullptr)
302                  return false;                  return false;
303    
304          // Invoke the channel mute method.          // Invoke the channel mute method.
# Line 314  bool ChannelStrip::channelMute ( bool bM Line 314  bool ChannelStrip::channelMute ( bool bM
314  // Channel solo slot.  // Channel solo slot.
315  bool ChannelStrip::channelSolo ( bool bSolo )  bool ChannelStrip::channelSolo ( bool bSolo )
316  {  {
317          if (m_pChannel == NULL)          if (m_pChannel == nullptr)
318                  return false;                  return false;
319    
320          // Invoke the channel solo method.          // Invoke the channel solo method.
# Line 330  bool ChannelStrip::channelSolo ( bool bS Line 330  bool ChannelStrip::channelSolo ( bool bS
330  // Channel edit slot.  // Channel edit slot.
331  void ChannelStrip::channelEdit (void)  void ChannelStrip::channelEdit (void)
332  {  {
333          if (m_pChannel == NULL)          if (m_pChannel == nullptr)
334                  return;                  return;
335    
336          m_pChannel->editChannel();          m_pChannel->editChannel();
# Line 368  bool ChannelStrip::channelFxEdit (void) Line 368  bool ChannelStrip::channelFxEdit (void)
368  // Channel reset slot.  // Channel reset slot.
369  bool ChannelStrip::channelReset (void)  bool ChannelStrip::channelReset (void)
370  {  {
371          if (m_pChannel == NULL)          if (m_pChannel == nullptr)
372                  return false;                  return false;
373    
374          // Invoke the channel reset method.          // Invoke the channel reset method.
# Line 384  bool ChannelStrip::channelReset (void) Line 384  bool ChannelStrip::channelReset (void)
384  // Update the channel instrument name.  // Update the channel instrument name.
385  bool ChannelStrip::updateInstrumentName ( bool bForce )  bool ChannelStrip::updateInstrumentName ( bool bForce )
386  {  {
387          if (m_pChannel == NULL)          if (m_pChannel == nullptr)
388                  return false;                  return false;
389    
390          // Do we refresh the actual name?          // Do we refresh the actual name?
# Line 439  bool ChannelStrip::updateInstrumentName Line 439  bool ChannelStrip::updateInstrumentName
439    
440          if (!bShowInstrumentPopup && m_instrumentListPopupMenu) {          if (!bShowInstrumentPopup && m_instrumentListPopupMenu) {
441                  delete m_instrumentListPopupMenu;                  delete m_instrumentListPopupMenu;
442                  m_instrumentListPopupMenu = NULL;                  m_instrumentListPopupMenu = nullptr;
443          }          }
444    
445          return true;          return true;
# Line 461  void ChannelStrip::instrumentListPopupIt Line 461  void ChannelStrip::instrumentListPopupIt
461  // Do the dirty volume change.  // Do the dirty volume change.
462  bool ChannelStrip::updateChannelVolume (void)  bool ChannelStrip::updateChannelVolume (void)
463  {  {
464          if (m_pChannel == NULL)          if (m_pChannel == nullptr)
465                  return false;                  return false;
466    
467          // Convert...          // Convert...
# Line 483  bool ChannelStrip::updateChannelVolume ( Line 483  bool ChannelStrip::updateChannelVolume (
483  // Update whole channel info state.  // Update whole channel info state.
484  bool ChannelStrip::updateChannelInfo (void)  bool ChannelStrip::updateChannelInfo (void)
485  {  {
486          if (m_pChannel == NULL)          if (m_pChannel == nullptr)
487                  return false;                  return false;
488    
489          // Check for error limit/recycle...          // Check for error limit/recycle...
# Line 497  bool ChannelStrip::updateChannelInfo (vo Line 497  bool ChannelStrip::updateChannelInfo (vo
497    
498          // Check if we're up and connected.          // Check if we're up and connected.
499          MainForm *pMainForm = MainForm::getInstance();          MainForm *pMainForm = MainForm::getInstance();
500          if (pMainForm->client() == NULL)          if (pMainForm->client() == nullptr)
501                  return false;                  return false;
502    
503          // Read actual channel information.          // Read actual channel information.
# Line 575  bool ChannelStrip::updateChannelInfo (vo Line 575  bool ChannelStrip::updateChannelInfo (vo
575  // Update whole channel usage state.  // Update whole channel usage state.
576  bool ChannelStrip::updateChannelUsage (void)  bool ChannelStrip::updateChannelUsage (void)
577  {  {
578          if (m_pChannel == NULL)          if (m_pChannel == nullptr)
579                  return false;                  return false;
580    
581          MainForm *pMainForm = MainForm::getInstance();          MainForm *pMainForm = MainForm::getInstance();
582          if (pMainForm->client() == NULL)          if (pMainForm->client() == nullptr)
583                  return false;                  return false;
584    
585          // This only makes sense on fully loaded channels...          // This only makes sense on fully loaded channels...
# Line 611  bool ChannelStrip::updateChannelUsage (v Line 611  bool ChannelStrip::updateChannelUsage (v
611  // Volume change slot.  // Volume change slot.
612  void ChannelStrip::volumeChanged ( int iVolume )  void ChannelStrip::volumeChanged ( int iVolume )
613  {  {
614          if (m_pChannel == NULL)          if (m_pChannel == nullptr)
615                  return;                  return;
616    
617          // Avoid recursion.          // Avoid recursion.
# Line 634  void ChannelStrip::volumeChanged ( int i Line 634  void ChannelStrip::volumeChanged ( int i
634  // Context menu event handler.  // Context menu event handler.
635  void ChannelStrip::contextMenuEvent( QContextMenuEvent *pEvent )  void ChannelStrip::contextMenuEvent( QContextMenuEvent *pEvent )
636  {  {
637          if (m_pChannel == NULL)          if (m_pChannel == nullptr)
638                  return;                  return;
639    
640          // We'll just show up the main form's edit menu (thru qsamplerChannel).          // We'll just show up the main form's edit menu (thru qsamplerChannel).
# Line 673  void ChannelStrip::setSelected ( bool bS Line 673  void ChannelStrip::setSelected ( bool bS
673                  g_pSelectedStrip = this;                  g_pSelectedStrip = this;
674          } else {          } else {
675                  if (g_pSelectedStrip == this)                  if (g_pSelectedStrip == this)
676                          g_pSelectedStrip = NULL;                          g_pSelectedStrip = nullptr;
677          }          }
678    
679          QPalette pal;          QPalette pal;

Legend:
Removed from v.3554  
changed lines
  Added in v.3555

  ViewVC Help
Powered by ViewVC