summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2009-05-13 06:42:40 +0000
committerDavid Robillard <d@drobilla.net>2009-05-13 06:42:40 +0000
commit44ddb73018b96a6979b4339f4ba234e5c97741f8 (patch)
tree7a7de53041e7ddd583059025a817ce2c118bfc66
parenta95e08e48c2d1f68693609627c6d6f52c6982264 (diff)
downloadingen-44ddb73018b96a6979b4339f4ba234e5c97741f8.tar.gz
ingen-44ddb73018b96a6979b4339f4ba234e5c97741f8.tar.bz2
ingen-44ddb73018b96a6979b4339f4ba234e5c97741f8.zip
Use new query system to get LADSPA plugin names from the engine.
Fixes ticket #365. git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@1998 a436a847-0d15-0410-975c-d299462d15a1
-rw-r--r--src/client/HTTPEngineSender.cpp4
-rw-r--r--src/client/HTTPEngineSender.hpp4
-rw-r--r--src/client/OSCEngineSender.cpp4
-rw-r--r--src/client/OSCEngineSender.hpp4
-rw-r--r--src/common/interface/EngineInterface.hpp8
-rw-r--r--src/engine/QueuedEngineInterface.cpp4
-rw-r--r--src/engine/QueuedEngineInterface.hpp4
-rw-r--r--src/gui/LoadPluginWindow.cpp83
-rw-r--r--src/gui/LoadPluginWindow.hpp8
-rw-r--r--src/shared/ResourceImpl.cpp1
-rw-r--r--src/shared/ResourceImpl.hpp3
11 files changed, 80 insertions, 47 deletions
diff --git a/src/client/HTTPEngineSender.cpp b/src/client/HTTPEngineSender.cpp
index a03bc26a..a586df72 100644
--- a/src/client/HTTPEngineSender.cpp
+++ b/src/client/HTTPEngineSender.cpp
@@ -246,13 +246,13 @@ HTTPEngineSender::request_object(const Path& path)
void
-HTTPEngineSender::request_variable(const Path& object_path, const URI& key)
+HTTPEngineSender::request_variable(const URI& object_path, const URI& key)
{
}
void
-HTTPEngineSender::request_property(const Path& object_path, const URI& key)
+HTTPEngineSender::request_property(const URI& object_path, const URI& key)
{
}
diff --git a/src/client/HTTPEngineSender.hpp b/src/client/HTTPEngineSender.hpp
index 7436040b..55d1646a 100644
--- a/src/client/HTTPEngineSender.hpp
+++ b/src/client/HTTPEngineSender.hpp
@@ -129,8 +129,8 @@ public:
void ping();
void request_plugin(const Raul::URI& uri);
void request_object(const Raul::Path& path);
- void request_variable(const Raul::Path& path, const Raul::URI& key);
- void request_property(const Raul::Path& path, const Raul::URI& key);
+ void request_variable(const Raul::URI& path, const Raul::URI& key);
+ void request_property(const Raul::URI& path, const Raul::URI& key);
void request_plugins();
void request_all_objects();
diff --git a/src/client/OSCEngineSender.cpp b/src/client/OSCEngineSender.cpp
index 153f8dee..2286108c 100644
--- a/src/client/OSCEngineSender.cpp
+++ b/src/client/OSCEngineSender.cpp
@@ -380,7 +380,7 @@ OSCEngineSender::request_object(const Path& path)
void
-OSCEngineSender::request_variable(const Path& object_path, const URI& key)
+OSCEngineSender::request_variable(const URI& object_path, const URI& key)
{
send("/ingen/request_variable", "iss",
next_id(),
@@ -391,7 +391,7 @@ OSCEngineSender::request_variable(const Path& object_path, const URI& key)
void
-OSCEngineSender::request_property(const Path& object_path, const URI& key)
+OSCEngineSender::request_property(const URI& object_path, const URI& key)
{
send("/ingen/request_property", "iss",
next_id(),
diff --git a/src/client/OSCEngineSender.hpp b/src/client/OSCEngineSender.hpp
index ffd8d678..13609df3 100644
--- a/src/client/OSCEngineSender.hpp
+++ b/src/client/OSCEngineSender.hpp
@@ -132,8 +132,8 @@ public:
void ping();
void request_plugin(const Raul::URI& uri);
void request_object(const Raul::Path& path);
- void request_variable(const Raul::Path& path, const Raul::URI& key);
- void request_property(const Raul::Path& path, const Raul::URI& key);
+ void request_variable(const Raul::URI& path, const Raul::URI& key);
+ void request_property(const Raul::URI& path, const Raul::URI& key);
void request_plugins();
void request_all_objects();
diff --git a/src/common/interface/EngineInterface.hpp b/src/common/interface/EngineInterface.hpp
index 5fdbffb8..64284f05 100644
--- a/src/common/interface/EngineInterface.hpp
+++ b/src/common/interface/EngineInterface.hpp
@@ -72,11 +72,11 @@ public:
virtual void request_object(const Raul::Path& path) = 0;
- virtual void request_variable(const Raul::Path& path,
- const Raul::URI& key) = 0;
+ virtual void request_variable(const Raul::URI& path,
+ const Raul::URI& key) = 0;
- virtual void request_property(const Raul::Path& path,
- const Raul::URI& key) = 0;
+ virtual void request_property(const Raul::URI& path,
+ const Raul::URI& key) = 0;
virtual void request_plugins() = 0;
diff --git a/src/engine/QueuedEngineInterface.cpp b/src/engine/QueuedEngineInterface.cpp
index dce860cd..1ac41f38 100644
--- a/src/engine/QueuedEngineInterface.cpp
+++ b/src/engine/QueuedEngineInterface.cpp
@@ -307,14 +307,14 @@ QueuedEngineInterface::request_object(const Path& path)
void
-QueuedEngineInterface::request_variable(const Path& object_path, const URI& key)
+QueuedEngineInterface::request_variable(const URI& object_path, const URI& key)
{
push_queued(new RequestMetadataEvent(_engine, _responder, now(), false, object_path, key));
}
void
-QueuedEngineInterface::request_property(const Path& object_path, const URI& key)
+QueuedEngineInterface::request_property(const URI& object_path, const URI& key)
{
push_queued(new RequestMetadataEvent(_engine, _responder, now(), true, object_path, key));
}
diff --git a/src/engine/QueuedEngineInterface.hpp b/src/engine/QueuedEngineInterface.hpp
index 2c174641..b4577850 100644
--- a/src/engine/QueuedEngineInterface.hpp
+++ b/src/engine/QueuedEngineInterface.hpp
@@ -127,8 +127,8 @@ public:
virtual void ping();
virtual void request_plugin(const Raul::URI& uri);
virtual void request_object(const Raul::Path& path);
- virtual void request_variable(const Raul::Path& object_path, const Raul::URI& key);
- virtual void request_property(const Raul::Path& object_path, const Raul::URI& key);
+ virtual void request_variable(const Raul::URI& object_path, const Raul::URI& key);
+ virtual void request_property(const Raul::URI& object_path, const Raul::URI& key);
virtual void request_plugins();
virtual void request_all_objects();
diff --git a/src/gui/LoadPluginWindow.cpp b/src/gui/LoadPluginWindow.cpp
index 1cc48b27..5b2c7925 100644
--- a/src/gui/LoadPluginWindow.cpp
+++ b/src/gui/LoadPluginWindow.cpp
@@ -68,7 +68,8 @@ LoadPluginWindow::LoadPluginWindow(BaseObjectType* cobject, const Glib::RefPtr<G
for (int i=0; i < 3; ++i)
_plugins_treeview->get_column(i)->set_resizable(true);
- _plugins_liststore->set_default_sort_func(sigc::mem_fun(this, &LoadPluginWindow::plugin_compare));
+ _plugins_liststore->set_default_sort_func(
+ sigc::mem_fun(this, &LoadPluginWindow::plugin_compare));
// Set up the search criteria combobox
_criteria_liststore = Gtk::ListStore::create(_criteria_columns);
@@ -85,17 +86,26 @@ LoadPluginWindow::LoadPluginWindow(BaseObjectType* cobject, const Glib::RefPtr<G
row[_criteria_columns._col_label] = "URI contains";
row[_criteria_columns._col_criteria] = CriteriaColumns::URI;
- _clear_button->signal_clicked().connect( sigc::mem_fun(this, &LoadPluginWindow::clear_clicked));
- _add_button->signal_clicked().connect( sigc::mem_fun(this, &LoadPluginWindow::add_clicked));
- //m_close_button->signal_clicked().connect( sigc::mem_fun(this, &LoadPluginWindow::close_clicked));
- //m_add_button->signal_clicked().connect( sigc::mem_fun(this, &LoadPluginWindow::ok_clicked));
- _plugins_treeview->signal_row_activated().connect(sigc::mem_fun(this, &LoadPluginWindow::plugin_activated));
- _search_entry->signal_activate().connect( sigc::mem_fun(this, &LoadPluginWindow::add_clicked));
- _search_entry->signal_changed().connect( sigc::mem_fun(this, &LoadPluginWindow::filter_changed));
- _node_name_entry->signal_changed().connect( sigc::mem_fun(this, &LoadPluginWindow::name_changed));
+ _clear_button->signal_clicked().connect(
+ sigc::mem_fun(this, &LoadPluginWindow::clear_clicked));
+ _add_button->signal_clicked().connect(
+ sigc::mem_fun(this, &LoadPluginWindow::add_clicked));
+ //m_close_button->signal_clicked().connect(
+ // sigc::mem_fun(this, &LoadPluginWindow::close_clicked));
+ //m_add_button->signal_clicked().connect(
+ // sigc::mem_fun(this, &LoadPluginWindow::ok_clicked));
+ _plugins_treeview->signal_row_activated().connect(
+ sigc::mem_fun(this, &LoadPluginWindow::plugin_activated));
+ _search_entry->signal_activate().connect(
+ sigc::mem_fun(this, &LoadPluginWindow::add_clicked));
+ _search_entry->signal_changed().connect(
+ sigc::mem_fun(this, &LoadPluginWindow::filter_changed));
+ _node_name_entry->signal_changed().connect(
+ sigc::mem_fun(this, &LoadPluginWindow::name_changed));
_selection = _plugins_treeview->get_selection();
- _selection->signal_changed().connect(sigc::mem_fun(this, &LoadPluginWindow::plugin_selection_changed));
+ _selection->signal_changed().connect(
+ sigc::mem_fun(this, &LoadPluginWindow::plugin_selection_changed));
//m_add_button->grab_default();
}
@@ -204,30 +214,15 @@ LoadPluginWindow::plugin_compare(const Gtk::TreeModel::iterator& a_i,
void
LoadPluginWindow::set_plugins(SharedPtr<const ClientStore::Plugins> m)
{
+ _rows.clear();
_plugins_liststore->clear();
for (ClientStore::Plugins::const_iterator i = m->begin(); i != m->end(); ++i) {
- SharedPtr<PluginModel> plugin = (*i).second;
-
- Gtk::TreeModel::iterator iter = _plugins_liststore->append();
- Gtk::TreeModel::Row row = *iter;
-
- row[_plugins_columns._col_icon] = App::instance().icon_from_path(plugin->icon_path(), 20);
- row[_plugins_columns._col_name] = plugin->name();
- if (!strcmp(plugin->type_uri(), "ingen:Internal"))
- row[_plugins_columns._col_type] = "Internal";
- else if (!strcmp(plugin->type_uri(), "lv2:Plugin"))
- row[_plugins_columns._col_type] = "LV2";
- else if (!strcmp(plugin->type_uri(), "ingen:LADSPA"))
- row[_plugins_columns._col_type] = "LADSPA";
- else
- row[_plugins_columns._col_type] = plugin->type_uri();
- row[_plugins_columns._col_uri] = plugin->uri().str();
- row[_plugins_columns._col_label] = plugin->name();
- row[_plugins_columns._col_plugin_model] = plugin;
+ add_plugin(i->second);
}
- _plugins_liststore->set_sort_column(Gtk::TreeSortable::DEFAULT_SORT_COLUMN_ID, Gtk::SORT_ASCENDING);
+ _plugins_liststore->set_sort_column(
+ Gtk::TreeSortable::DEFAULT_SORT_COLUMN_ID, Gtk::SORT_ASCENDING);
_plugins_treeview->columns_autosize();
}
@@ -248,12 +243,27 @@ LoadPluginWindow::add_plugin(SharedPtr<PluginModel> plugin)
{
Gtk::TreeModel::iterator iter = _plugins_liststore->append();
Gtk::TreeModel::Row row = *iter;
+ _rows.insert(make_pair(plugin->uri(), iter));
row[_plugins_columns._col_name] = plugin->name();
- row[_plugins_columns._col_type] = plugin->type_uri();
+ if (!strcmp(plugin->type_uri(), "ingen:Internal"))
+ row[_plugins_columns._col_type] = "Internal";
+ else if (!strcmp(plugin->type_uri(), "lv2:Plugin"))
+ row[_plugins_columns._col_type] = "LV2";
+ else if (!strcmp(plugin->type_uri(), "ingen:LADSPAPlugin"))
+ row[_plugins_columns._col_type] = "LADSPA";
+ else
+ row[_plugins_columns._col_type] = plugin->type_uri();
row[_plugins_columns._col_uri] = plugin->uri().str();
row[_plugins_columns._col_label] = plugin->name();
row[_plugins_columns._col_plugin_model] = plugin;
+
+ plugin->signal_property.connect(sigc::bind<0>(
+ sigc::mem_fun(this, &LoadPluginWindow::plugin_property_changed),
+ plugin->uri()));
+
+ if (plugin->name() == "")
+ App::instance().engine()->request_property(plugin->uri(), "doap:name");
}
@@ -369,6 +379,7 @@ LoadPluginWindow::ok_clicked()
void
LoadPluginWindow::filter_changed()
{
+ _rows.clear();
_plugins_liststore->clear();
string search = _search_entry->get_text();
@@ -384,7 +395,6 @@ LoadPluginWindow::filter_changed()
Gtk::TreeModel::iterator model_iter;
size_t num_visible = 0;
-
for (ClientStore::Plugins::const_iterator i = App::instance().store()->plugins()->begin();
i != App::instance().store()->plugins()->end(); ++i) {
@@ -442,6 +452,17 @@ LoadPluginWindow::on_key_press_event(GdkEventKey* event)
}
}
+void
+LoadPluginWindow::plugin_property_changed(const Raul::URI& plugin,
+ const Raul::URI& predicate,
+ const Raul::Atom& value)
+{
+ Rows::const_iterator i = _rows.find(plugin);
+ if (i != _rows.end() && value.type() == Atom::STRING)
+ (*i->second)[_plugins_columns._col_name] = value.get_string();
+}
+
} // namespace GUI
} // namespace Ingen
+
diff --git a/src/gui/LoadPluginWindow.hpp b/src/gui/LoadPluginWindow.hpp
index 7abeea41..0ff24ed7 100644
--- a/src/gui/LoadPluginWindow.hpp
+++ b/src/gui/LoadPluginWindow.hpp
@@ -18,6 +18,7 @@
#ifndef LOADPLUGINWINDOW_H
#define LOADPLUGINWINDOW_H
+#include <map>
#include <libglademm/xml.h>
#include <libglademm.h>
#include <gtkmm.h>
@@ -114,6 +115,10 @@ private:
void new_plugin(SharedPtr<PluginModel> plugin);
+ void plugin_property_changed(const Raul::URI& plugin,
+ const Raul::URI& predicate,
+ const Raul::Atom& value);
+
int plugin_compare(const Gtk::TreeModel::iterator& a,
const Gtk::TreeModel::iterator& b);
@@ -125,6 +130,9 @@ private:
SharedPtr<PatchModel> _patch;
+ typedef std::map<Raul::URI, Gtk::TreeModel::iterator> Rows;
+ Rows _rows;
+
Glib::RefPtr<Gtk::ListStore> _plugins_liststore;
ModelColumns _plugins_columns;
diff --git a/src/shared/ResourceImpl.cpp b/src/shared/ResourceImpl.cpp
index d2c1a06b..e8fbec35 100644
--- a/src/shared/ResourceImpl.cpp
+++ b/src/shared/ResourceImpl.cpp
@@ -26,6 +26,7 @@ void
ResourceImpl::set_property(const Raul::URI& uri, const Raul::Atom& value)
{
_properties[uri] = value;
+ signal_property.emit(uri, value);
}
diff --git a/src/shared/ResourceImpl.hpp b/src/shared/ResourceImpl.hpp
index ca588d8f..9cddbbf6 100644
--- a/src/shared/ResourceImpl.hpp
+++ b/src/shared/ResourceImpl.hpp
@@ -19,6 +19,7 @@
#define RESOURCEIMPL_HPP
#include <map>
+#include <sigc++/sigc++.h>
#include "raul/URI.hpp"
#include "interface/Resource.hpp"
@@ -39,6 +40,8 @@ public:
const Raul::Atom& get_property(const Raul::URI& uri) const;
void set_property(const Raul::URI& uri, const Raul::Atom& value);
+ sigc::signal<void, const Raul::URI&, const Raul::Atom&> signal_property;
+
private:
Raul::URI _uri;
Properties _properties;