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 |
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 |
|
|
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 |
|
|
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(":/images/ledon1.png"); |
79 |
|
g_pMidiActivityLedOff = new QPixmap(":/images/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 |
|
|
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 |
|
|
248 |
m_ui.MidiPortChannelTextLabel->setPalette(pal); |
m_ui.MidiPortChannelTextLabel->setPalette(pal); |
249 |
pal.setColor(QPalette::Foreground, Qt::green); |
pal.setColor(QPalette::Foreground, Qt::green); |
250 |
if (bDisplayEffect) { |
if (bDisplayEffect) { |
251 |
QPixmap pm(":/icons/displaybg1.png"); |
QPixmap pm(":/images/displaybg1.png"); |
252 |
pal.setBrush(QPalette::Background, QBrush(pm)); |
pal.setBrush(QPalette::Background, QBrush(pm)); |
253 |
} else { |
} else { |
254 |
pal.setColor(QPalette::Background, Qt::black); |
pal.setColor(QPalette::Background, Qt::black); |
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 |
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 |
{ |
{ |