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... |
513 |
// Create the device form if not already... |
// Create the device form if not already... |
514 |
if (m_pDeviceForm == NULL) { |
if (m_pDeviceForm == NULL) { |
515 |
m_pDeviceForm = new DeviceForm(this, Qt::Dialog); |
m_pDeviceForm = new DeviceForm(this, Qt::Dialog); |
516 |
m_pDeviceForm->setAttribute(Qt::WA_ShowModal); |
m_pDeviceForm->setAttribute(Qt::WA_ShowModal); |
517 |
QObject::connect(m_pDeviceForm, SIGNAL(devicesChanged()), |
QObject::connect(m_pDeviceForm, SIGNAL(devicesChanged()), |
518 |
this, SLOT(updateDevices())); |
this, SLOT(updateDevices())); |
519 |
} |
} |
562 |
for (int i = 0; piDeviceIDs && piDeviceIDs[i] >= 0; i++) { |
for (int i = 0; piDeviceIDs && piDeviceIDs[i] >= 0; i++) { |
563 |
pDevice = new qsamplerDevice(qsamplerDevice::Midi, piDeviceIDs[i]); |
pDevice = new qsamplerDevice(qsamplerDevice::Midi, piDeviceIDs[i]); |
564 |
if (pDevice->driverName().toUpper() == sDriverName) { |
if (pDevice->driverName().toUpper() == sDriverName) { |
565 |
m_ui.MidiDeviceComboBox->insertItem(0, midiPixmap, pDevice->deviceName()); |
m_ui.MidiDeviceComboBox->insertItem(0, |
566 |
|
midiPixmap, pDevice->deviceName()); |
567 |
m_midiDevices.append(pDevice); |
m_midiDevices.append(pDevice); |
568 |
} else { |
} else { |
569 |
delete pDevice; |
delete pDevice; |
677 |
for (int i = 0; piDeviceIDs && piDeviceIDs[i] >= 0; i++) { |
for (int i = 0; piDeviceIDs && piDeviceIDs[i] >= 0; i++) { |
678 |
pDevice = new qsamplerDevice(qsamplerDevice::Audio, piDeviceIDs[i]); |
pDevice = new qsamplerDevice(qsamplerDevice::Audio, piDeviceIDs[i]); |
679 |
if (pDevice->driverName().toUpper() == sDriverName) { |
if (pDevice->driverName().toUpper() == sDriverName) { |
680 |
m_ui.AudioDeviceComboBox->insertItem(0, audioPixmap, pDevice->deviceName()); |
m_ui.AudioDeviceComboBox->insertItem(0, |
681 |
|
audioPixmap, pDevice->deviceName()); |
682 |
m_audioDevices.append(pDevice); |
m_audioDevices.append(pDevice); |
683 |
} else { |
} else { |
684 |
delete pDevice; |
delete pDevice; |
787 |
{ |
{ |
788 |
const bool bValid = |
const bool bValid = |
789 |
m_ui.EngineNameComboBox->currentIndex() >= 0 && |
m_ui.EngineNameComboBox->currentIndex() >= 0 && |
790 |
m_ui.EngineNameComboBox->currentText() != |
m_ui.EngineNameComboBox->currentText() |
791 |
qsamplerChannel::noEngineName(); |
!= qsamplerChannel::noEngineName(); |
792 |
#if 0 |
#if 0 |
793 |
const QString& sPath = InstrumentFileComboBox->currentText(); |
const QString& sPath = InstrumentFileComboBox->currentText(); |
794 |
bValid = bValid && !sPath.isEmpty() && QFileInfo(sPath).exists(); |
bValid = bValid && !sPath.isEmpty() && QFileInfo(sPath).exists(); |
799 |
|
|
800 |
void ChannelForm::updateTableCellRenderers (void) |
void ChannelForm::updateTableCellRenderers (void) |
801 |
{ |
{ |
802 |
const int rows = m_routingModel.rowCount(); |
const int rows = m_routingModel.rowCount(); |
803 |
const int cols = m_routingModel.columnCount(); |
const int cols = m_routingModel.columnCount(); |
804 |
updateTableCellRenderers( |
updateTableCellRenderers( |
805 |
m_routingModel.index(0, 0), |
m_routingModel.index(0, 0), |
806 |
m_routingModel.index(rows - 1, cols - 1)); |
m_routingModel.index(rows - 1, cols - 1)); |
807 |
} |
} |
810 |
void ChannelForm::updateTableCellRenderers ( |
void ChannelForm::updateTableCellRenderers ( |
811 |
const QModelIndex& topLeft, const QModelIndex& bottomRight ) |
const QModelIndex& topLeft, const QModelIndex& bottomRight ) |
812 |
{ |
{ |
813 |
for (int r = topLeft.row(); r <= bottomRight.row(); r++) { |
for (int r = topLeft.row(); r <= bottomRight.row(); r++) { |
814 |
for (int c = topLeft.column(); c <= bottomRight.column(); c++) { |
for (int c = topLeft.column(); c <= bottomRight.column(); c++) { |
815 |
const QModelIndex index = m_routingModel.index(r, c); |
const QModelIndex index = m_routingModel.index(r, c); |
816 |
m_ui.AudioRoutingTable->openPersistentEditor(index); |
m_ui.AudioRoutingTable->openPersistentEditor(index); |
817 |
} |
} |
818 |
} |
} |
819 |
} |
} |
820 |
|
|
821 |
} // namespace QSampler |
} // namespace QSampler |