[gst-debugger] gst-debugger: add log control module



commit 4b54125b8b227eb17ce660e1aa7b0e576021b460
Author: Marcin Kolny <marcin kolny gmail com>
Date:   Tue Sep 1 22:41:59 2015 +0200

    gst-debugger: add log control module

 src/gst-debugger/modules/log_module.cpp  |   34 ++++++++++++++++++++++++++++++
 src/gst-debugger/modules/log_module.h    |   15 +++++++++++++
 src/gst-debugger/modules/main_module.cpp |    2 +-
 3 files changed, 50 insertions(+), 1 deletions(-)
---
diff --git a/src/gst-debugger/modules/log_module.cpp b/src/gst-debugger/modules/log_module.cpp
index 35f289d..97b17ba 100644
--- a/src/gst-debugger/modules/log_module.cpp
+++ b/src/gst-debugger/modules/log_module.cpp
@@ -13,6 +13,8 @@ static void free_log(GstreamerLog *log) { delete log; }
 
 LogModule::LogModule()
 {
+       model = Gtk::ListStore::create(columns);
+
        create_dispatcher("new-log", sigc::mem_fun(*this, &LogModule::log_received_), 
(GDestroyNotify)free_log);
 }
 
@@ -62,4 +64,36 @@ void LogModule::log_received_()
        row[columns.log] = log;
 }
 
+LogControlModule::LogControlModule()
+{
+       main_box = Gtk::manage(new Gtk::Box(Gtk::ORIENTATION_VERTICAL));
+
+       set_watch_button = Gtk::manage(new Gtk::CheckButton("Watch log messages"));
+       set_watch_button->signal_toggled().connect([this] {
+               controller->send_set_log_watch_command(set_watch_button->get_active(), 10); // todo log level
+       });
+       main_box->pack_start(*set_watch_button, false, true);
+
+       main_box->pack_start(*Gtk::manage(new Gtk::Label("Debug categories")), false, true);
+       main_box->pack_start(*Gtk::manage(new Gtk::ComboBox()), false, true);
+
+       main_box->pack_start(*Gtk::manage(new Gtk::Label("Log threshold:")), false, true);
+
+       threshold_entry = Gtk::manage(new Gtk::Entry());
+       main_box->pack_start(*threshold_entry, false, true);
 
+       overwrite_threshold_check_button = Gtk::manage(new Gtk::CheckButton("Overwrite current threshold"));
+       main_box->pack_start(*overwrite_threshold_check_button, false, true);
+
+       set_threshold_button = Gtk::manage(new Gtk::Button("Set threshold"));
+       set_threshold_button->signal_clicked().connect([this] {
+               controller->send_set_threshold_command(threshold_entry->get_text(),
+                       overwrite_threshold_check_button->get_active());
+       });
+       main_box->pack_start(*set_threshold_button, false, true);
+}
+
+Gtk::Widget* LogControlModule::get_widget()
+{
+       return main_box;
+}
diff --git a/src/gst-debugger/modules/log_module.h b/src/gst-debugger/modules/log_module.h
index d91c85d..a3da093 100644
--- a/src/gst-debugger/modules/log_module.h
+++ b/src/gst-debugger/modules/log_module.h
@@ -9,6 +9,7 @@
 #define SRC_GST_DEBUGGER_MODULES_LOG_MODULE_H_
 
 #include "base_main_module.h"
+#include "control_module.h"
 
 class GstreamerLog;
 
@@ -39,5 +40,19 @@ public:
        void set_controller(const std::shared_ptr<Controller> &controller) override;
 };
 
+class LogControlModule : public ControlModule
+{
+       Gtk::Box *main_box;
+       Gtk::CheckButton *set_watch_button;
+       Gtk::CheckButton *overwrite_threshold_check_button;
+       Gtk::Button *set_threshold_button;
+       Gtk::Entry *threshold_entry;
+
+public:
+       LogControlModule();
+       virtual ~LogControlModule() {}
+
+       Gtk::Widget* get_widget() override;
+};
 
 #endif /* SRC_GST_DEBUGGER_MODULES_LOG_MODULE_H_ */
diff --git a/src/gst-debugger/modules/main_module.cpp b/src/gst-debugger/modules/main_module.cpp
index b9cef0e..90a85b1 100644
--- a/src/gst-debugger/modules/main_module.cpp
+++ b/src/gst-debugger/modules/main_module.cpp
@@ -44,7 +44,7 @@ MainModule::MainModule(const Glib::RefPtr<Gtk::Builder> &builder)
 void MainModule::load_submodules(const Glib::RefPtr<Gtk::Builder>& builder)
 {
        submodules["logMessages"].display_module = std::make_shared<LogModule>();
-       submodules["logMessages"].control_module = 
std::make_shared<HooksControlModule>(PadWatch_WatchType_EVENT); //todo
+       submodules["logMessages"].control_module = std::make_shared<LogControlModule>();
 
        submodules["queries"].display_module = std::make_shared<QueryModule>();
        submodules["queries"].control_module = std::make_shared<PadPathTypesControlModule>("GstQueryType", 
PadWatch_WatchType_QUERY);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]