X-Git-Url: https://sigrok.org/gitweb/?p=pulseview.git;a=blobdiff_plain;f=pv%2Fviews%2Fviewbase.cpp;h=caed41eecb56daf0d3b58b1102e90d091c1f7ecb;hp=7d986fe051e730b55034bb423a0afdc1ca058c87;hb=7ea2a4ff0765fdad34b84e4b4631d6f3f5588714;hpb=558ad6ceb934ab7406d286c1a4ae08da4aba1448 diff --git a/pv/views/viewbase.cpp b/pv/views/viewbase.cpp index 7d986fe0..caed41ee 100644 --- a/pv/views/viewbase.cpp +++ b/pv/views/viewbase.cpp @@ -26,6 +26,7 @@ #include "pv/session.hpp" #include "pv/util.hpp" +#include "pv/data/segment.hpp" using std::shared_ptr; @@ -36,7 +37,9 @@ const int ViewBase::MaxViewAutoUpdateRate = 25; // No more than 25 Hz ViewBase::ViewBase(Session &session, bool is_main_view, QWidget *parent) : session_(session), - is_main_view_(is_main_view) + is_main_view_(is_main_view), + ruler_shift_(0), + current_segment_(0) { (void)parent; @@ -78,7 +81,7 @@ void ViewBase::clear_signalbases() disconnect(signalbase.get(), SIGNAL(samples_cleared()), this, SLOT(on_data_updated())); disconnect(signalbase.get(), SIGNAL(samples_added(QObject*, uint64_t, uint64_t)), - this, SLOT(on_data_updated())); + this, SLOT(on_samples_added(QObject*, uint64_t, uint64_t))); } signalbases_.clear(); @@ -91,7 +94,7 @@ void ViewBase::add_signalbase(const shared_ptr signalbase) connect(signalbase.get(), SIGNAL(samples_cleared()), this, SLOT(on_data_updated())); connect(signalbase.get(), SIGNAL(samples_added(QObject*, uint64_t, uint64_t)), - this, SLOT(on_data_updated())); + this, SLOT(on_samples_added(QObject*, uint64_t, uint64_t))); } #ifdef ENABLE_DECODE @@ -120,8 +123,9 @@ void ViewBase::restore_settings(QSettings &settings) (void)settings; } -void ViewBase::trigger_event(util::Timestamp location) +void ViewBase::trigger_event(int segment_id, util::Timestamp location) { + (void)segment_id; (void)location; } @@ -148,6 +152,21 @@ void ViewBase::perform_delayed_view_update() { } +void ViewBase::on_samples_added(QObject* segment, uint64_t start_sample, + uint64_t end_sample) +{ + (void)start_sample; + (void)end_sample; + + data::Segment* s = qobject_cast(segment); + + if (s->segment_id() != current_segment_) + return; + + if (!delayed_view_updater_.isActive()) + delayed_view_updater_.start(); +} + void ViewBase::on_data_updated() { if (!delayed_view_updater_.isActive())