From: Soeren Apel Date: Fri, 26 May 2017 08:46:14 +0000 (+0200) Subject: SignalBase: Also emit data related signals X-Git-Tag: pulseview-0.4.0~75 X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=eae3bbbbfd35aef309c186e278ff7ab2d90f362a;p=pulseview.git SignalBase: Also emit data related signals If we have a SignalBase instance we don't want to hook into every single segment just to be notified when data changes. --- diff --git a/pv/data/signalbase.cpp b/pv/data/signalbase.cpp index 6bcacd73..45dc082c 100644 --- a/pv/data/signalbase.cpp +++ b/pv/data/signalbase.cpp @@ -318,6 +318,8 @@ void SignalBase::conversion_thread_proc(QObject* segment, uint64_t start_sample, lsamples.push_back(convert_a2l_threshold(threshold, asamples[j])); lsegment->append_payload(lsamples.data(), lsamples.size()); delete[] asamples; + + samples_added(lsegment, start_sample, end_sample); } if (conversion_type_ == A2LConversionBySchmittTrigger) { @@ -343,6 +345,8 @@ void SignalBase::conversion_thread_proc(QObject* segment, uint64_t start_sample, lsamples.push_back(convert_a2l_schmitt_trigger(lo_thr, hi_thr, asamples[j], state)); lsegment->append_payload(lsamples.data(), lsamples.size()); delete[] asamples; + + samples_added(lsegment, start_sample, end_sample); } } } @@ -351,6 +355,8 @@ void SignalBase::on_samples_cleared() { if (converted_data_) converted_data_->clear(); + + samples_cleared(); } void SignalBase::on_samples_added(QObject* segment, uint64_t start_sample, @@ -370,6 +376,8 @@ void SignalBase::on_samples_added(QObject* segment, uint64_t start_sample, &SignalBase::conversion_thread_proc, this, segment, start_sample, end_sample); } + + samples_added(segment, start_sample, end_sample); } void SignalBase::on_capture_state_changed(int state) diff --git a/pv/data/signalbase.hpp b/pv/data/signalbase.hpp index 38171648..e6726c5a 100644 --- a/pv/data/signalbase.hpp +++ b/pv/data/signalbase.hpp @@ -176,6 +176,11 @@ Q_SIGNALS: void conversion_type_changed(const ConversionType t); + void samples_cleared(); + + void samples_added(QObject* segment, uint64_t start_sample, + uint64_t end_sample); + private Q_SLOTS: void on_samples_cleared();