1 |
// qsamplerChannelForm.cpp |
// qsamplerChannelForm.cpp |
2 |
// |
// |
3 |
/**************************************************************************** |
/**************************************************************************** |
4 |
Copyright (C) 2004-2009, rncbc aka Rui Nuno Capela. All rights reserved. |
Copyright (C) 2004-2010, rncbc aka Rui Nuno Capela. All rights reserved. |
5 |
Copyright (C) 2007, 2008 Christian Schoenebeck |
Copyright (C) 2007, 2008 Christian Schoenebeck |
6 |
|
|
7 |
This program is free software; you can redistribute it and/or |
This program is free software; you can redistribute it and/or |
107 |
QObject::connect(m_ui.AudioDeviceComboBox, |
QObject::connect(m_ui.AudioDeviceComboBox, |
108 |
SIGNAL(activated(int)), |
SIGNAL(activated(int)), |
109 |
SLOT(selectAudioDevice(int))); |
SLOT(selectAudioDevice(int))); |
110 |
QObject::connect(m_ui.OkPushButton, |
QObject::connect(m_ui.DialogButtonBox, |
111 |
SIGNAL(clicked()), |
SIGNAL(accepted()), |
112 |
SLOT(accept())); |
SLOT(accept())); |
113 |
QObject::connect(m_ui.CancelPushButton, |
QObject::connect(m_ui.DialogButtonBox, |
114 |
SIGNAL(clicked()), |
SIGNAL(rejected()), |
115 |
SLOT(reject())); |
SLOT(reject())); |
116 |
QObject::connect(m_ui.MidiDeviceToolButton, |
QObject::connect(m_ui.MidiDeviceToolButton, |
117 |
SIGNAL(clicked()), |
SIGNAL(clicked()), |
434 |
bool bReject = true; |
bool bReject = true; |
435 |
|
|
436 |
// Check if there's any pending changes... |
// Check if there's any pending changes... |
437 |
if (m_iDirtyCount > 0 && m_ui.OkPushButton->isEnabled()) { |
if (m_iDirtyCount > 0) { |
438 |
switch (QMessageBox::warning(this, |
switch (QMessageBox::warning(this, |
439 |
QSAMPLER_TITLE ": " + tr("Warning"), |
QSAMPLER_TITLE ": " + tr("Warning"), |
440 |
tr("Some channel settings have been changed.\n\n" |
tr("Some channel settings have been changed.\n\n" |
473 |
|
|
474 |
// FIXME: the instrument file filters should be restricted, |
// FIXME: the instrument file filters should be restricted, |
475 |
// depending on the current engine. |
// depending on the current engine. |
476 |
|
QStringList filters; |
477 |
|
const QString& sEngineName = m_ui.EngineNameComboBox->currentText().toUpper(); |
478 |
|
if (sEngineName.contains("GIG")) |
479 |
|
filters << tr("GIG Instrument files") + " (*.gig *.dls)"; |
480 |
|
if (sEngineName.contains("SFZ")) |
481 |
|
filters << tr("SFZ Instrument files") + " (*.sfz)"; |
482 |
|
if (sEngineName.contains("SF2")) |
483 |
|
filters << tr("SF2 Instrument files") + " (*.sf2)"; |
484 |
|
filters << tr("All files") + " (*.*)"; |
485 |
|
const QString& filter = filters.join(";;"); |
486 |
|
|
487 |
QString sInstrumentFile = QFileDialog::getOpenFileName(this, |
QString sInstrumentFile = QFileDialog::getOpenFileName(this, |
488 |
QSAMPLER_TITLE ": " + tr("Instrument files"), // Caption. |
QSAMPLER_TITLE ": " + tr("Instrument files"), // Caption. |
489 |
pOptions->sInstrumentDir, // Start here. |
pOptions->sInstrumentDir, // Start here. |
490 |
tr("Instrument files") + " (*.gig *.dls)" // Filter (GIG and DLS files) |
filter // File filter. |
491 |
); |
); |
492 |
|
|
493 |
if (sInstrumentFile.isEmpty()) |
if (sInstrumentFile.isEmpty()) |
581 |
m_midiDevices.clear(); |
m_midiDevices.clear(); |
582 |
|
|
583 |
// Populate with the current ones... |
// Populate with the current ones... |
584 |
const QPixmap midiPixmap(":/icons/midi2.png"); |
const QPixmap midiPixmap(":/images/midi2.png"); |
585 |
int *piDeviceIDs = Device::getDevices(pMainForm->client(), |
int *piDeviceIDs = Device::getDevices(pMainForm->client(), |
586 |
Device::Midi); |
Device::Midi); |
587 |
for (int i = 0; piDeviceIDs && piDeviceIDs[i] >= 0; i++) { |
for (int i = 0; piDeviceIDs && piDeviceIDs[i] >= 0; i++) { |
696 |
m_audioDevices.clear(); |
m_audioDevices.clear(); |
697 |
|
|
698 |
// Populate with the current ones... |
// Populate with the current ones... |
699 |
const QPixmap audioPixmap(":/icons/audio2.png"); |
const QPixmap audioPixmap(":/images/audio2.png"); |
700 |
int *piDeviceIDs = Device::getDevices(pMainForm->client(), |
int *piDeviceIDs = Device::getDevices(pMainForm->client(), |
701 |
Device::Audio); |
Device::Audio); |
702 |
for (int i = 0; piDeviceIDs && piDeviceIDs[i] >= 0; i++) { |
for (int i = 0; piDeviceIDs && piDeviceIDs[i] >= 0; i++) { |
818 |
const QString& sPath = InstrumentFileComboBox->currentText(); |
const QString& sPath = InstrumentFileComboBox->currentText(); |
819 |
bValid = bValid && !sPath.isEmpty() && QFileInfo(sPath).exists(); |
bValid = bValid && !sPath.isEmpty() && QFileInfo(sPath).exists(); |
820 |
#endif |
#endif |
821 |
m_ui.OkPushButton->setEnabled(m_iDirtyCount > 0 && bValid); |
m_ui.DialogButtonBox->button( |
822 |
|
QDialogButtonBox::Ok)->setEnabled(m_iDirtyCount > 0 && bValid); |
823 |
} |
} |
824 |
|
|
825 |
|
|