]> sigrok.org Git - pulseview.git/commitdiff
Adjust pv:prop::Enum to GVariant-based sr_config_* functions
authorBert Vermeulen <redacted>
Mon, 1 Apr 2013 15:07:10 +0000 (16:07 +0100)
committerJoel Holdsworth <redacted>
Mon, 8 Apr 2013 17:48:44 +0000 (18:48 +0100)
pv/prop/enum.cpp
pv/prop/enum.h

index 54fe5fedca8284b15dc2f051a44a7f5e3e1dba22..894ba9f8e2754ded46f9e07b783484871d25eade 100644 (file)
@@ -20,6 +20,7 @@
 
 #include <assert.h>
 
+#include <glib-2.0/glib.h>
 #include <QComboBox>
 
 #include "enum.h"
@@ -32,8 +33,8 @@ namespace prop {
 
 Enum::Enum(QString name,
        vector<pair<const void*, QString> > values,
-       function<const void* ()> getter,
-       function<void (const void*)> setter) :
+       function<GVariant* ()> getter,
+       function<void (GVariant*)> setter) :
        Property(name),
        _values(values),
        _getter(getter),
@@ -74,7 +75,7 @@ void Enum::commit()
        if (index < 0)
                return;
 
-       _setter(_selector->itemData(index).value<void*>());
+       _setter(_selector->itemData(index).value<GVariant*>());
 }
 
 } // prop
index c2cc63956cde129eac87f05a66959259b6b96cab..02b60df5dd5ee982ace26230f89a1b2ba6e2b34c 100644 (file)
@@ -24,6 +24,7 @@
 #include <utility>
 #include <vector>
 
+#include <glib-2.0/glib.h>
 #include "property.h"
 
 class QComboBox;
@@ -36,8 +37,8 @@ class Enum : public Property
 public:
        Enum(QString name,
                std::vector<std::pair<const void*, QString> > values,
-               boost::function<const void* ()> getter,
-               boost::function<void (const void*)> setter);
+               boost::function<GVariant* ()> getter,
+               boost::function<void (GVariant*)> setter);
 
        QWidget* get_widget(QWidget *parent);
 
@@ -45,8 +46,8 @@ public:
 
 private:
        const std::vector< std::pair<const void*, QString> > _values;
-       boost::function<const void* ()> _getter;
-       boost::function<void (const void*)> _setter;
+       boost::function<GVariant* ()> _getter;
+       boost::function<void (GVariant*)> _setter;
 
        QComboBox *_selector;
 };