From: Soeren Apel Date: Sat, 27 May 2017 20:13:16 +0000 (+0200) Subject: SignalBase: Always hook into signal data, not just for analog X-Git-Tag: pulseview-0.4.0~70 X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=8ce8ebb9796488bd2211591806ed00854ad64bb3;p=pulseview.git SignalBase: Always hook into signal data, not just for analog --- diff --git a/pv/data/analog.hpp b/pv/data/analog.hpp index 5b6e5ee8..30860ce1 100644 --- a/pv/data/analog.hpp +++ b/pv/data/analog.hpp @@ -36,7 +36,7 @@ namespace data { class AnalogSegment; -class Analog : public QObject, public SignalData +class Analog : public SignalData { Q_OBJECT diff --git a/pv/data/logic.hpp b/pv/data/logic.hpp index c80f0151..1ca5d3ed 100644 --- a/pv/data/logic.hpp +++ b/pv/data/logic.hpp @@ -35,7 +35,7 @@ namespace data { class LogicSegment; -class Logic : public QObject, public SignalData +class Logic : public SignalData { Q_OBJECT diff --git a/pv/data/signalbase.cpp b/pv/data/signalbase.cpp index 45dc082c..c8a6d556 100644 --- a/pv/data/signalbase.cpp +++ b/pv/data/signalbase.cpp @@ -125,23 +125,19 @@ QColor SignalBase::bgcolour() const void SignalBase::set_data(shared_ptr data) { - if (data_ && channel_type_ == AnalogChannel) { - shared_ptr analog_data = dynamic_pointer_cast(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_data = dynamic_pointer_cast(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 diff --git a/pv/data/signaldata.hpp b/pv/data/signaldata.hpp index 374a6f99..a90204f0 100644 --- a/pv/data/signaldata.hpp +++ b/pv/data/signaldata.hpp @@ -24,6 +24,8 @@ #include #include +#include + 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;