]> sigrok.org Git - pulseview.git/commitdiff
SignalBase: Always hook into signal data, not just for analog
authorSoeren Apel <redacted>
Sat, 27 May 2017 20:13:16 +0000 (22:13 +0200)
committerSoeren Apel <redacted>
Sat, 27 May 2017 20:13:16 +0000 (22:13 +0200)
pv/data/analog.hpp
pv/data/logic.hpp
pv/data/signalbase.cpp
pv/data/signaldata.hpp

index 5b6e5ee8600acf15452f52b40d1f815b9fc04f2d..30860ce18e4a0c4f98590629fd965c8a0326d3de 100644 (file)
@@ -36,7 +36,7 @@ namespace data {
 
 class AnalogSegment;
 
-class Analog : public QObject, public SignalData
+class Analog : public SignalData
 {
        Q_OBJECT
 
index c80f0151f8957122d8a87687a75c535b083d196f..1ca5d3ed3af0f407ca34cb54908d4e6dc01e40e0 100644 (file)
@@ -35,7 +35,7 @@ namespace data {
 
 class LogicSegment;
 
-class Logic : public QObject, public SignalData
+class Logic : public SignalData
 {
        Q_OBJECT
 
index 45dc082cce7f65c5dbc55548b94692d43dfc0729..c8a6d556648f1112c524be5ab7db4803cf20dcf0 100644 (file)
@@ -125,23 +125,19 @@ QColor SignalBase::bgcolour() const
 
 void SignalBase::set_data(shared_ptr<pv::data::SignalData> data)
 {
-       if (data_ && channel_type_ == AnalogChannel) {
-               shared_ptr<Analog> analog_data = dynamic_pointer_cast<Analog>(data_);
-
-               disconnect(analog_data.get(), SIGNAL(samples_cleared()),
+       if (data_) {
+               disconnect(data.get(), SIGNAL(samples_cleared()),
                        this, SLOT(on_samples_cleared()));
-               disconnect(analog_data.get(), SIGNAL(samples_added(QObject*, uint64_t, uint64_t)),
+               disconnect(data.get(), SIGNAL(samples_added(QObject*, uint64_t, uint64_t)),
                        this, SLOT(on_samples_added(QObject*, uint64_t, uint64_t)));
        }
 
        data_ = data;
 
-       if (data_ && channel_type_ == AnalogChannel) {
-               shared_ptr<Analog> analog_data = dynamic_pointer_cast<Analog>(data_);
-
-               connect(analog_data.get(), SIGNAL(samples_cleared()),
+       if (data_) {
+               connect(data.get(), SIGNAL(samples_cleared()),
                        this, SLOT(on_samples_cleared()));
-               connect(analog_data.get(), SIGNAL(samples_added(QObject*, uint64_t, uint64_t)),
+               connect(data.get(), SIGNAL(samples_added(QObject*, uint64_t, uint64_t)),
                        this, SLOT(on_samples_added(QObject*, uint64_t, uint64_t)));
        }
 }
@@ -362,10 +358,6 @@ void SignalBase::on_samples_cleared()
 void SignalBase::on_samples_added(QObject* segment, uint64_t start_sample,
        uint64_t end_sample)
 {
-       (void)segment;
-       (void)start_sample;
-       (void)end_sample;
-
        if (conversion_type_ != NoConversion) {
 
                // Wait for the currently ongoing conversion to finish
index 374a6f99efcfbb1f0e6ef2bd566ea7ae578e9b02..a90204f06f23bd379abd78278bb6bcf0bbc41455 100644 (file)
@@ -24,6 +24,8 @@
 #include <memory>
 #include <vector>
 
+#include <QObject>
+
 using std::shared_ptr;
 using std::vector;
 
@@ -32,8 +34,10 @@ namespace data {
 
 class Segment;
 
-class SignalData
+class SignalData : public QObject
 {
+       Q_OBJECT
+
 public:
        SignalData() = default;
        virtual ~SignalData() = default;