[gst-debugger/refactor-v1.0] refactor: display default property value in klass dialog
- From: Marcin Kolny <mkolny src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gst-debugger/refactor-v1.0] refactor: display default property value in klass dialog
- Date: Sat, 3 Oct 2015 10:03:01 +0000 (UTC)
commit bebf323d428b85474c3414a018e4995fc0d34771
Author: Marcin Kolny <marcin kolny gmail com>
Date: Sat Oct 3 12:02:38 2015 +0200
refactor: display default property value in klass dialog
src/gst-debugger/controller/controller.cpp | 7 ++++++-
src/gst-debugger/dialogs/klasses_dialog.cpp | 3 ++-
src/gst-debugger/models/gst_klass_model.h | 9 +++++++--
3 files changed, 15 insertions(+), 4 deletions(-)
---
diff --git a/src/gst-debugger/controller/controller.cpp b/src/gst-debugger/controller/controller.cpp
index 12c8282..5159383 100644
--- a/src/gst-debugger/controller/controller.cpp
+++ b/src/gst-debugger/controller/controller.cpp
@@ -233,7 +233,12 @@ void Controller::update_klass_model(const GstDebugger::ElementKlass &klass_info)
for (auto property : klass_info.property_info())
{
- model.append_property(PropertyModel(property.name(), property.nick(), property.blurb(),
(GParamFlags)property.flags()));
+ GValue *g_val = new GValue;
+ *g_val = {0};
+ g_value_deserialize(g_val, property.default_value().gtype(),
(InternalGType)property.default_value().internal_type(),
+ property.default_value().data().c_str(),
property.default_value().data().length());
+ model.append_property(PropertyModel(property.name(), property.nick(),
+ property.blurb(), (GParamFlags)property.flags(),
std::shared_ptr<GValueBase>(GValueBase::build_gvalue(g_val))));
}
if (it == klass_container.end())
diff --git a/src/gst-debugger/dialogs/klasses_dialog.cpp b/src/gst-debugger/dialogs/klasses_dialog.cpp
index 565d2b2..b9ed822 100644
--- a/src/gst-debugger/dialogs/klasses_dialog.cpp
+++ b/src/gst-debugger/dialogs/klasses_dialog.cpp
@@ -44,7 +44,7 @@ std::string KlassesDialog::g_param_flags_to_string(GParamFlags v)
#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_WRITABLE),
PARAM_FLAG(G_PARAM_CONSTRUCT),
PARAM_FLAG(G_PARAM_CONSTRUCT_ONLY),
PARAM_FLAG(G_PARAM_LAX_VALIDATION),
@@ -96,6 +96,7 @@ void KlassesDialog::reload_list(const Glib::ustring &klass_name, bool add)
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()));
+ APPEND_SUB_ROW(cr, "Default value", property.get_default_value()->to_string());
}
}
}
diff --git a/src/gst-debugger/models/gst_klass_model.h b/src/gst-debugger/models/gst_klass_model.h
index 301326e..bd9ae06 100644
--- a/src/gst-debugger/models/gst_klass_model.h
+++ b/src/gst-debugger/models/gst_klass_model.h
@@ -8,6 +8,8 @@
#ifndef SRC_GST_DEBUGGER_MODELS_GST_KLASS_MODEL_H_
#define SRC_GST_DEBUGGER_MODELS_GST_KLASS_MODEL_H_
+#include "gvalue-converter/gvalue_base.h"
+
#include <string>
class PropertyModel
@@ -16,15 +18,18 @@ class PropertyModel
std::string nick;
std::string blurb;
GParamFlags flags;
+ std::shared_ptr<GValueBase> value;
public:
- PropertyModel(const std::string &name, const std::string &nick, const std::string &blurb, GParamFlags
flags)
- : name(name), nick(nick), blurb(blurb), flags(flags) {}
+ PropertyModel(const std::string &name, const std::string &nick,
+ const std::string &blurb, GParamFlags flags, const std::shared_ptr<GValueBase> &value)
+ : name(name), nick(nick), blurb(blurb), flags(flags), value(value) {}
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; }
+ std::shared_ptr<GValueBase> get_default_value() const { return value; }
};
class KlassModel
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]