Moved pv::prop:bindings classes into pv::bindings namespace
authorJoel Holdsworth <joel@airwebreathe.org.uk>
Sat, 17 Jan 2015 21:45:04 +0000 (21:45 +0000)
committerUwe Hermann <uwe@hermann-uwe.de>
Tue, 27 Jan 2015 15:28:31 +0000 (16:28 +0100)
20 files changed:
CMakeLists.txt
pv/binding/binding.cpp [new file with mode: 0644]
pv/binding/binding.hpp [new file with mode: 0644]
pv/binding/decoderoptions.cpp [new file with mode: 0644]
pv/binding/decoderoptions.hpp [new file with mode: 0644]
pv/binding/deviceoptions.cpp [new file with mode: 0644]
pv/binding/deviceoptions.hpp [new file with mode: 0644]
pv/popups/channels.cpp
pv/popups/channels.hpp
pv/popups/deviceoptions.cpp
pv/popups/deviceoptions.hpp
pv/prop/binding/binding.cpp [deleted file]
pv/prop/binding/binding.hpp [deleted file]
pv/prop/binding/decoderoptions.cpp [deleted file]
pv/prop/binding/decoderoptions.hpp [deleted file]
pv/prop/binding/deviceoptions.cpp [deleted file]
pv/prop/binding/deviceoptions.hpp [deleted file]
pv/view/decodetrace.cpp
pv/view/decodetrace.hpp
test/CMakeLists.txt

