28 |
#include "qsamplerMainForm.h" |
#include "qsamplerMainForm.h" |
29 |
#include "qsamplerInstrument.h" |
#include "qsamplerInstrument.h" |
30 |
|
|
31 |
#include <qvalidator.h> |
#include <QValidator> |
32 |
#include <qmessagebox.h> |
#include <QMessageBox> |
33 |
#include <qfiledialog.h> |
#include <QFileDialog> |
34 |
#include <qfileinfo.h> |
#include <QFileInfo> |
35 |
|
|
36 |
|
#include <QHeaderView> |
37 |
|
|
38 |
|
|
39 |
namespace QSampler { |
namespace QSampler { |
40 |
|
|
41 |
ChannelForm::ChannelForm(QWidget* parent) : QDialog(parent) { |
ChannelForm::ChannelForm ( QWidget* pParent ) |
42 |
ui.setupUi(this); |
: QDialog(pParent) |
43 |
|
{ |
44 |
|
m_ui.setupUi(this); |
45 |
|
|
46 |
// Initialize locals. |
// Initialize locals. |
47 |
m_pChannel = NULL; |
m_pChannel = NULL; |
49 |
m_iDirtySetup = 0; |
m_iDirtySetup = 0; |
50 |
m_iDirtyCount = 0; |
m_iDirtyCount = 0; |
51 |
|
|
52 |
m_midiDevices.setAutoDelete(true); |
// m_midiDevices.setAutoDelete(true); |
53 |
m_audioDevices.setAutoDelete(true); |
// m_audioDevices.setAutoDelete(true); |
54 |
|
|
55 |
m_pDeviceForm = NULL; |
m_pDeviceForm = NULL; |
56 |
|
|
57 |
|
m_ui.AudioRoutingTable->setModel(&m_routingModel); |
58 |
|
m_ui.AudioRoutingTable->setItemDelegate(&m_routingDelegate); |
59 |
|
m_ui.AudioRoutingTable->horizontalHeader()->setResizeMode(0, QHeaderView::Stretch); |
60 |
|
// m_ui.AudioRoutingTable->verticalHeader()->hide(); |
61 |
|
|
62 |
|
// This goes initially hidden, and will be shown |
63 |
|
// on setup() for currently existing channels... |
64 |
|
m_ui.AudioRoutingTable->hide(); |
65 |
|
|
66 |
// Try to restore normal window positioning. |
// Try to restore normal window positioning. |
67 |
adjustSize(); |
adjustSize(); |
68 |
|
|
69 |
|
QObject::connect(m_ui.EngineNameComboBox, |
70 |
|
SIGNAL(activated(int)), |
71 |
|
SLOT(optionsChanged())); |
72 |
|
QObject::connect(m_ui.InstrumentFileComboBox, |
73 |
|
SIGNAL(activated(const QString&)), |
74 |
|
SLOT(updateInstrumentName())); |
75 |
|
QObject::connect(m_ui.InstrumentFileToolButton, |
76 |
|
SIGNAL(clicked()), |
77 |
|
SLOT(openInstrumentFile())); |
78 |
|
QObject::connect(m_ui.InstrumentNrComboBox, |
79 |
|
SIGNAL(activated(int)), |
80 |
|
SLOT(optionsChanged())); |
81 |
|
QObject::connect(m_ui.MidiDriverComboBox, |
82 |
|
SIGNAL(activated(const QString&)), |
83 |
|
SLOT(selectMidiDriver(const QString&))); |
84 |
|
QObject::connect(m_ui.MidiDeviceComboBox, |
85 |
|
SIGNAL(activated(int)), |
86 |
|
SLOT(selectMidiDevice(int))); |
87 |
|
QObject::connect(m_ui.MidiPortSpinBox, |
88 |
|
SIGNAL(valueChanged(int)), |
89 |
|
SLOT(optionsChanged())); |
90 |
|
QObject::connect(m_ui.MidiChannelComboBox, |
91 |
|
SIGNAL(activated(int)), |
92 |
|
SLOT(optionsChanged())); |
93 |
|
QObject::connect(m_ui.MidiMapComboBox, |
94 |
|
SIGNAL(activated(int)), |
95 |
|
SLOT(optionsChanged())); |
96 |
|
QObject::connect(m_ui.AudioDriverComboBox, |
97 |
|
SIGNAL(activated(const QString&)), |
98 |
|
SLOT(selectAudioDriver(const QString&))); |
99 |
|
QObject::connect(m_ui.AudioDeviceComboBox, |
100 |
|
SIGNAL(activated(int)), |
101 |
|
SLOT(selectAudioDevice(int))); |
102 |
|
QObject::connect(m_ui.OkPushButton, |
103 |
|
SIGNAL(clicked()), |
104 |
|
SLOT(accept())); |
105 |
|
QObject::connect(m_ui.CancelPushButton, |
106 |
|
SIGNAL(clicked()), |
107 |
|
SLOT(reject())); |
108 |
|
QObject::connect(m_ui.MidiDeviceToolButton, |
109 |
|
SIGNAL(clicked()), |
110 |
|
SLOT(setupMidiDevice())); |
111 |
|
QObject::connect(m_ui.AudioDeviceToolButton, |
112 |
|
SIGNAL(clicked()), |
113 |
|
SLOT(setupAudioDevice())); |
114 |
|
QObject::connect(&m_routingModel, |
115 |
|
SIGNAL(dataChanged(const QModelIndex&, const QModelIndex&)), |
116 |
|
SLOT(optionsChanged())); |
117 |
|
QObject::connect(&m_routingModel, |
118 |
|
SIGNAL(dataChanged(const QModelIndex&, const QModelIndex&)), |
119 |
|
SLOT(updateTableCellRenderers(const QModelIndex&, const QModelIndex&))); |
120 |
|
QObject::connect(&m_routingModel, |
121 |
|
SIGNAL(modelReset()), |
122 |
|
SLOT(updateTableCellRenderers())); |
123 |
} |
} |
124 |
|
|
125 |
ChannelForm::~ChannelForm() { |
ChannelForm::~ChannelForm() |
126 |
|
{ |
127 |
if (m_pDeviceForm) |
if (m_pDeviceForm) |
128 |
delete m_pDeviceForm; |
delete m_pDeviceForm; |
129 |
m_pDeviceForm = NULL; |
m_pDeviceForm = NULL; |
130 |
|
|
131 |
|
qDeleteAll(m_midiDevices); |
132 |
|
m_midiDevices.clear(); |
133 |
|
|
134 |
|
qDeleteAll(m_audioDevices); |
135 |
|
m_audioDevices.clear(); |
136 |
} |
} |
137 |
|
|
138 |
|
|
149 |
|
|
150 |
// It can be a brand new channel, remember? |
// It can be a brand new channel, remember? |
151 |
bool bNew = (m_pChannel->channelID() < 0); |
bool bNew = (m_pChannel->channelID() < 0); |
152 |
setCaption(QSAMPLER_TITLE ": " + m_pChannel->channelName()); |
setWindowTitle(QSAMPLER_TITLE ": " + m_pChannel->channelName()); |
153 |
|
|
154 |
// Check if we're up and connected. |
// Check if we're up and connected. |
155 |
MainForm *pMainForm = MainForm::getInstance(); |
MainForm *pMainForm = MainForm::getInstance(); |
166 |
m_iDirtySetup++; |
m_iDirtySetup++; |
167 |
|
|
168 |
// Load combo box history... |
// Load combo box history... |
169 |
pOptions->loadComboBoxHistory(ui.InstrumentFileComboBox); |
pOptions->loadComboBoxHistory(m_ui.InstrumentFileComboBox); |
|
|
|
|
// Notify.that we've just changed one audio route. |
|
|
QObject::connect(ui.AudioRoutingTable, SIGNAL(valueChanged(int,int)), |
|
|
this, SLOT(changeAudioRouting(int,int))); |
|
170 |
|
|
171 |
// Populate Engines list. |
// Populate Engines list. |
172 |
const char **ppszEngines = ::lscp_list_available_engines(pMainForm->client()); |
const char **ppszEngines = ::lscp_list_available_engines(pMainForm->client()); |
173 |
if (ppszEngines) { |
if (ppszEngines) { |
174 |
ui.EngineNameComboBox->clear(); |
m_ui.EngineNameComboBox->clear(); |
175 |
for (int iEngine = 0; ppszEngines[iEngine]; iEngine++) |
for (int iEngine = 0; ppszEngines[iEngine]; iEngine++) |
176 |
ui.EngineNameComboBox->insertItem(ppszEngines[iEngine]); |
m_ui.EngineNameComboBox->addItem(QString(ppszEngines[iEngine])); |
177 |
} |
} |
178 |
else m_pChannel->appendMessagesClient("lscp_list_available_engines"); |
else m_pChannel->appendMessagesClient("lscp_list_available_engines"); |
179 |
|
|
180 |
// Populate Audio output type list. |
// Populate Audio output type list. |
181 |
ui.AudioDriverComboBox->clear(); |
m_ui.AudioDriverComboBox->clear(); |
182 |
ui.AudioDriverComboBox->insertStringList( |
m_ui.AudioDriverComboBox->insertItems(0, |
183 |
qsamplerDevice::getDrivers(pMainForm->client(), qsamplerDevice::Audio)); |
qsamplerDevice::getDrivers(pMainForm->client(), qsamplerDevice::Audio)); |
184 |
|
|
185 |
// Populate MIDI input type list. |
// Populate MIDI input type list. |
186 |
ui.MidiDriverComboBox->clear(); |
m_ui.MidiDriverComboBox->clear(); |
187 |
ui.MidiDriverComboBox->insertStringList( |
m_ui.MidiDriverComboBox->insertItems(0, |
188 |
qsamplerDevice::getDrivers(pMainForm->client(), qsamplerDevice::Midi)); |
qsamplerDevice::getDrivers(pMainForm->client(), qsamplerDevice::Midi)); |
189 |
|
|
190 |
// Populate Maps list. |
// Populate Maps list. |
191 |
ui.MidiMapComboBox->clear(); |
m_ui.MidiMapComboBox->clear(); |
192 |
ui.MidiMapComboBox->insertStringList(qsamplerInstrument::getMapNames()); |
m_ui.MidiMapComboBox->insertItems(0, |
193 |
|
qsamplerInstrument::getMapNames()); |
194 |
|
|
195 |
// Read proper channel information, |
// Read proper channel information, |
196 |
// and populate the channel form fields. |
// and populate the channel form fields. |
201 |
sEngineName = pOptions->sEngineName; |
sEngineName = pOptions->sEngineName; |
202 |
if (sEngineName.isEmpty()) |
if (sEngineName.isEmpty()) |
203 |
sEngineName = qsamplerChannel::noEngineName(); |
sEngineName = qsamplerChannel::noEngineName(); |
204 |
if (ui.EngineNameComboBox->findText(sEngineName, |
if (m_ui.EngineNameComboBox->findText(sEngineName, |
205 |
Qt::MatchExactly | Qt::MatchCaseSensitive) == 0) { |
Qt::MatchExactly | Qt::MatchCaseSensitive) < 0) { |
206 |
ui.EngineNameComboBox->insertItem(sEngineName); |
m_ui.EngineNameComboBox->addItem(sEngineName); |
207 |
} |
} |
208 |
ui.EngineNameComboBox->setCurrentText(sEngineName); |
m_ui.EngineNameComboBox->setCurrentIndex( |
209 |
|
m_ui.EngineNameComboBox->findText(sEngineName, |
210 |
|
Qt::MatchExactly | Qt::MatchCaseSensitive)); |
211 |
|
|
212 |
// Instrument filename and index... |
// Instrument filename and index... |
213 |
QString sInstrumentFile = pChannel->instrumentFile(); |
QString sInstrumentFile = pChannel->instrumentFile(); |
214 |
if (sInstrumentFile.isEmpty()) |
if (sInstrumentFile.isEmpty()) |
215 |
sInstrumentFile = qsamplerChannel::noInstrumentName(); |
sInstrumentFile = qsamplerChannel::noInstrumentName(); |
216 |
ui.InstrumentFileComboBox->setCurrentText(sInstrumentFile); |
m_ui.InstrumentFileComboBox->setEditText(sInstrumentFile); |
217 |
ui.InstrumentNrComboBox->clear(); |
m_ui.InstrumentNrComboBox->clear(); |
218 |
ui.InstrumentNrComboBox->insertStringList( |
m_ui.InstrumentNrComboBox->insertItems(0, |
219 |
qsamplerChannel::getInstrumentList(sInstrumentFile, |
qsamplerChannel::getInstrumentList(sInstrumentFile, |
220 |
pOptions->bInstrumentNames)); |
pOptions->bInstrumentNames)); |
221 |
ui.InstrumentNrComboBox->setCurrentItem(pChannel->instrumentNr()); |
int iInstrumentNr = pChannel->instrumentNr(); |
222 |
|
if (iInstrumentNr < 0) |
223 |
|
iInstrumentNr = 0; |
224 |
|
m_ui.InstrumentNrComboBox->setCurrentIndex(iInstrumentNr); |
225 |
|
|
226 |
// MIDI input device... |
// MIDI input device... |
227 |
qsamplerDevice midiDevice(qsamplerDevice::Midi, m_pChannel->midiDevice()); |
qsamplerDevice midiDevice(qsamplerDevice::Midi, m_pChannel->midiDevice()); |
228 |
// MIDI input driver... |
// MIDI input driver... |
229 |
QString sMidiDriver = midiDevice.driverName(); |
QString sMidiDriver = midiDevice.driverName(); |
230 |
if (sMidiDriver.isEmpty() || bNew) |
if (sMidiDriver.isEmpty() || bNew) |
231 |
sMidiDriver = pOptions->sMidiDriver.upper(); |
sMidiDriver = pOptions->sMidiDriver.toUpper(); |
232 |
if (!sMidiDriver.isEmpty()) { |
if (!sMidiDriver.isEmpty()) { |
233 |
if (ui.MidiDriverComboBox->findText(sMidiDriver, |
if (m_ui.MidiDriverComboBox->findText(sMidiDriver, |
234 |
Qt::MatchExactly | Qt::MatchCaseSensitive) == 0) { |
Qt::MatchExactly | Qt::MatchCaseSensitive) < 0) { |
235 |
ui.MidiDriverComboBox->insertItem(sMidiDriver); |
m_ui.MidiDriverComboBox->insertItem(0, sMidiDriver); |
236 |
} |
} |
237 |
ui.MidiDriverComboBox->setCurrentText(sMidiDriver); |
m_ui.MidiDriverComboBox->setItemText( |
238 |
|
m_ui.MidiDriverComboBox->currentIndex(), |
239 |
|
sMidiDriver); |
240 |
} |
} |
241 |
selectMidiDriverItem(sMidiDriver); |
selectMidiDriverItem(sMidiDriver); |
242 |
if (!bNew) |
if (!bNew) { |
243 |
ui.MidiDeviceComboBox->setCurrentText(midiDevice.deviceName()); |
m_ui.MidiDeviceComboBox->setItemText( |
244 |
selectMidiDeviceItem(ui.MidiDeviceComboBox->currentItem()); |
m_ui.MidiDeviceComboBox->currentIndex(), |
245 |
|
midiDevice.deviceName()); |
246 |
|
} |
247 |
|
selectMidiDeviceItem(m_ui.MidiDeviceComboBox->currentIndex()); |
248 |
// MIDI input port... |
// MIDI input port... |
249 |
ui.MidiPortSpinBox->setValue(pChannel->midiPort()); |
m_ui.MidiPortSpinBox->setValue(pChannel->midiPort()); |
250 |
// MIDI input channel... |
// MIDI input channel... |
251 |
int iMidiChannel = pChannel->midiChannel(); |
int iMidiChannel = pChannel->midiChannel(); |
252 |
// When new, try to suggest a sensible MIDI channel... |
// When new, try to suggest a sensible MIDI channel... |
253 |
if (iMidiChannel < 0) |
if (iMidiChannel < 0) |
254 |
iMidiChannel = (::lscp_get_channels(pMainForm->client()) % 16); |
iMidiChannel = (::lscp_get_channels(pMainForm->client()) % 16); |
255 |
ui.MidiChannelComboBox->setCurrentItem(iMidiChannel); |
m_ui.MidiChannelComboBox->setCurrentIndex(iMidiChannel); |
256 |
// MIDI instrument map... |
// MIDI instrument map... |
257 |
int iMidiMap = (bNew ? pOptions->iMidiMap : pChannel->midiMap()); |
int iMidiMap = (bNew ? pOptions->iMidiMap : pChannel->midiMap()); |
258 |
// When new, try to suggest a sensible MIDI map... |
// When new, try to suggest a sensible MIDI map... |
259 |
if (iMidiMap < 0) |
if (iMidiMap < 0) |
260 |
iMidiMap = 0; |
iMidiMap = 0; |
261 |
const QString& sMapName = qsamplerInstrument::getMapName(iMidiMap); |
const QString& sMapName = qsamplerInstrument::getMapName(iMidiMap); |
262 |
if (!sMapName.isEmpty()) |
if (!sMapName.isEmpty()) { |
263 |
ui.MidiMapComboBox->setCurrentText(sMapName); |
m_ui.MidiMapComboBox->setItemText( |
264 |
|
m_ui.MidiMapComboBox->currentIndex(), |
265 |
|
sMapName); |
266 |
|
} |
267 |
// It might be no maps around... |
// It might be no maps around... |
268 |
bool bMidiMapEnabled = (ui.MidiMapComboBox->count() > 0); |
bool bMidiMapEnabled = (m_ui.MidiMapComboBox->count() > 0); |
269 |
ui.MidiMapTextLabel->setEnabled(bMidiMapEnabled); |
m_ui.MidiMapTextLabel->setEnabled(bMidiMapEnabled); |
270 |
ui.MidiMapComboBox->setEnabled(bMidiMapEnabled); |
m_ui.MidiMapComboBox->setEnabled(bMidiMapEnabled); |
271 |
|
|
272 |
// Audio output device... |
// Audio output device... |
273 |
qsamplerDevice audioDevice(qsamplerDevice::Audio, m_pChannel->audioDevice()); |
qsamplerDevice audioDevice(qsamplerDevice::Audio, m_pChannel->audioDevice()); |
274 |
// Audio output driver... |
// Audio output driver... |
275 |
QString sAudioDriver = audioDevice.driverName(); |
QString sAudioDriver = audioDevice.driverName(); |
276 |
if (sAudioDriver.isEmpty() || bNew) |
if (sAudioDriver.isEmpty() || bNew) |
277 |
sAudioDriver = pOptions->sAudioDriver.upper(); |
sAudioDriver = pOptions->sAudioDriver.toUpper(); |
278 |
if (!sAudioDriver.isEmpty()) { |
if (!sAudioDriver.isEmpty()) { |
279 |
if (ui.AudioDriverComboBox->findText(sAudioDriver, |
if (m_ui.AudioDriverComboBox->findText(sAudioDriver, |
280 |
Qt::MatchExactly | Qt::MatchCaseSensitive) == 0) { |
Qt::MatchExactly | Qt::MatchCaseSensitive) < 0) { |
281 |
ui.AudioDriverComboBox->insertItem(sAudioDriver); |
m_ui.AudioDriverComboBox->insertItem(0, sAudioDriver); |
282 |
} |
} |
283 |
ui.AudioDriverComboBox->setCurrentText(sAudioDriver); |
m_ui.AudioDriverComboBox->setItemText( |
284 |
|
m_ui.AudioDriverComboBox->currentIndex(), |
285 |
|
sAudioDriver); |
286 |
} |
} |
287 |
selectAudioDriverItem(sAudioDriver); |
selectAudioDriverItem(sAudioDriver); |
288 |
if (!bNew) |
if (!bNew) { |
289 |
ui.AudioDeviceComboBox->setCurrentText(audioDevice.deviceName()); |
m_ui.AudioDeviceComboBox->setItemText( |
290 |
selectAudioDeviceItem(ui.AudioDeviceComboBox->currentItem()); |
m_ui.AudioDeviceComboBox->currentIndex(), |
291 |
|
audioDevice.deviceName()); |
292 |
|
} |
293 |
|
selectAudioDeviceItem(m_ui.AudioDeviceComboBox->currentIndex()); |
294 |
|
|
295 |
|
// Let the audio routing table see the light, |
296 |
|
// if we're editing an existing sampler channel... |
297 |
|
m_ui.AudioRoutingTable->setVisible(!bNew); |
298 |
|
|
299 |
// As convenient, make it ready on stabilizeForm() for |
// As convenient, make it ready on stabilizeForm() for |
300 |
// prompt acceptance, if we got the minimum required... |
// prompt acceptance, if we got the minimum required... |
324 |
return; |
return; |
325 |
|
|
326 |
// Flush any pending editing... |
// Flush any pending editing... |
327 |
//ui.AudioRoutingTable->flush(); |
//m_ui.AudioRoutingTable->flush(); |
328 |
|
|
329 |
// We'll go for it! |
// We'll go for it! |
330 |
if (m_iDirtyCount > 0) { |
if (m_iDirtyCount > 0) { |
334 |
iErrors++; |
iErrors++; |
335 |
// Accept Audio driver or device selection... |
// Accept Audio driver or device selection... |
336 |
if (m_audioDevices.isEmpty()) { |
if (m_audioDevices.isEmpty()) { |
337 |
if (!m_pChannel->setAudioDriver(ui.AudioDriverComboBox->currentText())) |
if (!m_pChannel->setAudioDriver(m_ui.AudioDriverComboBox->currentText())) |
338 |
iErrors++; |
iErrors++; |
339 |
} else { |
} else { |
340 |
qsamplerDevice *pDevice = m_audioDevices.at(ui.AudioDeviceComboBox->currentItem()); |
qsamplerDevice *pDevice = NULL; |
341 |
|
int iAudioItem = m_ui.AudioDeviceComboBox->currentIndex(); |
342 |
|
if (iAudioItem >= 0 && iAudioItem < m_audioDevices.count()) |
343 |
|
pDevice = m_audioDevices.at(iAudioItem); |
344 |
|
qsamplerChannelRoutingMap routingMap = m_routingModel.routingMap(); |
345 |
if (pDevice == NULL) |
if (pDevice == NULL) |
346 |
iErrors++; |
iErrors++; |
347 |
else if (!m_pChannel->setAudioDevice(pDevice->deviceID())) |
else if (!m_pChannel->setAudioDevice(pDevice->deviceID())) |
348 |
iErrors++; |
iErrors++; |
349 |
else if (!m_audioRouting.isEmpty()) { |
else if (!routingMap.isEmpty()) { |
350 |
// Set the audio route changes... |
// Set the audio route changes... |
351 |
qsamplerChannelRoutingMap::ConstIterator iter; |
qsamplerChannelRoutingMap::ConstIterator iter; |
352 |
for (iter = m_audioRouting.begin(); |
for (iter = routingMap.begin(); |
353 |
iter != m_audioRouting.end(); ++iter) { |
iter != routingMap.end(); ++iter) { |
354 |
if (!m_pChannel->setAudioChannel(iter.key(), iter.data())) |
if (!m_pChannel->setAudioChannel(iter.key(), iter.value())) |
355 |
iErrors++; |
iErrors++; |
356 |
} |
} |
357 |
} |
} |
358 |
} |
} |
359 |
// Accept MIDI driver or device selection... |
// Accept MIDI driver or device selection... |
360 |
if (m_midiDevices.isEmpty()) { |
if (m_midiDevices.isEmpty()) { |
361 |
if (!m_pChannel->setMidiDriver(ui.MidiDriverComboBox->currentText())) |
if (!m_pChannel->setMidiDriver(m_ui.MidiDriverComboBox->currentText())) |
362 |
iErrors++; |
iErrors++; |
363 |
} else { |
} else { |
364 |
qsamplerDevice *pDevice = m_midiDevices.at(ui.MidiDeviceComboBox->currentItem()); |
qsamplerDevice *pDevice = NULL; |
365 |
|
int iMidiItem = m_ui.MidiDeviceComboBox->currentIndex(); |
366 |
|
if (iMidiItem >= 0 && iMidiItem < m_midiDevices.count()) |
367 |
|
pDevice = m_midiDevices.at(iMidiItem); |
368 |
if (pDevice == NULL) |
if (pDevice == NULL) |
369 |
iErrors++; |
iErrors++; |
370 |
else if (!m_pChannel->setMidiDevice(pDevice->deviceID())) |
else if (!m_pChannel->setMidiDevice(pDevice->deviceID())) |
371 |
iErrors++; |
iErrors++; |
372 |
} |
} |
373 |
// MIDI input port number... |
// MIDI input port number... |
374 |
if (!m_pChannel->setMidiPort(ui.MidiPortSpinBox->value())) |
if (!m_pChannel->setMidiPort(m_ui.MidiPortSpinBox->value())) |
375 |
iErrors++; |
iErrors++; |
376 |
// MIDI input channel... |
// MIDI input channel... |
377 |
if (!m_pChannel->setMidiChannel(ui.MidiChannelComboBox->currentItem())) |
if (!m_pChannel->setMidiChannel(m_ui.MidiChannelComboBox->currentIndex())) |
378 |
iErrors++; |
iErrors++; |
379 |
// Engine name... |
// Engine name... |
380 |
if (!m_pChannel->loadEngine(ui.EngineNameComboBox->currentText())) |
if (!m_pChannel->loadEngine(m_ui.EngineNameComboBox->currentText())) |
381 |
iErrors++; |
iErrors++; |
382 |
// Instrument file and index... |
// Instrument file and index... |
383 |
const QString& sPath = ui.InstrumentFileComboBox->currentText(); |
const QString& sPath = m_ui.InstrumentFileComboBox->currentText(); |
384 |
if (!sPath.isEmpty() && QFileInfo(sPath).exists()) { |
if (!sPath.isEmpty() && QFileInfo(sPath).exists()) { |
385 |
if (!m_pChannel->loadInstrument(sPath, ui.InstrumentNrComboBox->currentItem())) |
if (!m_pChannel->loadInstrument(sPath, m_ui.InstrumentNrComboBox->currentIndex())) |
386 |
iErrors++; |
iErrors++; |
387 |
} |
} |
388 |
// MIDI intrument map... |
// MIDI intrument map... |
389 |
if (!m_pChannel->setMidiMap(ui.MidiMapComboBox->currentItem())) |
if (!m_pChannel->setMidiMap(m_ui.MidiMapComboBox->currentIndex())) |
390 |
iErrors++; |
iErrors++; |
391 |
// Show error messages? |
// Show error messages? |
392 |
if (iErrors > 0) |
if (iErrors > 0) { |
393 |
m_pChannel->appendMessagesError(tr("Some channel settings could not be set.\n\nSorry.")); |
m_pChannel->appendMessagesError( |
394 |
|
tr("Some channel settings could not be set.\n\nSorry.")); |
395 |
|
} |
396 |
} |
} |
397 |
|
|
398 |
// Save default engine name, instrument directory and history... |
// Save default engine name, instrument directory and history... |
399 |
pOptions->sInstrumentDir = QFileInfo(ui.InstrumentFileComboBox->currentText()).dirPath(true); |
pOptions->sInstrumentDir = QFileInfo( |
400 |
pOptions->sEngineName = ui.EngineNameComboBox->currentText(); |
m_ui.InstrumentFileComboBox->currentText()).dir().absolutePath(); |
401 |
pOptions->sAudioDriver = ui.AudioDriverComboBox->currentText(); |
pOptions->sEngineName = m_ui.EngineNameComboBox->currentText(); |
402 |
pOptions->sMidiDriver = ui.MidiDriverComboBox->currentText(); |
pOptions->sAudioDriver = m_ui.AudioDriverComboBox->currentText(); |
403 |
pOptions->iMidiMap = ui.MidiMapComboBox->currentItem(); |
pOptions->sMidiDriver = m_ui.MidiDriverComboBox->currentText(); |
404 |
pOptions->saveComboBoxHistory(ui.InstrumentFileComboBox); |
pOptions->iMidiMap = m_ui.MidiMapComboBox->currentIndex(); |
405 |
|
pOptions->saveComboBoxHistory(m_ui.InstrumentFileComboBox); |
406 |
|
|
407 |
// Just go with dialog acceptance. |
// Just go with dialog acceptance. |
408 |
QDialog::accept(); |
QDialog::accept(); |
415 |
bool bReject = true; |
bool bReject = true; |
416 |
|
|
417 |
// Check if there's any pending changes... |
// Check if there's any pending changes... |
418 |
if (m_iDirtyCount > 0 && ui.OkPushButton->isEnabled()) { |
if (m_iDirtyCount > 0 && m_ui.OkPushButton->isEnabled()) { |
419 |
switch (QMessageBox::warning(this, |
switch (QMessageBox::warning(this, |
420 |
QSAMPLER_TITLE ": " + tr("Warning"), |
QSAMPLER_TITLE ": " + tr("Warning"), |
421 |
tr("Some channel settings have been changed.\n\n" |
tr("Some channel settings have been changed.\n\n" |
452 |
|
|
453 |
// FIXME: the instrument file filters should be restricted, |
// FIXME: the instrument file filters should be restricted, |
454 |
// depending on the current engine. |
// depending on the current engine. |
455 |
QString sInstrumentFile = QFileDialog::getOpenFileName( |
QString sInstrumentFile = QFileDialog::getOpenFileName(this, |
456 |
pOptions->sInstrumentDir, // Start here. |
QSAMPLER_TITLE ": " + tr("Instrument files"), // Caption. |
457 |
tr("Instrument files") + " (*.gig *.dls)", // Filter (GIG and DLS files) |
pOptions->sInstrumentDir, // Start here. |
458 |
this, 0, // Parent and name (none) |
tr("Instrument files") + " (*.gig *.dls)" // Filter (GIG and DLS files) |
|
QSAMPLER_TITLE ": " + tr("Instrument files") // Caption. |
|
459 |
); |
); |
460 |
|
|
461 |
if (sInstrumentFile.isEmpty()) |
if (sInstrumentFile.isEmpty()) |
462 |
return; |
return; |
463 |
|
|
464 |
ui.InstrumentFileComboBox->setCurrentText(sInstrumentFile); |
m_ui.InstrumentFileComboBox->setEditText(sInstrumentFile); |
465 |
updateInstrumentName(); |
updateInstrumentName(); |
466 |
} |
} |
467 |
|
|
481 |
|
|
482 |
// Finally this better idea would be to use libgig |
// Finally this better idea would be to use libgig |
483 |
// to retrieve the REAL instrument names. |
// to retrieve the REAL instrument names. |
484 |
ui.InstrumentNrComboBox->clear(); |
m_ui.InstrumentNrComboBox->clear(); |
485 |
ui.InstrumentNrComboBox->insertStringList( |
m_ui.InstrumentNrComboBox->insertItems(0, |
486 |
qsamplerChannel::getInstrumentList( |
qsamplerChannel::getInstrumentList( |
487 |
ui.InstrumentFileComboBox->currentText(), |
m_ui.InstrumentFileComboBox->currentText(), |
488 |
pOptions->bInstrumentNames) |
pOptions->bInstrumentNames) |
489 |
); |
); |
490 |
|
|
494 |
|
|
495 |
// Show device options dialog. |
// Show device options dialog. |
496 |
void ChannelForm::setupDevice ( qsamplerDevice *pDevice, |
void ChannelForm::setupDevice ( qsamplerDevice *pDevice, |
497 |
qsamplerDevice::qsamplerDeviceType deviceTypeMode, |
qsamplerDevice::DeviceType deviceTypeMode, |
498 |
const QString& sDriverName ) |
const QString& sDriverName ) |
499 |
{ |
{ |
500 |
|
if (pDevice == NULL) |
501 |
|
return; |
502 |
|
|
503 |
MainForm *pMainForm = MainForm::getInstance(); |
MainForm *pMainForm = MainForm::getInstance(); |
504 |
if (pMainForm == NULL) |
if (pMainForm == NULL) |
505 |
return; |
return; |
509 |
// Create the device form if not already... |
// Create the device form if not already... |
510 |
if (m_pDeviceForm == NULL) { |
if (m_pDeviceForm == NULL) { |
511 |
m_pDeviceForm = new DeviceForm(this, Qt::Dialog); |
m_pDeviceForm = new DeviceForm(this, Qt::Dialog); |
512 |
m_pDeviceForm->setAttribute(Qt::WA_ShowModal); |
m_pDeviceForm->setAttribute(Qt::WA_ShowModal); |
513 |
QObject::connect(m_pDeviceForm, SIGNAL(devicesChanged()), |
QObject::connect(m_pDeviceForm, SIGNAL(devicesChanged()), |
514 |
this, SLOT(updateDevices())); |
this, SLOT(updateDevices())); |
515 |
} |
} |
534 |
if (pMainForm->client() == NULL) |
if (pMainForm->client() == NULL) |
535 |
return; |
return; |
536 |
|
|
537 |
const QString sDriverName = sMidiDriver.upper(); |
const QString sDriverName = sMidiDriver.toUpper(); |
538 |
|
|
539 |
// Save current device id. |
// Save current device id. |
540 |
|
// Save current device id. |
541 |
int iDeviceID = 0; |
int iDeviceID = 0; |
542 |
qsamplerDevice *pDevice = m_midiDevices.at(ui.MidiDeviceComboBox->currentItem()); |
qsamplerDevice *pDevice = NULL; |
543 |
|
int iMidiItem = m_ui.MidiDeviceComboBox->currentIndex(); |
544 |
|
if (iMidiItem >= 0 && iMidiItem < m_midiDevices.count()) |
545 |
|
pDevice = m_midiDevices.at(iMidiItem); |
546 |
if (pDevice) |
if (pDevice) |
547 |
iDeviceID = pDevice->deviceID(); |
iDeviceID = pDevice->deviceID(); |
548 |
|
|
549 |
// Clean maplist. |
// Clean maplist. |
550 |
ui.MidiDeviceComboBox->clear(); |
m_ui.MidiDeviceComboBox->clear(); |
551 |
|
qDeleteAll(m_midiDevices); |
552 |
m_midiDevices.clear(); |
m_midiDevices.clear(); |
553 |
|
|
554 |
// Populate with the current ones... |
// Populate with the current ones... |
555 |
const QPixmap midiPixmap(":/qsampler/pixmaps/midi2.png"); |
const QPixmap midiPixmap(":/icons/midi2.png"); |
556 |
int *piDeviceIDs = qsamplerDevice::getDevices(pMainForm->client(), |
int *piDeviceIDs = qsamplerDevice::getDevices(pMainForm->client(), |
557 |
qsamplerDevice::Midi); |
qsamplerDevice::Midi); |
558 |
for (int i = 0; piDeviceIDs && piDeviceIDs[i] >= 0; i++) { |
for (int i = 0; piDeviceIDs && piDeviceIDs[i] >= 0; i++) { |
559 |
pDevice = new qsamplerDevice(qsamplerDevice::Midi, piDeviceIDs[i]); |
pDevice = new qsamplerDevice(qsamplerDevice::Midi, piDeviceIDs[i]); |
560 |
if (pDevice->driverName().upper() == sDriverName) { |
if (pDevice->driverName().toUpper() == sDriverName) { |
561 |
ui.MidiDeviceComboBox->insertItem(midiPixmap, pDevice->deviceName()); |
m_ui.MidiDeviceComboBox->insertItem(0, |
562 |
|
midiPixmap, pDevice->deviceName()); |
563 |
m_midiDevices.append(pDevice); |
m_midiDevices.append(pDevice); |
564 |
} else { |
} else { |
565 |
delete pDevice; |
delete pDevice; |
570 |
bool bEnabled = !m_midiDevices.isEmpty(); |
bool bEnabled = !m_midiDevices.isEmpty(); |
571 |
if (bEnabled) { |
if (bEnabled) { |
572 |
// Select the previous current device... |
// Select the previous current device... |
573 |
int iMidiItem = 0; |
iMidiItem = 0; |
574 |
for (pDevice = m_midiDevices.first(); |
QListIterator<qsamplerDevice *> iter(m_midiDevices); |
575 |
pDevice; |
while (iter.hasNext()) { |
576 |
pDevice = m_midiDevices.next()) { |
pDevice = iter.next(); |
577 |
if (pDevice->deviceID() == iDeviceID) { |
if (pDevice->deviceID() == iDeviceID) { |
578 |
ui.MidiDeviceComboBox->setCurrentItem(iMidiItem); |
m_ui.MidiDeviceComboBox->setCurrentIndex(iMidiItem); |
579 |
selectMidiDeviceItem(iMidiItem); |
selectMidiDeviceItem(iMidiItem); |
580 |
break; |
break; |
581 |
} |
} |
582 |
iMidiItem++; |
iMidiItem++; |
583 |
} |
} |
584 |
} else { |
} else { |
585 |
ui.MidiDeviceComboBox->insertItem( |
m_ui.MidiDeviceComboBox->insertItem(0, |
586 |
tr("(New MIDI %1 device)").arg(sMidiDriver)); |
tr("(New MIDI %1 device)").arg(sMidiDriver)); |
587 |
} |
} |
588 |
ui.MidiDeviceTextLabel->setEnabled(bEnabled); |
m_ui.MidiDeviceTextLabel->setEnabled(bEnabled); |
589 |
ui.MidiDeviceComboBox->setEnabled(bEnabled); |
m_ui.MidiDeviceComboBox->setEnabled(bEnabled); |
590 |
} |
} |
591 |
|
|
592 |
|
|
604 |
// Select MIDI device item. |
// Select MIDI device item. |
605 |
void ChannelForm::selectMidiDeviceItem ( int iMidiItem ) |
void ChannelForm::selectMidiDeviceItem ( int iMidiItem ) |
606 |
{ |
{ |
607 |
qsamplerDevice *pDevice = m_midiDevices.at(iMidiItem); |
qsamplerDevice *pDevice = NULL; |
608 |
|
if (iMidiItem >= 0 && iMidiItem < m_midiDevices.count()) |
609 |
|
pDevice = m_midiDevices.at(iMidiItem); |
610 |
if (pDevice) { |
if (pDevice) { |
611 |
const qsamplerDeviceParamMap& params = pDevice->params(); |
const qsamplerDeviceParamMap& params = pDevice->params(); |
612 |
int iPorts = params["PORTS"].value.toInt(); |
int iPorts = params["PORTS"].value.toInt(); |
613 |
ui.MidiPortTextLabel->setEnabled(iPorts > 0); |
m_ui.MidiPortTextLabel->setEnabled(iPorts > 0); |
614 |
ui.MidiPortSpinBox->setEnabled(iPorts > 0); |
m_ui.MidiPortSpinBox->setEnabled(iPorts > 0); |
615 |
if (iPorts > 0) |
if (iPorts > 0) |
616 |
ui.MidiPortSpinBox->setMaxValue(iPorts - 1); |
m_ui.MidiPortSpinBox->setMaximum(iPorts - 1); |
617 |
} |
} |
618 |
} |
} |
619 |
|
|
632 |
// MIDI device options. |
// MIDI device options. |
633 |
void ChannelForm::setupMidiDevice (void) |
void ChannelForm::setupMidiDevice (void) |
634 |
{ |
{ |
635 |
setupDevice(m_midiDevices.at(ui.MidiDeviceComboBox->currentItem()), |
qsamplerDevice *pDevice = NULL; |
636 |
qsamplerDevice::Midi, ui.MidiDriverComboBox->currentText()); |
int iMidiItem = m_ui.MidiDeviceComboBox->currentIndex(); |
637 |
|
if (iMidiItem >= 0 && iMidiItem < m_midiDevices.count()) |
638 |
|
pDevice = m_midiDevices.at(iMidiItem); |
639 |
|
setupDevice(pDevice, |
640 |
|
qsamplerDevice::Midi, m_ui.MidiDriverComboBox->currentText()); |
641 |
} |
} |
642 |
|
|
643 |
|
|
650 |
if (pMainForm->client() == NULL) |
if (pMainForm->client() == NULL) |
651 |
return; |
return; |
652 |
|
|
653 |
const QString sDriverName = sAudioDriver.upper(); |
const QString sDriverName = sAudioDriver.toUpper(); |
654 |
|
|
655 |
// Save current device id. |
// Save current device id. |
656 |
int iDeviceID = 0; |
int iDeviceID = 0; |
657 |
qsamplerDevice *pDevice = m_audioDevices.at(ui.AudioDeviceComboBox->currentItem()); |
qsamplerDevice *pDevice = NULL; |
658 |
|
int iAudioItem = m_ui.AudioDeviceComboBox->currentIndex(); |
659 |
|
if (iAudioItem >= 0 && iAudioItem < m_audioDevices.count()) |
660 |
|
pDevice = m_audioDevices.at(iAudioItem); |
661 |
if (pDevice) |
if (pDevice) |
662 |
iDeviceID = pDevice->deviceID(); |
iDeviceID = pDevice->deviceID(); |
663 |
|
|
664 |
// Clean maplist. |
// Clean maplist. |
665 |
ui.AudioDeviceComboBox->clear(); |
m_ui.AudioDeviceComboBox->clear(); |
666 |
|
qDeleteAll(m_audioDevices); |
667 |
m_audioDevices.clear(); |
m_audioDevices.clear(); |
668 |
|
|
669 |
// Populate with the current ones... |
// Populate with the current ones... |
670 |
const QPixmap audioPixmap(":/qsampler/pixmaps/audio2.png"); |
const QPixmap audioPixmap(":/icons/audio2.png"); |
671 |
int *piDeviceIDs = qsamplerDevice::getDevices(pMainForm->client(), |
int *piDeviceIDs = qsamplerDevice::getDevices(pMainForm->client(), |
672 |
qsamplerDevice::Audio); |
qsamplerDevice::Audio); |
673 |
for (int i = 0; piDeviceIDs && piDeviceIDs[i] >= 0; i++) { |
for (int i = 0; piDeviceIDs && piDeviceIDs[i] >= 0; i++) { |
674 |
pDevice = new qsamplerDevice(qsamplerDevice::Audio, piDeviceIDs[i]); |
pDevice = new qsamplerDevice(qsamplerDevice::Audio, piDeviceIDs[i]); |
675 |
if (pDevice->driverName().upper() == sDriverName) { |
if (pDevice->driverName().toUpper() == sDriverName) { |
676 |
ui.AudioDeviceComboBox->insertItem(audioPixmap, pDevice->deviceName()); |
m_ui.AudioDeviceComboBox->insertItem(0, |
677 |
|
audioPixmap, pDevice->deviceName()); |
678 |
m_audioDevices.append(pDevice); |
m_audioDevices.append(pDevice); |
679 |
} else { |
} else { |
680 |
delete pDevice; |
delete pDevice; |
685 |
bool bEnabled = !m_audioDevices.isEmpty(); |
bool bEnabled = !m_audioDevices.isEmpty(); |
686 |
if (bEnabled) { |
if (bEnabled) { |
687 |
// Select the previous current device... |
// Select the previous current device... |
688 |
int iAudioItem = 0; |
iAudioItem = 0; |
689 |
for (pDevice = m_audioDevices.first(); |
QListIterator<qsamplerDevice *> iter(m_audioDevices); |
690 |
pDevice; |
while (iter.hasNext()) { |
691 |
pDevice = m_audioDevices.next()) { |
pDevice = iter.next(); |
692 |
if (pDevice->deviceID() == iDeviceID) { |
if (pDevice->deviceID() == iDeviceID) { |
693 |
ui.AudioDeviceComboBox->setCurrentItem(iAudioItem); |
m_ui.AudioDeviceComboBox->setCurrentIndex(iAudioItem); |
694 |
selectAudioDeviceItem(iAudioItem); |
selectAudioDeviceItem(iAudioItem); |
695 |
break; |
break; |
696 |
} |
} |
697 |
iAudioItem++; |
iAudioItem++; |
698 |
} |
} |
699 |
} else { |
} else { |
700 |
ui.AudioDeviceComboBox->insertItem( |
m_ui.AudioDeviceComboBox->insertItem(0, |
701 |
tr("(New Audio %1 device)").arg(sAudioDriver)); |
tr("(New Audio %1 device)").arg(sAudioDriver)); |
702 |
//ui.AudioRoutingTable->setNumRows(0); |
//m_ui.AudioRoutingTable->setNumRows(0); |
703 |
} |
} |
704 |
ui.AudioDeviceTextLabel->setEnabled(bEnabled); |
m_ui.AudioDeviceTextLabel->setEnabled(bEnabled); |
705 |
ui.AudioDeviceComboBox->setEnabled(bEnabled); |
m_ui.AudioDeviceComboBox->setEnabled(bEnabled); |
706 |
ui.AudioRoutingTable->setEnabled(bEnabled); |
m_ui.AudioRoutingTable->setEnabled(bEnabled); |
707 |
} |
} |
708 |
|
|
709 |
|
|
721 |
// Select Audio device item. |
// Select Audio device item. |
722 |
void ChannelForm::selectAudioDeviceItem ( int iAudioItem ) |
void ChannelForm::selectAudioDeviceItem ( int iAudioItem ) |
723 |
{ |
{ |
724 |
qsamplerDevice *pDevice = m_audioDevices.at(iAudioItem); |
qsamplerDevice *pDevice = NULL; |
725 |
|
if (iAudioItem >= 0 && iAudioItem < m_audioDevices.count()) |
726 |
|
pDevice = m_audioDevices.at(iAudioItem); |
727 |
if (pDevice) { |
if (pDevice) { |
728 |
// Refresh the audio routing table. |
// Refresh the audio routing table. |
729 |
routingModel.refresh(pDevice, m_pChannel->audioRouting()); |
m_routingModel.refresh(pDevice, m_pChannel->audioRouting()); |
730 |
// Reset routing change map. |
// Reset routing change map. |
731 |
m_audioRouting.clear(); |
m_routingModel.clear(); |
732 |
} |
} |
733 |
} |
} |
734 |
|
|
747 |
// Audio device options. |
// Audio device options. |
748 |
void ChannelForm::setupAudioDevice (void) |
void ChannelForm::setupAudioDevice (void) |
749 |
{ |
{ |
750 |
setupDevice(m_audioDevices.at(ui.AudioDeviceComboBox->currentItem()), |
qsamplerDevice *pDevice = NULL; |
751 |
qsamplerDevice::Audio, ui.AudioDriverComboBox->currentText()); |
int iAudioItem = m_ui.AudioDeviceComboBox->currentIndex(); |
752 |
} |
if (iAudioItem >= 0 && iAudioItem < m_audioDevices.count()) |
753 |
|
pDevice = m_audioDevices.at(iAudioItem); |
754 |
|
setupDevice(pDevice, |
755 |
// Audio routing change slot. |
qsamplerDevice::Audio, m_ui.AudioDriverComboBox->currentText()); |
|
void ChannelForm::changeAudioRouting ( int iRow, int iCol ) |
|
|
{ |
|
|
#if 0 |
|
|
if (m_iDirtySetup > 0) |
|
|
return; |
|
|
if (iRow < 0 || iCol < 0) |
|
|
return; |
|
|
|
|
|
// Verify that this is a QComboTableItem (magic rtti == 1) |
|
|
QTableItem *pItem = ui.AudioRoutingTable->item(iRow, iCol); |
|
|
if (pItem == NULL) |
|
|
return; |
|
|
qsamplerChannelRoutingComboBox *pComboItem = |
|
|
static_cast<qsamplerChannelRoutingComboBox*> (pItem); |
|
|
// FIXME: Its not garanteed that we must have |
|
|
// iAudioOut == iRow on all times forth! |
|
|
m_audioRouting[iRow] = pComboItem->currentItem(); |
|
|
|
|
|
// And let's get dirty... |
|
|
optionsChanged(); |
|
|
#endif |
|
756 |
} |
} |
757 |
|
|
|
|
|
758 |
// UPdate all device lists slot. |
// UPdate all device lists slot. |
759 |
void ChannelForm::updateDevices (void) |
void ChannelForm::updateDevices (void) |
760 |
{ |
{ |
761 |
if (m_iDirtySetup > 0) |
if (m_iDirtySetup > 0) |
762 |
return; |
return; |
763 |
|
|
764 |
selectMidiDriverItem(ui.MidiDriverComboBox->currentText()); |
selectMidiDriverItem(m_ui.MidiDriverComboBox->currentText()); |
765 |
selectAudioDriverItem(ui.AudioDriverComboBox->currentText()); |
selectAudioDriverItem(m_ui.AudioDriverComboBox->currentText()); |
766 |
optionsChanged(); |
optionsChanged(); |
767 |
} |
} |
768 |
|
|
781 |
// Stabilize current form state. |
// Stabilize current form state. |
782 |
void ChannelForm::stabilizeForm (void) |
void ChannelForm::stabilizeForm (void) |
783 |
{ |
{ |
784 |
bool bValid = true; |
const bool bValid = |
785 |
|
m_ui.EngineNameComboBox->currentIndex() >= 0 && |
786 |
|
m_ui.EngineNameComboBox->currentText() |
787 |
|
!= qsamplerChannel::noEngineName(); |
788 |
#if 0 |
#if 0 |
789 |
const QString& sPath = InstrumentFileComboBox->currentText(); |
const QString& sPath = InstrumentFileComboBox->currentText(); |
790 |
bValid = bValid && !sPath.isEmpty() && QFileInfo(sPath).exists(); |
bValid = bValid && !sPath.isEmpty() && QFileInfo(sPath).exists(); |
791 |
#endif |
#endif |
792 |
ui.OkPushButton->setEnabled(m_iDirtyCount > 0 && bValid); |
m_ui.OkPushButton->setEnabled(m_iDirtyCount > 0 && bValid); |
793 |
|
} |
794 |
|
|
795 |
|
|
796 |
|
void ChannelForm::updateTableCellRenderers (void) |
797 |
|
{ |
798 |
|
const int rows = m_routingModel.rowCount(); |
799 |
|
const int cols = m_routingModel.columnCount(); |
800 |
|
updateTableCellRenderers( |
801 |
|
m_routingModel.index(0, 0), |
802 |
|
m_routingModel.index(rows - 1, cols - 1)); |
803 |
} |
} |
804 |
|
|
805 |
|
|
806 |
|
void ChannelForm::updateTableCellRenderers ( |
807 |
|
const QModelIndex& topLeft, const QModelIndex& bottomRight ) |
808 |
|
{ |
809 |
|
for (int r = topLeft.row(); r <= bottomRight.row(); r++) { |
810 |
|
for (int c = topLeft.column(); c <= bottomRight.column(); c++) { |
811 |
|
const QModelIndex index = m_routingModel.index(r, c); |
812 |
|
m_ui.AudioRoutingTable->openPersistentEditor(index); |
813 |
|
} |
814 |
|
} |
815 |
|
} |
816 |
|
|
817 |
} // namespace QSampler |
} // namespace QSampler |
818 |
|
|
819 |
|
|