From c37080eae184227a74e5c96237d6e7bf398fbf16 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Thu, 28 May 2009 21:17:44 +0000 Subject: Fix LADSPA names in plugin selection dialog. Fix request interface for non-graph objects (i.e. plugins). git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@2034 a436a847-0d15-0410-975c-d299462d15a1 --- src/client/PluginModel.cpp | 4 ++-- src/common/interface/EngineInterface.hpp | 2 +- src/engine/LADSPAPlugin.cpp | 1 + src/engine/QueuedEngineInterface.cpp | 7 ++++-- src/engine/events/RequestObjectEvent.hpp | 2 +- src/gui/LoadPluginWindow.cpp | 38 ++++++++++++++++++++++---------- 6 files changed, 36 insertions(+), 18 deletions(-) diff --git a/src/client/PluginModel.cpp b/src/client/PluginModel.cpp index 7998f8e2..4f1a4626 100644 --- a/src/client/PluginModel.cpp +++ b/src/client/PluginModel.cpp @@ -61,7 +61,7 @@ PluginModel::PluginModel(const URI& uri, const URI& type_uri, const Resource::Pr const Atom& PluginModel::get_property(const URI& key) const { - static Atom nil_atom(Atom::NIL); + static const Atom nil; const Atom& val = ResourceImpl::get_property(key); if (val.is_valid()) return val; @@ -124,7 +124,7 @@ PluginModel::get_property(const URI& key) const } #endif - return nil_atom; + return nil; } diff --git a/src/common/interface/EngineInterface.hpp b/src/common/interface/EngineInterface.hpp index e22ebfb3..b2e33cb0 100644 --- a/src/common/interface/EngineInterface.hpp +++ b/src/common/interface/EngineInterface.hpp @@ -66,7 +66,7 @@ public: virtual void request_object(const Raul::URI& uri) = 0; - virtual void request_property(const Raul::URI& path, + virtual void request_property(const Raul::URI& uri, const Raul::URI& key) = 0; virtual void request_plugins() = 0; diff --git a/src/engine/LADSPAPlugin.cpp b/src/engine/LADSPAPlugin.cpp index 0b3aabdc..44df77b0 100644 --- a/src/engine/LADSPAPlugin.cpp +++ b/src/engine/LADSPAPlugin.cpp @@ -43,6 +43,7 @@ LADSPAPlugin::LADSPAPlugin( { set_property("rdf:type", Atom(Atom::URI, "ingen:LADSPAPlugin")); set_property("lv2:symbol", Atom(Atom::STRING, Symbol::symbolify(label))); + set_property("doap:name", Atom(Atom::STRING, name)); } diff --git a/src/engine/QueuedEngineInterface.cpp b/src/engine/QueuedEngineInterface.cpp index 1ac9a1f1..8dd31adc 100644 --- a/src/engine/QueuedEngineInterface.cpp +++ b/src/engine/QueuedEngineInterface.cpp @@ -279,8 +279,11 @@ QueuedEngineInterface::request_property(const URI& uri, const URI& key) { size_t hash = uri.find("#"); bool meta = (hash != string::npos); - Path path = meta ? (string("/") + path.chop_start("/")) : uri.str(); - push_queued(new RequestMetadataEvent(_engine, _responder, now(), meta, path, key)); + const string path_str = string("/") + uri.chop_start("/"); + if (meta && Path::is_valid(path_str)) + push_queued(new RequestMetadataEvent(_engine, _responder, now(), meta, path_str, key)); + else + push_queued(new RequestMetadataEvent(_engine, _responder, now(), meta, uri, key)); } diff --git a/src/engine/events/RequestObjectEvent.hpp b/src/engine/events/RequestObjectEvent.hpp index 67454892..cd759224 100644 --- a/src/engine/events/RequestObjectEvent.hpp +++ b/src/engine/events/RequestObjectEvent.hpp @@ -27,7 +27,7 @@ class GraphObjectImpl; class PluginImpl; -/** A request from a client to send the value of a port. +/** A request from a client to send an object. * * \ingroup engine */ diff --git a/src/gui/LoadPluginWindow.cpp b/src/gui/LoadPluginWindow.cpp index 260641a9..70a0d5e3 100644 --- a/src/gui/LoadPluginWindow.cpp +++ b/src/gui/LoadPluginWindow.cpp @@ -220,16 +220,28 @@ LoadPluginWindow::add_plugin(SharedPtr plugin) _rows.insert(make_pair(plugin->uri(), iter)); const Atom& name = plugin->get_property("doap:name"); - if (name.is_valid() && name.type() == Atom::STRING) - row[_plugins_columns._col_name] = name.get_string(); - if (!strcmp(plugin->type_uri(), "ingen:Internal")) - row[_plugins_columns._col_type] = "Internal"; - else if (!strcmp(plugin->type_uri(), "lv2:Plugin")) + if (name.is_valid()) { + if (name.type() == Atom::STRING) + row[_plugins_columns._col_name] = name.get_string(); + } else if (plugin->type() == Plugin::LADSPA) { + App::instance().engine()->request_property(plugin->uri(), "doap:name"); + } + + switch (plugin->type()) { + case Plugin::LV2: row[_plugins_columns._col_type] = "LV2"; - else if (!strcmp(plugin->type_uri(), "ingen:LADSPAPlugin")) + break; + case Plugin::LADSPA: row[_plugins_columns._col_type] = "LADSPA"; - else - row[_plugins_columns._col_type] = plugin->type_uri(); + break; + case Plugin::Internal: + row[_plugins_columns._col_type] = "Internal"; + break; + case Plugin::Patch: + row[_plugins_columns._col_type] = "Patch"; + break; + } + row[_plugins_columns._col_uri] = plugin->uri().str(); row[_plugins_columns._col_plugin_model] = plugin; @@ -426,15 +438,17 @@ LoadPluginWindow::on_key_press_event(GdkEventKey* event) } } + void LoadPluginWindow::plugin_property_changed(const URI& plugin, const URI& predicate, const Atom& value) { - cerr << "PLUGIN PROPERTY " << plugin << " : " << predicate << " = " << value << endl; - Rows::const_iterator i = _rows.find(plugin); - if (i != _rows.end() && value.type() == Atom::STRING) - (*i->second)[_plugins_columns._col_name] = value.get_string(); + if (predicate.str() == "doap:name") { + Rows::const_iterator i = _rows.find(plugin); + if (i != _rows.end() && value.type() == Atom::STRING) + (*i->second)[_plugins_columns._col_name] = value.get_string(); + } } -- cgit v1.2.1