X-Git-Url: http://git.code-monkey.de/?a=blobdiff_plain;f=pv%2Fprop%2Fbinding%2Fdeviceoptions.h;h=a7fffa30ed47e937c2e135bf382eee03ae02999c;hb=e8d009288de28cb194bc7964f96677c2baf900c9;hp=ce0799b5f09a2c2be1cb5f8a239cf031d9e539cc;hpb=3820592a018c777727a6e65bd754d113742f4462;p=pulseview.git diff --git a/pv/prop/binding/deviceoptions.h b/pv/prop/binding/deviceoptions.h index ce0799b..a7fffa3 100644 --- a/pv/prop/binding/deviceoptions.h +++ b/pv/prop/binding/deviceoptions.h @@ -21,36 +21,50 @@ #ifndef PULSEVIEW_PV_PROP_BINDING_DEVICEOPTIONS_H #define PULSEVIEW_PV_PROP_BINDING_DEVICEOPTIONS_H -#include +#include -extern "C" { -#include -} +#include +#include #include "binding.h" +#include + +namespace sigrok { + class Configurable; +} + namespace pv { + namespace prop { namespace binding { -class DeviceOptions : public Binding +class DeviceOptions : public QObject, public Binding { + Q_OBJECT + public: - DeviceOptions(struct sr_dev_inst *sdi); + DeviceOptions(std::shared_ptr configurable); -private: - void expose_enum(const struct sr_config_info *info, - const std::vector > &values, - int opt); +Q_SIGNALS: + void config_changed(); - void bind_stropt(const struct sr_config_info *info, int key); +private: + void bind_bool(const QString &name, + Property::Getter getter, Property::Setter setter); + void bind_enum(const QString &name, Glib::VariantContainerBase gvar_list, + Property::Getter getter, Property::Setter setter, + std::function printer = print_gvariant); + void bind_int(const QString &name, QString suffix, + boost::optional< std::pair > range, + Property::Getter getter, Property::Setter setter); - void bind_buffer_size(const struct sr_config_info *info); - void bind_time_base(const struct sr_config_info *info); - void bind_vdiv(const struct sr_config_info *info); + static QString print_timebase(Glib::VariantBase gvar); + static QString print_vdiv(Glib::VariantBase gvar); + static QString print_voltage_threshold(Glib::VariantBase gvar); protected: - const struct sr_dev_inst *_sdi; + std::shared_ptr _configurable; }; } // binding