2 |
// |
// |
3 |
// ui.h extension file, included from the uic-generated form implementation. |
// ui.h extension file, included from the uic-generated form implementation. |
4 |
/**************************************************************************** |
/**************************************************************************** |
5 |
Copyright (C) 2004, rncbc aka Rui Nuno Capela. All rights reserved. |
Copyright (C) 2004-2005, rncbc aka Rui Nuno Capela. All rights reserved. |
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 |
39 |
void qsamplerChannelStrip::init (void) |
void qsamplerChannelStrip::init (void) |
40 |
{ |
{ |
41 |
// Initialize locals. |
// Initialize locals. |
|
m_pMainForm = NULL; |
|
42 |
m_pChannel = NULL; |
m_pChannel = NULL; |
43 |
m_iDirtyChange = 0; |
m_iDirtyChange = 0; |
44 |
|
|
58 |
|
|
59 |
|
|
60 |
// Channel strip setup formal initializer. |
// Channel strip setup formal initializer. |
61 |
void qsamplerChannelStrip::setup ( qsamplerMainForm *pMainForm, int iChannelID ) |
void qsamplerChannelStrip::setup ( qsamplerChannel *pChannel ) |
62 |
{ |
{ |
63 |
// Set main form reference. |
// Destroy any previous channel descriptor; |
64 |
m_pMainForm = pMainForm; |
// (remember that once setup we own it!) |
|
|
|
|
// Destroy any previous channel descriptor. |
|
65 |
if (m_pChannel) |
if (m_pChannel) |
66 |
delete m_pChannel; |
delete m_pChannel; |
67 |
|
|
68 |
// Create a new one... |
// Set the new one... |
69 |
m_pChannel = new qsamplerChannel(pMainForm); |
m_pChannel = pChannel; |
70 |
// And set appropriate settings. |
|
|
if (m_pChannel && iChannelID >= 0) { |
|
|
m_pChannel->setChannelID(iChannelID); |
|
|
m_iDirtyChange = 0; |
|
|
} |
|
|
|
|
71 |
// Stabilize this around. |
// Stabilize this around. |
72 |
updateChannelInfo(); |
updateChannelInfo(); |
73 |
} |
} |
126 |
// Channel setup dialog slot. |
// Channel setup dialog slot. |
127 |
bool qsamplerChannelStrip::channelSetup (void) |
bool qsamplerChannelStrip::channelSetup (void) |
128 |
{ |
{ |
129 |
bool bResult = false; |
bool bResult = m_pChannel->channelSetup(this); |
|
|
|
|
qsamplerChannelForm *pChannelForm = new qsamplerChannelForm(this); |
|
|
if (pChannelForm) { |
|
|
pChannelForm->setup(m_pChannel); |
|
|
bResult = pChannelForm->exec(); |
|
|
delete pChannelForm; |
|
|
} |
|
130 |
|
|
131 |
if (bResult) |
if (bResult) |
132 |
emit channelChanged(this); |
emit channelChanged(this); |
166 |
if (m_pChannel->instrumentFile().isEmpty()) |
if (m_pChannel->instrumentFile().isEmpty()) |
167 |
InstrumentNameTextLabel->setText(sIndent + tr("(No instrument)")); |
InstrumentNameTextLabel->setText(sIndent + tr("(No instrument)")); |
168 |
else |
else |
169 |
InstrumentNameTextLabel->setText(sIndent + QString("%1 [%2]") |
InstrumentNameTextLabel->setText(sIndent + qsamplerChannel::getInstrumentName(m_pChannel->instrumentFile(), m_pChannel->instrumentNr())); |
|
.arg(QFileInfo(m_pChannel->instrumentFile()).fileName()).arg(m_pChannel->instrumentNr())); |
|
170 |
|
|
171 |
// Instrument status... |
// Instrument status... |
172 |
int iInstrumentStatus = m_pChannel->instrumentStatus(); |
int iInstrumentStatus = m_pChannel->instrumentStatus(); |
231 |
if (m_pChannel->client() == NULL) |
if (m_pChannel->client() == NULL) |
232 |
return false; |
return false; |
233 |
|
|
234 |
// Conditionally update whole channel status info. |
// Update whole channel status info, |
235 |
if (m_pChannel->instrumentStatus() >= 0 && m_pChannel->instrumentStatus() < 100) { |
// if instrument load is still pending... |
236 |
|
if (m_pChannel->instrumentStatus() < 100) { |
237 |
updateChannelInfo(); |
updateChannelInfo(); |
238 |
// Once we get a complete instrument load, try a implied reset channel.... |
// Check (updated) status again... |
239 |
if (m_pChannel->instrumentStatus() == 100) |
if (m_pChannel->instrumentStatus() < 100) |
240 |
m_pChannel->resetChannel(); |
return false; |
241 |
|
// Once we get a complete instrument load, |
242 |
|
// we'll try an implied channel reset... |
243 |
|
m_pChannel->resetChannel(); |
244 |
} |
} |
245 |
// Leave, if we still have an erroneus or incomplete instrument load. |
|
246 |
|
// Check again that we're clean. |
247 |
if (m_pChannel->instrumentStatus() < 100) |
if (m_pChannel->instrumentStatus() < 100) |
248 |
return false; |
return false; |
249 |
|
|
291 |
// Context menu event handler. |
// Context menu event handler. |
292 |
void qsamplerChannelStrip::contextMenuEvent( QContextMenuEvent *pEvent ) |
void qsamplerChannelStrip::contextMenuEvent( QContextMenuEvent *pEvent ) |
293 |
{ |
{ |
294 |
if (m_pMainForm == NULL) |
if (m_pChannel == NULL) |
295 |
return; |
return; |
296 |
|
|
297 |
// We'll just show up the main form's edit menu. |
// We'll just show up the main form's edit menu (thru qsamplerChannel). |
298 |
m_pMainForm->contextMenuEvent(pEvent); |
m_pChannel->contextMenuEvent(pEvent); |
299 |
} |
} |
300 |
|
|
301 |
|
|