diff options
-rw-r--r-- | ChangeLog | 4 | ||||
-rw-r--r-- | include/qmpcorepublic.hpp | 6 | ||||
-rw-r--r-- | qmidiplayer-desktop/qmpmainwindow.cpp | 12 | ||||
-rw-r--r-- | qmidiplayer-desktop/qmpplugin.cpp | 10 | ||||
-rw-r--r-- | qmidiplayer-desktop/qmpplugin.hpp | 2 | ||||
-rw-r--r-- | qmidiplayer-desktop/qmpsettingswindow.cpp | 29 | ||||
-rw-r--r-- | qmidiplayer-desktop/qmpsettingswindow.hpp | 2 | ||||
-rw-r--r-- | qmidiplayer-desktop/qmpsettingswindow.ui | 35 | ||||
-rw-r--r-- | visualization/qmpvisualization.cpp | 9 | ||||
-rw-r--r-- | visualization/qmpvisualization.hpp | 1 |
10 files changed, 98 insertions, 12 deletions
@@ -1,3 +1,7 @@ +2016-04-28 0.7.8 beta +List plugins in settings window. +Plugins can be disabled now. + 2016-04-27 0.7.8 beta Show file name in window title. Handle pitch bend in visualization. diff --git a/include/qmpcorepublic.hpp b/include/qmpcorepublic.hpp index a8e3fa8..03e99a0 100644 --- a/include/qmpcorepublic.hpp +++ b/include/qmpcorepublic.hpp @@ -63,15 +63,17 @@ class qmpPluginAPI virtual double getPitchBend(int ch); virtual bool getChannelMask(int ch); virtual std::string getTitle(); + virtual int registerVisualizationIntf(qmpVisualizationIntf* intf); virtual void unregisterVisualizationIntf(int intfhandle); virtual int registerEventReaderIntf(IMidiCallBack* cb,void* userdata); virtual void unregisterEventReaderIntf(int intfhandle); virtual int registerEventHandlerIntf(IMidiCallBack* cb,void* userdata); virtual void unregisterEventHandlerIntf(int intfhandle); - virtual void registerOptionInt(std::string desc,std::string key,int defaultval); + + virtual void registerOptionInt(std::string desc,std::string key,int min,int max,int defaultval); virtual int getOptionInt(std::string key); - virtual void registerOptionDouble(std::string desc,std::string key,double defaultval); + virtual void registerOptionDouble(std::string desc,std::string key,double min,double max,double defaultval); virtual double getOptionDouble(std::string key); virtual void registerOptionString(std::string desc,std::string key,std::string defaultval); virtual std::string getOptionString(std::string key); diff --git a/qmidiplayer-desktop/qmpmainwindow.cpp b/qmidiplayer-desktop/qmpmainwindow.cpp index 58b28b7..d25cadd 100644 --- a/qmidiplayer-desktop/qmpmainwindow.cpp +++ b/qmidiplayer-desktop/qmpmainwindow.cpp @@ -80,7 +80,7 @@ void qmpMainWindow::init() ui->lbFileName->addAction(fnA1); ui->lbFileName->addAction(fnA2); ui->lbFileName->addAction(fnA3); - pmgr->scanPlugins();pmgr->initPlugins(); + pmgr->scanPlugins();settingsw->updatePluginList(pmgr);pmgr->initPlugins(); if(singleFS){player->fluidPreInitialize();playerSetup();player->fluidInitialize(); for(int i=settingsw->getSFWidget()->count()-1;i>=0;--i) LOAD_SOUNDFONT;} @@ -655,7 +655,15 @@ void qmpMainWindow::on_pushButton_clicked() void qmpMainWindow::on_pbVisualization_clicked() { if(ui->pbVisualization->isChecked()) - {for(int i=0;i<16;++i)if(VIs[i])VIs[i]->show();} + { + bool havevis=false; + for(int i=0;i<16;++i)if(VIs[i])VIs[i]->show(),havevis=true; + if(!havevis) + { + QMessageBox::information(this,tr("No visualization plugin enabled"),tr("No visualization plugin enabled. Please enable at least one in plugin settings.")); + ui->pbVisualization->setChecked(false); + } + } else {for(int i=0;i<16;++i)if(VIs[i])VIs[i]->close();} } diff --git a/qmidiplayer-desktop/qmpplugin.cpp b/qmidiplayer-desktop/qmpplugin.cpp index 837f4db..3db7b08 100644 --- a/qmidiplayer-desktop/qmpplugin.cpp +++ b/qmidiplayer-desktop/qmpplugin.cpp @@ -58,12 +58,18 @@ qmpPluginManager::qmpPluginManager() } qmpPluginManager::~qmpPluginManager() { + for(unsigned i=0;i<plugins.size();++i)delete plugins[i].interface; qmw=NULL;qsw=NULL; } +std::vector<qmpPlugin> *qmpPluginManager::getPlugins() +{ + return &plugins; +} void qmpPluginManager::initPlugins() { for(unsigned i=0;i<plugins.size();++i) { + if(!plugins[i].enabled)continue; printf("Loaded plugin: %s\n",plugins[i].path.c_str()); plugins[i].interface->init(); } @@ -111,9 +117,9 @@ int qmpPluginAPI::registerVisualizationIntf(qmpVisualizationIntf* intf) {return qmw->registerVisualizationIntf(intf);} void qmpPluginAPI::unregisterVisualizationIntf(int intfhandle) {qmw->unregisterVisualizationIntf(intfhandle);} -void qmpPluginAPI::registerOptionInt(std::string,std::string,int){} +void qmpPluginAPI::registerOptionInt(std::string,std::string,int,int,int){} int qmpPluginAPI::getOptionInt(std::string){return 0;} -void qmpPluginAPI::registerOptionDouble(std::string,std::string,double){} +void qmpPluginAPI::registerOptionDouble(std::string,std::string,double,double,double){} double qmpPluginAPI::getOptionDouble(std::string){return 0;} void qmpPluginAPI::registerOptionString(std::string,std::string,std::string){} std::string qmpPluginAPI::getOptionString(std::string){return "";} diff --git a/qmidiplayer-desktop/qmpplugin.hpp b/qmidiplayer-desktop/qmpplugin.hpp index 81a16a7..836cee2 100644 --- a/qmidiplayer-desktop/qmpplugin.hpp +++ b/qmidiplayer-desktop/qmpplugin.hpp @@ -19,7 +19,7 @@ class qmpPluginManager public: qmpPluginManager(); ~qmpPluginManager(); - std::vector<qmpPlugin> getPlugins() const; + std::vector<qmpPlugin> *getPlugins(); void scanPlugins(); void initPlugins(); void deinitPlugins(); diff --git a/qmidiplayer-desktop/qmpsettingswindow.cpp b/qmidiplayer-desktop/qmpsettingswindow.cpp index 985fb6e..d59d2be 100644 --- a/qmidiplayer-desktop/qmpsettingswindow.cpp +++ b/qmidiplayer-desktop/qmpsettingswindow.cpp @@ -242,6 +242,12 @@ void qmpSettingsWindow::settingsUpdate() } settings->setValue("Behavior/SingleInstance",ui->cbPersistentfs->isChecked()?1:0); + + for(int i=0;i<ui->twPluginList->rowCount();++i) + settings->setValue( + QString("PluginSwitch/")+ui->twPluginList->item(i,1)->text(), + ((QCheckBox*)ui->twPluginList->cellWidget(i,0))->isChecked()?1:0); + settings->sync(); } @@ -294,3 +300,26 @@ void qmpSettingsWindow::on_cbAutoBS_stateChanged() { ui->lbBSMode->setText(ui->cbAutoBS->isChecked()?"Fallback bank select mode":"Bank select mode"); } + +void qmpSettingsWindow::updatePluginList(qmpPluginManager *pmgr) +{ + std::vector<qmpPlugin> *plugins=pmgr->getPlugins(); + for(unsigned i=0;i<plugins->size();++i) + { + ui->twPluginList->insertRow(i); + ui->twPluginList->setCellWidget(i,0,new QCheckBox("")); + if(settings->value(QString("PluginSwitch/")+QString(plugins->at(i).name.c_str()),0).toInt()) + {((QCheckBox*)ui->twPluginList->cellWidget(i,0))->setChecked(true);plugins->at(i).enabled=true;} + else + {((QCheckBox*)ui->twPluginList->cellWidget(i,0))->setChecked(false);plugins->at(i).enabled=false;} + ui->twPluginList->setItem(i,1,new QTableWidgetItem(plugins->at(i).name.c_str())); + ui->twPluginList->setItem(i,2,new QTableWidgetItem(plugins->at(i).version.c_str())); + ui->twPluginList->setItem(i,3,new QTableWidgetItem(plugins->at(i).path.c_str())); + for(int j=1;j<=3;++j) + ui->twPluginList->item(i,j)->setFlags(ui->twPluginList->item(i,j)->flags()^Qt::ItemIsEditable); + } + ui->twPluginList->setColumnWidth(0,22); + ui->twPluginList->setColumnWidth(1,192); + ui->twPluginList->setColumnWidth(2,64); + ui->twPluginList->setColumnWidth(3,128); +} diff --git a/qmidiplayer-desktop/qmpsettingswindow.hpp b/qmidiplayer-desktop/qmpsettingswindow.hpp index 6c95663..f7bfae9 100644 --- a/qmidiplayer-desktop/qmpsettingswindow.hpp +++ b/qmidiplayer-desktop/qmpsettingswindow.hpp @@ -6,6 +6,7 @@ #include <QSettings> #include <QListWidget> #include <QComboBox> +#include "qmpplugin.hpp" namespace Ui { class qmpSettingsWindow; @@ -21,6 +22,7 @@ class qmpSettingsWindow:public QDialog void closeEvent(QCloseEvent *event); void settingsInit(); QListWidget* getSFWidget(); + void updatePluginList(qmpPluginManager *pmgr); signals: void dialogClosing(); diff --git a/qmidiplayer-desktop/qmpsettingswindow.ui b/qmidiplayer-desktop/qmpsettingswindow.ui index 96d0a43..cc9064f 100644 --- a/qmidiplayer-desktop/qmpsettingswindow.ui +++ b/qmidiplayer-desktop/qmpsettingswindow.ui @@ -6,13 +6,13 @@ <rect> <x>0</x> <y>0</y> - <width>494</width> + <width>495</width> <height>445</height> </rect> </property> <property name="minimumSize"> <size> - <width>494</width> + <width>495</width> <height>445</height> </size> </property> @@ -564,6 +564,37 @@ </item> </layout> </widget> + <widget class="QWidget" name="tab_5"> + <attribute name="title"> + <string>Plugins</string> + </attribute> + <layout class="QVBoxLayout" name="verticalLayout_5"> + <item> + <widget class="QTableWidget" name="twPluginList"> + <column> + <property name="text"> + <string>E</string> + </property> + </column> + <column> + <property name="text"> + <string>Name</string> + </property> + </column> + <column> + <property name="text"> + <string>Version</string> + </property> + </column> + <column> + <property name="text"> + <string>Path</string> + </property> + </column> + </widget> + </item> + </layout> + </widget> </widget> </item> <item> diff --git a/visualization/qmpvisualization.cpp b/visualization/qmpvisualization.cpp index 1e64b22..1a11334 100644 --- a/visualization/qmpvisualization.cpp +++ b/visualization/qmpvisualization.cpp @@ -238,13 +238,16 @@ void qmpVisualization::init() vi=new CDemoVisualization(this); h=new CMidiVisualHandler(this); closeh=new CloseHandler(this); - api->registerVisualizationIntf(vi); - api->registerEventReaderIntf(cb,NULL); - api->registerEventHandlerIntf(hcb,NULL); + hvif=api->registerVisualizationIntf(vi); + herif=api->registerEventReaderIntf(cb,NULL); + hehif=api->registerEventHandlerIntf(hcb,NULL); } void qmpVisualization::deinit() { close(); + api->unregisterVisualizationIntf(hvif); + api->unregisterEventReaderIntf(herif); + api->unregisterEventHandlerIntf(hehif); delete cb;delete hcb;delete vi; delete h;delete closeh; } diff --git a/visualization/qmpvisualization.hpp b/visualization/qmpvisualization.hpp index afc57a4..787b218 100644 --- a/visualization/qmpvisualization.hpp +++ b/visualization/qmpvisualization.hpp @@ -53,6 +53,7 @@ class qmpVisualization:public qmpPluginIntf uint32_t ctc,ctk,fintk,elb; double etps; bool shouldclose,playing; + int hvif,herif,hehif; void drawCube(smvec3d a,smvec3d b,DWORD col,SMTEX tex); void showThread(); public: |