diff options
author | Chris Xiong <chirs241097@gmail.com> | 2020-05-12 00:58:40 +0800 |
---|---|---|
committer | Chris Xiong <chirs241097@gmail.com> | 2020-05-12 00:58:40 +0800 |
commit | a7407edaf81c685d4a389785a405a53a5de4b148 (patch) | |
tree | e6e4f2d85f2172c94ac83a6e8f01e1e90a78ede9 /visualization/renderer/qmppluginapistub.cpp | |
parent | 437b7b16c322a8e53ac55a5f831098494d9a7073 (diff) | |
download | QMidiPlayer-a7407edaf81c685d4a389785a405a53a5de4b148.tar.xz |
Format EVERYTHING.
Hopefully this will make the source code less horrendous and actually
readable.
The command used was:
```
astyle --suffix=none --style=allman --attach-extern-c --attach-closing-while --indent-switches --indent-after-parens --pad-oper --pad-header --unpad-paren --align-pointer=name --recursive './*.cpp,*.hpp'
```
Diffstat (limited to 'visualization/renderer/qmppluginapistub.cpp')
-rw-r--r-- | visualization/renderer/qmppluginapistub.cpp | 220 |
1 files changed, 134 insertions, 86 deletions
diff --git a/visualization/renderer/qmppluginapistub.cpp b/visualization/renderer/qmppluginapistub.cpp index 1be4880..b84a2b6 100644 --- a/visualization/renderer/qmppluginapistub.cpp +++ b/visualization/renderer/qmppluginapistub.cpp @@ -6,197 +6,245 @@ #include <QTextCodec> qmpPluginAPIStub::qmpPluginAPIStub(qmpVisRenderCore *_core): - core(_core) + core(_core) { } qmpPluginAPIStub::~qmpPluginAPIStub() { - core=nullptr; + core = nullptr; } uint32_t qmpPluginAPIStub::getDivision() { - return core->player->getDivision(); + return core->player->getDivision(); +} +uint32_t qmpPluginAPIStub::getRawTempo() +{ + return 0; +} +double qmpPluginAPIStub::getRealTempo() +{ + return 0; +} +uint32_t qmpPluginAPIStub::getTimeSig() +{ + return 0; +} +int qmpPluginAPIStub::getKeySig() +{ + return 0; +} +uint32_t qmpPluginAPIStub::getNoteCount() +{ + return 0; } -uint32_t qmpPluginAPIStub::getRawTempo(){return 0;} -double qmpPluginAPIStub::getRealTempo(){return 0;} -uint32_t qmpPluginAPIStub::getTimeSig(){return 0;} -int qmpPluginAPIStub::getKeySig(){return 0;} -uint32_t qmpPluginAPIStub::getNoteCount(){return 0;} uint32_t qmpPluginAPIStub::getMaxTick() { - return core->player->getMaxTick(); -} -uint32_t qmpPluginAPIStub::getCurrentPolyphone(){return 0;} -uint32_t qmpPluginAPIStub::getMaxPolyphone(){return 0;} -uint32_t qmpPluginAPIStub::getCurrentTimeStamp(){return 0;} -uint32_t qmpPluginAPIStub::getCurrentPlaybackPercentage(){return 0;} -int qmpPluginAPIStub::getChannelCC(int ch, int cc){return 0;} -int qmpPluginAPIStub::getChannelPreset(int ch){return 0;} -void qmpPluginAPIStub::playerSeek(uint32_t percentage){} -double qmpPluginAPIStub::getPitchBend(int ch){return 0;} -void qmpPluginAPIStub::getPitchBendRaw(int ch,uint32_t *pb,uint32_t *pbr){} -bool qmpPluginAPIStub::getChannelMask(int ch){return 0;} + return core->player->getMaxTick(); +} +uint32_t qmpPluginAPIStub::getCurrentPolyphone() +{ + return 0; +} +uint32_t qmpPluginAPIStub::getMaxPolyphone() +{ + return 0; +} +uint32_t qmpPluginAPIStub::getCurrentTimeStamp() +{ + return 0; +} +uint32_t qmpPluginAPIStub::getCurrentPlaybackPercentage() +{ + return 0; +} +int qmpPluginAPIStub::getChannelCC(int ch, int cc) +{ + return 0; +} +int qmpPluginAPIStub::getChannelPreset(int ch) +{ + return 0; +} +void qmpPluginAPIStub::playerSeek(uint32_t percentage) {} +double qmpPluginAPIStub::getPitchBend(int ch) +{ + return 0; +} +void qmpPluginAPIStub::getPitchBendRaw(int ch, uint32_t *pb, uint32_t *pbr) {} +bool qmpPluginAPIStub::getChannelMask(int ch) +{ + return 0; +} std::string qmpPluginAPIStub::getTitle() { - if(core->settings()->getOptionEnumIntOptName("Midi/TextEncoding")=="Unicode") - return std::string(core->player->getTitle()); - return QTextCodec::codecForName( - core->settings()->getOptionEnumIntOptName("Midi/TextEncoding").c_str())-> - toUnicode(core->player->getTitle()).toStdString(); + if (core->settings()->getOptionEnumIntOptName("Midi/TextEncoding") == "Unicode") + return std::string(core->player->getTitle()); + return QTextCodec::codecForName( + core->settings()->getOptionEnumIntOptName("Midi/TextEncoding").c_str())-> + toUnicode(core->player->getTitle()).toStdString(); } std::wstring qmpPluginAPIStub::getWTitle() { - if(core->settings()->getOptionEnumIntOptName("Midi/TextEncoding")=="Unicode") - return QString(core->player->getTitle()).toStdWString(); - return QTextCodec::codecForName( - core->settings()->getOptionEnumIntOptName("Midi/TextEncoding").c_str())-> - toUnicode(core->player->getTitle()).toStdWString(); -} -std::string qmpPluginAPIStub::getChannelPresetString(int ch){return std::string();} -bool qmpPluginAPIStub::isDarkTheme(){return false;} -void *qmpPluginAPIStub::getMainWindow(){return nullptr;} -void qmpPluginAPIStub::discardCurrentEvent(){} -void qmpPluginAPIStub::commitEventChange(SEvent d){} -void qmpPluginAPIStub::callEventReaderCB(SEvent d){} -void qmpPluginAPIStub::setFuncState(std::string name,bool state){} + if (core->settings()->getOptionEnumIntOptName("Midi/TextEncoding") == "Unicode") + return QString(core->player->getTitle()).toStdWString(); + return QTextCodec::codecForName( + core->settings()->getOptionEnumIntOptName("Midi/TextEncoding").c_str())-> + toUnicode(core->player->getTitle()).toStdWString(); +} +std::string qmpPluginAPIStub::getChannelPresetString(int ch) +{ + return std::string(); +} +bool qmpPluginAPIStub::isDarkTheme() +{ + return false; +} +void *qmpPluginAPIStub::getMainWindow() +{ + return nullptr; +} +void qmpPluginAPIStub::discardCurrentEvent() {} +void qmpPluginAPIStub::commitEventChange(SEvent d) {} +void qmpPluginAPIStub::callEventReaderCB(SEvent d) {} +void qmpPluginAPIStub::setFuncState(std::string name, bool state) {} void qmpPluginAPIStub::setFuncEnabled(std::string name, bool enable) {} void qmpPluginAPIStub::registerFunctionality(qmpFuncBaseIntf *i, std::string name, std::string desc, const char *icon, int iconlen, bool checkable) { - if(name=="Visualization") - core->vf=i; + if (name == "Visualization") + core->vf = i; } void qmpPluginAPIStub::unregisterFunctionality(std::string name) { - if(name=="Visualization") - core->vf=nullptr; + if (name == "Visualization") + core->vf = nullptr; } -int qmpPluginAPIStub::registerUIHook(std::string e, ICallBack *cb, void *userdat){} +int qmpPluginAPIStub::registerUIHook(std::string e, ICallBack *cb, void *userdat) {} int qmpPluginAPIStub::registerUIHook(std::string e, callback_t cb, void *userdat) { - if(e=="main.start") - core->startcb=cb; - if(e=="main.reset") - core->resetcb=cb; - return 0; + if (e == "main.start") + core->startcb = cb; + if (e == "main.reset") + core->resetcb = cb; + return 0; } void qmpPluginAPIStub::unregisterUIHook(std::string e, int hook) { - if(e=="main.start") - core->startcb=nullptr; - if(e=="main.reset") - core->resetcb=nullptr; + if (e == "main.start") + core->startcb = nullptr; + if (e == "main.reset") + core->resetcb = nullptr; } -void qmpPluginAPIStub::registerMidiOutDevice(qmpMidiOutDevice *dev, std::string name){} -void qmpPluginAPIStub::unregisterMidiOutDevice(std::string name){} +void qmpPluginAPIStub::registerMidiOutDevice(qmpMidiOutDevice *dev, std::string name) {} +void qmpPluginAPIStub::unregisterMidiOutDevice(std::string name) {} -int qmpPluginAPIStub::registerEventReaderIntf(ICallBack *cb, void *userdata){} -void qmpPluginAPIStub::unregisterEventReaderIntf(int intfhandle){} -int qmpPluginAPIStub::registerEventHandlerIntf(ICallBack *cb, void *userdata){} -void qmpPluginAPIStub::unregisterEventHandlerIntf(int intfhandle){} -int qmpPluginAPIStub::registerFileReadFinishedHandlerIntf(ICallBack *cb, void *userdata){} -void qmpPluginAPIStub::unregisterFileReadFinishedHandlerIntf(int intfhandle){} +int qmpPluginAPIStub::registerEventReaderIntf(ICallBack *cb, void *userdata) {} +void qmpPluginAPIStub::unregisterEventReaderIntf(int intfhandle) {} +int qmpPluginAPIStub::registerEventHandlerIntf(ICallBack *cb, void *userdata) {} +void qmpPluginAPIStub::unregisterEventHandlerIntf(int intfhandle) {} +int qmpPluginAPIStub::registerFileReadFinishedHandlerIntf(ICallBack *cb, void *userdata) {} +void qmpPluginAPIStub::unregisterFileReadFinishedHandlerIntf(int intfhandle) {} -int qmpPluginAPIStub::registerEventHandler(callback_t cb, void *userdata, bool post){} -void qmpPluginAPIStub::unregisterEventHandler(int id){} +int qmpPluginAPIStub::registerEventHandler(callback_t cb, void *userdata, bool post) {} +void qmpPluginAPIStub::unregisterEventHandler(int id) {} int qmpPluginAPIStub::registerEventReadHandler(callback_t cb, void *userdata) { - return core->player->registerEventReadHandler(cb,userdata); + return core->player->registerEventReadHandler(cb, userdata); } void qmpPluginAPIStub::unregisterEventReadHandler(int id) { - core->player->unregisterEventReadHandler(id); + core->player->unregisterEventReadHandler(id); } int qmpPluginAPIStub::registerFileReadFinishHook(callback_t cb, void *userdata) { - return core->player->registerFileReadFinishHook(cb,userdata); + return core->player->registerFileReadFinishHook(cb, userdata); } void qmpPluginAPIStub::unregisterFileReadFinishHook(int id) { - core->player->unregisterFileReadFinishHook(id); + core->player->unregisterFileReadFinishHook(id); } -void qmpPluginAPIStub::registerFileReader(qmpFileReader *reader, std::string name){} -void qmpPluginAPIStub::unregisterFileReader(std::string name){} +void qmpPluginAPIStub::registerFileReader(qmpFileReader *reader, std::string name) {} +void qmpPluginAPIStub::unregisterFileReader(std::string name) {} void qmpPluginAPIStub::registerOptionInt(std::string tab, std::string desc, std::string key, int min, int max, int defaultval) { - core->settings()->registerOptionInt(tab,desc,key,min,max,defaultval); + core->settings()->registerOptionInt(tab, desc, key, min, max, defaultval); } int qmpPluginAPIStub::getOptionInt(std::string key) { - return core->settings()->getOptionInt(key); + return core->settings()->getOptionInt(key); } void qmpPluginAPIStub::setOptionInt(std::string key, int val) { - core->settings()->setOptionInt(key,val); + core->settings()->setOptionInt(key, val); } void qmpPluginAPIStub::registerOptionUint(std::string tab, std::string desc, std::string key, unsigned min, unsigned max, unsigned defaultval) { - core->settings()->registerOptionUint(tab,desc,key,min,max,defaultval); + core->settings()->registerOptionUint(tab, desc, key, min, max, defaultval); } unsigned qmpPluginAPIStub::getOptionUint(std::string key) { - return core->settings()->getOptionUint(key); + return core->settings()->getOptionUint(key); } void qmpPluginAPIStub::setOptionUint(std::string key, unsigned val) { - return core->settings()->setOptionUint(key,val); + return core->settings()->setOptionUint(key, val); } void qmpPluginAPIStub::registerOptionBool(std::string tab, std::string desc, std::string key, bool defaultval) { - core->settings()->registerOptionBool(tab,desc,key,defaultval); + core->settings()->registerOptionBool(tab, desc, key, defaultval); } bool qmpPluginAPIStub::getOptionBool(std::string key) { - return core->settings()->getOptionBool(key); + return core->settings()->getOptionBool(key); } void qmpPluginAPIStub::setOptionBool(std::string key, bool val) { - core->settings()->setOptionBool(key,val); + core->settings()->setOptionBool(key, val); } void qmpPluginAPIStub::registerOptionDouble(std::string tab, std::string desc, std::string key, double min, double max, double defaultval) { - core->settings()->registerOptionDouble(tab,desc,key,min,max,defaultval); + core->settings()->registerOptionDouble(tab, desc, key, min, max, defaultval); } double qmpPluginAPIStub::getOptionDouble(std::string key) { - return core->settings()->getOptionDouble(key); + return core->settings()->getOptionDouble(key); } void qmpPluginAPIStub::setOptionDouble(std::string key, double val) { - core->settings()->setOptionDouble(key,val); + core->settings()->setOptionDouble(key, val); } void qmpPluginAPIStub::registerOptionString(std::string tab, std::string desc, std::string key, std::string defaultval, bool ispath) { - core->settings()->registerOptionString(tab,desc,key,defaultval,ispath); + core->settings()->registerOptionString(tab, desc, key, defaultval, ispath); } std::string qmpPluginAPIStub::getOptionString(std::string key) { - return core->settings()->getOptionString(key); + return core->settings()->getOptionString(key); } void qmpPluginAPIStub::setOptionString(std::string key, std::string val) { - core->settings()->setOptionString(key,val); + core->settings()->setOptionString(key, val); } void qmpPluginAPIStub::registerOptionEnumInt(std::string tab, std::string desc, std::string key, std::vector<std::string> options, int defaultval) { - core->settings()->registerOptionEnumInt(tab,desc,key,options,defaultval); + core->settings()->registerOptionEnumInt(tab, desc, key, options, defaultval); } int qmpPluginAPIStub::getOptionEnumInt(std::string key) { - return core->settings()->getOptionEnumInt(key); + return core->settings()->getOptionEnumInt(key); } void qmpPluginAPIStub::setOptionEnumInt(std::string key, int val) { - core->settings()->setOptionEnumInt(key,val); + core->settings()->setOptionEnumInt(key, val); } |