diff options
author | Chris Xiong <chirs241097@gmail.com> | 2019-05-25 22:40:15 +0800 |
---|---|---|
committer | Chris Xiong <chirs241097@gmail.com> | 2019-05-25 22:40:15 +0800 |
commit | 3f72121ac41741d53e4916f1275cbd4f93259c4d (patch) | |
tree | 15bba079c86de0e241812cd657ad190eb0c2c41a /qmidiplayer-desktop/qmpplugin.cpp | |
parent | eba45fdf11a98113b439db0510b55f14845db8fb (diff) | |
download | QMidiPlayer-3f72121ac41741d53e4916f1275cbd4f93259c4d.tar.xz |
Massive code refactor en cours!
Less complain from compilers:
- use nullptr instead of NULL
- use types for event fields
- explicit type casting added
Stop saving parameters of meta events in p1/p2 fields of SEvent.
callback_t now uses std::function, deprecating ICallback.
Not recommended for daily usage, or even testing: the code refactor
is still a work in progress.
Diffstat (limited to 'qmidiplayer-desktop/qmpplugin.cpp')
-rw-r--r-- | qmidiplayer-desktop/qmpplugin.cpp | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/qmidiplayer-desktop/qmpplugin.cpp b/qmidiplayer-desktop/qmpplugin.cpp index 13d5730..8655dff 100644 --- a/qmidiplayer-desktop/qmpplugin.cpp +++ b/qmidiplayer-desktop/qmpplugin.cpp @@ -101,7 +101,7 @@ qmpPluginManager::~qmpPluginManager() if(plugins[i].initialized)plugins[i].pinterface->deinit(); delete plugins[i].pinterface; } - qmw=NULL;qsw=NULL;delete pluginAPI; + qmw=nullptr;qsw=nullptr;delete pluginAPI; } std::vector<qmpPlugin> *qmpPluginManager::getPlugins() { @@ -182,10 +182,11 @@ std::string qmpPluginAPI::getChannelPresetString(int ch) return std::string(ret); } bool qmpPluginAPI::isDarkTheme(){return qmw?qmw->isDarkTheme():false;} +void* qmpPluginAPI::getMainWindow(){return (void*)qmw;} void qmpPluginAPI::discardCurrentEvent(){if(qmw&&qmw->getPlayer())qmw->getPlayer()->discardCurrentEvent();} -void qmpPluginAPI::commitEventChange(SEventCallBackData d){if(qmw&&qmw->getPlayer())qmw->getPlayer()->commitEventChange(d);} -void qmpPluginAPI::callEventReaderCB(SEventCallBackData d){if(qmw&&qmw->getPlayer())qmw->getPlayer()->callEventReaderCB(d);} +void qmpPluginAPI::commitEventChange(SEvent d){if(qmw&&qmw->getPlayer())qmw->getPlayer()->commitEventChange(d);} +void qmpPluginAPI::callEventReaderCB(SEvent d){if(qmw&&qmw->getPlayer())qmw->getPlayer()->callEventReaderCB(d);} void qmpPluginAPI::setFuncState(std::string name,bool state){if(qmw)qmw->setFuncState(name,state);} void qmpPluginAPI::setFuncEnabled(std::string name,bool enable){if(qmw)qmw->setFuncEnabled(name,enable);} @@ -219,6 +220,18 @@ void qmpPluginAPI::registerFileReader(qmpFileReader* reader,std::string name) {qmw->getPlayer()->registerReader(reader,name);} void qmpPluginAPI::unregisterFileReader(std::string name) {qmw->getPlayer()->unregisterReader(name);} +int qmpPluginAPI::registerEventHandler(callback_t cb,void *userdata) +{return qmw->getPlayer()->registerEventHandler(cb,userdata);} +void qmpPluginAPI::unregisterEventHandler(int id) +{qmw->getPlayer()->unregisterEventHandler(id);} +int qmpPluginAPI::registerEventReadHandler(callback_t cb,void *userdata) +{return qmw->getPlayer()->registerEventReadHandler(cb,userdata);} +void qmpPluginAPI::unregisterEventReadHandler(int id) +{qmw->getPlayer()->unregisterEventReadHandler(id);} +int qmpPluginAPI::registerFileReadFinishHook(callback_t cb,void *userdata) +{return qmw->getPlayer()->registerFileReadFinishHook(cb,userdata);} +void qmpPluginAPI::unregisterFileReadFinishHook(int id) +{qmw->getPlayer()->unregisterFileReadFinishHook(id);} void qmpPluginAPI::registerOptionInt(std::string tab,std::string desc,std::string key,int min,int max,int defaultval) {qsw->registerOptionInt(tab,desc,key,min,max,defaultval);} |