#include "pv/session.hpp"
#include "pv/util.hpp"
+#include "pv/data/segment.hpp"
using std::shared_ptr;
ViewBase::ViewBase(Session &session, bool is_main_view, QWidget *parent) :
session_(session),
- is_main_view_(is_main_view)
+ is_main_view_(is_main_view),
+ current_segment_(0)
{
(void)parent;
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();
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
{
}
+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<data::Segment*>(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())
virtual void perform_delayed_view_update();
private Q_SLOTS:
+ void on_samples_added(QObject* segment, uint64_t start_sample,
+ uint64_t end_sample);
+
void on_data_updated();
protected:
unordered_set< shared_ptr<data::SignalBase> > signalbases_;
+ /// The ID of the currently displayed segment
+ uint32_t current_segment_;
+
QTimer delayed_view_updater_;
};