]> sigrok.org Git - pulseview.git/blobdiff - pv/prop/binding/deviceoptions.cpp
Added Int property and bound to SR_CONF_CAPTURE_RATIO
[pulseview.git] / pv / prop / binding / deviceoptions.cpp
index 50af3ed4ffdec51a09565537a997f2578f2d366b..f71cbac2a42aeb57a3db42d4377b973346e679d5 100644 (file)
@@ -30,6 +30,7 @@
 #include <pv/prop/bool.h>
 #include <pv/prop/double.h>
 #include <pv/prop/enum.h>
+#include <pv/prop/int.h>
 
 using namespace boost;
 using namespace std;
@@ -71,6 +72,10 @@ DeviceOptions::DeviceOptions(struct sr_dev_inst *sdi) :
                        bind_samplerate(name, gvar_list);
                        break;
 
+               case SR_CONF_CAPTURE_RATIO:
+                       bind_int(name, key, "%", make_pair(0L, 100L));
+                       break;
+
                case SR_CONF_PATTERN_MODE:
                case SR_CONF_BUFFERSIZE:
                case SR_CONF_TRIGGER_SOURCE:
@@ -143,6 +148,15 @@ void DeviceOptions::bind_enum(const QString &name, int key,
                        bind(config_setter, _sdi, key, _1))));
 }
 
+void DeviceOptions::bind_int(const QString &name, int key, QString suffix,
+       optional< std::pair<int64_t, int64_t> > range)
+{
+       _properties.push_back(shared_ptr<Property>(
+               new Int(name, suffix, range,
+                       bind(config_getter, _sdi, key),
+                       bind(config_setter, _sdi, key, _1))));
+}
+
 QString DeviceOptions::print_gvariant(GVariant *const gvar)
 {
        QString s;