aboutsummaryrefslogtreecommitdiff
path: root/simple-visualization/simplevisualization.cpp
diff options
context:
space:
mode:
authorGravatar Chris Xiong <chirs241097@gmail.com> 2020-05-12 00:58:40 +0800
committerGravatar Chris Xiong <chirs241097@gmail.com> 2020-05-12 00:58:40 +0800
commita7407edaf81c685d4a389785a405a53a5de4b148 (patch)
treee6e4f2d85f2172c94ac83a6e8f01e1e90a78ede9 /simple-visualization/simplevisualization.cpp
parent437b7b16c322a8e53ac55a5f831098494d9a7073 (diff)
downloadQMidiPlayer-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 'simple-visualization/simplevisualization.cpp')
-rw-r--r--simple-visualization/simplevisualization.cpp66
1 files changed, 42 insertions, 24 deletions
diff --git a/simple-visualization/simplevisualization.cpp b/simple-visualization/simplevisualization.cpp
index b93af30..0c3a5b9 100644
--- a/simple-visualization/simplevisualization.cpp
+++ b/simple-visualization/simplevisualization.cpp
@@ -1,33 +1,51 @@
#include "simplevisualization.hpp"
#include "qmpkeyboardwindow.hpp"
-qmpSimpleVisualization::qmpSimpleVisualization(qmpPluginAPI *_api){api=_api;}
-void qmpSimpleVisualization::show(){p->show();}
-void qmpSimpleVisualization::close(){p->close();}
+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());
- auto refreshfn=[this](const void*,void*){this->p->resetAll();};
- uihs=api->registerUIHook("main.stop",refreshfn,nullptr);
- uihsk=api->registerUIHook("main.seek",refreshfn,nullptr);
- uihsk=api->registerUIHook("preset.set",refreshfn,nullptr);
- uihsk=api->registerUIHook("channel.ccchange",refreshfn,nullptr);
+ 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());
+ auto refreshfn = [this](const void *, void *)
+ {
+ this->p->resetAll();
+ };
+ uihs = api->registerUIHook("main.stop", refreshfn, nullptr);
+ uihsk = api->registerUIHook("main.seek", refreshfn, nullptr);
+ uihsk = api->registerUIHook("preset.set", refreshfn, nullptr);
+ uihsk = api->registerUIHook("channel.ccchange", refreshfn, nullptr);
}
void qmpSimpleVisualization::deinit()
{
- if(!api)return;close();
- api->unregisterFunctionality("Keyboard");
- api->unregisterUIHook("main.stop",uihs);
- api->unregisterUIHook("main.seek",uihsk);
- delete p;
+ 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 PLUGIN_VERSION;
}
-const char* qmpSimpleVisualization::pluginGetName()
-{return "QMidiPlayer Simple Visualization Plugin";}
-const char* qmpSimpleVisualization::pluginGetVersion()
-{return PLUGIN_VERSION;}