]> sigrok.org Git - pulseview.git/commitdiff
Removed Sample Rate binding from DeviceOptions
authorJoel Holdsworth <redacted>
Wed, 25 Dec 2013 18:56:18 +0000 (18:56 +0000)
committerJoel Holdsworth <redacted>
Wed, 25 Dec 2013 18:56:18 +0000 (18:56 +0000)
The value is already exposed in the SamplingBar

pv/prop/binding/deviceoptions.cpp
pv/prop/binding/deviceoptions.h

index 3fe63940cc2efe6508313647893af740353f9faf..e8ae002bae8ba0c0339b2da1fb5f9861d71fb5c3 100644 (file)
@@ -71,7 +71,8 @@ DeviceOptions::DeviceOptions(struct sr_dev_inst *sdi) :
                switch(key)
                {
                case SR_CONF_SAMPLERATE:
-                       bind_samplerate(name, gvar_list);
+                       // Sample rate values are not bound because they are shown
+                       // in the SamplingBar
                        break;
 
                case SR_CONF_CAPTURE_RATIO:
@@ -179,74 +180,6 @@ QString DeviceOptions::print_gvariant(GVariant *const gvar)
        return s;
 }
 
-void DeviceOptions::bind_samplerate(const QString &name,
-       GVariant *const gvar_list)
-{
-       GVariant *gvar_list_samplerates;
-
-       assert(gvar_list);
-
-       if ((gvar_list_samplerates = g_variant_lookup_value(gvar_list,
-                       "samplerate-steps", G_VARIANT_TYPE("at"))))
-       {
-               gsize num_elements;
-               const uint64_t *const elements =
-                       (const uint64_t *)g_variant_get_fixed_array(
-                               gvar_list_samplerates, &num_elements, sizeof(uint64_t));
-
-               assert(num_elements == 3);
-
-               _properties.push_back(shared_ptr<Property>(
-                       new Double(name, 0, QObject::tr("Hz"),
-                               make_pair((double)elements[0], (double)elements[1]),
-                                               (double)elements[2],
-                               bind(samplerate_double_getter, _sdi),
-                               bind(samplerate_double_setter, _sdi, _1))));
-
-               g_variant_unref(gvar_list_samplerates);
-       }
-       else if ((gvar_list_samplerates = g_variant_lookup_value(gvar_list,
-                       "samplerates", G_VARIANT_TYPE("at"))))
-       {
-               bind_enum(name, SR_CONF_SAMPLERATE,
-                       gvar_list_samplerates, print_samplerate);
-               g_variant_unref(gvar_list_samplerates);
-       }
-}
-
-QString DeviceOptions::print_samplerate(GVariant *const gvar)
-{
-       char *const s = sr_samplerate_string(
-               g_variant_get_uint64(gvar));
-       const QString qstring(s);
-       g_free(s);
-       return qstring;
-}
-
-GVariant* DeviceOptions::samplerate_double_getter(
-       const struct sr_dev_inst *sdi)
-{
-       GVariant *const gvar = config_getter(sdi, SR_CONF_SAMPLERATE);
-
-       if(!gvar)
-               return NULL;
-
-       GVariant *const gvar_double = g_variant_new_double(
-               g_variant_get_uint64(gvar));
-
-       g_variant_unref(gvar);
-
-       return gvar_double;
-}
-
-void DeviceOptions::samplerate_double_setter(
-       struct sr_dev_inst *sdi, GVariant *value)
-{
-       GVariant *const gvar = g_variant_new_uint64(
-               g_variant_get_double(value));
-       config_setter(sdi, SR_CONF_SAMPLERATE, gvar);
-}
-
 QString DeviceOptions::print_timebase(GVariant *const gvar)
 {
        uint64_t p, q;
index e8af8e8a3b4678bd6e2d5c14472f698bba204a84..0b441599e70df89b9c57f5665282cbadecf3a723 100644 (file)
@@ -55,14 +55,6 @@ private:
 
        static QString print_gvariant(GVariant *const gvar);
 
-       void bind_samplerate(const QString &name,
-               GVariant *const gvar_list);
-       static QString print_samplerate(GVariant *const gvar);
-       static GVariant* samplerate_double_getter(
-               const struct sr_dev_inst *sdi);
-       static void samplerate_double_setter(
-               struct sr_dev_inst *sdi, GVariant *value);
-
        static QString print_timebase(GVariant *const gvar);
        static QString print_vdiv(GVariant *const gvar);
        static QString print_voltage_threshold(GVariant *const gvar);