[gst-debugger/refactor-v1.0] refactor: send klass definition
- From: Marcin Kolny <mkolny src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gst-debugger/refactor-v1.0] refactor: send klass definition
- Date: Thu, 1 Oct 2015 13:18:32 +0000 (UTC)
commit 65ab445c0ecd933433f43706f1e93714243469c8
Author: Marcin Kolny <marcin kolny gmail com>
Date: Thu Oct 1 15:18:03 2015 +0200
refactor: send klass definition
src/common/gstdebugger.proto | 17 +++-
src/common/serializer.c | 9 ++-
src/debugserver/gstdebugserver.c | 9 +-
src/debugserver/gstdebugservertypes.c | 77 +++++++++++++++
src/gst-debugger/Makefile.am | 5 +-
src/gst-debugger/controller/command_factory.cpp | 11 --
src/gst-debugger/controller/command_factory.h | 1 -
src/gst-debugger/controller/controller.cpp | 42 ++++++++-
src/gst-debugger/controller/controller.h | 10 ++-
src/gst-debugger/dialogs/klasses_dialog.cpp | 103 ++++++++++++++++++++
src/gst-debugger/dialogs/klasses_dialog.h | 42 ++++++++
src/gst-debugger/main_window.cpp | 7 ++
src/gst-debugger/main_window.h | 3 +
src/gst-debugger/models/gst_klass_model.h | 56 +++++++++++
src/gst-debugger/modules/gst_properties_module.cpp | 8 +-
src/gst-debugger/modules/gst_properties_module.h | 2 +-
src/gst-debugger/ui/gst-debugger.glade | 8 ++
17 files changed, 378 insertions(+), 32 deletions(-)
---
diff --git a/src/common/gstdebugger.proto b/src/common/gstdebugger.proto
index e53afa7..52cd357 100644
--- a/src/common/gstdebugger.proto
+++ b/src/common/gstdebugger.proto
@@ -18,8 +18,13 @@ message PropertyInfo {
required string nick = 2;
required string blurb = 3;
required int32 flags = 4;
- required Value value = 5;
- required string object = 6;
+ required Value default_value = 5;
+}
+
+message PropertyValue {
+ required string name = 1;
+ required string object = 2;
+ required Value value = 3;
}
message PropertyRequest {
@@ -156,6 +161,11 @@ message FactoryType {
repeated PadTemplate templates = 3;
}
+message ElementKlass {
+ required string name = 1;
+ repeated PropertyInfo property_info = 2;
+}
+
message TopologyLink {
required string src_pad = 1;
required string sink_pad = 2;
@@ -197,6 +207,7 @@ message GStreamerData {
EventInfo event_info = 7;
TopologyInfo topology_info = 8;
QueryInfo query_info = 9;
- PropertyInfo property_info = 10;
+ PropertyValue property_value = 10;
+ ElementKlass element_klass = 11;
}
}
diff --git a/src/common/serializer.c b/src/common/serializer.c
index 6ab3c04..cb5c3e4 100644
--- a/src/common/serializer.c
+++ b/src/common/serializer.c
@@ -140,7 +140,14 @@ gchar * g_value_serialize (GValue * value, GType * type, InternalGType * interna
} else if (value->g_type == GST_TYPE_OBJECT) {
g_value_init(&tmp, G_TYPE_STRING);
gchar buffer[128];
- snprintf (buffer, 128, "(GstObject:name) %s", GST_OBJECT_NAME (g_value_get_object (value)));
+ GstObject *obj = g_value_get_object (value);
+ gchar *name;
+ if (obj == NULL || GST_OBJECT_NAME (obj) == NULL) {
+ name = "(null)";
+ } else {
+ name = GST_OBJECT_NAME (obj);
+ }
+ snprintf (buffer, 128, "(GstObject:name) %s", name);
*type = G_TYPE_STRING;
g_value_set_string (&tmp, g_strdup (buffer));
*internal_type = INTERNAL_GTYPE_GST_OBJECT;
diff --git a/src/debugserver/gstdebugserver.c b/src/debugserver/gstdebugserver.c
index 789ef9c..f64e225 100644
--- a/src/debugserver/gstdebugserver.c
+++ b/src/debugserver/gstdebugserver.c
@@ -195,7 +195,7 @@ static void
gst_debugserver_tracer_send_property (GstDebugserverTcp * tcp_server, TcpClient * client, GParamSpec * spec,
GstElement * element)
{
GstDebugger__GStreamerData gst_data = GST_DEBUGGER__GSTREAMER_DATA__INIT;
- GstDebugger__PropertyInfo property = GST_DEBUGGER__PROPERTY_INFO__INIT;
+ GstDebugger__PropertyValue property = GST_DEBUGGER__PROPERTY_VALUE__INIT;
GstDebugger__Value value = GST_DEBUGGER__VALUE__INIT;
GType out_gtype;
InternalGType out_internal_type;
@@ -207,10 +207,7 @@ gst_debugserver_tracer_send_property (GstDebugserverTcp * tcp_server, TcpClient
return;
}
- property.blurb = (gchar*) g_param_spec_get_blurb (spec);
- property.flags = spec->flags;
property.name = (gchar*) g_param_spec_get_name (spec);
- property.nick = (gchar*) g_param_spec_get_nick (spec);
property.object = (gchar*) object;
g_value_init (&gvalue, spec->value_type);
@@ -230,8 +227,8 @@ gst_debugserver_tracer_send_property (GstDebugserverTcp * tcp_server, TcpClient
}
property.value = &value;
- gst_data.property_info = &property;
- gst_data.info_type_case = GST_DEBUGGER__GSTREAMER_DATA__INFO_TYPE_PROPERTY_INFO;
+ gst_data.property_value = &property;
+ gst_data.info_type_case = GST_DEBUGGER__GSTREAMER_DATA__INFO_TYPE_PROPERTY_VALUE;
gst_debugserver_tcp_send_packet (tcp_server, client, &gst_data);
diff --git a/src/debugserver/gstdebugservertypes.c b/src/debugserver/gstdebugservertypes.c
index 7f70f98..89fb36c 100644
--- a/src/debugserver/gstdebugservertypes.c
+++ b/src/debugserver/gstdebugservertypes.c
@@ -22,8 +22,13 @@
#include "gstdebugservertypes.h"
+#include "common/serializer.h"
+#include "common/common.h"
+
#include <gst/gst.h>
+#include <string.h>
+
#define SERIALIZE_ENUM_FLAGS \
do { \
n_values = klass->n_values; \
@@ -145,6 +150,74 @@ static void gst_debugserver_types_send_factory (GstDebugserverTcp *tcp_server, T
g_strfreev (keys);
}
+static void gst_debugserver_types_send_klass (GstDebugserverTcp *tcp_server, TcpClient *client, const gchar
* name)
+{
+ GType type = g_type_from_name (name);
+ GObjectClass *obj_klass = G_OBJECT_CLASS (g_type_class_peek (type));
+ GstElementClass *element_klass = GST_ELEMENT_CLASS (obj_klass);
+ GstDebugger__GStreamerData gst_data = GST_DEBUGGER__GSTREAMER_DATA__INIT;
+ GstDebugger__ElementKlass klass = GST_DEBUGGER__ELEMENT_KLASS__INIT;
+ GstDebugger__PropertyInfo **properties_info = NULL;
+ GParamSpec **specs;
+ GValue gvalue = G_VALUE_INIT;
+ gint n_specs, i;
+ GstElement *element = NULL;
+ GType out_gtype;
+ InternalGType out_internal_type;
+ GstDebugger__Value *value = NULL;
+
+ if (element_klass == NULL) {
+ // todo
+ return;
+ }
+
+ klass.name = (gchar*) name;
+ specs = g_object_class_list_properties (obj_klass, &n_specs);
+ klass.n_property_info = n_specs;
+
+ properties_info = g_malloc (sizeof (GstDebugger__PropertyInfo*) * n_specs);
+
+ for (i = 0; i < n_specs; i++) {
+ properties_info[i] = g_malloc (sizeof (GstDebugger__PropertyInfo));
+ gst_debugger__property_info__init (properties_info[i]);
+ properties_info[i]->blurb = (gchar*) g_param_spec_get_blurb (specs[i]);
+ properties_info[i]->flags = specs[i]->flags;
+ properties_info[i]->name = (gchar*) g_param_spec_get_name (specs[i]);
+ properties_info[i]->nick = (gchar*) g_param_spec_get_nick (specs[i]);
+
+ g_value_init (&gvalue, specs[i]->value_type);
+ g_param_value_set_default (specs[i], &gvalue);
+ value = (GstDebugger__Value*) g_malloc (sizeof (GstDebugger__Value));
+ gst_debugger__value__init (value);
+ value->data.data = (uint8_t*) g_value_serialize (&gvalue, &out_gtype, &out_internal_type);
+ value->data.len = value->data.data == NULL ? 0 : strlen (value->data.data);
+ value->gtype = out_gtype;
+
+ if (out_gtype == specs[i]->value_type) {
+ value->internal_type = out_internal_type;
+ value->has_internal_type = TRUE;
+ } else {
+ value->has_internal_type = FALSE;
+ }
+ properties_info[i]->default_value = value;
+
+ g_value_unset (&gvalue);
+ }
+
+ klass.property_info = properties_info;
+ gst_data.element_klass = &klass;
+ gst_data.info_type_case = GST_DEBUGGER__GSTREAMER_DATA__INFO_TYPE_ELEMENT_KLASS;
+
+ gst_debugserver_tcp_send_packet (tcp_server, client, &gst_data);
+
+ for (i = 0; i < (gint) n_specs; i++) {
+ g_free (properties_info[i]->default_value);
+ g_free (properties_info[i]);
+ }
+
+ g_free (properties_info);
+}
+
void gst_debugserver_types_send_type (GstDebugserverTcp *tcp_server, TcpClient *client, const
GstDebugger__TypeDescriptionRequest *request)
{
switch (request->type) {
@@ -153,5 +226,9 @@ void gst_debugserver_types_send_type (GstDebugserverTcp *tcp_server, TcpClient *
break;
case GST_DEBUGGER__TYPE_DESCRIPTION_REQUEST__TYPE__ENUM_FLAGS:
gst_debugserver_types_send_enum_flags (tcp_server, client, request->name);
+ break;
+ case GST_DEBUGGER__TYPE_DESCRIPTION_REQUEST__TYPE__KLASS:
+ gst_debugserver_types_send_klass (tcp_server, client, request->name);
+ break;
}
}
diff --git a/src/gst-debugger/Makefile.am b/src/gst-debugger/Makefile.am
index b213570..af2841c 100644
--- a/src/gst-debugger/Makefile.am
+++ b/src/gst-debugger/Makefile.am
@@ -66,7 +66,10 @@ gst_debugger_ GST_API_VERSION@_SOURCES = \
dialogs/factories_dialog.cpp \
dialogs/factories_dialog.h \
modules/gst_properties_module.cpp \
- modules/gst_properties_module.h
+ modules/gst_properties_module.h \
+ models/gst_klass_model.h \
+ dialogs/klasses_dialog.h \
+ dialogs/klasses_dialog.cpp
gst_debugger_ GST_API_VERSION@_LDFLAGS = $(GTKMM_LIBS) $(GSTMM_LIBS) $(GVC_LIBS) $(PROTOBUF_LIBS) -lX11
gst_debugger_ GST_API_VERSION@_LDADD = ../common/libgst-debugger-common-cpp- GST_DEBUGGER_API_VERSION@.la
diff --git a/src/gst-debugger/controller/command_factory.cpp b/src/gst-debugger/controller/command_factory.cpp
index 9882c9c..aa49910 100644
--- a/src/gst-debugger/controller/command_factory.cpp
+++ b/src/gst-debugger/controller/command_factory.cpp
@@ -111,17 +111,6 @@ void CommandFactory::send_request_debug_categories_command()
client->send_command(cmd);
}
-void CommandFactory::send_request_factory_command(const std::string &factory_name)
-{
- GstDebugger::Command cmd;
- auto rq = new GstDebugger::TypeDescriptionRequest();
- rq->set_type(GstDebugger::TypeDescriptionRequest_Type_FACTORY);
- rq->set_name(factory_name);
- cmd.set_allocated_type_description(rq);
-
- client->send_command(cmd);
-}
-
/*
void CommandFactory::send_request_topology_command()
diff --git a/src/gst-debugger/controller/command_factory.h b/src/gst-debugger/controller/command_factory.h
index 62c71cf..0e94573 100644
--- a/src/gst-debugger/controller/command_factory.h
+++ b/src/gst-debugger/controller/command_factory.h
@@ -28,7 +28,6 @@ public:
void send_data_type_request_command(const std::string &type_name,
GstDebugger::TypeDescriptionRequest_Type type);
void send_request_debug_categories_command();
void send_request_entire_topology_command();
- void send_request_factory_command(const std::string &factory_name);
/*void send_property_command(const std::string &path, const std::string &property_name, GValue
*gvalue);
void send_request_pad_dynamic_info(const std::string &pad_path);*/
};
diff --git a/src/gst-debugger/controller/controller.cpp b/src/gst-debugger/controller/controller.cpp
index fe7b567..c9c814c 100644
--- a/src/gst-debugger/controller/controller.cpp
+++ b/src/gst-debugger/controller/controller.cpp
@@ -57,15 +57,25 @@ void Controller::process_frame(const GstDebugger::GStreamerData &data)
process(data.topology_info());
on_model_changed(current_model);
- if (data.topology_info().has_element() &&
!get_factory(data.topology_info().element().factory_name()))
+ if (data.topology_info().has_element())
{
- send_request_factory_command(data.topology_info().element().factory_name());
+ if (!get_factory(data.topology_info().element().factory_name()))
+ send_data_type_request_command(data.topology_info().element().factory_name(),
GstDebugger::TypeDescriptionRequest_Type_FACTORY);
+ if (!get_klass(data.topology_info().element().type_name()))
+ send_data_type_request_command(data.topology_info().element().type_name(),
GstDebugger::TypeDescriptionRequest_Type_KLASS);
}
break;
case GstDebugger::GStreamerData::kFactory:
update_factory_model(data.factory());
on_factory_list_changed(data.factory().name(), true);
break;
+ case GstDebugger::GStreamerData::kElementKlass:
+ update_klass_model(data.element_klass());
+ on_klass_list_changed(data.element_klass().name(), true);
+ break;
+ case GstDebugger::GStreamerData::kPropertyValue:
+ on_property_value_received(data.property_value());
+ break;
}
/*
case GstreamerInfo_InfoType_PROPERTY:
@@ -114,6 +124,10 @@ boost::optional<FactoryModel> Controller::get_factory(const std::string &name)
return get_from_container<FactoryModel>(factory_container, name, [](const FactoryModel& factory)
{return factory.get_name(); } );
}
+boost::optional<KlassModel> Controller::get_klass(const std::string &name)
+{
+ return get_from_container<KlassModel>(klass_container, name, [](const KlassModel& klass) {return
klass.get_name(); } );
+}
void Controller::model_up()
{
@@ -219,6 +233,30 @@ void Controller::update_factory_model(const GstDebugger::FactoryType &factory_in
*it = model;
}
}
+
+void Controller::update_klass_model(const GstDebugger::ElementKlass &klass_info)
+{
+ KlassModel model(klass_info.name());
+
+ // todo copy & paste get_enum_type()
+ auto it = std::find_if(klass_container.begin(), klass_container.end(), [model](const KlassModel&
type) {
+ return type.get_name() == model.get_name();
+ });
+
+ for (auto property : klass_info.property_info())
+ {
+ model.append_property(PropertyModel(property.name(), property.nick(), property.blurb(),
(GParamFlags)property.flags()));
+ }
+
+ if (it == klass_container.end())
+ {
+ klass_container.push_back(model);
+ }
+ else
+ {
+ *it = model;
+ }
+}
/*
void Controller::append_property(const Property& property)
{
diff --git a/src/gst-debugger/controller/controller.h b/src/gst-debugger/controller/controller.h
index 7f9cc62..8d328d4 100644
--- a/src/gst-debugger/controller/controller.h
+++ b/src/gst-debugger/controller/controller.h
@@ -15,6 +15,7 @@
#include "models/gst_enum_model.h"
#include "models/gst_factory_model.h"
+#include "models/gst_klass_model.h"
#include <boost/optional/optional.hpp>
@@ -29,6 +30,7 @@ private:
std::vector<GstEnumType> enum_container;
std::vector<FactoryModel> factory_container;
+ std::vector<KlassModel> klass_container;
std::vector<std::string> debug_categories;
std::shared_ptr<ObjectModel> selected_object;
@@ -38,6 +40,7 @@ private:
void update_enum_model(const GstDebugger::EnumFlagsType &enum_type);
void update_factory_model(const GstDebugger::FactoryType &factory_info);
+ void update_klass_model(const GstDebugger::ElementKlass &klass_element);
/*
@@ -63,9 +66,11 @@ public:
boost::optional<GstEnumType> get_enum_type(const std::string &name);
boost::optional<FactoryModel> get_factory(const std::string &name);
+ boost::optional<KlassModel> get_klass(const std::string &name);
const std::vector<FactoryModel>& get_factories() const { return factory_container; }
- const std::vector<GstEnumType> get_enums() const { return enum_container; }
+ const std::vector<GstEnumType>& get_enums() const { return enum_container; }
+ const std::vector<KlassModel>& get_klasses() const { return klass_container; }
std::shared_ptr<ObjectModel> get_selected_object() const { return selected_object; }
@@ -76,8 +81,9 @@ public:
sigc::signal<void, const GstDebugger::Command&> on_confirmation_received;
sigc::signal<void, const Glib::ustring&, bool> on_enum_list_changed; /* enum name, true - add, false
- remove */
sigc::signal<void, const Glib::ustring&, bool> on_factory_list_changed;
+ sigc::signal<void, const Glib::ustring&, bool> on_klass_list_changed;
sigc::signal<void, std::shared_ptr<ElementModel>> on_model_changed;
- sigc::signal<void, const GstDebugger::PropertyInfo&> on_property_received;
+ sigc::signal<void, const GstDebugger::PropertyValue&> on_property_value_received;
sigc::signal<void> on_selected_object_changed;
/* sigc::signal<void, const Glib::ustring&> on_new_log_entry;*/
};
diff --git a/src/gst-debugger/dialogs/klasses_dialog.cpp b/src/gst-debugger/dialogs/klasses_dialog.cpp
new file mode 100644
index 0000000..f0af2ef
--- /dev/null
+++ b/src/gst-debugger/dialogs/klasses_dialog.cpp
@@ -0,0 +1,103 @@
+/*
+ * klasses_dialog.cpp
+ *
+ * Created on: Oct 1, 2015
+ * Author: loganek
+ */
+
+#include "klasses_dialog.h"
+#include "ui_utils.h"
+
+#include "controller/controller.h"
+
+#include <map>
+
+KlassesDialog::KlassesDialog(BaseObjectType* cobject, const Glib::RefPtr<Gtk::Builder>& builder)
+: RemoteDataDialog(cobject, builder)
+{
+ tree_model = Gtk::TreeStore::create(klasses_columns);
+ data_tree_view->set_model(tree_model);
+ data_tree_view->append_column("Property", klasses_columns.m_col_name);
+ data_tree_view->append_column("Value", klasses_columns.m_col_value);
+
+ set_title("Remote Factories");
+}
+
+void KlassesDialog::set_controller(const std::shared_ptr<Controller> &controller)
+{
+ IBaseView::set_controller(controller);
+ controller->on_klass_list_changed.connect(sigc::mem_fun(*this, &KlassesDialog::reload_list));
+ reload_list("", true);
+}
+
+#define APPEND_SUB_ROW(PARENT, NAME, VALUE) \
+ do { \
+ auto c = *(tree_model->append(PARENT.children())); \
+ c[klasses_columns.m_col_name] = NAME; \
+ c[klasses_columns.m_col_value] = VALUE; \
+ } while (false)
+
+std::string KlassesDialog::g_param_flags_to_string(GParamFlags v, std::string flags_name)
+{
+#define xstr(s) str(s)
+#define str(s) #s
+#define PARAM_FLAG(NAME) { NAME, xstr(NAME) }
+ std::map<int, std::string> values = {
+ PARAM_FLAG(G_PARAM_READABLE),
+ PARAM_FLAG(G_PARAM_READWRITE),
+ PARAM_FLAG(G_PARAM_CONSTRUCT),
+ PARAM_FLAG(G_PARAM_CONSTRUCT_ONLY),
+ PARAM_FLAG(G_PARAM_LAX_VALIDATION),
+ PARAM_FLAG(G_PARAM_STATIC_NAME),
+ PARAM_FLAG(G_PARAM_PRIVATE),
+ PARAM_FLAG(G_PARAM_STATIC_NICK),
+ PARAM_FLAG(G_PARAM_STATIC_BLURB),
+ PARAM_FLAG(G_PARAM_EXPLICIT_NOTIFY),
+ PARAM_FLAG(G_PARAM_DEPRECATED)
+ };
+
+ std::string str;
+ bool first = false;
+ if (values.empty()) str = "none";
+ for (auto value : values)
+ {
+ if (value.first & v)
+ {
+ if (first) str.append(", ");
+ else first = true;
+ str.append(value.second);
+ }
+ }
+
+ return str;
+}
+
+void KlassesDialog::reload_list(const Glib::ustring &klass_name, bool add)
+{
+ // todo if (add)
+
+ tree_model->clear();
+
+ for (auto klass : controller->get_klasses())
+ {
+ auto row = *(tree_model->append());
+ row[klasses_columns.m_col_name] = klass.get_name();
+ row[klasses_columns.m_col_value] = "";
+
+ auto childrow = *(tree_model->append(row.children()));
+ childrow[klasses_columns.m_col_name] = "Properties";
+
+ for (auto property : klass.get_properties())
+ {
+ auto cr = *(tree_model->append(childrow.children()));
+
+ cr[klasses_columns.m_col_name] = property.get_name();
+
+ APPEND_SUB_ROW(cr, "Nick", property.get_nick());
+ APPEND_SUB_ROW(cr, "Blurb", property.get_blurb());
+ APPEND_SUB_ROW(cr, "Flags", g_param_flags_to_string(property.get_flags(),
"GParamFlags"));
+ }
+ }
+}
+#undef APPEND_SUB_ROW
+
diff --git a/src/gst-debugger/dialogs/klasses_dialog.h b/src/gst-debugger/dialogs/klasses_dialog.h
new file mode 100644
index 0000000..a75ae7b
--- /dev/null
+++ b/src/gst-debugger/dialogs/klasses_dialog.h
@@ -0,0 +1,42 @@
+/*
+ * klasses_dialog.h
+ *
+ * Created on: Oct 1, 2015
+ * Author: loganek
+ */
+
+#ifndef SRC_GST_DEBUGGER_DIALOGS_KLASSES_DIALOG_H_
+#define SRC_GST_DEBUGGER_DIALOGS_KLASSES_DIALOG_H_
+
+#include "remote_data_dialog.h"
+
+#include "controller/iview.h"
+
+#include <gtkmm.h>
+
+class KlassModelColumns : public Gtk::TreeModel::ColumnRecord
+{
+public:
+
+ KlassModelColumns() { add(m_col_name); add(m_col_value); }
+
+ Gtk::TreeModelColumn<Glib::ustring> m_col_name;
+ Gtk::TreeModelColumn<Glib::ustring> m_col_value;
+};
+
+class KlassesDialog : public RemoteDataDialog
+{
+ KlassModelColumns klasses_columns;
+ Glib::RefPtr<Gtk::TreeStore> klasses_tree_model;
+
+ void reload_list(const Glib::ustring &klass_name, bool add);
+
+ std::string g_param_flags_to_string(GParamFlags v, std::string flags_name);
+
+public:
+ KlassesDialog(BaseObjectType* cobject, const Glib::RefPtr<Gtk::Builder>& builder);
+
+ void set_controller(const std::shared_ptr<Controller> &controller) override;
+};
+
+#endif /* SRC_GST_DEBUGGER_DIALOGS_KLASSES_DIALOG_H_ */
diff --git a/src/gst-debugger/main_window.cpp b/src/gst-debugger/main_window.cpp
index 3f0e5a3..e043b92 100644
--- a/src/gst-debugger/main_window.cpp
+++ b/src/gst-debugger/main_window.cpp
@@ -31,6 +31,9 @@ MainWindow::MainWindow(BaseObjectType* cobject, const Glib::RefPtr<Gtk::Builder>
builder->get_widget("remoteFactoriesMenuitem", remote_factories);
remote_factories->signal_activate().connect([this] { factories_dialog->show(); });
+ builder->get_widget("remoteKlassesMenuitem", remote_klasses);
+ remote_klasses->signal_activate().connect([this] { klasses_dialog->show(); });
+
builder->get_widget("connectMenuItem", connect_menu_item);
connect_menu_item->signal_activate().connect(sigc::mem_fun(*this,
&MainWindow::connectMenuItem_activate_cb));
@@ -44,6 +47,7 @@ MainWindow::MainWindow(BaseObjectType* cobject, const Glib::RefPtr<Gtk::Builder>
enums_dialog = load_dialog<EnumsDialog>("remoteDataDialog");
factories_dialog = load_dialog<FactoriesDialog>("remoteDataDialog");
+ klasses_dialog = load_dialog<KlassesDialog>("remoteDataDialog");
connection_properties_dialog = load_dialog<ConnectionPropertiesDialog>("connectionPropertiesDialog");
{
@@ -83,6 +87,9 @@ void MainWindow::set_controller(const std::shared_ptr<Controller> &controller)
factories_dialog->set_controller(controller);
factories_dialog->set_transient_for(*this);
+ klasses_dialog->set_controller(controller);
+ klasses_dialog->set_transient_for(*this);
+
properties_module->set_controller(controller);
connection_properties_dialog->set_transient_for(*this);
diff --git a/src/gst-debugger/main_window.h b/src/gst-debugger/main_window.h
index 44ca02b..8c0e3ae 100644
--- a/src/gst-debugger/main_window.h
+++ b/src/gst-debugger/main_window.h
@@ -11,6 +11,7 @@
#include "dialogs/connection_properties_dialog.h"
#include "dialogs/enums_dialog.h"
#include "dialogs/factories_dialog.h"
+#include "dialogs/klasses_dialog.h"
#include "modules/main_module.h"
#include "modules/gst_properties_module.h"
#include "pipeline-drawer/graph_module.h"
@@ -31,6 +32,7 @@ class MainWindow : public IMainView
Gtk::MenuItem *connection_properties;
Gtk::MenuItem *remote_enum_types;
Gtk::MenuItem *remote_factories;
+ Gtk::MenuItem *remote_klasses;
Gtk::MenuItem *connect_menu_item;
Gtk::MenuItem *about_menu_item;
Gtk::MenuItem *quit_menu_item;
@@ -41,6 +43,7 @@ class MainWindow : public IMainView
ConnectionPropertiesDialog *connection_properties_dialog;
EnumsDialog *enums_dialog;
FactoriesDialog *factories_dialog;
+ KlassesDialog *klasses_dialog;
std::shared_ptr<Glib::Dispatcher> dispatcher;
std::shared_ptr<MainModule> main_module;
diff --git a/src/gst-debugger/models/gst_klass_model.h b/src/gst-debugger/models/gst_klass_model.h
new file mode 100644
index 0000000..b3669e5
--- /dev/null
+++ b/src/gst-debugger/models/gst_klass_model.h
@@ -0,0 +1,56 @@
+/*
+ * gst_klass_model.h
+ *
+ * Created on: Oct 1, 2015
+ * Author: loganek
+ */
+
+#ifndef SRC_GST_DEBUGGER_MODELS_GST_KLASS_MODEL_H_
+#define SRC_GST_DEBUGGER_MODELS_GST_KLASS_MODEL_H_
+
+#include <string>
+
+class PropertyModel
+{
+ std::string name;
+ std::string nick;
+ std::string blurb;
+ GParamFlags flags;
+
+public:
+ PropertyModel(const std::string &name, const std::string &nick, const std::string &blurb, GParamFlags
flags)
+ : name(name), nick(nick), blurb(blurb), flags(flags) {}
+
+ std::string get_name() const { return name; }
+ std::string get_nick() const { return nick; }
+ std::string get_blurb() const { return blurb; }
+ GParamFlags get_flags() const { return flags; }
+};
+
+class KlassModel
+{
+ std::string name;
+ std::vector<PropertyModel> properties;
+
+public:
+ KlassModel(const std::string &klass_name)
+ : name (klass_name)
+ {}
+
+ std::string get_name() const { return name; }
+
+ void append_property(const PropertyModel& property)
+ {
+ // todo copy&paste
+ auto it = std::find_if(properties.begin(), properties.end(), [this](const PropertyModel&
model) { return model.get_name() == name; });
+
+ if (it == properties.end())
+ properties.push_back(property);
+ else
+ *it = property;
+ }
+
+ const std::vector<PropertyModel>& get_properties() const { return properties; }
+};
+
+#endif /* SRC_GST_DEBUGGER_MODELS_GST_KLASS_MODEL_H_ */
diff --git a/src/gst-debugger/modules/gst_properties_module.cpp
b/src/gst-debugger/modules/gst_properties_module.cpp
index 9a995d2..4940e15 100644
--- a/src/gst-debugger/modules/gst_properties_module.cpp
+++ b/src/gst-debugger/modules/gst_properties_module.cpp
@@ -30,13 +30,13 @@ GstPropertiesModule::GstPropertiesModule(const Glib::RefPtr<Gtk::Builder>& build
void GstPropertiesModule::set_controller(const std::shared_ptr<Controller> &controller)
{
IBaseView::set_controller(controller);
- controller->on_property_received.connect(sigc::mem_fun(*this, &GstPropertiesModule::new_property));
+ controller->on_property_value_received.connect(sigc::mem_fun(*this,
&GstPropertiesModule::new_property));
controller->on_selected_object_changed.connect(sigc::mem_fun(*this,
&GstPropertiesModule::selected_object_changed));
}
-void GstPropertiesModule::new_property(const GstDebugger::PropertyInfo &property)
+void GstPropertiesModule::new_property(const GstDebugger::PropertyValue &property)
{
- gui_push("property", new GstDebugger::PropertyInfo(property));
+ gui_push("property", new GstDebugger::PropertyValue(property));
gui_emit("property");
}
@@ -65,7 +65,7 @@ void GstPropertiesModule::showPropertiesButton_clicked_cb()
void GstPropertiesModule::new_property_()
{
- auto property = gui_pop<GstDebugger::PropertyInfo*>("property");
+ auto property = gui_pop<GstDebugger::PropertyValue*>("property");
auto element =
std::dynamic_pointer_cast<ElementModel>(ElementPathProcessor(property->object()).get_last_obj());
if (!element)
diff --git a/src/gst-debugger/modules/gst_properties_module.h
b/src/gst-debugger/modules/gst_properties_module.h
index 9b72ca7..24dc973 100644
--- a/src/gst-debugger/modules/gst_properties_module.h
+++ b/src/gst-debugger/modules/gst_properties_module.h
@@ -31,7 +31,7 @@ private:
void show_pad_properties();
- void new_property(const GstDebugger::PropertyInfo& property);
+ void new_property(const GstDebugger::PropertyValue& property);
void new_property_();
void selected_object_changed();
diff --git a/src/gst-debugger/ui/gst-debugger.glade b/src/gst-debugger/ui/gst-debugger.glade
index 8ab3e52..8576dc5 100644
--- a/src/gst-debugger/ui/gst-debugger.glade
+++ b/src/gst-debugger/ui/gst-debugger.glade
@@ -97,6 +97,14 @@
<property name="use_underline">True</property>
</object>
</child>
+ <child>
+ <object class="GtkMenuItem" id="remoteKlassesMenuitem">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label" translatable="yes">Remote Klasses...</property>
+ <property name="use_underline">True</property>
+ </object>
+ </child>
</object>
</child>
</object>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]