aboutsummaryrefslogtreecommitdiff
path: root/qmidiplayer-desktop
diff options
context:
space:
mode:
authorGravatar Chris Xiong <chirs241097@gmail.com> 2016-04-28 23:40:42 +0800
committerGravatar Chris Xiong <chirs241097@gmail.com> 2016-04-28 23:40:42 +0800
commit13fca5100f1e28a538e7900d011714d94f6b1b10 (patch)
tree2034d837473c14f600987134d98f51f0a5ab3c5d /qmidiplayer-desktop
parent8eac5088101595422753030b1b259411d63f83a8 (diff)
downloadQMidiPlayer-13fca5100f1e28a538e7900d011714d94f6b1b10.tar.xz
Now it is possible to disable plugins in the plugin list.
Diffstat (limited to 'qmidiplayer-desktop')
-rw-r--r--qmidiplayer-desktop/qmpmainwindow.cpp12
-rw-r--r--qmidiplayer-desktop/qmpplugin.cpp10
-rw-r--r--qmidiplayer-desktop/qmpplugin.hpp2
-rw-r--r--qmidiplayer-desktop/qmpsettingswindow.cpp29
-rw-r--r--qmidiplayer-desktop/qmpsettingswindow.hpp2
-rw-r--r--qmidiplayer-desktop/qmpsettingswindow.ui35
6 files changed, 83 insertions, 7 deletions
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>