index 78acee6163836d1d44eb1faa2564450f1152ed87..c77859286a6204dbd212d0a5e5104eb40df1203d 100644 (file)
@@ -146,6 +146,8 @@ set(pulseview_SOURCES
        pv/session.cpp
        pv/storesession.cpp
        pv/util.cpp
+       pv/binding/binding.cpp
+       pv/binding/deviceoptions.cpp
        pv/data/analog.cpp
        pv/data/analogsegment.cpp
        pv/data/logic.cpp
@@ -163,8 +165,6 @@ set(pulseview_SOURCES
        pv/prop/int.cpp
        pv/prop/property.cpp
        pv/prop/string.cpp
-       pv/prop/binding/binding.cpp
-       pv/prop/binding/deviceoptions.cpp
        pv/toolbars/mainbar.cpp
        pv/view/analogsignal.cpp
        pv/view/cursor.cpp
@@ -203,6 +203,7 @@ set(pulseview_HEADERS
        pv/mainwindow.hpp
        pv/session.hpp
        pv/storesession.hpp
+       pv/binding/deviceoptions.hpp
        pv/dialogs/about.hpp
        pv/dialogs/connect.hpp
        pv/dialogs/storeprogress.hpp
@@ -214,7 +215,6 @@ set(pulseview_HEADERS
        pv/prop/int.hpp
        pv/prop/property.hpp
        pv/prop/string.hpp
-       pv/prop/binding/deviceoptions.hpp
        pv/toolbars/mainbar.hpp
        pv/view/cursor.hpp
        pv/view/flag.hpp
@@ -258,12 +258,12 @@ endif()
 
 if(ENABLE_DECODE)
        list(APPEND pulseview_SOURCES
+               pv/binding/decoderoptions.cpp
                pv/data/decoderstack.cpp
                pv/data/decode/annotation.cpp
                pv/data/decode/decoder.cpp
                pv/data/decode/row.cpp
                pv/data/decode/rowdata.cpp
-               pv/prop/binding/decoderoptions.cpp
                pv/view/decodetrace.cpp
                pv/widgets/decodergroupbox.cpp
                pv/widgets/decodermenu.cpp
diff --git a/pv/binding/binding.cpp b/pv/binding/binding.cpp
new file mode 100644 (file)
index 0000000..fccb96b
--- /dev/null
@@ -0,0 +1,92 @@
+/*
+ * This file is part of the PulseView project.
+ *
+ * Copyright (C) 2012 Joel Holdsworth <joel@airwebreathe.org.uk>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
+ */
+
+#include <cassert>
+
+#include <QFormLayout>
+
+#include <pv/prop/property.hpp>
+
+#include "binding.hpp"
+
+using std::shared_ptr;
+
+namespace pv {
+namespace binding {
+
+const std::vector< std::shared_ptr<prop::Property> >& Binding::properties()
+{
+       return properties_;
+}
+
+void Binding::commit()
+{
+       for (shared_ptr<pv::prop::Property> p : properties_) {
+               assert(p);
+               p->commit();
+       }
+}
+
+void Binding::add_properties_to_form(QFormLayout *layout,
+       bool auto_commit) const
+{
+       assert(layout);
+
+       for (shared_ptr<pv::prop::Property> p : properties_)
+       {
+               assert(p);
+
+               QWidget *const widget = p->get_widget(layout->parentWidget(),
+                       auto_commit);
+               if (p->labeled_widget())
+                       layout->addRow(widget);
+               else
+                       layout->addRow(p->name(), widget);
+       }
+}
+
+QWidget* Binding::get_property_form(QWidget *parent,
+       bool auto_commit) const
+{
+       QWidget *const form = new QWidget(parent);
+       QFormLayout *const layout = new QFormLayout(form);
+       form->setLayout(layout);
+       add_properties_to_form(layout, auto_commit);
+       return form;
+}
+
+QString Binding::print_gvariant(Glib::VariantBase gvar)
+{
+       QString s;
+
+       if (!gvar.gobj())
+               s = QString::fromStdString("(null)");
+       else if (gvar.is_of_type(Glib::VariantType("s")))
+               s = QString::fromStdString(
+                       Glib::VariantBase::cast_dynamic<Glib::Variant<std::string>>(
+                               gvar).get());
+       else
+               s = QString::fromStdString(gvar.print());
+
+       return s;
+}
+
+} // binding
+} // pv
diff --git a/pv/binding/binding.hpp b/pv/binding/binding.hpp
new file mode 100644 (file)
index 0000000..ae0afb7
--- /dev/null
@@ -0,0 +1,64 @@
+/*
+ * This file is part of the PulseView project.
+ *
+ * Copyright (C) 2012 Joel Holdsworth <joel@airwebreathe.org.uk>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
+ */
+
+#ifndef PULSEVIEW_PV_BINDING_BINDING_H
+#define PULSEVIEW_PV_BINDING_BINDING_H
+
+#include <glibmm.h>
+
+#include <vector>
+#include <memory>
+
+#include <QString>
+
+class QFormLayout;
+class QWidget;
+
+namespace pv {
+
+namespace prop {
+class Property;
+}
+
+namespace binding {
+
+class Binding
+{
+public:
+       const std::vector< std::shared_ptr<prop::Property> >& properties();
+
+       void commit();
+
+       void add_properties_to_form(QFormLayout *layout,
+               bool auto_commit = false) const;
+
+       QWidget* get_property_form(QWidget *parent,
+               bool auto_commit = false) const;
+
+       static QString print_gvariant(Glib::VariantBase gvar);
+
+protected:
+       std::vector< std::shared_ptr<prop::Property> > properties_;
+};
+
+} // binding
+} // pv
+
+#endif // PULSEVIEW_PV_BINDING_BINDING_H
diff --git a/pv/binding/decoderoptions.cpp b/pv/binding/decoderoptions.cpp
new file mode 100644 (file)
index 0000000..fd7d918
--- /dev/null
@@ -0,0 +1,151 @@
+/*
+ * This file is part of the PulseView project.
+ *
+ * Copyright (C) 2013 Joel Holdsworth <joel@airwebreathe.org.uk>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
+ */
+
+#include <libsigrokdecode/libsigrokdecode.h>
+
+#include "decoderoptions.hpp"
+
+#include <boost/none_t.hpp>
+
+#include <pv/data/decoderstack.hpp>
+#include <pv/data/decode/decoder.hpp>
+#include <pv/prop/double.hpp>
+#include <pv/prop/enum.hpp>
+#include <pv/prop/int.hpp>
+#include <pv/prop/string.hpp>
+
+using boost::none;
+using std::make_pair;
+using std::map;
+using std::pair;
+using std::shared_ptr;
+using std::string;
+using std::vector;
+
+using pv::prop::Double;
+using pv::prop::Enum;
+using pv::prop::Int;
+using pv::prop::Property;
+using pv::prop::String;
+
+namespace pv {
+namespace binding {
+
+DecoderOptions::DecoderOptions(
+       shared_ptr<pv::data::DecoderStack> decoder_stack,
+       shared_ptr<data::decode::Decoder> decoder) :
+       decoder_stack_(decoder_stack),
+       decoder_(decoder)
+{
+       assert(decoder_);
+
+       const srd_decoder *const dec = decoder_->decoder();
+       assert(dec);
+
+       for (GSList *l = dec->options; l; l = l->next)
+       {
+               const srd_decoder_option *const opt =
+                       (srd_decoder_option*)l->data;
+
+               const QString name = QString::fromUtf8(opt->desc);
+
+               const Property::Getter get = [&, opt]() {
+                       return getter(opt->id); };
+               const Property::Setter set = [&, opt](Glib::VariantBase value) {
+                       setter(opt->id, value); };
+
+               shared_ptr<Property> prop;
+
+               if (opt->values)
+                       prop = bind_enum(name, opt, get, set);
+               else if (g_variant_is_of_type(opt->def, G_VARIANT_TYPE("d")))
+                       prop = shared_ptr<Property>(new Double(name, 2, "",
+                               none, none, get, set));
+               else if (g_variant_is_of_type(opt->def, G_VARIANT_TYPE("x")))
+                       prop = shared_ptr<Property>(
+                               new Int(name, "", none, get, set));
+               else if (g_variant_is_of_type(opt->def, G_VARIANT_TYPE("s")))
+                       prop = shared_ptr<Property>(
+                               new String(name, get, set));
+               else
+                       continue;
+
+               properties_.push_back(prop);
+       }
+}
+
+shared_ptr<Property> DecoderOptions::bind_enum(
+       const QString &name, const srd_decoder_option *option,
+       Property::Getter getter, Property::Setter setter)
+{
+       vector< pair<Glib::VariantBase, QString> > values;
+       for (GSList *l = option->values; l; l = l->next) {
+               Glib::VariantBase var = Glib::VariantBase((GVariant*)l->data, true);
+               values.push_back(make_pair(var, print_gvariant(var)));
+       }
+
+       return shared_ptr<Property>(new Enum(name, values, getter, setter));
+}
+
+Glib::VariantBase DecoderOptions::getter(const char *id)
+{
+       GVariant *val = NULL;
+
+       assert(decoder_);
+
+       // Get the value from the hash table if it is already present
+       const map<string, GVariant*>& options = decoder_->options();
+       const auto iter = options.find(id);
+
+       if (iter != options.end())
+               val = (*iter).second;
+       else
+       {
+               assert(decoder_->decoder());
+
+               // Get the default value if not
+               for (GSList *l = decoder_->decoder()->options; l; l = l->next)
+               {
+                       const srd_decoder_option *const opt =
+                               (srd_decoder_option*)l->data;
+                       if (strcmp(opt->id, id) == 0) {
+                               val = opt->def;
+                               break;
+                       }
+               }
+       }
+
+       if (val)
+               return Glib::VariantBase(val, true);
+       else
+               return Glib::VariantBase();
+}
+
+void DecoderOptions::setter(const char *id, Glib::VariantBase value)
+{
+       assert(decoder_);
+       decoder_->set_option(id, value.gobj());
+
+       assert(decoder_stack_);
+       decoder_stack_->begin_decode();
+}
+
+} // binding
+} // pv
diff --git a/pv/binding/decoderoptions.hpp b/pv/binding/decoderoptions.hpp
new file mode 100644 (file)
index 0000000..a2f7706
--- /dev/null
@@ -0,0 +1,64 @@
+/*
+ * This file is part of the PulseView project.
+ *
+ * Copyright (C) 2013 Joel Holdsworth <joel@airwebreathe.org.uk>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
+ */
+
+#ifndef PULSEVIEW_PV_BINDING_DECODEROPTIONS_H
+#define PULSEVIEW_PV_BINDING_DECODEROPTIONS_H
+
+#include "binding.hpp"
+
+#include <pv/prop/property.hpp>
+
+struct srd_decoder_option;
+
+namespace pv {
+
+namespace data {
+class DecoderStack;
+namespace decode {
+class Decoder;
+}
+}
+
+namespace binding {
+
+class DecoderOptions : public Binding
+{
+public:
+       DecoderOptions(std::shared_ptr<pv::data::DecoderStack> decoder_stack,
+               std::shared_ptr<pv::data::decode::Decoder> decoder);
+
+private:
+       static std::shared_ptr<prop::Property> bind_enum(const QString &name,
+               const srd_decoder_option *option,
+               prop::Property::Getter getter, prop::Property::Setter setter);
+
+       Glib::VariantBase getter(const char *id);
+
+       void setter(const char *id, Glib::VariantBase value);
+
+private:
+       std::shared_ptr<pv::data::DecoderStack> decoder_stack_;
+       std::shared_ptr<pv::data::decode::Decoder> decoder_;
+};
+
+} // binding
+} // pv
+
+#endif // PULSEVIEW_PV_BINDING_DECODEROPTIONS_H
diff --git a/pv/binding/deviceoptions.cpp b/pv/binding/deviceoptions.cpp
new file mode 100644 (file)
index 0000000..8609e21
--- /dev/null
@@ -0,0 +1,192 @@
+/*
+ * This file is part of the PulseView project.
+ *
+ * Copyright (C) 2012 Joel Holdsworth <joel@airwebreathe.org.uk>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
+ */
+
+#include <stdint.h>
+
+#include <QDebug>
+
+#include "deviceoptions.hpp"
+
+#include <pv/prop/bool.hpp>
+#include <pv/prop/double.hpp>
+#include <pv/prop/enum.hpp>
+#include <pv/prop/int.hpp>
+
+#include <libsigrokcxx/libsigrokcxx.hpp>
+
+using boost::optional;
+using std::function;
+using std::make_pair;
+using std::pair;
+using std::shared_ptr;
+using std::string;
+using std::vector;
+
+using sigrok::Capability;
+using sigrok::Configurable;
+using sigrok::ConfigKey;
+using sigrok::Error;
+
+using pv::prop::Bool;
+using pv::prop::Double;
+using pv::prop::Enum;
+using pv::prop::Int;
+using pv::prop::Property;
+
+namespace pv {
+namespace binding {
+
+DeviceOptions::DeviceOptions(shared_ptr<sigrok::Configurable> configurable) :
+       configurable_(configurable)
+{
+       assert(configurable);
+
+       for (auto entry : configurable->config_keys(ConfigKey::DEVICE_OPTIONS)) {
+               auto key = entry.first;
+               auto capabilities = entry.second;
+
+               Glib::VariantContainerBase gvar_list;
+
+               if (!capabilities.count(Capability::GET) ||
+                       !capabilities.count(Capability::SET))
+                       continue;
+
+               if (capabilities.count(Capability::LIST))
+                       gvar_list = configurable->config_list(key);
+
+               string name_str;
+               try {
+                       name_str = key->description();
+               } catch (Error e) {
+                       name_str = key->name();
+               }
+
+               const QString name = QString::fromStdString(name_str);
+
+               const Property::Getter get = [&, key]() {
+                       return configurable_->config_get(key); };
+               const Property::Setter set = [&, key](Glib::VariantBase value) {
+                       configurable_->config_set(key, value);
+                       config_changed();
+               };
+
+               switch (key->id())
+               {
+               case SR_CONF_SAMPLERATE:
+                       // Sample rate values are not bound because they are shown
+                       // in the MainBar
+                       break;
+
+               case SR_CONF_CAPTURE_RATIO:
+                       bind_int(name, "%", pair<int64_t, int64_t>(0, 100),
+                               get, set);
+                       break;
+
+               case SR_CONF_PATTERN_MODE:
+               case SR_CONF_BUFFERSIZE:
+               case SR_CONF_TRIGGER_SOURCE:
+               case SR_CONF_TRIGGER_SLOPE:
+               case SR_CONF_FILTER:
+               case SR_CONF_COUPLING:
+               case SR_CONF_CLOCK_EDGE:
+                       bind_enum(name, gvar_list, get, set);
+                       break;
+
+               case SR_CONF_EXTERNAL_CLOCK:
+               case SR_CONF_RLE:
+                       bind_bool(name, get, set);
+                       break;
+
+               case SR_CONF_TIMEBASE:
+                       bind_enum(name, gvar_list, get, set, print_timebase);
+                       break;
+
+               case SR_CONF_VDIV:
+                       bind_enum(name, gvar_list, get, set, print_vdiv);
+                       break;
+
+               case SR_CONF_VOLTAGE_THRESHOLD:
+                       bind_enum(name, gvar_list, get, set, print_voltage_threshold);
+                       break;
+
+               default:
+                       break;
+               }
+       }
+}
+
+void DeviceOptions::bind_bool(const QString &name,
+       Property::Getter getter, Property::Setter setter)
+{
+       assert(configurable_);
+       properties_.push_back(shared_ptr<Property>(new Bool(
+               name, getter, setter)));
+}
+
+void DeviceOptions::bind_enum(const QString &name,
+       Glib::VariantContainerBase gvar_list, Property::Getter getter,
+       Property::Setter setter, function<QString (Glib::VariantBase)> printer)
+{
+       Glib::VariantBase gvar;
+       vector< pair<Glib::VariantBase, QString> > values;
+
+       assert(configurable_);
+
+       Glib::VariantIter iter(gvar_list);
+       while ((iter.next_value(gvar)))
+               values.push_back(make_pair(gvar, printer(gvar)));
+
+       properties_.push_back(shared_ptr<Property>(new Enum(name, values,
+               getter, setter)));
+}
+
+void DeviceOptions::bind_int(const QString &name, QString suffix,
+       optional< std::pair<int64_t, int64_t> > range,
+       Property::Getter getter, Property::Setter setter)
+{
+       assert(configurable_);
+
+       properties_.push_back(shared_ptr<Property>(new Int(name, suffix, range,
+               getter, setter)));
+}
+
+QString DeviceOptions::print_timebase(Glib::VariantBase gvar)
+{
+       uint64_t p, q;
+       g_variant_get(gvar.gobj(), "(tt)", &p, &q);
+       return QString::fromUtf8(sr_period_string(p * q));
+}
+
+QString DeviceOptions::print_vdiv(Glib::VariantBase gvar)
+{
+       uint64_t p, q;
+       g_variant_get(gvar.gobj(), "(tt)", &p, &q);
+       return QString::fromUtf8(sr_voltage_string(p, q));
+}
+
+QString DeviceOptions::print_voltage_threshold(Glib::VariantBase gvar)
+{
+       gdouble lo, hi;
+       g_variant_get(gvar.gobj(), "(dd)", &lo, &hi);
+       return QString("L<%1V H>%2V").arg(lo, 0, 'f', 1).arg(hi, 0, 'f', 1);
+}
+
+} // binding
+} // pv
diff --git a/pv/binding/deviceoptions.hpp b/pv/binding/deviceoptions.hpp
new file mode 100644 (file)
index 0000000..9e913b0
--- /dev/null
@@ -0,0 +1,72 @@
+/*
+ * This file is part of the PulseView project.
+ *
+ * Copyright (C) 2012 Joel Holdsworth <joel@airwebreathe.org.uk>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
+ */
+
+#ifndef PULSEVIEW_PV_BINDING_DEVICEOPTIONS_H
+#define PULSEVIEW_PV_BINDING_DEVICEOPTIONS_H
+
+#include <boost/optional.hpp>
+
+#include <QObject>
+#include <QString>
+
+#include "binding.hpp"
+
+#include <pv/prop/property.hpp>
+
+namespace sigrok {
+       class Configurable;
+}
+
+namespace pv {
+
+namespace binding {
+
+class DeviceOptions : public QObject, public Binding
+{
+       Q_OBJECT
+
+public:
+       DeviceOptions(std::shared_ptr<sigrok::Configurable> configurable);
+
+Q_SIGNALS:
+       void config_changed();
+
+private:
+       void bind_bool(const QString &name,
+               prop::Property::Getter getter, prop::Property::Setter setter);
+       void bind_enum(const QString &name, Glib::VariantContainerBase gvar_list,
+               prop::Property::Getter getter, prop::Property::Setter setter,
+               std::function<QString (Glib::VariantBase)> printer = print_gvariant);
+       void bind_int(const QString &name, QString suffix,
+               boost::optional< std::pair<int64_t, int64_t> > range,
+               prop::Property::Getter getter, prop::Property::Setter setter);
+
+       static QString print_timebase(Glib::VariantBase gvar);
+       static QString print_vdiv(Glib::VariantBase gvar);
+       static QString print_voltage_threshold(Glib::VariantBase gvar);
+
+protected:
+       std::shared_ptr<sigrok::Configurable> configurable_;
+};
+
+} // binding
+} // pv
+
+#endif // PULSEVIEW_PV_BINDING_DEVICEOPTIONS_H
index 7dedb317cf8428043ca9d3701744e04aae71a86b..c00863b0161dc3dfd4b124f13541c8832c3efcf0 100644 (file)
@@ -27,7 +27,7 @@
 
 #include "channels.hpp"
 
-#include <pv/prop/binding/deviceoptions.hpp>
+#include <pv/binding/deviceoptions.hpp>
 #include <pv/session.hpp>
 #include <pv/view/signal.hpp>
 
@@ -151,7 +151,7 @@ void Channels::set_all_channels(bool set)
 void Channels::populate_group(shared_ptr<ChannelGroup> group,
        const vector< shared_ptr<pv::view::Signal> > sigs)
 {
-       using pv::prop::binding::DeviceOptions;
+       using pv::binding::DeviceOptions;
 
        // Only bind options if this is a group. We don't do it for general
        // options, because these properties are shown in the device config
index 0ebe333f5f4836484ebf547f364e735445e50338..61dc9e156f2f95c5b72a6725796379b3b4d5e3e1 100644 (file)
@@ -43,11 +43,9 @@ namespace pv {
 
 class Session;
 
-namespace prop {
 namespace binding {
 class DeviceOptions;
 }
-}
 
 namespace view {
 class Signal;
@@ -87,7 +85,7 @@ private:
 
        bool updating_channels_;
 
-       std::vector< std::shared_ptr<pv::prop::binding::DeviceOptions> >
+       std::vector< std::shared_ptr<pv::binding::DeviceOptions> >
                 group_bindings_;
        std::map< QCheckBox*, std::shared_ptr<pv::view::Signal> >
                check_box_signal_map_;
index 47bb6ca282465666a5e2134f3a11c7f9a678d453..06c9705f06a7e8326b3dc50c4d34f803d5fab6bd 100644 (file)
@@ -45,7 +45,7 @@ DeviceOptions::DeviceOptions(shared_ptr<Device> device, QWidget *parent) :
        layout_.addWidget(binding_.get_property_form(this, true));
 }
 
-pv::prop::binding::DeviceOptions& DeviceOptions::binding()
+pv::binding::DeviceOptions& DeviceOptions::binding()
 {
        return binding_;
 }
index d43ab607b4a48746afc9aa973e4ec0b8a0ef26af..94ce7afd6f54fc7be5c3dfb0c16c6923242127b2 100644 (file)
@@ -24,7 +24,7 @@
 #include <QGroupBox>
 #include <QVBoxLayout>
 
-#include <pv/prop/binding/deviceoptions.hpp>
+#include <pv/binding/deviceoptions.hpp>
 #include <pv/widgets/popup.hpp>
 
 namespace sigrok {
@@ -42,14 +42,14 @@ public:
        DeviceOptions(std::shared_ptr<sigrok::Device> device,
                QWidget *parent);
 
-       pv::prop::binding::DeviceOptions& binding();
+       pv::binding::DeviceOptions& binding();
 
 private:
        std::shared_ptr<sigrok::Device> device_;
 
        QVBoxLayout layout_;
 
-       pv::prop::binding::DeviceOptions binding_;
+       pv::binding::DeviceOptions binding_;
 };
 
 } // namespace popups
diff --git a/pv/prop/binding/binding.cpp b/pv/prop/binding/binding.cpp
deleted file mode 100644 (file)
index 062ce66..0000000
+++ /dev/null
@@ -1,94 +0,0 @@
-/*
- * This file is part of the PulseView project.
- *
- * Copyright (C) 2012 Joel Holdsworth <joel@airwebreathe.org.uk>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
- */
-
-#include <cassert>
-
-#include <QFormLayout>
-
-#include <pv/prop/property.hpp>
-
-#include "binding.hpp"
-
-using std::shared_ptr;
-
-namespace pv {
-namespace prop {
-namespace binding {
-
-const std::vector< std::shared_ptr<Property> >& Binding::properties()
-{
-       return properties_;
-}
-
-void Binding::commit()
-{
-       for (shared_ptr<pv::prop::Property> p : properties_) {
-               assert(p);
-               p->commit();
-       }
-}
-
-void Binding::add_properties_to_form(QFormLayout *layout,
-       bool auto_commit) const
-{
-       assert(layout);
-
-       for (shared_ptr<pv::prop::Property> p : properties_)
-       {
-               assert(p);
-
-               QWidget *const widget = p->get_widget(layout->parentWidget(),
-                       auto_commit);
-               if (p->labeled_widget())
-                       layout->addRow(widget);
-               else
-                       layout->addRow(p->name(), widget);
-       }
-}
-
-QWidget* Binding::get_property_form(QWidget *parent,
-       bool auto_commit) const
-{
-       QWidget *const form = new QWidget(parent);
-       QFormLayout *const layout = new QFormLayout(form);
-       form->setLayout(layout);
-       add_properties_to_form(layout, auto_commit);
-       return form;
-}
-
-QString Binding::print_gvariant(Glib::VariantBase gvar)
-{
-       QString s;
-
-       if (!gvar.gobj())
-               s = QString::fromStdString("(null)");
-       else if (gvar.is_of_type(Glib::VariantType("s")))
-               s = QString::fromStdString(
-                       Glib::VariantBase::cast_dynamic<Glib::Variant<std::string>>(
-                               gvar).get());
-       else
-               s = QString::fromStdString(gvar.print());
-
-       return s;
-}
-
-} // binding
-} // prop
-} // pv
diff --git a/pv/prop/binding/binding.hpp b/pv/prop/binding/binding.hpp
deleted file mode 100644 (file)
index 5e9604f..0000000
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * This file is part of the PulseView project.
- *
- * Copyright (C) 2012 Joel Holdsworth <joel@airwebreathe.org.uk>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
- */
-
-#ifndef PULSEVIEW_PV_PROP_BINDING_BINDING_H
-#define PULSEVIEW_PV_PROP_BINDING_BINDING_H
-
-#include <glibmm.h>
-
-#include <vector>
-#include <memory>
-
-#include <QString>
-
-class QFormLayout;
-class QWidget;
-
-namespace pv {
-namespace prop {
-
-class Property;
-
-namespace binding {
-
-class Binding
-{
-public:
-       const std::vector< std::shared_ptr<Property> >& properties();
-
-       void commit();
-
-       void add_properties_to_form(QFormLayout *layout,
-               bool auto_commit = false) const;
-
-       QWidget* get_property_form(QWidget *parent,
-               bool auto_commit = false) const;
-
-       static QString print_gvariant(Glib::VariantBase gvar);
-
-protected:
-       std::vector< std::shared_ptr<Property> > properties_;
-};
-
-} // binding
-} // prop
-} // pv
-
-#endif // PULSEVIEW_PV_PROP_BINDING_BINDING_H
diff --git a/pv/prop/binding/decoderoptions.cpp b/pv/prop/binding/decoderoptions.cpp
deleted file mode 100644 (file)
index d9b4b88..0000000
+++ /dev/null
@@ -1,147 +0,0 @@
-/*
- * This file is part of the PulseView project.
- *
- * Copyright (C) 2013 Joel Holdsworth <joel@airwebreathe.org.uk>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
- */
-
-#include <libsigrokdecode/libsigrokdecode.h>
-
-#include "decoderoptions.hpp"
-
-#include <boost/none_t.hpp>
-
-#include <pv/data/decoderstack.hpp>
-#include <pv/data/decode/decoder.hpp>
-#include <pv/prop/double.hpp>
-#include <pv/prop/enum.hpp>
-#include <pv/prop/int.hpp>
-#include <pv/prop/string.hpp>
-
-using boost::none;
-using std::make_pair;
-using std::map;
-using std::pair;
-using std::shared_ptr;
-using std::string;
-using std::vector;
-
-namespace pv {
-namespace prop {
-namespace binding {
-
-DecoderOptions::DecoderOptions(
-       shared_ptr<pv::data::DecoderStack> decoder_stack,
-       shared_ptr<data::decode::Decoder> decoder) :
-       decoder_stack_(decoder_stack),
-       decoder_(decoder)
-{
-       assert(decoder_);
-
-       const srd_decoder *const dec = decoder_->decoder();
-       assert(dec);
-
-       for (GSList *l = dec->options; l; l = l->next)
-       {
-               const srd_decoder_option *const opt =
-                       (srd_decoder_option*)l->data;
-
-               const QString name = QString::fromUtf8(opt->desc);
-
-               const Property::Getter get = [&, opt]() {
-                       return getter(opt->id); };
-               const Property::Setter set = [&, opt](Glib::VariantBase value) {
-                       setter(opt->id, value); };
-
-               shared_ptr<Property> prop;
-
-               if (opt->values)
-                       prop = bind_enum(name, opt, get, set);
-               else if (g_variant_is_of_type(opt->def, G_VARIANT_TYPE("d")))
-                       prop = shared_ptr<Property>(new Double(name, 2, "",
-                               none, none, get, set));
-               else if (g_variant_is_of_type(opt->def, G_VARIANT_TYPE("x")))
-                       prop = shared_ptr<Property>(
-                               new Int(name, "", none, get, set));
-               else if (g_variant_is_of_type(opt->def, G_VARIANT_TYPE("s")))
-                       prop = shared_ptr<Property>(
-                               new String(name, get, set));
-               else
-                       continue;
-
-               properties_.push_back(prop);
-       }
-}
-
-shared_ptr<Property> DecoderOptions::bind_enum(
-       const QString &name, const srd_decoder_option *option,
-       Property::Getter getter, Property::Setter setter)
-{
-       vector< pair<Glib::VariantBase, QString> > values;
-       for (GSList *l = option->values; l; l = l->next) {
-               Glib::VariantBase var = Glib::VariantBase((GVariant*)l->data, true);
-               values.push_back(make_pair(var, print_gvariant(var)));
-       }
-
-       return shared_ptr<Property>(new Enum(name, values, getter, setter));
-}
-
-Glib::VariantBase DecoderOptions::getter(const char *id)
-{
-       GVariant *val = NULL;
-
-       assert(decoder_);
-
-       // Get the value from the hash table if it is already present
-       const map<string, GVariant*>& options = decoder_->options();
-       const auto iter = options.find(id);
-
-       if (iter != options.end())
-               val = (*iter).second;
-       else
-       {
-               assert(decoder_->decoder());
-
-               // Get the default value if not
-               for (GSList *l = decoder_->decoder()->options; l; l = l->next)
-               {
-                       const srd_decoder_option *const opt =
-                               (srd_decoder_option*)l->data;
-                       if (strcmp(opt->id, id) == 0) {
-                               val = opt->def;
-                               break;
-                       }
-               }
-       }
-
-       if (val)
-               return Glib::VariantBase(val, true);
-       else
-               return Glib::VariantBase();
-}
-
-void DecoderOptions::setter(const char *id, Glib::VariantBase value)
-{
-       assert(decoder_);
-       decoder_->set_option(id, value.gobj());
-
-       assert(decoder_stack_);
-       decoder_stack_->begin_decode();
-}
-
-} // binding
-} // prop
-} // pv
diff --git a/pv/prop/binding/decoderoptions.hpp b/pv/prop/binding/decoderoptions.hpp
deleted file mode 100644 (file)
index 680bc42..0000000
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * This file is part of the PulseView project.
- *
- * Copyright (C) 2013 Joel Holdsworth <joel@airwebreathe.org.uk>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
- */
-
-#ifndef PULSEVIEW_PV_PROP_BINDING_DECODEROPTIONS_H
-#define PULSEVIEW_PV_PROP_BINDING_DECODEROPTIONS_H
-
-#include "binding.hpp"
-
-#include <pv/prop/property.hpp>
-
-struct srd_decoder_option;
-
-namespace pv {
-
-namespace data {
-class DecoderStack;
-namespace decode {
-class Decoder;
-}
-}
-
-namespace prop {
-namespace binding {
-
-class DecoderOptions : public Binding
-{
-public:
-       DecoderOptions(std::shared_ptr<pv::data::DecoderStack> decoder_stack,
-               std::shared_ptr<pv::data::decode::Decoder> decoder);
-
-private:
-       static std::shared_ptr<Property> bind_enum(const QString &name,
-               const srd_decoder_option *option,
-               Property::Getter getter, Property::Setter setter);
-
-       Glib::VariantBase getter(const char *id);
-
-       void setter(const char *id, Glib::VariantBase value);
-
-private:
-       std::shared_ptr<pv::data::DecoderStack> decoder_stack_;
-       std::shared_ptr<pv::data::decode::Decoder> decoder_;
-};
-
-} // binding
-} // prop
-} // pv
-
-#endif // PULSEVIEW_PV_PROP_BINDING_DECODEROPTIONS_H
diff --git a/pv/prop/binding/deviceoptions.cpp b/pv/prop/binding/deviceoptions.cpp
deleted file mode 100644 (file)
index 8b38505..0000000
+++ /dev/null
@@ -1,188 +0,0 @@
-/*
- * This file is part of the PulseView project.
- *
- * Copyright (C) 2012 Joel Holdsworth <joel@airwebreathe.org.uk>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
- */
-
-#include <stdint.h>
-
-#include <QDebug>
-
-#include "deviceoptions.hpp"
-
-#include <pv/prop/bool.hpp>
-#include <pv/prop/double.hpp>
-#include <pv/prop/enum.hpp>
-#include <pv/prop/int.hpp>
-
-#include <libsigrokcxx/libsigrokcxx.hpp>
-
-using boost::optional;
-using std::function;
-using std::make_pair;
-using std::pair;
-using std::shared_ptr;
-using std::string;
-using std::vector;
-
-using sigrok::Capability;
-using sigrok::Configurable;
-using sigrok::ConfigKey;
-using sigrok::Error;
-
-namespace pv {
-namespace prop {
-namespace binding {
-
-DeviceOptions::DeviceOptions(shared_ptr<sigrok::Configurable> configurable) :
-       configurable_(configurable)
-{
-       assert(configurable);
-
-       for (auto entry : configurable->config_keys(ConfigKey::DEVICE_OPTIONS)) {
-               auto key = entry.first;
-               auto capabilities = entry.second;
-
-               Glib::VariantContainerBase gvar_list;
-
-               if (!capabilities.count(Capability::GET) ||
-                       !capabilities.count(Capability::SET))
-                       continue;
-
-               if (capabilities.count(Capability::LIST))
-                       gvar_list = configurable->config_list(key);
-
-               string name_str;
-               try {
-                       name_str = key->description();
-               } catch (Error e) {
-                       name_str = key->name();
-               }
-
-               const QString name = QString::fromStdString(name_str);
-
-               const Property::Getter get = [&, key]() {
-                       return configurable_->config_get(key); };
-               const Property::Setter set = [&, key](Glib::VariantBase value) {
-                       configurable_->config_set(key, value);
-                       config_changed();
-               };
-
-               switch (key->id())
-               {
-               case SR_CONF_SAMPLERATE:
-                       // Sample rate values are not bound because they are shown
-                       // in the MainBar
-                       break;
-
-               case SR_CONF_CAPTURE_RATIO:
-                       bind_int(name, "%", pair<int64_t, int64_t>(0, 100),
-                               get, set);
-                       break;
-
-               case SR_CONF_PATTERN_MODE:
-               case SR_CONF_BUFFERSIZE:
-               case SR_CONF_TRIGGER_SOURCE:
-               case SR_CONF_TRIGGER_SLOPE:
-               case SR_CONF_FILTER:
-               case SR_CONF_COUPLING:
-               case SR_CONF_CLOCK_EDGE:
-                       bind_enum(name, gvar_list, get, set);
-                       break;
-
-               case SR_CONF_EXTERNAL_CLOCK:
-               case SR_CONF_RLE:
-                       bind_bool(name, get, set);
-                       break;
-
-               case SR_CONF_TIMEBASE:
-                       bind_enum(name, gvar_list, get, set, print_timebase);
-                       break;
-
-               case SR_CONF_VDIV:
-                       bind_enum(name, gvar_list, get, set, print_vdiv);
-                       break;
-
-               case SR_CONF_VOLTAGE_THRESHOLD:
-                       bind_enum(name, gvar_list, get, set, print_voltage_threshold);
-                       break;
-
-               default:
-                       break;
-               }
-       }
-}
-
-void DeviceOptions::bind_bool(const QString &name,
-       Property::Getter getter, Property::Setter setter)
-{
-       assert(configurable_);
-       properties_.push_back(shared_ptr<Property>(new Bool(
-               name, getter, setter)));
-}
-
-void DeviceOptions::bind_enum(const QString &name,
-       Glib::VariantContainerBase gvar_list, Property::Getter getter,
-       Property::Setter setter, function<QString (Glib::VariantBase)> printer)
-{
-       Glib::VariantBase gvar;
-       vector< pair<Glib::VariantBase, QString> > values;
-
-       assert(configurable_);
-
-       Glib::VariantIter iter(gvar_list);
-       while ((iter.next_value(gvar)))
-               values.push_back(make_pair(gvar, printer(gvar)));
-
-       properties_.push_back(shared_ptr<Property>(new Enum(name, values,
-               getter, setter)));
-}
-
-void DeviceOptions::bind_int(const QString &name, QString suffix,
-       optional< std::pair<int64_t, int64_t> > range,
-       Property::Getter getter, Property::Setter setter)
-{
-       assert(configurable_);
-
-       properties_.push_back(shared_ptr<Property>(new Int(name, suffix, range,
-               getter, setter)));
-}
-
-QString DeviceOptions::print_timebase(Glib::VariantBase gvar)
-{
-       uint64_t p, q;
-       g_variant_get(gvar.gobj(), "(tt)", &p, &q);
-       return QString::fromUtf8(sr_period_string(p * q));
-}
-
-QString DeviceOptions::print_vdiv(Glib::VariantBase gvar)
-{
-       uint64_t p, q;
-       g_variant_get(gvar.gobj(), "(tt)", &p, &q);
-       return QString::fromUtf8(sr_voltage_string(p, q));
-}
-
-QString DeviceOptions::print_voltage_threshold(Glib::VariantBase gvar)
-{
-       gdouble lo, hi;
-       g_variant_get(gvar.gobj(), "(dd)", &lo, &hi);
-       return QString("L<%1V H>%2V").arg(lo, 0, 'f', 1).arg(hi, 0, 'f', 1);
-}
-
-} // binding
-} // prop
-} // pv
diff --git a/pv/prop/binding/deviceoptions.hpp b/pv/prop/binding/deviceoptions.hpp
deleted file mode 100644 (file)
index d027ccc..0000000
+++ /dev/null
@@ -1,74 +0,0 @@
-/*
- * This file is part of the PulseView project.
- *
- * Copyright (C) 2012 Joel Holdsworth <joel@airwebreathe.org.uk>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
- */
-
-#ifndef PULSEVIEW_PV_PROP_BINDING_DEVICEOPTIONS_H
-#define PULSEVIEW_PV_PROP_BINDING_DEVICEOPTIONS_H
-
-#include <boost/optional.hpp>
-
-#include <QObject>
-#include <QString>
-
-#include "binding.hpp"
-
-#include <pv/prop/property.hpp>
-
-namespace sigrok {
-       class Configurable;
-}
-
-namespace pv {
-
-namespace prop {
-namespace binding {
-
-class DeviceOptions : public QObject, public Binding
-{
-       Q_OBJECT
-
-public:
-       DeviceOptions(std::shared_ptr<sigrok::Configurable> configurable);
-
-Q_SIGNALS:
-       void config_changed();
-
-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<QString (Glib::VariantBase)> printer = print_gvariant);
-       void bind_int(const QString &name, QString suffix,
-               boost::optional< std::pair<int64_t, int64_t> > range,
-               Property::Getter getter, Property::Setter setter);
-
-       static QString print_timebase(Glib::VariantBase gvar);
-       static QString print_vdiv(Glib::VariantBase gvar);
-       static QString print_voltage_threshold(Glib::VariantBase gvar);
-
-protected:
-       std::shared_ptr<sigrok::Configurable> configurable_;
-};
-
-} // binding
-} // prop
-} // pv
-
-#endif // PULSEVIEW_PV_PROP_BINDING_DEVICEOPTIONS_H
index be2dadf11a0023a5cc1bce1204b71ad1a7a43d8f..91ffebe46fe37e2704a0700dc6f4428a4cff459b 100644 (file)
@@ -687,8 +687,8 @@ void DecodeTrace::create_decoder_form(int index,
        }
 
        // Add the options
-       shared_ptr<prop::binding::DecoderOptions> binding(
-               new prop::binding::DecoderOptions(decoder_stack_, dec));
+       shared_ptr<binding::DecoderOptions> binding(
+               new binding::DecoderOptions(decoder_stack_, dec));
        binding->add_properties_to_form(decoder_form, true);
 
        bindings_.push_back(binding);
index 968ebf9569672a92e76640bc7a88039603a235ee..863fb35e922baff17efb7aa39fcea275e26a92fe 100644 (file)
@@ -29,7 +29,7 @@
 
 #include <QSignalMapper>
 
-#include <pv/prop/binding/decoderoptions.hpp>
+#include <pv/binding/decoderoptions.hpp>
 #include <pv/data/decode/row.hpp>
 
 struct srd_channel;
@@ -191,7 +191,7 @@ private:
 
        uint64_t decode_start_, decode_end_;
 
-       std::list< std::shared_ptr<pv::prop::binding::DecoderOptions> >
+       std::list< std::shared_ptr<pv::binding::DecoderOptions> >
                bindings_;
 
        std::list<ChannelSelector> channel_selectors_;
index 4041d293cdfa3b8ee6637e048076b5c58b24cea0..61b9c4d505b4ebaf1e4a59a34fdd7af7d367a739 100644 (file)
@@ -23,6 +23,8 @@ set(pulseview_TEST_SOURCES
        ${PROJECT_SOURCE_DIR}/pv/session.cpp
        ${PROJECT_SOURCE_DIR}/pv/storesession.cpp
        ${PROJECT_SOURCE_DIR}/pv/util.cpp
+       ${PROJECT_SOURCE_DIR}/pv/binding/binding.cpp
+       ${PROJECT_SOURCE_DIR}/pv/binding/deviceoptions.cpp
        ${PROJECT_SOURCE_DIR}/pv/data/analog.cpp
        ${PROJECT_SOURCE_DIR}/pv/data/analogsegment.cpp
        ${PROJECT_SOURCE_DIR}/pv/data/logic.cpp
@@ -35,8 +37,6 @@ set(pulseview_TEST_SOURCES
        ${PROJECT_SOURCE_DIR}/pv/prop/int.cpp
        ${PROJECT_SOURCE_DIR}/pv/prop/property.cpp
        ${PROJECT_SOURCE_DIR}/pv/prop/string.cpp
-       ${PROJECT_SOURCE_DIR}/pv/prop/binding/binding.cpp
-       ${PROJECT_SOURCE_DIR}/pv/prop/binding/deviceoptions.cpp
        ${PROJECT_SOURCE_DIR}/pv/popups/channels.cpp
        ${PROJECT_SOURCE_DIR}/pv/view/analogsignal.cpp
        ${PROJECT_SOURCE_DIR}/pv/view/cursor.cpp
@@ -74,6 +74,7 @@ set(pulseview_TEST_SOURCES
 set(pulseview_TEST_HEADERS
        ${PROJECT_SOURCE_DIR}/pv/session.hpp
        ${PROJECT_SOURCE_DIR}/pv/storesession.hpp
+       ${PROJECT_SOURCE_DIR}/pv/binding/deviceoptions.hpp
        ${PROJECT_SOURCE_DIR}/pv/popups/channels.hpp
        ${PROJECT_SOURCE_DIR}/pv/popups/deviceoptions.hpp
        ${PROJECT_SOURCE_DIR}/pv/prop/bool.hpp
@@ -82,7 +83,6 @@ set(pulseview_TEST_HEADERS
        ${PROJECT_SOURCE_DIR}/pv/prop/int.hpp
        ${PROJECT_SOURCE_DIR}/pv/prop/property.hpp
        ${PROJECT_SOURCE_DIR}/pv/prop/string.hpp
-       ${PROJECT_SOURCE_DIR}/pv/prop/binding/deviceoptions.hpp
        ${PROJECT_SOURCE_DIR}/pv/view/cursor.hpp
        ${PROJECT_SOURCE_DIR}/pv/view/flag.hpp
        ${PROJECT_SOURCE_DIR}/pv/view/header.hpp
@@ -109,12 +109,12 @@ set(pulseview_TEST_HEADERS
 
 if(ENABLE_DECODE)
        list(APPEND pulseview_TEST_SOURCES
+               ${PROJECT_SOURCE_DIR}/pv/binding/decoderoptions.cpp
                ${PROJECT_SOURCE_DIR}/pv/data/decoderstack.cpp
                ${PROJECT_SOURCE_DIR}/pv/data/decode/annotation.cpp
                ${PROJECT_SOURCE_DIR}/pv/data/decode/decoder.cpp
                ${PROJECT_SOURCE_DIR}/pv/data/decode/row.cpp
                ${PROJECT_SOURCE_DIR}/pv/data/decode/rowdata.cpp
-               ${PROJECT_SOURCE_DIR}/pv/prop/binding/decoderoptions.cpp
                ${PROJECT_SOURCE_DIR}/pv/view/decodetrace.cpp
                ${PROJECT_SOURCE_DIR}/pv/widgets/decodergroupbox.cpp
                ${PROJECT_SOURCE_DIR}/pv/widgets/decodermenu.cpp