25 |
#include "qsamplerInstrument.h" |
#include "qsamplerInstrument.h" |
26 |
#include "qsamplerInstrumentForm.h" |
#include "qsamplerInstrumentForm.h" |
27 |
|
|
28 |
|
#include "qsamplerOptions.h" |
29 |
#include "qsamplerMainForm.h" |
#include "qsamplerMainForm.h" |
30 |
|
|
31 |
|
#include <qmessagebox.h> |
32 |
#include <qaction.h> |
#include <qaction.h> |
33 |
#include <qfileinfo.h> |
#include <qfileinfo.h> |
34 |
#include <qpopupmenu.h> |
#include <qpopupmenu.h> |
254 |
QListView::setColumnWidth(5, 240); // File |
QListView::setColumnWidth(5, 240); // File |
255 |
|
|
256 |
m_pNewGroupAction = new QAction(tr("New &Group"), tr("Ctrl+G"), this); |
m_pNewGroupAction = new QAction(tr("New &Group"), tr("Ctrl+G"), this); |
257 |
m_pNewItemAction = new QAction(tr("New &Instrument..."), tr("Ctrl+I"), this); |
m_pNewItemAction = new QAction(tr("New &Instrument..."), tr("Ins"), this); |
258 |
m_pEditItemAction = new QAction(tr("&Edit..."), tr("Ctrl+E"), this); |
m_pEditItemAction = new QAction(tr("&Edit..."), tr("Enter"), this); |
259 |
m_pRenameAction = new QAction(tr("&Rename"), tr("Ctrl+R"), this); |
m_pRenameAction = new QAction(tr("&Rename"), tr("F2"), this); |
260 |
m_pDeleteAction = new QAction(tr("&Delete"), tr("Ctrl+D"), this); |
m_pDeleteAction = new QAction(tr("&Delete"), tr("Del"), this); |
261 |
m_pRefreshAction = new QAction(tr("Re&fresh"), tr("Ctrl+F"), this); |
m_pRefreshAction = new QAction(tr("Re&fresh"), tr("F5"), this); |
262 |
|
|
263 |
QObject::connect(m_pNewGroupAction, |
QObject::connect(m_pNewGroupAction, |
264 |
SIGNAL(activated()), |
SIGNAL(activated()), |
481 |
void qsamplerInstrumentList::deleteSlot (void) |
void qsamplerInstrumentList::deleteSlot (void) |
482 |
{ |
{ |
483 |
QListViewItem *pListItem = QListView::selectedItem(); |
QListViewItem *pListItem = QListView::selectedItem(); |
484 |
if (pListItem) { |
if (pListItem == NULL) |
485 |
if (pListItem->rtti() == Item) { |
return; |
486 |
qsamplerInstrumentItem *pItem |
|
487 |
= static_cast<qsamplerInstrumentItem *> (pListItem); |
qsamplerMainForm *pMainForm = qsamplerMainForm::getInstance(); |
488 |
if (pItem && pItem->instrument()) { |
if (pMainForm == NULL) |
489 |
pItem->instrument()->unmapInstrument(); |
return; |
490 |
emit instrumentsChanged(); |
|
491 |
} |
// Prompt user if this is for real... |
492 |
|
qsamplerOptions *pOptions = pMainForm->options(); |
493 |
|
if (pOptions && pOptions->bConfirmRemove) { |
494 |
|
if (QMessageBox::warning(this, |
495 |
|
QSAMPLER_TITLE ": " + tr("Warning"), |
496 |
|
tr("Delete %1:\n\n" |
497 |
|
"%2\n\n" |
498 |
|
"Are you sure?") |
499 |
|
.arg(pListItem->rtti() == Item ? tr("instrument") : tr("group")) |
500 |
|
.arg(pListItem->text(0)), |
501 |
|
tr("OK"), tr("Cancel")) > 0) |
502 |
|
return; |
503 |
|
} |
504 |
|
|
505 |
|
// Unmap instrument entry... |
506 |
|
if (pListItem->rtti() == Item) { |
507 |
|
qsamplerInstrumentItem *pItem |
508 |
|
= static_cast<qsamplerInstrumentItem *> (pListItem); |
509 |
|
if (pItem && pItem->instrument()) { |
510 |
|
pItem->instrument()->unmapInstrument(); |
511 |
|
emit instrumentsChanged(); |
512 |
} |
} |
|
delete pListItem; |
|
513 |
} |
} |
514 |
|
|
515 |
|
// Do it for real... |
516 |
|
delete pListItem; |
517 |
|
|
518 |
selectionChangedSlot(); |
selectionChangedSlot(); |
519 |
} |
} |
520 |
|
|
595 |
qsamplerInstrumentItem *pItem = NULL; |
qsamplerInstrumentItem *pItem = NULL; |
596 |
lscp_midi_instrument_t *pInstrs |
lscp_midi_instrument_t *pInstrs |
597 |
= ::lscp_list_midi_instruments(pMainForm->client(), LSCP_MIDI_MAP_ALL); |
= ::lscp_list_midi_instruments(pMainForm->client(), LSCP_MIDI_MAP_ALL); |
598 |
for (int iInstr = 0; pInstrs && pInstrs[iInstr].prog >= 0; ++iInstr) { |
for (int iInstr = 0; pInstrs && pInstrs[iInstr].map >= 0; ++iInstr) { |
599 |
int iMap = pInstrs[iInstr].map; |
int iMap = pInstrs[iInstr].map; |
600 |
int iBank = pInstrs[iInstr].bank; |
int iBank = pInstrs[iInstr].bank; |
601 |
int iProg = pInstrs[iInstr].prog; |
int iProg = pInstrs[iInstr].prog; |