53 |
|
|
54 |
|
|
55 |
// Channel dialog setup formal initializer. |
// Channel dialog setup formal initializer. |
56 |
void qsamplerChannelForm::setup ( qsamplerChannelStrip *pChannel ) |
void qsamplerChannelForm::setup ( qsamplerChannelStrip *pChannel, bool bNew ) |
57 |
{ |
{ |
58 |
m_pChannel = pChannel; |
m_pChannel = pChannel; |
59 |
|
|
111 |
|
|
112 |
// Engine name... |
// Engine name... |
113 |
QString sEngineName = pChannel->engineName(); |
QString sEngineName = pChannel->engineName(); |
114 |
|
if (sEngineName.isEmpty() && bNew) |
115 |
|
sEngineName = pOptions->sEngineName; |
116 |
if (sEngineName.isEmpty()) |
if (sEngineName.isEmpty()) |
117 |
sEngineName = tr("(No engine)"); |
sEngineName = tr("(No engine)"); |
118 |
if (EngineNameComboBox->listBox()->findItem(sEngineName, Qt::ExactMatch) == NULL) |
if (EngineNameComboBox->listBox()->findItem(sEngineName, Qt::ExactMatch) == NULL) |
124 |
sInstrumentFile = tr("(No instrument)"); |
sInstrumentFile = tr("(No instrument)"); |
125 |
InstrumentFileComboBox->setCurrentText(sInstrumentFile); |
InstrumentFileComboBox->setCurrentText(sInstrumentFile); |
126 |
InstrumentNrSpinBox->setValue(pChannel->instrumentNr()); |
InstrumentNrSpinBox->setValue(pChannel->instrumentNr()); |
127 |
// MIDI input... |
// MIDI input driver... |
128 |
const QString& sMidiDriver = pChannel->midiDriver(); |
QString sMidiDriver = pChannel->midiDriver(); |
129 |
|
if (sMidiDriver.isEmpty() && bNew) |
130 |
|
sMidiDriver = pOptions->sMidiDriver; |
131 |
if (!sMidiDriver.isEmpty()) { |
if (!sMidiDriver.isEmpty()) { |
132 |
if (MidiDriverComboBox->listBox()->findItem(sMidiDriver, Qt::ExactMatch) == NULL) |
if (MidiDriverComboBox->listBox()->findItem(sMidiDriver, Qt::ExactMatch) == NULL) |
133 |
MidiDriverComboBox->insertItem(sMidiDriver); |
MidiDriverComboBox->insertItem(sMidiDriver); |
134 |
MidiDriverComboBox->setCurrentText(sMidiDriver); |
MidiDriverComboBox->setCurrentText(sMidiDriver); |
135 |
} |
} |
136 |
|
// MIDI input port... |
137 |
MidiPortSpinBox->setValue(pChannel->midiPort()); |
MidiPortSpinBox->setValue(pChannel->midiPort()); |
138 |
MidiChannelSpinBox->setValue(pChannel->midiChannel()); |
// MIDI input channel... |
139 |
// Audio output... |
int iMidiChannel = pChannel->midiChannel(); |
140 |
const QString& sAudioDriver = pChannel->audioDriver(); |
if (bNew) |
141 |
|
iMidiChannel = (pChannel->channelID() + 1) % 16; |
142 |
|
MidiChannelSpinBox->setValue(iMidiChannel); |
143 |
|
// Audio output driver... |
144 |
|
QString sAudioDriver = pChannel->audioDriver(); |
145 |
|
if (sAudioDriver.isEmpty() && bNew) |
146 |
|
sAudioDriver = pOptions->sAudioDriver; |
147 |
if (!sAudioDriver.isEmpty()) { |
if (!sAudioDriver.isEmpty()) { |
148 |
if (AudioDriverComboBox->listBox()->findItem(sAudioDriver, Qt::ExactMatch) == NULL) |
if (AudioDriverComboBox->listBox()->findItem(sAudioDriver, Qt::ExactMatch) == NULL) |
149 |
AudioDriverComboBox->insertItem(sAudioDriver); |
AudioDriverComboBox->insertItem(sAudioDriver); |
191 |
m_pChannel->appendMessagesError(tr("Some channel settings could not be set.\n\nSorry.")); |
m_pChannel->appendMessagesError(tr("Some channel settings could not be set.\n\nSorry.")); |
192 |
} |
} |
193 |
|
|
194 |
// Save default instrument directory and history... |
// Save default engine name, instrument directory and history... |
195 |
pOptions->sInstrumentDir = QFileInfo(InstrumentFileComboBox->currentText()).dirPath(true); |
pOptions->sInstrumentDir = QFileInfo(InstrumentFileComboBox->currentText()).dirPath(true); |
196 |
|
pOptions->sEngineName = EngineNameComboBox->currentText(); |
197 |
|
pOptions->sAudioDriver = AudioDriverComboBox->currentText(); |
198 |
|
pOptions->sMidiDriver = MidiDriverComboBox->currentText(); |
199 |
pOptions->saveComboBoxHistory(InstrumentFileComboBox); |
pOptions->saveComboBoxHistory(InstrumentFileComboBox); |
200 |
|
|
201 |
// Just go with dialog acceptance. |
// Just go with dialog acceptance. |
209 |
bool bReject = true; |
bool bReject = true; |
210 |
|
|
211 |
// Check if there's any pending changes... |
// Check if there's any pending changes... |
212 |
if (m_iDirtyCount > 0) { |
if (m_iDirtyCount > 0 && OkPushButton->isEnabled()) { |
213 |
switch (QMessageBox::warning(this, tr("Warning"), |
switch (QMessageBox::warning(this, tr("Warning"), |
214 |
tr("Some channel settings have been changed.\n\n" |
tr("Some channel settings have been changed.\n\n" |
215 |
"Do you want to apply the changes?"), |
"Do you want to apply the changes?"), |