aboutsummaryrefslogtreecommitdiff
path: root/visualization/renderer/qmpsettingsro.cpp
diff options
context:
space:
mode:
authorGravatar Chris Xiong <chirs241097@gmail.com> 2020-05-02 10:42:01 +0800
committerGravatar Chris Xiong <chirs241097@gmail.com> 2020-05-02 10:42:01 +0800
commit86f10fa1bcdc25bf4a91e9b07322edcaa885fe49 (patch)
tree4a73e85ed4bce11edc4639d67444749c8f153ff5 /visualization/renderer/qmpsettingsro.cpp
parentf4f80b19a27118275d5f925558f3cfb46bb5d14b (diff)
downloadQMidiPlayer-86f10fa1bcdc25bf4a91e9b07322edcaa885fe49.tar.xz
New command line option "list-options" for visualization renderer.
Add documentation for the visualization renderer.
Diffstat (limited to 'visualization/renderer/qmpsettingsro.cpp')
-rw-r--r--visualization/renderer/qmpsettingsro.cpp52
1 files changed, 52 insertions, 0 deletions
diff --git a/visualization/renderer/qmpsettingsro.cpp b/visualization/renderer/qmpsettingsro.cpp
index bf8096f..034f073 100644
--- a/visualization/renderer/qmpsettingsro.cpp
+++ b/visualization/renderer/qmpsettingsro.cpp
@@ -1,6 +1,8 @@
#include <QScopedPointer>
#include <QSettings>
+#include <cstdio>
+
#include "qmpsettingsro.hpp"
qmpSettingsRO::qmpSettingsRO()
@@ -172,3 +174,53 @@ void qmpSettingsRO::setopt(std::string key, std::string val)
if(key.find("Visualization/")!=0)
settings.insert("Visualization/"+QString(key.c_str()),QString(val.c_str()));
}
+
+void qmpSettingsRO::listopt()
+{
+ for(auto&k:optionlist)
+ {
+ printf("Option key: %s\n",k.c_str());
+ if(options[k].desc.length())
+ printf("Description: %s\n",options[k].desc.c_str());
+ switch(options[k].type)
+ {
+ case qmpOptionR::ParameterType::parameter_int:
+ printf("Type: int\n");
+ printf("Range: [%d,%d]\n",options[k].minv.toInt(),options[k].maxv.toInt());
+ printf("Default value: %d\n",options[k].defaultval.toInt());
+ break;
+ case qmpOptionR::ParameterType::parameter_uint:
+ printf("Type: uint\n");
+ printf("Range: [%u,%u]\n",options[k].minv.toUInt(),options[k].maxv.toUInt());
+ printf("Default value: %u\n",options[k].defaultval.toUInt());
+ break;
+ case qmpOptionR::ParameterType::parameter_double:
+ printf("Type: double\n");
+ printf("Range: [%.2f,%.2f]\n",options[k].minv.toDouble(),options[k].maxv.toDouble());
+ printf("Default value: %.f2\n",options[k].defaultval.toDouble());
+ break;
+ case qmpOptionR::ParameterType::parameter_bool:
+ printf("Type: bool\n");
+ printf("Default value: %s\n",options[k].defaultval.toBool()?"true":"false");
+ break;
+ case qmpOptionR::ParameterType::parameter_str:
+ printf("Type: str\n");
+ printf("Default value: %s\n",options[k].defaultval.toString().toStdString().c_str());
+ break;
+ case qmpOptionR::ParameterType::parameter_url:
+ printf("Type: url\n");
+ printf("Default value: %s\n",options[k].defaultval.toString().toStdString().c_str());
+ break;
+ case qmpOptionR::ParameterType::parameter_enum:
+ printf("Type: enum\n");
+ printf("Possible values: ");
+ for(size_t i=0;i<options[k].enumlist.size();++i)
+ printf("%s%s",options[k].enumlist[i].c_str(),i==options[k].enumlist.size()-1?"\n":", ");
+ printf("Default value: %s\n",options[k].enumlist[options[k].defaultval.toInt()].c_str());
+ break;
+ default:
+ printf("Type: unknown\n");
+ }
+ puts("");
+ }
+}