/[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 1667 by schoenebeck, Mon Feb 4 23:24:19 2008 UTC revision 2068 by capela, Sun Mar 14 16:35:48 2010 UTC
# Line 1  Line 1 
1  // qsamplerChannelStrip.cpp  // qsamplerChannelStrip.cpp
2  //  //
3  /****************************************************************************  /****************************************************************************
4     Copyright (C) 2004-2007, rncbc aka Rui Nuno Capela. All rights reserved.     Copyright (C) 2004-2010, rncbc aka Rui Nuno Capela. All rights reserved.
5     Copyright (C) 2007, 2008 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
# Line 29  Line 29 
29    
30  #include <QMessageBox>  #include <QMessageBox>
31  #include <QDragEnterEvent>  #include <QDragEnterEvent>
32    #include <QTimer>
33  #include <QUrl>  #include <QUrl>
34    
35    
36  // Channel status/usage usage limit control.  // Channel status/usage usage limit control.
37  #define QSAMPLER_ERROR_LIMIT    3  #define QSAMPLER_ERROR_LIMIT    3
38    
# Line 54  namespace QSampler { Line 56  namespace QSampler {
56  // QSampler::ChannelStrip -- Channel strip form implementation.  // QSampler::ChannelStrip -- Channel strip form implementation.
57  //  //
58    
59    // MIDI activity pixmap common resources.
60    int      ChannelStrip::g_iMidiActivityRefCount = 0;
61    QPixmap *ChannelStrip::g_pMidiActivityLedOn    = NULL;
62    QPixmap *ChannelStrip::g_pMidiActivityLedOff   = NULL;
63    
64  // Channel strip activation/selection.  // Channel strip activation/selection.
65  ChannelStrip *ChannelStrip::g_pSelectedStrip = NULL;  ChannelStrip *ChannelStrip::g_pSelectedStrip = NULL;
66    
# Line 67  ChannelStrip::ChannelStrip ( QWidget* pP Line 74  ChannelStrip::ChannelStrip ( QWidget* pP
74          m_iDirtyChange = 0;          m_iDirtyChange = 0;
75          m_iErrorCount  = 0;          m_iErrorCount  = 0;
76    
77            if (++g_iMidiActivityRefCount == 1) {
78                    g_pMidiActivityLedOn  = new QPixmap(":/icons/ledon1.png");
79                    g_pMidiActivityLedOff = new QPixmap(":/icons/ledoff1.png");
80            }
81    
82            m_ui.MidiActivityLabel->setPixmap(*g_pMidiActivityLedOff);
83    
84    #ifndef CONFIG_EVENT_CHANNEL_MIDI
85            m_ui.MidiActivityLabel->setToolTip("MIDI activity (disabled)");
86    #endif
87    
88            m_pMidiActivityTimer = new QTimer(this);
89            m_pMidiActivityTimer->setSingleShot(true);
90    
91            QObject::connect(m_pMidiActivityTimer,
92                    SIGNAL(timeout()),
93                    SLOT(midiActivityLedOff())
94            );
95    
96          // Try to restore normal window positioning.          // Try to restore normal window positioning.
97          adjustSize();          adjustSize();
98    
# Line 104  ChannelStrip::~ChannelStrip (void) Line 130  ChannelStrip::~ChannelStrip (void)
130          if (m_pChannel)          if (m_pChannel)
131                  delete m_pChannel;                  delete m_pChannel;
132          m_pChannel = NULL;          m_pChannel = NULL;
133    
134            if (--g_iMidiActivityRefCount == 0) {
135                    if (g_pMidiActivityLedOn)
136                            delete g_pMidiActivityLedOn;
137                    g_pMidiActivityLedOn = NULL;
138                    if (g_pMidiActivityLedOff)
139                            delete g_pMidiActivityLedOff;
140                    g_pMidiActivityLedOff = NULL;
141            }
142  }  }
143    
144    
# Line 303  bool ChannelStrip::channelFxEdit (void) Line 338  bool ChannelStrip::channelFxEdit (void)
338    
339  #if CONFIG_FXSEND  #if CONFIG_FXSEND
340          ChannelFxForm *pChannelFxForm =          ChannelFxForm *pChannelFxForm =
341                  new ChannelFxForm(channel()->channelID(), parentWidget());                  new ChannelFxForm(channel(), parentWidget());
342          if (pChannelFxForm) {          if (pChannelFxForm) {
343                  //pChannelForm->setup(this);                  //pChannelForm->setup(this);
344                  bResult = pChannelFxForm->exec();                  bResult = pChannelFxForm->exec();
# Line 454  bool ChannelStrip::updateChannelInfo (vo Line 489  bool ChannelStrip::updateChannelInfo (vo
489          // Mute/Solo button state coloring...          // Mute/Solo button state coloring...
490          bool bMute = m_pChannel->channelMute();          bool bMute = m_pChannel->channelMute();
491          const QColor& rgbButton = pal.color(QPalette::Button);          const QColor& rgbButton = pal.color(QPalette::Button);
492            const QColor& rgbButtonText = pal.color(QPalette::ButtonText);
493          pal.setColor(QPalette::Foreground, rgbFore);          pal.setColor(QPalette::Foreground, rgbFore);
494          pal.setColor(QPalette::Button, bMute ? Qt::yellow : rgbButton);          pal.setColor(QPalette::Button, bMute ? Qt::yellow : rgbButton);
495            pal.setColor(QPalette::ButtonText, bMute ? Qt::darkYellow : rgbButtonText);
496          m_ui.ChannelMutePushButton->setPalette(pal);          m_ui.ChannelMutePushButton->setPalette(pal);
497          m_ui.ChannelMutePushButton->setDown(bMute);          m_ui.ChannelMutePushButton->setDown(bMute);
498          bool bSolo = m_pChannel->channelSolo();          bool bSolo = m_pChannel->channelSolo();
499          pal.setColor(QPalette::Button, bSolo ? Qt::cyan : rgbButton);            pal.setColor(QPalette::Button, bSolo ? Qt::cyan : rgbButton);  
500            pal.setColor(QPalette::ButtonText, bSolo ? Qt::darkCyan : rgbButtonText);
501          m_ui.ChannelSoloPushButton->setPalette(pal);          m_ui.ChannelSoloPushButton->setPalette(pal);
502          m_ui.ChannelSoloPushButton->setDown(bSolo);          m_ui.ChannelSoloPushButton->setDown(bSolo);
503  #else  #else
# Line 543  void ChannelStrip::contextMenuEvent( QCo Line 581  void ChannelStrip::contextMenuEvent( QCo
581  }  }
582    
583    
584    void ChannelStrip::midiActivityLedOn (void)
585    {
586            m_ui.MidiActivityLabel->setPixmap(*g_pMidiActivityLedOn);
587            m_pMidiActivityTimer->start(100);
588    }
589    
590    
591    void ChannelStrip::midiActivityLedOff (void)
592    {
593            m_ui.MidiActivityLabel->setPixmap(*g_pMidiActivityLedOff);
594    }
595    
596    
597  // Error count hackish accessors.  // Error count hackish accessors.
598  void ChannelStrip::resetErrorCount (void)  void ChannelStrip::resetErrorCount (void)
599  {  {

Legend:
Removed from v.1667  
changed lines
  Added in v.2068

  ViewVC Help
Powered by ViewVC