35 |
|
|
36 |
namespace QSampler { |
namespace QSampler { |
37 |
|
|
38 |
|
//------------------------------------------------------------------------- |
39 |
|
// QSampler::InstrumentListForm -- Instrument map list form implementation. |
40 |
|
// |
41 |
|
|
42 |
InstrumentListForm::InstrumentListForm ( |
InstrumentListForm::InstrumentListForm ( |
43 |
QWidget* pParent, Qt::WindowFlags wflags ) |
QWidget* pParent, Qt::WindowFlags wflags ) |
44 |
: QMainWindow(pParent, wflags) |
: QMainWindow(pParent, wflags) |
172 |
if (pMainForm == NULL) |
if (pMainForm == NULL) |
173 |
return; |
return; |
174 |
|
|
175 |
qsamplerOptions *pOptions = pMainForm->options(); |
Options *pOptions = pMainForm->options(); |
176 |
if (pOptions == NULL) |
if (pOptions == NULL) |
177 |
return; |
return; |
178 |
|
|
184 |
// Populate maps list. |
// Populate maps list. |
185 |
m_pMapComboBox->clear(); |
m_pMapComboBox->clear(); |
186 |
m_pMapComboBox->addItem(tr("(All)")); |
m_pMapComboBox->addItem(tr("(All)")); |
187 |
m_pMapComboBox->insertItems(1, qsamplerInstrument::getMapNames()); |
m_pMapComboBox->insertItems(1, Instrument::getMapNames()); |
188 |
|
|
189 |
// Adjust to saved selection... |
// Adjust to saved selection... |
190 |
if (iMap < 0 || iMap >= m_pMapComboBox->count()) |
if (iMap < 0 || iMap >= m_pMapComboBox->count()) |
203 |
if (pMainForm == NULL) |
if (pMainForm == NULL) |
204 |
return; |
return; |
205 |
|
|
206 |
qsamplerOptions *pOptions = pMainForm->options(); |
Options *pOptions = pMainForm->options(); |
207 |
if (pOptions == NULL) |
if (pOptions == NULL) |
208 |
return; |
return; |
209 |
|
|
229 |
if (!index.isValid() || !index.data(Qt::UserRole).isValid()) |
if (!index.isValid() || !index.data(Qt::UserRole).isValid()) |
230 |
return; |
return; |
231 |
|
|
232 |
qsamplerInstrument* pInstrument |
Instrument* pInstrument |
233 |
= static_cast<qsamplerInstrument *> ( |
= static_cast<Instrument *> ( |
234 |
index.data(Qt::UserRole).value<void *> ()); |
index.data(Qt::UserRole).value<void *> ()); |
235 |
|
|
236 |
if (pInstrument == NULL) |
if (pInstrument == NULL) |
237 |
return; |
return; |
238 |
|
|
239 |
// Save current key values... |
// Save current key values... |
240 |
qsamplerInstrument oldInstrument(*pInstrument); |
Instrument oldInstrument(*pInstrument); |
241 |
// Do the edit dance... |
// Do the edit dance... |
242 |
InstrumentForm form(this); |
InstrumentForm form(this); |
243 |
form.setup(pInstrument); |
form.setup(pInstrument); |
264 |
|
|
265 |
void InstrumentListForm::newInstrument (void) |
void InstrumentListForm::newInstrument (void) |
266 |
{ |
{ |
267 |
qsamplerInstrument instrument; |
Instrument instrument; |
268 |
|
|
269 |
InstrumentForm form(this); |
InstrumentForm form(this); |
270 |
form.setup(&instrument); |
form.setup(&instrument); |
288 |
if (!index.isValid() || !index.data(Qt::UserRole).isValid()) |
if (!index.isValid() || !index.data(Qt::UserRole).isValid()) |
289 |
return; |
return; |
290 |
|
|
291 |
qsamplerInstrument *pInstrument = |
Instrument *pInstrument = |
292 |
static_cast<qsamplerInstrument*> ( |
static_cast<Instrument*> ( |
293 |
index.data(Qt::UserRole).value<void *> ()); |
index.data(Qt::UserRole).value<void *> ()); |
294 |
|
|
295 |
if (pInstrument == NULL) |
if (pInstrument == NULL) |
300 |
return; |
return; |
301 |
|
|
302 |
// Prompt user if this is for real... |
// Prompt user if this is for real... |
303 |
qsamplerOptions *pOptions = pMainForm->options(); |
Options *pOptions = pMainForm->options(); |
304 |
if (pOptions && pOptions->bConfirmRemove) { |
if (pOptions && pOptions->bConfirmRemove) { |
305 |
if (QMessageBox::warning(this, |
if (QMessageBox::warning(this, |
306 |
QSAMPLER_TITLE ": " + tr("Warning"), |
QSAMPLER_TITLE ": " + tr("Warning"), |