[gst-debugger] gst-debugger: filtering data - draft
- From: Marcin Kolny <mkolny src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gst-debugger] gst-debugger: filtering data - draft
- Date: Tue, 1 Sep 2015 22:42:49 +0000 (UTC)
commit 0f83efbfaf4a6a55a1ceb2b5270c69cb6988d45e
Author: Marcin Kolny <marcin kolny gmail com>
Date: Wed Sep 2 00:42:38 2015 +0200
gst-debugger: filtering data - draft
src/gst-debugger/modules/base_main_module.cpp | 14 ++++-
src/gst-debugger/modules/base_main_module.h | 7 ++
src/gst-debugger/modules/bus_messages_module.cpp | 2 +-
src/gst-debugger/modules/log_module.cpp | 17 +++++-
src/gst-debugger/modules/log_module.h | 3 +
src/gst-debugger/modules/main_module.cpp | 5 ++
src/gst-debugger/modules/main_module.h | 1 +
src/gst-debugger/modules/pad_data_modules.cpp | 2 +-
src/gst-debugger/ui/gst-debugger.glade | 74 ++++++++++++++-------
9 files changed, 96 insertions(+), 29 deletions(-)
---
diff --git a/src/gst-debugger/modules/base_main_module.cpp b/src/gst-debugger/modules/base_main_module.cpp
index b0f8bf8..a0bd7e4 100644
--- a/src/gst-debugger/modules/base_main_module.cpp
+++ b/src/gst-debugger/modules/base_main_module.cpp
@@ -17,7 +17,13 @@ BaseMainModule::BaseMainModule()
void BaseMainModule::configure_main_list_view(Gtk::TreeView *view)
{
view->remove_all_columns();
- view->set_model(model);
+
+ filter = Gtk::TreeModelFilter::create(model);
+ filter->set_visible_func([this](const Gtk::TreeModel::const_iterator& it){
+ return filter_function(it);
+ });
+
+ view->set_model(filter);
}
void BaseMainModule::load_details(Gtk::TreeView *view, const Gtk::TreeModel::Path &path)
@@ -26,6 +32,12 @@ void BaseMainModule::load_details(Gtk::TreeView *view, const Gtk::TreeModel::Pat
view->set_model(details_model);
}
+void BaseMainModule::update_filter_string(const std::string &filter_text)
+{
+ this->filter_text = filter_text;
+ filter->refilter();
+}
+
void BaseMainModule::configure_details_view(Gtk::TreeView *view)
{
view->remove_all_columns();
diff --git a/src/gst-debugger/modules/base_main_module.h b/src/gst-debugger/modules/base_main_module.h
index 0197192..60734be 100644
--- a/src/gst-debugger/modules/base_main_module.h
+++ b/src/gst-debugger/modules/base_main_module.h
@@ -18,14 +18,19 @@
class BaseMainModule : public IBaseView
{
protected:
+ std::string filter_text;
+
static DetailsModelColumns detail_columns;
+ Glib::RefPtr<Gtk::TreeModelFilter> filter;
Glib::RefPtr<Gtk::ListStore> model;
Glib::RefPtr<Gtk::ListStore> details_model;
void append_details_row(const std::string &name, const std::string &value);
void append_details_from_structure(Gst::Structure& structure);
+ virtual bool filter_function(const Gtk::TreeModel::const_iterator& it) { return true; }
+
public:
BaseMainModule();
virtual ~BaseMainModule() {}
@@ -36,6 +41,8 @@ public:
static void configure_details_view(Gtk::TreeView *view);
+ void update_filter_string(const std::string &filter_text);
+
Glib::RefPtr<Gtk::ListStore> get_model() const { return model; }
};
diff --git a/src/gst-debugger/modules/bus_messages_module.cpp
b/src/gst-debugger/modules/bus_messages_module.cpp
index 54ac941..aed9171 100644
--- a/src/gst-debugger/modules/bus_messages_module.cpp
+++ b/src/gst-debugger/modules/bus_messages_module.cpp
@@ -30,7 +30,7 @@ void BusMessagesModule::load_details(Gtk::TreeView *view, const Gtk::TreeModel::
{
BaseMainModule::load_details(view, path);
- Gtk::TreeModel::iterator iter = model->get_iter(path);
+ Gtk::TreeModel::iterator iter = filter->get_iter(path);
if (!iter)
{
return;
diff --git a/src/gst-debugger/modules/log_module.cpp b/src/gst-debugger/modules/log_module.cpp
index 97b17ba..6b87838 100644
--- a/src/gst-debugger/modules/log_module.cpp
+++ b/src/gst-debugger/modules/log_module.cpp
@@ -28,7 +28,7 @@ void LogModule::load_details(Gtk::TreeView *view, const Gtk::TreeModel::Path &pa
{
BaseMainModule::load_details(view, path);
- Gtk::TreeModel::iterator iter = model->get_iter(path);
+ Gtk::TreeModel::iterator iter = filter->get_iter(path);
if (!iter)
{
return;
@@ -64,6 +64,21 @@ void LogModule::log_received_()
row[columns.log] = log;
}
+bool LogModule::filter_function(const Gtk::TreeModel::const_iterator& it)
+{
+ if (filter_text.empty())
+ return true;
+
+ auto log = it->get_value(columns.log);
+
+ if (log == nullptr)
+ return true;
+
+ int line = atoi(filter_text.c_str());
+
+ return log->line() == line;
+}
+
LogControlModule::LogControlModule()
{
main_box = Gtk::manage(new Gtk::Box(Gtk::ORIENTATION_VERTICAL));
diff --git a/src/gst-debugger/modules/log_module.h b/src/gst-debugger/modules/log_module.h
index a3da093..048bacb 100644
--- a/src/gst-debugger/modules/log_module.h
+++ b/src/gst-debugger/modules/log_module.h
@@ -30,6 +30,9 @@ class LogModule : public BaseMainModule
LogModelColumns columns;
+protected:
+ bool filter_function(const Gtk::TreeModel::const_iterator& it) override;
+
public:
LogModule();
virtual ~LogModule() {}
diff --git a/src/gst-debugger/modules/main_module.cpp b/src/gst-debugger/modules/main_module.cpp
index 8d8199f..b62e2e8 100644
--- a/src/gst-debugger/modules/main_module.cpp
+++ b/src/gst-debugger/modules/main_module.cpp
@@ -26,6 +26,11 @@ MainModule::MainModule(const Glib::RefPtr<Gtk::Builder> &builder)
builder->get_widget("controllerFrame", controller_frame);
+ builder->get_widget("dataFilterEntry", data_filter_entry);
+ data_filter_entry->signal_activate().connect([this]{
+ current_module->update_filter_string(data_filter_entry->get_text());
+ });
+
load_submodules(builder);
}
diff --git a/src/gst-debugger/modules/main_module.h b/src/gst-debugger/modules/main_module.h
index eb70c79..1c0a2c6 100644
--- a/src/gst-debugger/modules/main_module.h
+++ b/src/gst-debugger/modules/main_module.h
@@ -27,6 +27,7 @@ class MainModule : public IBaseView
Gtk::TreeView *list_tree_view;
Gtk::TreeView *details_tree_view;
Gtk::Frame *controller_frame;
+ Gtk::Entry *data_filter_entry;
TypesModelColumns types_columns;
diff --git a/src/gst-debugger/modules/pad_data_modules.cpp b/src/gst-debugger/modules/pad_data_modules.cpp
index e1d685e..f231f5e 100644
--- a/src/gst-debugger/modules/pad_data_modules.cpp
+++ b/src/gst-debugger/modules/pad_data_modules.cpp
@@ -61,7 +61,7 @@ void PadDataModule<T>::load_details(Gtk::TreeView *view, const Gtk::TreeModel::P
{
BaseMainModule::load_details(view, path);
- Gtk::TreeModel::iterator iter = model->get_iter(path);
+ Gtk::TreeModel::iterator iter = filter->get_iter(path);
if (!iter)
{
return;
diff --git a/src/gst-debugger/ui/gst-debugger.glade b/src/gst-debugger/ui/gst-debugger.glade
index f121e4f..76291b8 100644
--- a/src/gst-debugger/ui/gst-debugger.glade
+++ b/src/gst-debugger/ui/gst-debugger.glade
@@ -218,51 +218,75 @@
<property name="visible">True</property>
<property name="can_focus">False</property>
<child>
- <object class="GtkPaned" id="paned7">
+ <object class="GtkBox" id="box1">
<property name="visible">True</property>
- <property name="can_focus">True</property>
+ <property name="can_focus">False</property>
<property name="orientation">vertical</property>
- <property name="position">88</property>
- <property name="position_set">True</property>
<child>
- <object class="GtkScrolledWindow" id="scrolledwindow14">
+ <object class="GtkEntry" id="dataFilterEntry">
<property name="visible">True</property>
<property name="can_focus">True</property>
- <property name="shadow_type">in</property>
- <child>
- <object class="GtkTreeView" id="mainListTreeView">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <child internal-child="selection">
- <object class="GtkTreeSelection" id="treeview-selection"/>
- </child>
- </object>
- </child>
+ <property name="placeholder_text" translatable="yes">Data filter</property>
</object>
<packing>
- <property name="resize">False</property>
- <property name="shrink">True</property>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">0</property>
</packing>
</child>
<child>
- <object class="GtkScrolledWindow" id="scrolledwindow15">
+ <object class="GtkPaned" id="paned7">
<property name="visible">True</property>
<property name="can_focus">True</property>
- <property name="shadow_type">in</property>
+ <property name="orientation">vertical</property>
+ <property name="position">88</property>
+ <property name="position_set">True</property>
<child>
- <object class="GtkTreeView" id="mainDetailsTreeView">
+ <object class="GtkScrolledWindow" id="scrolledwindow14">
<property name="visible">True</property>
<property name="can_focus">True</property>
- <property name="margin_top">1</property>
- <child internal-child="selection">
- <object class="GtkTreeSelection" id="treeview-selection2"/>
+ <property name="shadow_type">in</property>
+ <child>
+ <object class="GtkTreeView" id="mainListTreeView">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <child internal-child="selection">
+ <object class="GtkTreeSelection" id="treeview-selection"/>
+ </child>
+ </object>
+ </child>
+ </object>
+ <packing>
+ <property name="resize">False</property>
+ <property name="shrink">True</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkScrolledWindow" id="scrolledwindow15">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="shadow_type">in</property>
+ <child>
+ <object class="GtkTreeView" id="mainDetailsTreeView">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="margin_top">1</property>
+ <child internal-child="selection">
+ <object class="GtkTreeSelection" id="treeview-selection2"/>
+ </child>
+ </object>
</child>
</object>
+ <packing>
+ <property name="resize">True</property>
+ <property name="shrink">True</property>
+ </packing>
</child>
</object>
<packing>
- <property name="resize">True</property>
- <property name="shrink">True</property>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ <property name="position">1</property>
</packing>
</child>
</object>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]