From 5757ab645cae1d844d6d457ab2dea4a12d21a4e7 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Sat, 1 Oct 2011 04:40:15 +0000 Subject: Support inline display of HTML LV2 documentation via WebKit. git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@3515 a436a847-0d15-0410-975c-d299462d15a1 --- src/client/PluginModel.cpp | 28 ++++++++++++++++++++-------- 1 file changed, 20 insertions(+), 8 deletions(-) (limited to 'src/client/PluginModel.cpp') diff --git a/src/client/PluginModel.cpp b/src/client/PluginModel.cpp index 80b78887..1d13ee5b 100644 --- a/src/client/PluginModel.cpp +++ b/src/client/PluginModel.cpp @@ -28,6 +28,8 @@ #include "ingen/client/PluginModel.hpp" #include "ingen/client/PluginUI.hpp" +#include "ingen-config.h" + using namespace std; using namespace Raul; @@ -225,19 +227,27 @@ PluginModel::get_lv2_icon_path(const LilvPlugin* plugin) } std::string -PluginModel::documentation() const +PluginModel::documentation(bool* html) const { std::string doc; - if (!_lilv_plugin) + if (!_lilv_plugin) { return doc; + } - //LilvNode lv2_documentation = lilv_new_uri( - // _lilv_world, LILV_NAMESPACE_LV2 "documentation"); - LilvNode* rdfs_comment = lilv_new_uri( - _lilv_world, "http://www.w3.org/2000/01/rdf-schema#comment"); + LilvNode* lv2_documentation = lilv_new_uri(_lilv_world, + LILV_NS_LV2 "documentation"); + LilvNode* rdfs_comment = lilv_new_uri(_lilv_world, + LILV_NS_RDFS "comment"); + + LilvNodes* vals = lilv_plugin_get_value(_lilv_plugin, lv2_documentation); + if (vals) { + *html = true; + doc += std::string("

") + human_name() + "

\n"; + } else { + *html = false; + vals = lilv_plugin_get_value(_lilv_plugin, rdfs_comment); + } - LilvNodes* vals = lilv_plugin_get_value(_lilv_plugin, - rdfs_comment); if (vals) { const LilvNode* val = lilv_nodes_get_first(vals); if (lilv_node_is_string(val)) { @@ -245,6 +255,8 @@ PluginModel::documentation() const } } lilv_node_free(rdfs_comment); + lilv_node_free(lv2_documentation); + lilv_nodes_free(vals); return doc; -- cgit v1.2.1