diff options
Diffstat (limited to 'muse2')
-rw-r--r-- | muse2/ChangeLog | 2 | ||||
-rw-r--r-- | muse2/muse/plugin.cpp | 386 | ||||
-rw-r--r-- | muse2/muse/plugin.h | 11 |
3 files changed, 197 insertions, 202 deletions
diff --git a/muse2/ChangeLog b/muse2/ChangeLog index 832def1d..196d4838 100644 --- a/muse2/ChangeLog +++ b/muse2/ChangeLog @@ -1,3 +1,5 @@ +04.11.2010 + - Fixed LADSPA plugin dialog. TODO: fix sorting order. (Tim) 02.11.2010 - Solved! All the MESS synths load now. Removed mpevent(.h, .cpp) and evdata.h from /libsynti, conflicting with copies in /muse, causing crashes. Versions in /muse are newer. diff --git a/muse2/muse/plugin.cpp b/muse2/muse/plugin.cpp index 61e49401..68486bf0 100644 --- a/muse2/muse/plugin.cpp +++ b/muse2/muse/plugin.cpp @@ -2533,27 +2533,47 @@ int PluginI::oscControl(unsigned long port, float value) // select Plugin dialog //--------------------------------------------------------- -PluginDialog::PluginDialog(QWidget* parent, const char* name, bool modal) - : QDialog(parent, name, modal) +PluginDialog::PluginDialog(QWidget* parent) + : QDialog(parent) { setCaption(tr("MusE: select plugin")); QVBoxLayout* layout = new QVBoxLayout(this); - pList = new Q3ListView(this); - pList->setAllColumnsShowFocus(true); - pList->addColumn(tr("Lib"), 110); - pList->addColumn(tr("Label"), 110); - pList->addColumn(tr("Name"), 200); - pList->addColumn(tr("AI"), 30); - pList->addColumn(tr("AO"), 30); - pList->addColumn(tr("CI"), 30); - pList->addColumn(tr("CO"), 30); - pList->addColumn(tr("IP"), 30); - pList->addColumn(tr("id"), 40); - pList->addColumn(tr("Maker"), 110); - pList->addColumn(tr("Copyright"), 110); - pList->setColumnWidthMode(1, Q3ListView::Maximum); + pList = new QTreeWidget(this); + pList->setColumnCount(11); + pList->setSortingEnabled(true); + QStringList headerLabels; + headerLabels << tr("Lib"); + headerLabels << tr("Label"); + headerLabels << tr("Name"); + headerLabels << tr("AI"); + headerLabels << tr("AO"); + headerLabels << tr("CI"); + headerLabels << tr("CO"); + headerLabels << tr("IP"); + headerLabels << tr("id"); + headerLabels << tr("Maker"); + headerLabels << tr("Copyright"); + + int sizes[] = { 110, 110, 0, 30, 30, 30, 30, 30, 40, 110, 110 }; + for (int i = 0; i < 11; ++i) { + if (sizes[i] == 0) { + pList->header()->setResizeMode(i, QHeaderView::Stretch); + } + else { + if (sizes[i] <= 40) // hack alert! + pList->header()->setResizeMode(i, QHeaderView::Custom); + pList->header()->resizeSection(i, sizes[i]); + } + } + + pList->setHeaderLabels(headerLabels); + pList->setSelectionBehavior(QAbstractItemView::SelectRows); + pList->setSelectionMode(QAbstractItemView::SingleSelection); + pList->setAlternatingRowColors(true); + + fillPlugs(selectedPlugType); layout->addWidget(pList); //--------------------------------------------------- @@ -2572,60 +2592,73 @@ PluginDialog::PluginDialog(QWidget* parent, const char* name, bool modal) w5->addSpacing(12); w5->addWidget(cancelB); - // ORCAN - CHECK - //QButtonGroup* plugSel = new QButtonGroup(4, Qt::Horizontal, this, "Show plugs:"); - QGroupBox* plugSel = new QGroupBox(this); - plugSel->setTitle("Show plugs:"); - QRadioButton* onlySM = new QRadioButton(plugSel, "Mono and Stereo"); - onlySM->setText( "Mono and Stereo"); - QRadioButton* onlyS = new QRadioButton(plugSel, "Stereo"); - onlyS->setText( "Stereo"); - QRadioButton* onlyM = new QRadioButton(plugSel, "Mono"); - onlyM->setText( "Mono"); - QRadioButton* allPlug = new QRadioButton(plugSel, "Show all"); - allPlug->setText( "Show All"); - - // ORCAN - FIXME - //plugSel->setRadioButtonExclusive(true); - //plugSel->setButton(selectedPlugType); - - QToolTip::add(plugSel, tr("Select which types of plugins should be visible in the list.<br>" - "Note that using mono plugins on stereo tracks is not a problem, two will be used in parallel.<br>" - "Also beware that the 'all' alternative includes plugins that probably are not usable by MusE.")); - - onlySM->setCaption(tr("Stereo and Mono")); - onlyS->setCaption(tr("Stereo")); - onlyM->setCaption(tr("Mono")); - allPlug->setCaption(tr("All")); + QGroupBox* plugSelGroup = new QGroupBox; + plugSelGroup->setTitle("Show plugs:"); + QHBoxLayout* psl = new QHBoxLayout; + plugSelGroup->setLayout(psl); + + QButtonGroup* plugSel = new QButtonGroup(plugSelGroup); + onlySM = new QRadioButton; + onlySM->setText(tr("Mono and Stereo")); + onlySM->setCheckable(true); + plugSel->addButton(onlySM); + psl->addWidget(onlySM); + onlyS = new QRadioButton; + onlyS->setText(tr("Stereo")); + onlyS->setCheckable(true); + plugSel->addButton(onlyS); + psl->addWidget(onlyS); + onlyM = new QRadioButton; + onlyM->setText(tr("Mono")); + onlyM->setCheckable(true); + plugSel->addButton(onlyM); + psl->addWidget(onlyM); + allPlug = new QRadioButton; + allPlug->setText(tr("Show All")); + allPlug->setCheckable(true); + plugSel->addButton(allPlug); + psl->addWidget(allPlug); + plugSel->setExclusive(true); + + switch(selectedPlugType) { + case SEL_SM: onlySM->setChecked(true); break; + case SEL_S: onlyS->setChecked(true); break; + case SEL_M: onlyM->setChecked(true); break; + case SEL_ALL: allPlug->setChecked(true); break; + } + + plugSelGroup->setToolTip(tr("Select which types of plugins should be visible in the list.<br>" + "Note that using mono plugins on stereo tracks is not a problem, two will be used in parallell.<br>" + "Also beware that the 'all' alternative includes plugins that probably not are usable by MusE.")); w5->addSpacing(12); - w5->addWidget(plugSel); + w5->addWidget(plugSelGroup); w5->addSpacing(12); - - QLabel *sortLabel = new QLabel( this, "Search in 'Label' and 'Name':" ); - sortLabel->setText( "Search in 'Label' and 'Name':" ); + + QLabel *sortLabel = new QLabel; + sortLabel->setText(tr("Search in 'Label' and 'Name':")); w5->addWidget(sortLabel); w5->addSpacing(2); - - sortBox = new QComboBox( true, this, "sort" ); + + sortBox = new QComboBox(this); + sortBox->setEditable(true); if (!sortItems.empty()) - sortBox->insertStringList(sortItems); - - sortBox->setMinimumSize( 100, 10); + sortBox->addItems(sortItems); + + sortBox->setMinimumSize(100, 10); w5->addWidget(sortBox); w5->addStretch(-1); - - if (sortBox->currentText().length() > 0) - fillPlugs(sortBox->currentText()); + + if (!sortBox->currentText().isEmpty()) + fillPlugs(sortBox->currentText()); else - fillPlugs(selectedPlugType); - + fillPlugs(selectedPlugType); - connect(pList, SIGNAL(doubleClicked(Q3ListViewItem*)), SLOT(accept())); + connect(pList, SIGNAL(itemDoubleClicked(QTreeWidgetItem*,int)), SLOT(accept())); connect(cancelB, SIGNAL(clicked()), SLOT(reject())); connect(okB, SIGNAL(clicked()), SLOT(accept())); - connect(plugSel, SIGNAL(clicked(int)), SLOT(fillPlugs(int))); - connect(sortBox, SIGNAL(textChanged(const QString&)),SLOT(fillPlugs(const QString&))); + connect(plugSel, SIGNAL(buttonClicked(QAbstractButton*)), SLOT(fillPlugs(QAbstractButton*))); + connect(sortBox, SIGNAL(editTextChanged(const QString&)),SLOT(fillPlugs(const QString&))); sortBox->setFocus(); } @@ -2635,9 +2668,10 @@ PluginDialog::PluginDialog(QWidget* parent, const char* name, bool modal) Plugin* PluginDialog::value() { - Q3ListViewItem* item = pList->selectedItem(); + QTreeWidgetItem* item = pList->selectedItems().at(0); if (item) - return plugins.find(item->text(0), item->text(1)); + return plugins.find(item->text(0), item->text(1)); + printf("plugin not found\n"); return 0; } @@ -2648,9 +2682,13 @@ Plugin* PluginDialog::value() void PluginDialog::accept() { if (!sortBox->currentText().isEmpty()) { - if (sortItems.find(sortBox->currentText()) == sortItems.end()) - sortItems.push_front(sortBox->currentText()); - } + foreach (QString item, sortItems) + if(item == sortBox->currentText()) { + QDialog::accept(); + return; + } + sortItems.push_front(sortBox->currentText()); + } QDialog::accept(); } @@ -2658,149 +2696,97 @@ void PluginDialog::accept() // fillPlugs //--------------------------------------------------------- -void PluginDialog::fillPlugs(int nbr) -{ - pList->clear(); - for(iPlugin i = plugins.begin(); i != plugins.end(); ++i) - { - /* - int ai = 0; - int ao = 0; - int ci = 0; - int co = 0; - for(unsigned long k = 0; k < i->ports(); ++k) - { - LADSPA_PortDescriptor pd = i->portd(k); - if(pd & LADSPA_PORT_CONTROL) +void PluginDialog::fillPlugs(QAbstractButton* ab) { - if(pd & LADSPA_PORT_INPUT) - ++ci; - else - if(pd & LADSPA_PORT_OUTPUT) - ++co; + if (ab == allPlug) + fillPlugs(SEL_ALL); + else if (ab == onlyM) + fillPlugs(SEL_M); + else if (ab == onlyS) + fillPlugs(SEL_S); + else if (ab == onlySM) + fillPlugs(SEL_SM); } - else - if(pd & LADSPA_PORT_AUDIO) - { - if(pd & LADSPA_PORT_INPUT) - ++ai; - else - if(pd & LADSPA_PORT_OUTPUT) - ++ao; - } - } - */ - int ai = i->inports(); - int ao = i->outports(); - int ci = i->controlInPorts(); - int co = i->controlOutPorts(); - - bool addFlag = false; - switch(nbr) - { - case 0: // stereo & mono - if ((ai == 1 || ai == 2) && (ao == 1 || ao ==2)) - { - addFlag = true; - } - break; - case 1: // stereo - if ((ai == 1 || ai == 2) && ao ==2) - { - addFlag = true; - } - break; - case 2: // mono - if (ai == 1 && ao == 1) - { - addFlag = true; - } - break; - case 3: // all - addFlag = true; - break; - } - if(addFlag) - { - Q3ListViewItem* item = new Q3ListViewItem(pList, - i->lib(), - i->label(), - i->name(), - QString().setNum(ai), - QString().setNum(ao), - QString().setNum(ci), - QString().setNum(co), - QString().setNum(i->inPlaceCapable()) - ); - item->setText(8, QString().setNum(i->id())); - item->setText(9, i->maker()); - item->setText(10, i->copyright()); - } - } - selectedPlugType = nbr; + +void PluginDialog::fillPlugs(int nbr) +{ + pList->clear(); + for (iPlugin i = plugins.begin(); i != plugins.end(); ++i) { + int ai = i->inports(); + int ao = i->outports(); + int ci = i->controlInPorts(); + int co = i->controlOutPorts(); + bool addFlag = false; + switch (nbr) { + case SEL_SM: // stereo & mono + if ((ai == 1 || ai == 2) && (ao == 1 || ao ==2)) { + addFlag = true; + } + break; + case SEL_S: // stereo + if ((ai == 1 || ai == 2) && ao ==2) { + addFlag = true; + } + break; + case SEL_M: // mono + if (ai == 1 && ao == 1) { + addFlag = true; + } + break; + case SEL_ALL: // all + addFlag = true; + break; + } + if (addFlag) { + QTreeWidgetItem* item = new QTreeWidgetItem; + item->setText(0, i->lib()); + item->setText(1, i->label()); + item->setText(2, i->name()); + item->setText(3, QString().setNum(ai)); + item->setText(4, QString().setNum(ao)); + item->setText(5, QString().setNum(ci)); + item->setText(6, QString().setNum(co)); + item->setText(7, QString().setNum(i->inPlaceCapable())); + item->setText(8, QString().setNum(i->id())); + item->setText(9, i->maker()); + item->setText(10, i->copyright()); + pList->addTopLevelItem(item); + } + } + selectedPlugType = nbr; } void PluginDialog::fillPlugs(const QString &sortValue) { - pList->clear(); - for(iPlugin i = plugins.begin(); i != plugins.end(); ++i) - { - /* - int ai = 0; - int ao = 0; - int ci = 0; - int co = 0; - for(unsigned long k = 0; k < i->ports(); ++k) - { - LADSPA_PortDescriptor pd = i->portd(k); - if(pd & LADSPA_PORT_CONTROL) - { - if(pd & LADSPA_PORT_INPUT) - ++ci; - else - if(pd & LADSPA_PORT_OUTPUT) - ++co; - } - else - if(pd & LADSPA_PORT_AUDIO) - { - if(pd & LADSPA_PORT_INPUT) - ++ai; - else - if(pd & LADSPA_PORT_OUTPUT) - ++ao; - } - } - */ - int ai = i->inports(); - int ao = i->outports(); - int ci = i->controlInPorts(); - int co = i->controlOutPorts(); - - bool addFlag = false; - - if(i->label().lower().contains(sortValue.lower())) - addFlag = true; - else - if(i->name().lower().contains(sortValue.lower())) - addFlag = true; - if(addFlag) - { - Q3ListViewItem* item = new Q3ListViewItem(pList, - i->lib(), - i->label(), - i->name(), - QString().setNum(ai), - QString().setNum(ao), - QString().setNum(ci), - QString().setNum(co), - QString().setNum(i->inPlaceCapable()) - ); - item->setText(8, QString().setNum(i->id())); - item->setText(9, i->maker()); - item->setText(10, i->copyright()); - } - } + pList->clear(); + for (iPlugin i = plugins.begin(); i != plugins.end(); ++i) { + int ai = i->inports(); + int ao = i->outports(); + int ci = i->controlInPorts(); + int co = i->controlOutPorts(); + + bool addFlag = false; + + if (i->label().toLower().contains(sortValue.toLower())) + addFlag = true; + else if (i->name().toLower().contains(sortValue.toLower())) + addFlag = true; + if (addFlag) { + QTreeWidgetItem* item = new QTreeWidgetItem; + item->setText(0, i->lib()); + item->setText(1, i->label()); + item->setText(2, i->name()); + item->setText(3, QString().setNum(ai)); + item->setText(4, QString().setNum(ao)); + item->setText(5, QString().setNum(ci)); + item->setText(6, QString().setNum(co)); + item->setText(7, QString().setNum(i->inPlaceCapable())); + item->setText(8, QString().setNum(i->id())); + item->setText(9, i->maker()); + item->setText(10, i->copyright()); + pList->addTopLevelItem(item); + } + } } //--------------------------------------------------------- diff --git a/muse2/muse/plugin.h b/muse2/muse/plugin.h index 70573796..a6834cdc 100644 --- a/muse2/muse/plugin.h +++ b/muse2/muse/plugin.h @@ -504,17 +504,24 @@ typedef Pipeline::const_iterator ciPluginI; // PluginDialog //--------------------------------------------------------- +enum { SEL_SM, SEL_S, SEL_M, SEL_ALL }; + class PluginDialog : public QDialog { - Q3ListView* pList; + QTreeWidget* pList; + QRadioButton* allPlug; + QRadioButton* onlyM; + QRadioButton* onlyS; + QRadioButton* onlySM; Q_OBJECT public: - PluginDialog(QWidget* parent=0, const char* name=0, bool modal=true); + PluginDialog(QWidget* parent=0); static Plugin* getPlugin(QWidget* parent); Plugin* value(); void accept(); public slots: + void fillPlugs(QAbstractButton*); void fillPlugs(int i); void fillPlugs(const QString& sortValue); private: |