From 8935cca8706d74f39d3cca43b4df3ab48799b06a Mon Sep 17 00:00:00 2001 From: David Robillard Date: Thu, 28 May 2009 18:15:11 +0000 Subject: Replace new_plugin with put. Fix default symbol generation (URI chopping). git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@2029 a436a847-0d15-0410-975c-d299462d15a1 --- src/client/ClientStore.cpp | 29 ++++++++++++++--------------- 1 file changed, 14 insertions(+), 15 deletions(-) (limited to 'src/client/ClientStore.cpp') diff --git a/src/client/ClientStore.cpp b/src/client/ClientStore.cpp index a8fe7c51..e4cd604e 100644 --- a/src/client/ClientStore.cpp +++ b/src/client/ClientStore.cpp @@ -45,7 +45,6 @@ ClientStore::ClientStore(SharedPtr engine, SharedPtrsignal_object_deleted.connect(sigc::mem_fun(this, &ClientStore::del)); emitter->signal_object_moved.connect(sigc::mem_fun(this, &ClientStore::move)); - emitter->signal_new_plugin.connect(sigc::mem_fun(this, &ClientStore::new_plugin)); emitter->signal_put.connect(sigc::mem_fun(this, &ClientStore::put)); emitter->signal_clear_patch.connect(sigc::mem_fun(this, &ClientStore::clear_patch)); emitter->signal_connection.connect(sigc::mem_fun(this, &ClientStore::connect)); @@ -264,29 +263,29 @@ ClientStore::move(const Path& old_path_str, const Path& new_path_str) }*/ } -void -ClientStore::new_plugin(const URI& uri, const URI& type_uri, const Symbol& symbol) -{ - SharedPtr p(new PluginModel(uri, type_uri)); - p->set_property("lv2:symbol", Atom(Atom::STRING, symbol)); - add_plugin(p); - //resolve_plugin_orphans(p); -} - void ClientStore::put(const URI& uri, const Resource::Properties& properties) { - size_t hash = uri.find("#"); - bool meta = (hash != string::npos); - Path path(meta ? (string("/") + uri.chop_start("#")) : uri.str()); - typedef Resource::Properties::const_iterator iterator; - cerr << "CLIENT PUT " << uri << " (" << path << ") {" << endl; + cerr << "CLIENT PUT " << uri << " {" << endl; for (iterator i = properties.begin(); i != properties.end(); ++i) cerr << "\t" << i->first << " = " << i->second << " :: " << i->second.type() << endl; cerr << "}" << endl; + bool is_path = Path::is_valid(uri.str()); + bool is_meta = uri.substr(0, 8) == "meta:#"; + + if (!(is_path || is_meta)) { + const URI& type_uri = properties.find("rdf:type")->second.get_uri(); + SharedPtr p(new PluginModel(uri, type_uri)); + p->set_properties(properties); + add_plugin(p); + return; + } + + Path path(is_meta ? (string("/") + uri.chop_start("#")) : uri.str()); + SharedPtr obj = PtrCast(object(path)); if (obj) { obj->set_properties(properties); -- cgit v1.2.1