41 |
ChannelForm::ChannelForm ( QWidget* pParent ) |
ChannelForm::ChannelForm ( QWidget* pParent ) |
42 |
: QDialog(pParent) |
: QDialog(pParent) |
43 |
{ |
{ |
44 |
m_ui.setupUi(this); |
m_ui.setupUi(this); |
45 |
|
|
46 |
// Initialize locals. |
// Initialize locals. |
47 |
m_pChannel = NULL; |
m_pChannel = NULL; |
54 |
|
|
55 |
m_pDeviceForm = NULL; |
m_pDeviceForm = NULL; |
56 |
|
|
57 |
|
int iRowHeight = m_ui.AudioRoutingTable->fontMetrics().height() + 4; |
58 |
|
m_ui.AudioRoutingTable->verticalHeader()->setDefaultSectionSize(iRowHeight); |
59 |
|
m_ui.AudioRoutingTable->horizontalHeader()->setDefaultAlignment(Qt::AlignLeft); |
60 |
|
|
61 |
m_ui.AudioRoutingTable->setModel(&m_routingModel); |
m_ui.AudioRoutingTable->setModel(&m_routingModel); |
62 |
m_ui.AudioRoutingTable->setItemDelegate(&m_routingDelegate); |
m_ui.AudioRoutingTable->setItemDelegate(&m_routingDelegate); |
63 |
m_ui.AudioRoutingTable->horizontalHeader()->setResizeMode(0, QHeaderView::Stretch); |
m_ui.AudioRoutingTable->horizontalHeader()->setResizeMode(0, QHeaderView::Stretch); |
64 |
// m_ui.AudioRoutingTable->verticalHeader()->hide(); |
// m_ui.AudioRoutingTable->verticalHeader()->hide(); |
65 |
|
|
66 |
// This goes initially hidden, and will be shown |
// This goes initially hidden, and will be shown |
67 |
// on setup() for currently existing channels... |
// on setup() for currently existing channels... |
68 |
m_ui.AudioRoutingTable->hide(); |
m_ui.AudioRoutingTable->hide(); |
69 |
|
|
70 |
// Try to restore normal window positioning. |
// Try to restore normal window positioning. |
222 |
m_ui.InstrumentNrComboBox->insertItems(0, |
m_ui.InstrumentNrComboBox->insertItems(0, |
223 |
qsamplerChannel::getInstrumentList(sInstrumentFile, |
qsamplerChannel::getInstrumentList(sInstrumentFile, |
224 |
pOptions->bInstrumentNames)); |
pOptions->bInstrumentNames)); |
225 |
m_ui.InstrumentNrComboBox->setCurrentIndex(pChannel->instrumentNr()); |
int iInstrumentNr = pChannel->instrumentNr(); |
226 |
|
if (iInstrumentNr < 0) |
227 |
|
iInstrumentNr = 0; |
228 |
|
m_ui.InstrumentNrComboBox->setCurrentIndex(iInstrumentNr); |
229 |
|
|
230 |
// MIDI input device... |
// MIDI input device... |
231 |
qsamplerDevice midiDevice(qsamplerDevice::Midi, m_pChannel->midiDevice()); |
qsamplerDevice midiDevice(qsamplerDevice::Midi, m_pChannel->midiDevice()); |
393 |
if (!m_pChannel->setMidiMap(m_ui.MidiMapComboBox->currentIndex())) |
if (!m_pChannel->setMidiMap(m_ui.MidiMapComboBox->currentIndex())) |
394 |
iErrors++; |
iErrors++; |
395 |
// Show error messages? |
// Show error messages? |
396 |
if (iErrors > 0) |
if (iErrors > 0) { |
397 |
m_pChannel->appendMessagesError(tr("Some channel settings could not be set.\n\nSorry.")); |
m_pChannel->appendMessagesError( |
398 |
|
tr("Some channel settings could not be set.\n\nSorry.")); |
399 |
|
} |
400 |
} |
} |
401 |
|
|
402 |
// Save default engine name, instrument directory and history... |
// Save default engine name, instrument directory and history... |
501 |
qsamplerDevice::DeviceType deviceTypeMode, |
qsamplerDevice::DeviceType deviceTypeMode, |
502 |
const QString& sDriverName ) |
const QString& sDriverName ) |
503 |
{ |
{ |
|
if (pDevice == NULL) |
|
|
return; |
|
|
|
|
504 |
MainForm *pMainForm = MainForm::getInstance(); |
MainForm *pMainForm = MainForm::getInstance(); |
505 |
if (pMainForm == NULL) |
if (pMainForm == NULL) |
506 |
return; |
return; |
510 |
// Create the device form if not already... |
// Create the device form if not already... |
511 |
if (m_pDeviceForm == NULL) { |
if (m_pDeviceForm == NULL) { |
512 |
m_pDeviceForm = new DeviceForm(this, Qt::Dialog); |
m_pDeviceForm = new DeviceForm(this, Qt::Dialog); |
513 |
m_pDeviceForm->setAttribute(Qt::WA_ShowModal); |
m_pDeviceForm->setAttribute(Qt::WA_ShowModal); |
514 |
QObject::connect(m_pDeviceForm, SIGNAL(devicesChanged()), |
QObject::connect(m_pDeviceForm, SIGNAL(devicesChanged()), |
515 |
this, SLOT(updateDevices())); |
this, SLOT(updateDevices())); |
516 |
} |
} |
559 |
for (int i = 0; piDeviceIDs && piDeviceIDs[i] >= 0; i++) { |
for (int i = 0; piDeviceIDs && piDeviceIDs[i] >= 0; i++) { |
560 |
pDevice = new qsamplerDevice(qsamplerDevice::Midi, piDeviceIDs[i]); |
pDevice = new qsamplerDevice(qsamplerDevice::Midi, piDeviceIDs[i]); |
561 |
if (pDevice->driverName().toUpper() == sDriverName) { |
if (pDevice->driverName().toUpper() == sDriverName) { |
562 |
m_ui.MidiDeviceComboBox->insertItem(0, midiPixmap, pDevice->deviceName()); |
m_ui.MidiDeviceComboBox->insertItem(0, |
563 |
|
midiPixmap, pDevice->deviceName()); |
564 |
m_midiDevices.append(pDevice); |
m_midiDevices.append(pDevice); |
565 |
} else { |
} else { |
566 |
delete pDevice; |
delete pDevice; |
674 |
for (int i = 0; piDeviceIDs && piDeviceIDs[i] >= 0; i++) { |
for (int i = 0; piDeviceIDs && piDeviceIDs[i] >= 0; i++) { |
675 |
pDevice = new qsamplerDevice(qsamplerDevice::Audio, piDeviceIDs[i]); |
pDevice = new qsamplerDevice(qsamplerDevice::Audio, piDeviceIDs[i]); |
676 |
if (pDevice->driverName().toUpper() == sDriverName) { |
if (pDevice->driverName().toUpper() == sDriverName) { |
677 |
m_ui.AudioDeviceComboBox->insertItem(0, audioPixmap, pDevice->deviceName()); |
m_ui.AudioDeviceComboBox->insertItem(0, |
678 |
|
audioPixmap, pDevice->deviceName()); |
679 |
m_audioDevices.append(pDevice); |
m_audioDevices.append(pDevice); |
680 |
} else { |
} else { |
681 |
delete pDevice; |
delete pDevice; |
784 |
{ |
{ |
785 |
const bool bValid = |
const bool bValid = |
786 |
m_ui.EngineNameComboBox->currentIndex() >= 0 && |
m_ui.EngineNameComboBox->currentIndex() >= 0 && |
787 |
m_ui.EngineNameComboBox->currentText() != |
m_ui.EngineNameComboBox->currentText() |
788 |
qsamplerChannel::noEngineName(); |
!= qsamplerChannel::noEngineName(); |
789 |
#if 0 |
#if 0 |
790 |
const QString& sPath = InstrumentFileComboBox->currentText(); |
const QString& sPath = InstrumentFileComboBox->currentText(); |
791 |
bValid = bValid && !sPath.isEmpty() && QFileInfo(sPath).exists(); |
bValid = bValid && !sPath.isEmpty() && QFileInfo(sPath).exists(); |
796 |
|
|
797 |
void ChannelForm::updateTableCellRenderers (void) |
void ChannelForm::updateTableCellRenderers (void) |
798 |
{ |
{ |
799 |
const int rows = m_routingModel.rowCount(); |
const int rows = m_routingModel.rowCount(); |
800 |
const int cols = m_routingModel.columnCount(); |
const int cols = m_routingModel.columnCount(); |
801 |
updateTableCellRenderers( |
updateTableCellRenderers( |
802 |
m_routingModel.index(0, 0), |
m_routingModel.index(0, 0), |
803 |
m_routingModel.index(rows - 1, cols - 1)); |
m_routingModel.index(rows - 1, cols - 1)); |
804 |
} |
} |
807 |
void ChannelForm::updateTableCellRenderers ( |
void ChannelForm::updateTableCellRenderers ( |
808 |
const QModelIndex& topLeft, const QModelIndex& bottomRight ) |
const QModelIndex& topLeft, const QModelIndex& bottomRight ) |
809 |
{ |
{ |
810 |
for (int r = topLeft.row(); r <= bottomRight.row(); r++) { |
for (int r = topLeft.row(); r <= bottomRight.row(); r++) { |
811 |
for (int c = topLeft.column(); c <= bottomRight.column(); c++) { |
for (int c = topLeft.column(); c <= bottomRight.column(); c++) { |
812 |
const QModelIndex index = m_routingModel.index(r, c); |
const QModelIndex index = m_routingModel.index(r, c); |
813 |
m_ui.AudioRoutingTable->openPersistentEditor(index); |
m_ui.AudioRoutingTable->openPersistentEditor(index); |
814 |
} |
} |
815 |
} |
} |
816 |
} |
} |
817 |
|
|
818 |
} // namespace QSampler |
} // namespace QSampler |