aboutsummaryrefslogblamecommitdiff
path: root/simple-visualization/simplevisualization.cpp
blob: 71dac7a99acc85def87211e083ad50fd32597ea3 (plain) (tree)
1
2
3
4
5
6
7
8
9








                                                                                                                                               




                                                                                                         

                                                                                                      
                                                                                                       





                                                 
                                                 




                                                      
                 
#include "simplevisualization.hpp"
#include "qmpkeyboardwindow.hpp"

qmpSimpleVisualization::qmpSimpleVisualization(qmpPluginAPI *_api){api=_api;}
void qmpSimpleVisualization::show(){p->show();}
void qmpSimpleVisualization::close(){p->close();}
void qmpSimpleVisualization::init()
{
	api->registerFunctionality(this,"Keyboard","Keyboard",api->isDarkTheme()?":/img/visualization_i.svg":":/img/visualization.svg",0,true);
	for(int i=0;i<16;++i)
	{
		api->registerOptionUint("","","Keyboard/acolor"+std::to_string(i),0,0xffffff,0xffff66cc);
		api->registerOptionUint("","","Keyboard/bcolor"+std::to_string(i),0,0xffffff,0xff66ccff);
	}
	p=new qmpKeyboardWindow(api,(QWidget*)api->getMainWindow());
	uihs=api->registerUIHook("main.stop",[this](const void*,void*){this->p->resetAll();},nullptr);
	uihsk=api->registerUIHook("main.seek",[this](const void*,void*){this->p->resetAll();},nullptr);
}
void qmpSimpleVisualization::deinit()
{
	if(!api)return;close();
	api->unregisterFunctionality("Keyboard");
	api->unregisterUIHook("main.stop",uihs);
	api->unregisterUIHook("main.seek",uihsk);
	delete p;
}
const char* qmpSimpleVisualization::pluginGetName()
{return "QMidiPlayer Simple Visualization Plugin";}
const char* qmpSimpleVisualization::pluginGetVersion()
{return "0.8.7";}