Update to new configuration API.
[pulseview.git] / pv / binding / device.cpp
index 6f9788932c8dd0d4377d98771cee69ad6b6760e3..026ca16c6b49354f5e51cbbe89b59a1c09f5bf86 100644 (file)
@@ -56,17 +56,12 @@ namespace binding {
 Device::Device(shared_ptr<sigrok::Configurable> configurable) :
        configurable_(configurable)
 {
-       std::map< const ConfigKey*, std::set<Capability> > keys;
 
-       try {
-               keys = configurable->config_keys(ConfigKey::DEVICE_OPTIONS);
-       } catch (const Error) {
-               return;
-       }
+       auto keys = configurable->config_keys();
+
+       for (auto key : keys) {
 
-       for (auto entry : keys) {
-               auto key = entry.first;
-               auto capabilities = entry.second;
+               auto capabilities = configurable->config_capabilities(key);
 
                if (!capabilities.count(Capability::GET) ||
                        !capabilities.count(Capability::SET))
@@ -88,8 +83,7 @@ Device::Device(shared_ptr<sigrok::Configurable> configurable) :
                        config_changed();
                };
 
-               switch (key->id())
-               {
+               switch (key->id()) {
                case SR_CONF_SAMPLERATE:
                        // Sample rate values are not bound because they are shown
                        // in the MainBar
@@ -147,7 +141,7 @@ void Device::bind_bool(const QString &name,
 }
 
 void Device::bind_enum(const QString &name,
-       const ConfigKey *key, std::set<Capability> capabilities,
+       const ConfigKey *key, std::set<const Capability *> capabilities,
        Property::Getter getter,
        Property::Setter setter, function<QString (Glib::VariantBase)> printer)
 {