1 |
// qsamplerChannelFxForm.cpp |
// qsamplerChannelFxForm.cpp |
2 |
// |
// |
3 |
/**************************************************************************** |
/**************************************************************************** |
4 |
|
Copyright (C) 2010-2020, rncbc aka Rui Nuno Capela. All rights reserved. |
5 |
Copyright (C) 2008, Christian Schoenebeck |
Copyright (C) 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 |
14 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
15 |
GNU General Public License for more details. |
GNU General Public License for more details. |
16 |
|
|
17 |
You should have received a copy of the GNU General Public License |
You should have received a copy of the GNU General Public License along |
18 |
along with this program; if not, write to the Free Software |
with this program; if not, write to the Free Software Foundation, Inc., |
19 |
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. |
20 |
|
|
21 |
*****************************************************************************/ |
*****************************************************************************/ |
22 |
|
|
105 |
|
|
106 |
namespace QSampler { |
namespace QSampler { |
107 |
|
|
108 |
ChannelFxForm::ChannelFxForm ( |
ChannelFxForm::ChannelFxForm ( Channel *pSamplerChannel, QWidget *pParent ) |
109 |
Channel* pSamplerChannel, QWidget* pParent, Qt::WindowFlags wflags ) |
: QDialog(pParent) |
|
: QDialog(pParent, wflags) |
|
110 |
{ |
{ |
111 |
m_ui.setupUi(this); |
m_ui.setupUi(this); |
112 |
|
|
113 |
m_pSamplerChannel = pSamplerChannel; |
m_pSamplerChannel = pSamplerChannel; |
114 |
|
|
115 |
m_pAudioDevice = NULL; |
m_pAudioDevice = nullptr; |
116 |
|
|
117 |
FxSendsModel* pModel = |
FxSendsModel* pModel = |
118 |
new FxSendsModel(m_pSamplerChannel->channelID(), m_ui.SendsListView); |
new FxSendsModel(m_pSamplerChannel->channelID(), m_ui.SendsListView); |
119 |
m_ui.SendsListView->setModel(pModel); |
m_ui.SendsListView->setModel(pModel); |
|
#ifdef QT_VERSION >= 0x040300 |
|
120 |
m_ui.SendsListView->setSelectionRectVisible(true); |
m_ui.SendsListView->setSelectionRectVisible(true); |
|
#endif |
|
121 |
|
|
122 |
const int iRowHeight = m_ui.audioRoutingTable->fontMetrics().height() + 4; |
const int iRowHeight = m_ui.audioRoutingTable->fontMetrics().height() + 4; |
123 |
m_ui.audioRoutingTable->verticalHeader()->setDefaultSectionSize(iRowHeight); |
m_ui.audioRoutingTable->verticalHeader()->setDefaultSectionSize(iRowHeight); |
128 |
ChannelRoutingDelegate* pRoutingDelegate = |
ChannelRoutingDelegate* pRoutingDelegate = |
129 |
new ChannelRoutingDelegate(m_ui.audioRoutingTable); |
new ChannelRoutingDelegate(m_ui.audioRoutingTable); |
130 |
m_ui.audioRoutingTable->setItemDelegate(pRoutingDelegate); |
m_ui.audioRoutingTable->setItemDelegate(pRoutingDelegate); |
131 |
|
#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0) |
132 |
|
m_ui.audioRoutingTable->horizontalHeader()->setSectionResizeMode(0, QHeaderView::Stretch); |
133 |
|
#else |
134 |
m_ui.audioRoutingTable->horizontalHeader()->setResizeMode(0, QHeaderView::Stretch); |
m_ui.audioRoutingTable->horizontalHeader()->setResizeMode(0, QHeaderView::Stretch); |
135 |
|
#endif |
136 |
// m_ui.audioRoutingTable->verticalHeader()->hide(); |
// m_ui.audioRoutingTable->verticalHeader()->hide(); |
137 |
|
|
138 |
QAbstractButton* pApplyButton = |
QAbstractButton* pApplyButton = |
139 |
m_ui.buttonBox->button(QDialogButtonBox::Apply); |
m_ui.buttonBox->button(QDialogButtonBox::Apply); |
140 |
pApplyButton->setEnabled(false); |
pApplyButton->setEnabled(false); |
141 |
pApplyButton->setIcon(QIcon(":/icons/formEdit.png")); |
pApplyButton->setIcon(QIcon(":/images/formEdit.png")); |
142 |
|
|
143 |
QAbstractButton* pCancelButton = |
QAbstractButton* pCancelButton = |
144 |
m_ui.buttonBox->button(QDialogButtonBox::Cancel); |
m_ui.buttonBox->button(QDialogButtonBox::Cancel); |
145 |
pCancelButton->setIcon(QIcon(":/icons/formRemove.png")); |
pCancelButton->setIcon(QIcon(":/images/formRemove.png")); |
146 |
|
|
147 |
QAbstractButton* pOkButton = |
QAbstractButton* pOkButton = |
148 |
m_ui.buttonBox->button(QDialogButtonBox::Ok); |
m_ui.buttonBox->button(QDialogButtonBox::Ok); |
149 |
pOkButton->setIcon(QIcon(":/icons/formAccept.png")); |
pOkButton->setIcon(QIcon(":/images/formAccept.png")); |
150 |
|
|
151 |
QAbstractButton* pResetButton = |
QAbstractButton* pResetButton = |
152 |
m_ui.buttonBox->button(QDialogButtonBox::Reset); |
m_ui.buttonBox->button(QDialogButtonBox::Reset); |
245 |
// clear routing model |
// clear routing model |
246 |
ChannelRoutingModel* pRoutingModel = |
ChannelRoutingModel* pRoutingModel = |
247 |
(ChannelRoutingModel*) m_ui.audioRoutingTable->model(); |
(ChannelRoutingModel*) m_ui.audioRoutingTable->model(); |
248 |
pRoutingModel->refresh(NULL, ChannelRoutingMap()); |
pRoutingModel->refresh(nullptr, ChannelRoutingMap()); |
249 |
pRoutingModel->routingMap().clear(); // Reset routing change map. |
pRoutingModel->routingMap().clear(); // Reset routing change map. |
250 |
if (m_pAudioDevice) { |
if (m_pAudioDevice) { |
251 |
delete m_pAudioDevice; |
delete m_pAudioDevice; |
252 |
m_pAudioDevice = NULL; |
m_pAudioDevice = nullptr; |
253 |
} |
} |
254 |
|
|
255 |
if (!pFxSend) return; |
if (!pFxSend) return; |