summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/client/ClientStore.cpp31
-rw-r--r--src/client/DeprecatedLoader.cpp2
-rw-r--r--src/client/HTTPClientReceiver.cpp8
-rw-r--r--src/client/ObjectModel.cpp47
-rw-r--r--src/client/ObjectModel.hpp10
-rw-r--r--src/client/PatchModel.cpp9
-rw-r--r--src/client/PatchModel.hpp2
-rw-r--r--src/client/PluginModel.cpp21
-rw-r--r--src/client/PluginModel.hpp24
-rw-r--r--src/common/interface/GraphObject.hpp7
-rw-r--r--src/common/interface/Plugin.hpp10
-rw-r--r--src/common/interface/Resource.hpp49
-rw-r--r--src/engine/GraphObjectImpl.hpp23
-rw-r--r--src/engine/InternalPlugin.cpp8
-rw-r--r--src/engine/LV2Plugin.cpp2
-rw-r--r--src/engine/PluginImpl.hpp11
-rw-r--r--src/gui/NodePropertiesWindow.cpp6
-rw-r--r--src/gui/PatchPropertiesWindow.cpp6
-rw-r--r--src/gui/UploadPatchWindow.cpp4
-rw-r--r--src/serialisation/Parser.cpp4
-rw-r--r--src/serialisation/Serialiser.cpp2
-rw-r--r--src/shared/ResourceImpl.hpp63
22 files changed, 229 insertions, 120 deletions
diff --git a/src/client/ClientStore.cpp b/src/client/ClientStore.cpp
index 8c54e96e..31ecbd3e 100644
--- a/src/client/ClientStore.cpp
+++ b/src/client/ClientStore.cpp
@@ -182,7 +182,7 @@ ClientStore::add_variable_orphan(const Path& subject_path, const string& predica
Raul::PathTable<list<std::pair<string, Atom> > >::iterator orphans
= _variable_orphans.find(subject_path);
- _engine->request_object(subject_path);
+ //_engine->request_object(subject_path);
if (orphans != _variable_orphans.end()) {
orphans->second.push_back(std::pair<string, Atom>(predicate, value));
@@ -420,7 +420,9 @@ ClientStore::rename(const Path& old_path, const Path& new_path)
void
ClientStore::new_plugin(const string& uri, const string& type_uri, const string& symbol, const string& name)
{
- SharedPtr<PluginModel> p(new PluginModel(uri, type_uri, symbol, name));
+ SharedPtr<PluginModel> p(new PluginModel(uri, type_uri));
+ p->set_property("lv2:symbol", Atom(Atom::STRING, symbol));
+ p->set_property("doap:name", Atom(Atom::STRING, name));
add_plugin(p);
resolve_plugin_orphans(p);
}
@@ -508,15 +510,26 @@ ClientStore::set_variable(const string& subject_path, const string& predicate, c
void
ClientStore::set_property(const string& subject_path, const string& predicate, const Atom& value)
{
- SharedPtr<ObjectModel> subject = object(subject_path);
+ if (!value.is_valid())
+ cerr << "WARNING: property '" << predicate << "' is NULL" << endl;
- if (!value.is_valid()) {
- cerr << "ERROR: property '" << predicate << "' has no type" << endl;
- } else if (subject) {
- subject->set_property(predicate, value);
+ if (Path::is_valid(subject_path)) {
+ SharedPtr<ObjectModel> obj = object(subject_path);
+ if (obj)
+ obj->set_property(predicate, value);
+ else
+ cerr << "WARNING: property for unknown object " << subject_path
+ << ". Refresh!" << endl;
} else {
- cerr << "WARNING: property for unknown object " << subject_path
- << " lost. Client must refresh!" << endl;
+ if (subject_path.find(":") != string::npos
+ && predicate == "rdf:type" && value.type() == Atom::URI) {
+ const std::string& type = value.get_uri();
+ if ( (type == "http://drobilla.net/ns/ingen#LADSPAPlugin")
+ || (type == "http://drobilla.net/ns/ingen#Internal")
+ || (type == "http://lv2plug.in/ns/lv2core#Plugin")) {
+ add_plugin(SharedPtr<PluginModel>(new PluginModel(subject_path, type)));
+ }
+ }
}
}
diff --git a/src/client/DeprecatedLoader.cpp b/src/client/DeprecatedLoader.cpp
index 84f47aeb..256b2947 100644
--- a/src/client/DeprecatedLoader.cpp
+++ b/src/client/DeprecatedLoader.cpp
@@ -177,7 +177,7 @@ DeprecatedLoader::add_variable(GraphObject::Variables& data, string old_key, str
if (endptr != c_val && *endptr == '\0')
data[key] = Atom(fval);
else
- data[key] = Atom(value);
+ data[key] = Atom(Atom::STRING, value);
free(c_val);
}
diff --git a/src/client/HTTPClientReceiver.cpp b/src/client/HTTPClientReceiver.cpp
index 5d4a8660..624a7786 100644
--- a/src/client/HTTPClientReceiver.cpp
+++ b/src/client/HTTPClientReceiver.cpp
@@ -53,16 +53,13 @@ void
HTTPClientReceiver::message_callback(SoupSession* session, SoupMessage* msg, void* ptr)
{
HTTPClientReceiver* me = (HTTPClientReceiver*)ptr;
- //cout << "RECEIVED ASYNC MESSAGE: " << msg->response_body->data << endl;
const string path = soup_message_get_uri(msg)->path;
if (path == "/") {
- cout << "RECEIVED ROOT" << endl;
me->_target->response_ok(0);
me->_target->enable();
} else if (path == "/plugins") {
- cout << "RECIEVED PLUGINS" << endl;
if (msg->response_body->data == NULL) {
- cout << "NO RESPONSE?!" << endl;
+ cout << "ERROR: Empty response" << endl;
} else {
me->_target->response_ok(0);
me->_target->enable();
@@ -71,9 +68,8 @@ HTTPClientReceiver::message_callback(SoupSession* session, SoupMessage* msg, voi
Glib::ustring("."), Glib::ustring(""));
}
} else if (path == "/patch") {
- cout << "RECEIVED OBJECTS" << endl;
if (msg->response_body->data == NULL) {
- cout << "NO RESPONSE?!" << endl;
+ cout << "ERROR: Empty response" << endl;
} else {
me->_target->response_ok(0);
me->_target->enable();
diff --git a/src/client/ObjectModel.cpp b/src/client/ObjectModel.cpp
index b1a0169f..80460547 100644
--- a/src/client/ObjectModel.cpp
+++ b/src/client/ObjectModel.cpp
@@ -27,7 +27,8 @@ namespace Client {
ObjectModel::ObjectModel(const Path& path)
- : _path(path)
+ : ResourceImpl(string("patch/") + path)
+ , _path(path)
{
}
@@ -71,45 +72,11 @@ ObjectModel::get_variable( string& key)
}
-/** Get a property of this object.
- *
- * @return Metadata value with key @a key, empty string otherwise.
- */
-const Atom&
-ObjectModel::get_property(const string& key) const
-{
- static const Atom null_atom;
-
- Properties::const_iterator i = _properties.find(key);
- if (i != _properties.end())
- return i->second;
- else
- return null_atom;
-}
-
-
-/** Get a property of this object.
- *
- * @return Metadata value with key @a key, empty string otherwise.
- */
-Atom&
-ObjectModel::get_property(const string& key)
-{
- static Atom null_atom;
-
- Properties::iterator i = _properties.find(key);
- if (i != _properties.end())
- return i->second;
- else
- return null_atom;
-}
-
-
bool
ObjectModel::polyphonic() const
{
- Properties::const_iterator i = _properties.find("ingen:polyphonic");
- return (i != _properties.end() && i->second.type() == Atom::BOOL && i->second.get_bool());
+ const Raul::Atom& polyphonic = get_property("ingen:polyphonic");
+ return (polyphonic.is_valid() && polyphonic.get_bool());
}
@@ -134,10 +101,10 @@ ObjectModel::set(SharedPtr<ObjectModel> o)
}
for (Properties::const_iterator v = o->properties().begin(); v != o->properties().end(); ++v) {
- Properties::const_iterator mine = _properties.find(v->first);
- if (mine != _properties.end())
+ const Raul::Atom& mine = get_property(v->first);
+ if (mine.is_valid())
cerr << "WARNING: " << _path << "Client/Server property mismatch: " << v->first << endl;
- _properties[v->first] = v->second;
+ ResourceImpl::set_property(v->first, v->second);
signal_variable.emit(v->first, v->second);
}
}
diff --git a/src/client/ObjectModel.hpp b/src/client/ObjectModel.hpp
index ac54ff98..843b14de 100644
--- a/src/client/ObjectModel.hpp
+++ b/src/client/ObjectModel.hpp
@@ -30,6 +30,7 @@
#include "raul/SharedPtr.hpp"
#include "raul/PathTable.hpp"
#include "interface/GraphObject.hpp"
+#include "shared/ResourceImpl.hpp"
using Raul::PathTable;
using std::string;
@@ -55,25 +56,19 @@ class ClientStore;
* \ingroup IngenClient
*/
class ObjectModel : virtual public Ingen::Shared::GraphObject
+ , public Ingen::Shared::ResourceImpl
{
public:
virtual ~ObjectModel();
const Atom& get_variable(const string& key) const;
Atom& get_variable( string& key);
- const Atom& get_property(const string& key) const;
- Atom& get_property(const string& key);
virtual void set_variable(const string& key, const Atom& value)
{ _variables[key] = value; signal_variable.emit(key, value); }
-
- virtual void set_property(const string& key, const Atom& value)
- { _properties[key] = value; signal_property.emit(key, value); }
const Variables& variables() const { return _variables; }
- const Properties& properties() const { return _properties; }
Variables& variables() { return _variables; }
- Properties& properties() { return _properties; }
const Path path() const { return _path; }
const Symbol symbol() const { return _path.name(); }
SharedPtr<ObjectModel> parent() const { return _parent; }
@@ -105,7 +100,6 @@ protected:
SharedPtr<ObjectModel> _parent;
Variables _variables;
- Properties _properties;
};
diff --git a/src/client/PatchModel.cpp b/src/client/PatchModel.cpp
index d9f62b45..b79c8edd 100644
--- a/src/client/PatchModel.cpp
+++ b/src/client/PatchModel.cpp
@@ -163,15 +163,14 @@ PatchModel::remove_connection(const string& src_port_path, const string& dst_por
bool
PatchModel::enabled() const
{
- Properties::const_iterator i = _properties.find("ingen:enabled");
- return (i != _properties.end() && i->second.type() == Atom::BOOL && i->second.get_bool());
+ const Raul::Atom& enabled = get_property("ingen:enabled");
+ return (enabled.is_valid() && enabled.get_bool());
}
-
void
-PatchModel::set_property(const string& key, const Atom& value)
+PatchModel::set(const string& key, const Atom& value)
{
- ObjectModel::set_property(key, value);
+ ResourceImpl::set_property(key, value);
if (key == "ingen:polyphony")
_poly = value.get_int32();
}
diff --git a/src/client/PatchModel.hpp b/src/client/PatchModel.hpp
index 64ceaddf..4e5890ef 100644
--- a/src/client/PatchModel.hpp
+++ b/src/client/PatchModel.hpp
@@ -64,7 +64,7 @@ public:
signal_editable.emit(e);
} }
- virtual void set_property(const string& key, const Atom& value);
+ virtual void set(const string& key, const Atom& value);
// Signals
sigc::signal<void, SharedPtr<NodeModel> > signal_new_node;
diff --git a/src/client/PluginModel.cpp b/src/client/PluginModel.cpp
index 2b824034..16e09414 100644
--- a/src/client/PluginModel.cpp
+++ b/src/client/PluginModel.cpp
@@ -35,6 +35,21 @@ SLV2Plugins PluginModel::_slv2_plugins = NULL;
Redland::World* PluginModel::_rdf_world = NULL;
+PluginModel::PluginModel(const string& uri, const string& type_uri)
+ : ResourceImpl(uri)
+ , _type(type_from_uri(_rdf_world->prefixes().qualify(type_uri)))
+{
+ Glib::Mutex::Lock lock(_rdf_world->mutex());
+ assert(_rdf_world);
+ set_property("rdf:type", Raul::Atom(Raul::Atom::URI, this->type_uri()));
+#ifdef HAVE_SLV2
+ SLV2Value plugin_uri = slv2_value_new_uri(_slv2_world, uri.c_str());
+ _slv2_plugin = slv2_plugins_get_by_uri(_slv2_plugins, plugin_uri);
+ slv2_value_free(plugin_uri);
+#endif
+}
+
+
string
PluginModel::default_node_symbol()
{
@@ -45,14 +60,20 @@ PluginModel::default_node_symbol()
string
PluginModel::human_name()
{
+ const Atom& name_atom = get_property("doap:name");
+ if (name_atom.type() == Atom::STRING)
+ return name_atom.get_string();
+
#ifdef HAVE_SLV2
if (_slv2_plugin) {
SLV2Value name = slv2_plugin_get_name(_slv2_plugin);
string ret = slv2_value_as_string(name);
slv2_value_free(name);
+ set_property("doap:name", Raul::Atom(Raul::Atom::STRING, ret.c_str()));
return ret;
}
#endif
+
return default_node_symbol();
}
diff --git a/src/client/PluginModel.hpp b/src/client/PluginModel.hpp
index 3d25cb5e..62ee13a8 100644
--- a/src/client/PluginModel.hpp
+++ b/src/client/PluginModel.hpp
@@ -30,6 +30,7 @@
#include "interface/EngineInterface.hpp"
#include "interface/Plugin.hpp"
#include "module/World.hpp"
+#include "shared/ResourceImpl.hpp"
using std::string;
@@ -46,11 +47,12 @@ class PluginUI;
* \ingroup IngenClient
*/
class PluginModel : public Ingen::Shared::Plugin
+ , public Ingen::Shared::ResourceImpl
{
public:
- PluginModel(const string& uri, const string& type_uri, const string& symbol, const string& name)
- : _type(type_from_uri(type_uri))
- , _uri(uri)
+ /*PluginModel(const string& uri, const string& type_uri, const string& symbol, const string& name)
+ : ResourceImpl(uri)
+ , _type(type_from_uri(type_uri))
, _symbol(symbol)
, _name(name)
{
@@ -60,12 +62,19 @@ public:
_slv2_plugin = slv2_plugins_get_by_uri(_slv2_plugins, plugin_uri);
slv2_value_free(plugin_uri);
#endif
- }
+ }*/
+ PluginModel(const string& uri, const string& type_uri);
- Type type() const { return _type; }
- const string& uri() const { return _uri; }
- const string& name() const { return _name; }
+ Type type() const { return _type; }
+ const string name() const {
+ const Raul::Atom& name_atom = get_property("doap:name");
+ if (name_atom.type() == Raul::Atom::STRING)
+ return name_atom.get_string();
+ else
+ return "";
+ }
+
string default_node_symbol();
string human_name();
string port_human_name(uint32_t index);
@@ -102,7 +111,6 @@ public:
private:
const Type _type;
- const string _uri;
const string _symbol;
const string _name;
diff --git a/src/common/interface/GraphObject.hpp b/src/common/interface/GraphObject.hpp
index 013977d3..a82dd278 100644
--- a/src/common/interface/GraphObject.hpp
+++ b/src/common/interface/GraphObject.hpp
@@ -26,6 +26,7 @@
#include "raul/Atom.hpp"
#include "raul/SharedPtr.hpp"
#include "raul/WeakPtr.hpp"
+#include "interface/Resource.hpp"
using Raul::PathTable;
@@ -40,19 +41,17 @@ namespace Shared {
* \ingroup interface
*/
class GraphObject : public Raul::Deletable
+ , public virtual Resource
{
public:
typedef std::map<std::string, Raul::Atom> Variables;
- typedef std::map<std::string, Raul::Atom> Properties;
typedef PathTable< SharedPtr<GraphObject> >::const_iterator const_iterator;
-
+
virtual const Raul::Path path() const = 0;
virtual const Raul::Symbol symbol() const = 0;
virtual const Variables& variables() const = 0;
virtual Variables& variables() = 0;
- virtual const Properties& properties() const = 0;
- virtual Properties& properties() = 0;
virtual bool polyphonic() const = 0;
// FIXME: return WeakPtr, and stupid name
diff --git a/src/common/interface/Plugin.hpp b/src/common/interface/Plugin.hpp
index db67bf08..30b453f3 100644
--- a/src/common/interface/Plugin.hpp
+++ b/src/common/interface/Plugin.hpp
@@ -19,18 +19,19 @@
#define PLUGIN_H
#include <string>
+#include <iostream>
+#include "interface/Resource.hpp"
namespace Ingen {
namespace Shared {
-class Plugin
+class Plugin : virtual public Resource
{
public:
enum Type { LV2, LADSPA, Internal, Patch };
- virtual Type type() const = 0;
- virtual const std::string& uri() const = 0;
+ virtual Type type() const = 0;
inline const char* type_uri() const {
switch (type()) {
@@ -52,7 +53,8 @@ public:
else if (uri == "ingen:Patch")
return Patch;
else
- return Internal;
+ std::cerr << "WARNING: Unknown plugin type " << uri << std::endl;
+ return Internal;
}
};
diff --git a/src/common/interface/Resource.hpp b/src/common/interface/Resource.hpp
new file mode 100644
index 00000000..32c760d7
--- /dev/null
+++ b/src/common/interface/Resource.hpp
@@ -0,0 +1,49 @@
+/* This file is part of Ingen.
+ * Copyright (C) 2008 Dave Robillard <http://drobilla.net>
+ *
+ * Ingen is free software; you can redistribute it and/or modify it under the
+ * terms of the GNU General Public License as published by the Free Software
+ * Foundation; either version 2 of the License, or (at your option) any later
+ * version.
+ *
+ * Ingen is distributed in the hope that it will be useful, but WITHOUT ANY
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#ifndef RESOURCE_HPP
+#define RESOURCE_HPP
+
+#include <string>
+#include <map>
+#include "raul/Atom.hpp"
+
+namespace Ingen {
+namespace Shared {
+
+
+class Resource
+{
+public:
+ typedef std::map<std::string, Raul::Atom> Properties;
+
+ virtual const std::string uri() const = 0;
+ virtual const Properties& properties() const = 0;
+ virtual Properties& properties() = 0;
+
+ virtual void set_property(const std::string& uri,
+ const Raul::Atom& value) = 0;
+
+ virtual const Raul::Atom& get_property(const std::string& uri) const = 0;
+};
+
+
+} // namespace Shared
+} // namespace Ingen
+
+#endif // RESOURCE_HPP
+
diff --git a/src/engine/GraphObjectImpl.hpp b/src/engine/GraphObjectImpl.hpp
index 88ed3617..ab5eb24b 100644
--- a/src/engine/GraphObjectImpl.hpp
+++ b/src/engine/GraphObjectImpl.hpp
@@ -26,6 +26,7 @@
#include "raul/Path.hpp"
#include "raul/Atom.hpp"
#include "interface/GraphObject.hpp"
+#include "shared/ResourceImpl.hpp"
#include "types.hpp"
using Raul::Atom;
@@ -49,6 +50,7 @@ class ProcessContext;
* \ingroup engine
*/
class GraphObjectImpl : virtual public Ingen::Shared::GraphObject
+ , public Ingen::Shared::ResourceImpl
{
public:
virtual ~GraphObjectImpl() {}
@@ -58,6 +60,8 @@ public:
GraphObject* graph_parent() const { return _parent; }
+ const std::string uri() const { return std::string("patch") + path(); }
+
inline GraphObjectImpl* parent() const { return _parent; }
const Symbol symbol() const { return _name; }
@@ -73,25 +77,14 @@ public:
void set_variable(const std::string& key, const Atom& value)
{ _variables[key] = value; }
- void set_property(const std::string& key, const Atom& value)
- { _properties[key] = value; }
-
const Atom& get_variable(const std::string& key) {
static Atom null_atom;
Variables::iterator i = _variables.find(key);
return (i != _variables.end()) ? (*i).second : null_atom;
}
- const Atom& get_property(const std::string& key) {
- static Atom null_atom;
- Properties::iterator i = _properties.find(key);
- return (i != _properties.end()) ? (*i).second : null_atom;
- }
-
const Variables& variables() const { return _variables; }
- const Properties& properties() const { return _properties; }
- Variables& variables() { return _variables; }
- Properties& properties() { return _properties; }
+ Variables& variables() { return _variables; }
/** The Patch this object is a child of. */
virtual PatchImpl* parent_patch() const;
@@ -110,7 +103,10 @@ public:
protected:
GraphObjectImpl(GraphObjectImpl* parent, const std::string& name, bool polyphonic=false)
- : _parent(parent), _name(name), _polyphonic(polyphonic)
+ : ResourceImpl(std::string("patch/") + (parent ? parent->path().base() : "/") + name)
+ , _parent(parent)
+ , _name(name)
+ , _polyphonic(polyphonic)
{
assert(parent == NULL || _name.length() > 0);
assert(_name.find("/") == std::string::npos);
@@ -123,7 +119,6 @@ protected:
private:
Variables _variables;
- Properties _properties;
};
diff --git a/src/engine/InternalPlugin.cpp b/src/engine/InternalPlugin.cpp
index 1c6a92a5..2e869395 100644
--- a/src/engine/InternalPlugin.cpp
+++ b/src/engine/InternalPlugin.cpp
@@ -38,13 +38,13 @@ InternalPlugin::instantiate(const string& name,
SampleCount srate = engine.audio_driver()->sample_rate();
SampleCount buffer_size = engine.audio_driver()->buffer_size();
- if (_uri == NS_INGEN "note_node") {
+ if (uri() == NS_INGEN "note_node") {
return new MidiNoteNode(name, polyphonic, parent, srate, buffer_size);
- } else if (_uri == NS_INGEN "trigger_node") {
+ } else if (uri() == NS_INGEN "trigger_node") {
return new MidiTriggerNode(name, polyphonic, parent, srate, buffer_size);
- } else if (_uri == NS_INGEN "control_node") {
+ } else if (uri() == NS_INGEN "control_node") {
return new MidiControlNode(name, polyphonic, parent, srate, buffer_size);
- } else if (_uri == NS_INGEN "transport_node") {
+ } else if (uri() == NS_INGEN "transport_node") {
return new TransportNode(name, polyphonic, parent, srate, buffer_size);
} else {
return NULL;
diff --git a/src/engine/LV2Plugin.cpp b/src/engine/LV2Plugin.cpp
index e294b3b1..cb35e495 100644
--- a/src/engine/LV2Plugin.cpp
+++ b/src/engine/LV2Plugin.cpp
@@ -30,7 +30,7 @@ namespace Ingen {
const string
LV2Plugin::symbol() const
{
- string working = _uri;
+ string working = uri();
if (working[working.length()-1] == '/')
working = working.substr(0, working.length()-1);
diff --git a/src/engine/PluginImpl.hpp b/src/engine/PluginImpl.hpp
index 53275313..2b78b29a 100644
--- a/src/engine/PluginImpl.hpp
+++ b/src/engine/PluginImpl.hpp
@@ -28,6 +28,7 @@
#include <iostream>
#include "types.hpp"
#include "interface/Plugin.hpp"
+#include "shared/ResourceImpl.hpp"
using std::string;
using Ingen::Shared::Plugin;
@@ -43,12 +44,14 @@ class Engine;
*
* Conceptually, a Node is an instance of this.
*/
-class PluginImpl : public Ingen::Shared::Plugin, public boost::noncopyable
+class PluginImpl : public Ingen::Shared::Plugin
+ , public Ingen::Shared::ResourceImpl
+ , public boost::noncopyable
{
public:
PluginImpl(Type type, const string& uri, const string library_path="")
- : _type(type)
- , _uri(uri)
+ : ResourceImpl(uri)
+ , _type(type)
, _library_path(library_path)
, _module(NULL)
{}
@@ -69,13 +72,11 @@ public:
Plugin::Type type() const { return _type; }
void type(Plugin::Type t) { _type = t; }
- const string& uri() const { return _uri; }
Glib::Module* module() const { return _module; }
void module(Glib::Module* module) { _module = module; }
protected:
Plugin::Type _type;
- const string _uri;
string _library_path;
Glib::Module* _module;
};
diff --git a/src/gui/NodePropertiesWindow.cpp b/src/gui/NodePropertiesWindow.cpp
index ae2c23b5..7885b906 100644
--- a/src/gui/NodePropertiesWindow.cpp
+++ b/src/gui/NodePropertiesWindow.cpp
@@ -56,7 +56,11 @@ NodePropertiesWindow::set_node(SharedPtr<NodeModel> node_model)
if (pm) {
_plugin_type_label->set_text(pm->type_uri());
_plugin_uri_label->set_text(pm->uri());
- _plugin_name_label->set_text(pm->name());
+ const Atom& name = pm->get_property("doap:name");
+ if (name.is_valid())
+ _plugin_name_label->set_text(pm->get_property("doap:name").get_string());
+ else
+ _plugin_name_label->set_text("(Unknown)");
}
}
diff --git a/src/gui/PatchPropertiesWindow.cpp b/src/gui/PatchPropertiesWindow.cpp
index caf81452..055c8386 100644
--- a/src/gui/PatchPropertiesWindow.cpp
+++ b/src/gui/PatchPropertiesWindow.cpp
@@ -89,11 +89,11 @@ void
PatchPropertiesWindow::ok_clicked()
{
App::instance().engine()->set_property(_patch_model->path(), "doap:name",
- Atom(_name_entry->get_text()));
+ Atom(Atom::STRING, _name_entry->get_text()));
App::instance().engine()->set_property(_patch_model->path(), "dc:creator",
- Atom(_author_entry->get_text()));
+ Atom(Atom::STRING, _author_entry->get_text()));
App::instance().engine()->set_property(_patch_model->path(), "dc:description",
- Atom(_textview->get_buffer()->get_text()));
+ Atom(Atom::STRING, _textview->get_buffer()->get_text()));
hide();
}
diff --git a/src/gui/UploadPatchWindow.cpp b/src/gui/UploadPatchWindow.cpp
index bb45cc71..874a4b43 100644
--- a/src/gui/UploadPatchWindow.cpp
+++ b/src/gui/UploadPatchWindow.cpp
@@ -239,8 +239,8 @@ UploadPatchWindow::upload_clicked()
Glib::ustring short_name = _short_name_entry->get_text();
GraphObject::Variables extra_rdf;
- extra_rdf["lv2:symbol"] = Atom(symbol);
- extra_rdf["doap:name"] = Atom(short_name);
+ extra_rdf["lv2:symbol"] = Atom(Atom::STRING, symbol);
+ extra_rdf["doap:name"] = Atom(Atom::STRING, short_name);
_response = 0;
_progress_pct = 0;
diff --git a/src/serialisation/Parser.cpp b/src/serialisation/Parser.cpp
index b9f52652..73f55074 100644
--- a/src/serialisation/Parser.cpp
+++ b/src/serialisation/Parser.cpp
@@ -129,8 +129,6 @@ Parser::parse(
else
query_str = Glib::ustring("SELECT DISTINCT ?subject ?class WHERE { ?subject a ?class . }");
- cout << "QUERY: " << query_str << endl;
-
Redland::Query query(*world->rdf_world, query_str);
Redland::Query::Results results = query.run(*world->rdf_world, model, base_uri);
@@ -204,7 +202,7 @@ Parser::parse(
} else if (is_plugin) {
if (path_str.length() > 0) {
const string uri = path_str.substr(1);
- cout << "PLUGIN: " << uri << endl;
+ target->set_property(uri, "rdf:type", Atom(Atom::URI, rdf_class.to_c_string()));
} else {
cout << "ERROR: Plugin with no URI parsed, ignoring" << endl;
}
diff --git a/src/serialisation/Serialiser.cpp b/src/serialisation/Serialiser.cpp
index 9e8623a3..fdadfc2f 100644
--- a/src/serialisation/Serialiser.cpp
+++ b/src/serialisation/Serialiser.cpp
@@ -358,7 +358,7 @@ Serialiser::serialise_patch(SharedPtr<Shared::Patch> patch)
// Ensure lv2:name always exists so Patch is a valid LV2 plugin
if (p->properties().find("lv2:name") == p->properties().end())
- p->properties()["lv2:name"] = p->symbol(); // FIXME: use human name
+ p->set_property("lv2:name", Atom(Atom::STRING, p->symbol())); // FIXME: use human name
_model->add_statement(patch_id, "lv2:port", port_id);
serialise_port(p, port_id);
diff --git a/src/shared/ResourceImpl.hpp b/src/shared/ResourceImpl.hpp
new file mode 100644
index 00000000..35259a3b
--- /dev/null
+++ b/src/shared/ResourceImpl.hpp
@@ -0,0 +1,63 @@
+/* This file is part of Ingen.
+ * Copyright (C) 2008 Dave Robillard <http://drobilla.net>
+ *
+ * Ingen is free software; you can redistribute it and/or modify it under the
+ * terms of the GNU General Public License as published by the Free Software
+ * Foundation; either version 2 of the License, or (at your option) any later
+ * version.
+ *
+ * Ingen is distributed in the hope that it will be useful, but WITHOUT ANY
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#ifndef RESOURCEIMPL_HPP
+#define RESOURCEIMPL_HPP
+
+#include <map>
+#include "interface/Resource.hpp"
+
+namespace Ingen {
+namespace Shared {
+
+
+class ResourceImpl : virtual public Resource
+{
+public:
+ typedef std::map<std::string, Raul::Atom> Properties;
+
+ ResourceImpl(const std::string& uri) : _uri(uri) {}
+
+ virtual const std::string uri() const { return _uri; }
+
+ const Properties& properties() const { return _properties; }
+ Properties& properties() { return _properties; }
+
+ void set_property(const std::string& uri, const Raul::Atom& value) {
+ _properties[uri] = value;
+ }
+
+ const Raul::Atom& get_property(const std::string& uri) const {
+ static const Raul::Atom nil;
+ Properties::const_iterator i = _properties.find(uri);
+ if (i == _properties.end())
+ return nil;
+ else
+ return i->second;
+ }
+
+private:
+ std::string _uri;
+ Properties _properties;
+};
+
+
+} // namespace Shared
+} // namespace Ingen
+
+#endif // RESOURCEIMPL_HPP
+