From: Joel Holdsworth Date: Mon, 10 Mar 2014 22:11:11 +0000 (+0100) Subject: Moved print_gvariant into DeviceOptions X-Git-Tag: pulseview-0.2.0~24 X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=5b1994c45194a95069dfcadf637723f3db8249da;p=pulseview.git Moved print_gvariant into DeviceOptions --- diff --git a/pv/prop/binding/binding.cpp b/pv/prop/binding/binding.cpp index ec312725..3a6c73fb 100644 --- a/pv/prop/binding/binding.cpp +++ b/pv/prop/binding/binding.cpp @@ -73,6 +73,22 @@ QWidget* Binding::get_property_form(QWidget *parent, return form; } +QString Binding::print_gvariant(GVariant *const gvar) +{ + QString s; + + if (g_variant_is_of_type(gvar, G_VARIANT_TYPE("s"))) + s = QString::fromUtf8(g_variant_get_string(gvar, NULL)); + else + { + gchar *const text = g_variant_print(gvar, FALSE); + s = QString::fromUtf8(text); + g_free(text); + } + + return s; +} + } // binding } // prop } // pv diff --git a/pv/prop/binding/binding.h b/pv/prop/binding/binding.h index 9b63c162..89c1acbc 100644 --- a/pv/prop/binding/binding.h +++ b/pv/prop/binding/binding.h @@ -21,9 +21,13 @@ #ifndef PULSEVIEW_PV_PROP_BINDING_BINDING_H #define PULSEVIEW_PV_PROP_BINDING_BINDING_H +#include + #include #include +#include + class QFormLayout; class QWidget; @@ -47,6 +51,8 @@ public: QWidget* get_property_form(QWidget *parent, bool auto_commit = false) const; + static QString print_gvariant(GVariant *const gvar); + protected: std::vector< boost::shared_ptr > _properties; }; diff --git a/pv/prop/binding/decoderoptions.h b/pv/prop/binding/decoderoptions.h index 62f4fe18..c08f1017 100644 --- a/pv/prop/binding/decoderoptions.h +++ b/pv/prop/binding/decoderoptions.h @@ -21,8 +21,6 @@ #ifndef PULSEVIEW_PV_PROP_BINDING_DECODEROPTIONS_H #define PULSEVIEW_PV_PROP_BINDING_DECODEROPTIONS_H -#include - #include "binding.h" namespace pv { diff --git a/pv/prop/binding/deviceoptions.cpp b/pv/prop/binding/deviceoptions.cpp index ea8f4b42..26d4ef2a 100644 --- a/pv/prop/binding/deviceoptions.cpp +++ b/pv/prop/binding/deviceoptions.cpp @@ -157,22 +157,6 @@ void DeviceOptions::bind_int(const QString &name, int key, QString suffix, bind(&device::DevInst::set_config, _dev_inst, _group, key, _1)))); } -QString DeviceOptions::print_gvariant(GVariant *const gvar) -{ - QString s; - - if (g_variant_is_of_type(gvar, G_VARIANT_TYPE("s"))) - s = QString::fromUtf8(g_variant_get_string(gvar, NULL)); - else - { - gchar *const text = g_variant_print(gvar, FALSE); - s = QString::fromUtf8(text); - g_free(text); - } - - return s; -} - QString DeviceOptions::print_timebase(GVariant *const gvar) { uint64_t p, q; diff --git a/pv/prop/binding/deviceoptions.h b/pv/prop/binding/deviceoptions.h index 4a6eff2e..341d3d93 100644 --- a/pv/prop/binding/deviceoptions.h +++ b/pv/prop/binding/deviceoptions.h @@ -56,8 +56,6 @@ private: void bind_int(const QString &name, int key, QString suffix, boost::optional< std::pair > range); - static QString print_gvariant(GVariant *const gvar); - static QString print_timebase(GVariant *const gvar); static QString print_vdiv(GVariant *const gvar); static QString print_voltage_threshold(GVariant *const gvar);