26 |
#include <qfileinfo.h> |
#include <qfileinfo.h> |
27 |
#include <qlistbox.h> |
#include <qlistbox.h> |
28 |
|
|
29 |
|
#include "qsamplerDeviceForm.h" |
30 |
|
|
31 |
#include "config.h" |
#include "config.h" |
32 |
|
|
33 |
|
|
43 |
m_midiDevices.setAutoDelete(true); |
m_midiDevices.setAutoDelete(true); |
44 |
m_audioDevices.setAutoDelete(true); |
m_audioDevices.setAutoDelete(true); |
45 |
|
|
46 |
|
m_pDeviceForm = NULL; |
47 |
|
|
48 |
// Try to restore normal window positioning. |
// Try to restore normal window positioning. |
49 |
adjustSize(); |
adjustSize(); |
50 |
} |
} |
53 |
// Kind of destructor. |
// Kind of destructor. |
54 |
void qsamplerChannelForm::destroy (void) |
void qsamplerChannelForm::destroy (void) |
55 |
{ |
{ |
56 |
|
if (m_pDeviceForm) |
57 |
|
delete m_pDeviceForm; |
58 |
|
m_pDeviceForm = NULL; |
59 |
} |
} |
60 |
|
|
61 |
|
|
318 |
optionsChanged(); |
optionsChanged(); |
319 |
} |
} |
320 |
|
|
321 |
|
// Show device options dialog. |
322 |
|
void qsamplerChannelForm::setupDevice ( qsamplerDevice *pDevice ) |
323 |
|
{ |
324 |
|
if (pDevice == NULL) |
325 |
|
return; |
326 |
|
|
327 |
|
// Create the device form if not already... |
328 |
|
if (m_pDeviceForm == NULL) { |
329 |
|
m_pDeviceForm = new qsamplerDeviceForm(this, 0, |
330 |
|
WType_Dialog | WShowModal); |
331 |
|
m_pDeviceForm->setMainForm(m_pChannel->mainForm()); |
332 |
|
m_pDeviceForm->move(QDialog::pos() + QPoint(32, 32)); |
333 |
|
} |
334 |
|
|
335 |
|
// Refresh the device form with selected data. |
336 |
|
if (m_pDeviceForm) { |
337 |
|
m_pDeviceForm->setClient(m_pChannel->client()); // <-- refreshDevices(). |
338 |
|
m_pDeviceForm->setDevice(pDevice->deviceType(), |
339 |
|
pDevice->deviceID()); |
340 |
|
m_pDeviceForm->show(); |
341 |
|
} |
342 |
|
} |
343 |
|
|
344 |
|
|
345 |
// Refresh MIDI device options. |
// Refresh MIDI device options. |
346 |
void qsamplerChannelForm::selectMidiDriver ( const QString& sMidiDriver ) |
void qsamplerChannelForm::selectMidiDriver ( const QString& sMidiDriver ) |
369 |
MidiDeviceComboBox->insertItem(tr("(New MIDI device)")); |
MidiDeviceComboBox->insertItem(tr("(New MIDI device)")); |
370 |
MidiDeviceTextLabel->setEnabled(bEnabled); |
MidiDeviceTextLabel->setEnabled(bEnabled); |
371 |
MidiDeviceComboBox->setEnabled(bEnabled); |
MidiDeviceComboBox->setEnabled(bEnabled); |
372 |
|
MidiDevicePushButton->setEnabled(bEnabled); |
373 |
optionsChanged(); |
optionsChanged(); |
374 |
} |
} |
375 |
|
|
390 |
} |
} |
391 |
|
|
392 |
|
|
393 |
|
// MIDI device options. |
394 |
|
void qsamplerChannelForm::setupMidiDevice (void) |
395 |
|
{ |
396 |
|
setupDevice(m_midiDevices.at(MidiDeviceComboBox->currentItem())); |
397 |
|
} |
398 |
|
|
399 |
|
|
400 |
// Refresh Audio device options. |
// Refresh Audio device options. |
401 |
void qsamplerChannelForm::selectAudioDriver ( const QString& sAudioDriver ) |
void qsamplerChannelForm::selectAudioDriver ( const QString& sAudioDriver ) |
402 |
{ |
{ |
424 |
AudioDeviceComboBox->insertItem(tr("(New Audio device)")); |
AudioDeviceComboBox->insertItem(tr("(New Audio device)")); |
425 |
AudioDeviceTextLabel->setEnabled(bEnabled); |
AudioDeviceTextLabel->setEnabled(bEnabled); |
426 |
AudioDeviceComboBox->setEnabled(bEnabled); |
AudioDeviceComboBox->setEnabled(bEnabled); |
427 |
|
AudioDevicePushButton->setEnabled(bEnabled); |
428 |
optionsChanged(); |
optionsChanged(); |
429 |
} |
} |
430 |
|
|
440 |
} |
} |
441 |
|
|
442 |
|
|
443 |
|
// Audio device options. |
444 |
|
void qsamplerChannelForm::setupAudioDevice (void) |
445 |
|
{ |
446 |
|
setupDevice(m_audioDevices.at(AudioDeviceComboBox->currentItem())); |
447 |
|
} |
448 |
|
|
449 |
|
|
450 |
// Dirty up settings. |
// Dirty up settings. |
451 |
void qsamplerChannelForm::optionsChanged (void) |
void qsamplerChannelForm::optionsChanged (void) |
452 |
{ |
{ |