From 61703a0124c7ace84caf415f7d491a3ad6f42599 Mon Sep 17 00:00:00 2001 From: Joel Holdsworth Date: Sat, 17 Jan 2015 21:45:04 +0000 Subject: [PATCH] Moved pv::prop:bindings classes into pv::bindings namespace --- CMakeLists.txt | 8 ++++---- pv/{prop => }/binding/binding.cpp | 4 +--- pv/{prop => }/binding/binding.hpp | 14 +++++++------- pv/{prop => }/binding/decoderoptions.cpp | 8 ++++++-- pv/{prop => }/binding/decoderoptions.hpp | 12 +++++------- pv/{prop => }/binding/deviceoptions.cpp | 8 ++++++-- pv/{prop => }/binding/deviceoptions.hpp | 14 ++++++-------- pv/popups/channels.cpp | 4 ++-- pv/popups/channels.hpp | 4 +--- pv/popups/deviceoptions.cpp | 2 +- pv/popups/deviceoptions.hpp | 6 +++--- pv/view/decodetrace.cpp | 4 ++-- pv/view/decodetrace.hpp | 4 ++-- test/CMakeLists.txt | 8 ++++---- 14 files changed, 50 insertions(+), 50 deletions(-) rename pv/{prop => }/binding/binding.cpp (95%) rename pv/{prop => }/binding/binding.hpp (83%) rename pv/{prop => }/binding/decoderoptions.cpp (97%) rename pv/{prop => }/binding/decoderoptions.hpp (83%) rename pv/{prop => }/binding/deviceoptions.cpp (97%) rename pv/{prop => }/binding/deviceoptions.hpp (84%) diff --git a/CMakeLists.txt b/CMakeLists.txt index 78acee6..c778592 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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/prop/binding/binding.cpp b/pv/binding/binding.cpp similarity index 95% rename from pv/prop/binding/binding.cpp rename to pv/binding/binding.cpp index 062ce66..fccb96b 100644 --- a/pv/prop/binding/binding.cpp +++ b/pv/binding/binding.cpp @@ -29,10 +29,9 @@ using std::shared_ptr; namespace pv { -namespace prop { namespace binding { -const std::vector< std::shared_ptr >& Binding::properties() +const std::vector< std::shared_ptr >& Binding::properties() { return properties_; } @@ -90,5 +89,4 @@ QString Binding::print_gvariant(Glib::VariantBase gvar) } } // binding -} // prop } // pv diff --git a/pv/prop/binding/binding.hpp b/pv/binding/binding.hpp similarity index 83% rename from pv/prop/binding/binding.hpp rename to pv/binding/binding.hpp index 5e9604f..ae0afb7 100644 --- a/pv/prop/binding/binding.hpp +++ b/pv/binding/binding.hpp @@ -18,8 +18,8 @@ * 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 +#ifndef PULSEVIEW_PV_BINDING_BINDING_H +#define PULSEVIEW_PV_BINDING_BINDING_H #include @@ -32,16 +32,17 @@ class QFormLayout; class QWidget; namespace pv { -namespace prop { +namespace prop { class Property; +} namespace binding { class Binding { public: - const std::vector< std::shared_ptr >& properties(); + const std::vector< std::shared_ptr >& properties(); void commit(); @@ -54,11 +55,10 @@ public: static QString print_gvariant(Glib::VariantBase gvar); protected: - std::vector< std::shared_ptr > properties_; + std::vector< std::shared_ptr > properties_; }; } // binding -} // prop } // pv -#endif // PULSEVIEW_PV_PROP_BINDING_BINDING_H +#endif // PULSEVIEW_PV_BINDING_BINDING_H diff --git a/pv/prop/binding/decoderoptions.cpp b/pv/binding/decoderoptions.cpp similarity index 97% rename from pv/prop/binding/decoderoptions.cpp rename to pv/binding/decoderoptions.cpp index d9b4b88..fd7d918 100644 --- a/pv/prop/binding/decoderoptions.cpp +++ b/pv/binding/decoderoptions.cpp @@ -39,8 +39,13 @@ 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 prop { namespace binding { DecoderOptions::DecoderOptions( @@ -143,5 +148,4 @@ void DecoderOptions::setter(const char *id, Glib::VariantBase value) } } // binding -} // prop } // pv diff --git a/pv/prop/binding/decoderoptions.hpp b/pv/binding/decoderoptions.hpp similarity index 83% rename from pv/prop/binding/decoderoptions.hpp rename to pv/binding/decoderoptions.hpp index 680bc42..a2f7706 100644 --- a/pv/prop/binding/decoderoptions.hpp +++ b/pv/binding/decoderoptions.hpp @@ -18,8 +18,8 @@ * 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 +#ifndef PULSEVIEW_PV_BINDING_DECODEROPTIONS_H +#define PULSEVIEW_PV_BINDING_DECODEROPTIONS_H #include "binding.hpp" @@ -36,7 +36,6 @@ class Decoder; } } -namespace prop { namespace binding { class DecoderOptions : public Binding @@ -46,9 +45,9 @@ public: std::shared_ptr decoder); private: - static std::shared_ptr bind_enum(const QString &name, + static std::shared_ptr bind_enum(const QString &name, const srd_decoder_option *option, - Property::Getter getter, Property::Setter setter); + prop::Property::Getter getter, prop::Property::Setter setter); Glib::VariantBase getter(const char *id); @@ -60,7 +59,6 @@ private: }; } // binding -} // prop } // pv -#endif // PULSEVIEW_PV_PROP_BINDING_DECODEROPTIONS_H +#endif // PULSEVIEW_PV_BINDING_DECODEROPTIONS_H diff --git a/pv/prop/binding/deviceoptions.cpp b/pv/binding/deviceoptions.cpp similarity index 97% rename from pv/prop/binding/deviceoptions.cpp rename to pv/binding/deviceoptions.cpp index 8b38505..8609e21 100644 --- a/pv/prop/binding/deviceoptions.cpp +++ b/pv/binding/deviceoptions.cpp @@ -44,8 +44,13 @@ 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 prop { namespace binding { DeviceOptions::DeviceOptions(shared_ptr configurable) : @@ -184,5 +189,4 @@ QString DeviceOptions::print_voltage_threshold(Glib::VariantBase gvar) } } // binding -} // prop } // pv diff --git a/pv/prop/binding/deviceoptions.hpp b/pv/binding/deviceoptions.hpp similarity index 84% rename from pv/prop/binding/deviceoptions.hpp rename to pv/binding/deviceoptions.hpp index d027ccc..9e913b0 100644 --- a/pv/prop/binding/deviceoptions.hpp +++ b/pv/binding/deviceoptions.hpp @@ -18,8 +18,8 @@ * 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 +#ifndef PULSEVIEW_PV_BINDING_DEVICEOPTIONS_H +#define PULSEVIEW_PV_BINDING_DEVICEOPTIONS_H #include @@ -36,7 +36,6 @@ namespace sigrok { namespace pv { -namespace prop { namespace binding { class DeviceOptions : public QObject, public Binding @@ -51,13 +50,13 @@ Q_SIGNALS: private: void bind_bool(const QString &name, - Property::Getter getter, Property::Setter setter); + prop::Property::Getter getter, prop::Property::Setter setter); void bind_enum(const QString &name, Glib::VariantContainerBase gvar_list, - Property::Getter getter, Property::Setter setter, + prop::Property::Getter getter, prop::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); + prop::Property::Getter getter, prop::Property::Setter setter); static QString print_timebase(Glib::VariantBase gvar); static QString print_vdiv(Glib::VariantBase gvar); @@ -68,7 +67,6 @@ protected: }; } // binding -} // prop } // pv -#endif // PULSEVIEW_PV_PROP_BINDING_DEVICEOPTIONS_H +#endif // PULSEVIEW_PV_BINDING_DEVICEOPTIONS_H diff --git a/pv/popups/channels.cpp b/pv/popups/channels.cpp index 7dedb31..c00863b 100644 --- a/pv/popups/channels.cpp +++ b/pv/popups/channels.cpp @@ -27,7 +27,7 @@ #include "channels.hpp" -#include +#include #include #include @@ -151,7 +151,7 @@ void Channels::set_all_channels(bool set) void Channels::populate_group(shared_ptr group, const vector< shared_ptr > 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 diff --git a/pv/popups/channels.hpp b/pv/popups/channels.hpp index 0ebe333..61dc9e1 100644 --- a/pv/popups/channels.hpp +++ b/pv/popups/channels.hpp @@ -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 > + std::vector< std::shared_ptr > group_bindings_; std::map< QCheckBox*, std::shared_ptr > check_box_signal_map_; diff --git a/pv/popups/deviceoptions.cpp b/pv/popups/deviceoptions.cpp index 47bb6ca..06c9705 100644 --- a/pv/popups/deviceoptions.cpp +++ b/pv/popups/deviceoptions.cpp @@ -45,7 +45,7 @@ DeviceOptions::DeviceOptions(shared_ptr device, QWidget *parent) : layout_.addWidget(binding_.get_property_form(this, true)); } -pv::prop::binding::DeviceOptions& DeviceOptions::binding() +pv::binding::DeviceOptions& DeviceOptions::binding() { return binding_; } diff --git a/pv/popups/deviceoptions.hpp b/pv/popups/deviceoptions.hpp index d43ab60..94ce7af 100644 --- a/pv/popups/deviceoptions.hpp +++ b/pv/popups/deviceoptions.hpp @@ -24,7 +24,7 @@ #include #include -#include +#include #include namespace sigrok { @@ -42,14 +42,14 @@ public: DeviceOptions(std::shared_ptr device, QWidget *parent); - pv::prop::binding::DeviceOptions& binding(); + pv::binding::DeviceOptions& binding(); private: std::shared_ptr device_; QVBoxLayout layout_; - pv::prop::binding::DeviceOptions binding_; + pv::binding::DeviceOptions binding_; }; } // namespace popups diff --git a/pv/view/decodetrace.cpp b/pv/view/decodetrace.cpp index be2dadf..91ffebe 100644 --- a/pv/view/decodetrace.cpp +++ b/pv/view/decodetrace.cpp @@ -687,8 +687,8 @@ void DecodeTrace::create_decoder_form(int index, } // Add the options - shared_ptr binding( - new prop::binding::DecoderOptions(decoder_stack_, dec)); + shared_ptr binding( + new binding::DecoderOptions(decoder_stack_, dec)); binding->add_properties_to_form(decoder_form, true); bindings_.push_back(binding); diff --git a/pv/view/decodetrace.hpp b/pv/view/decodetrace.hpp index 968ebf9..863fb35 100644 --- a/pv/view/decodetrace.hpp +++ b/pv/view/decodetrace.hpp @@ -29,7 +29,7 @@ #include -#include +#include #include struct srd_channel; @@ -191,7 +191,7 @@ private: uint64_t decode_start_, decode_end_; - std::list< std::shared_ptr > + std::list< std::shared_ptr > bindings_; std::list channel_selectors_; diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 4041d29..61b9c4d 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -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 -- 2.30.2