From: Joel Holdsworth Date: Sat, 7 Sep 2013 13:50:22 +0000 (+0100) Subject: Update the viewport as new data is decoded X-Git-Tag: pulseview-0.2.0~286 X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=9cef95672622f4ecdb21edef9d81a10c789daf1e;p=pulseview.git Update the viewport as new data is decoded --- diff --git a/pv/data/decoder.cpp b/pv/data/decoder.cpp index 787d1600..00b9e0b7 100644 --- a/pv/data/decoder.cpp +++ b/pv/data/decoder.cpp @@ -189,6 +189,8 @@ void Decoder::annotation_callback(srd_proto_data *pdata, void *decoder) shared_ptr a(new Annotation(pdata)); lock_guard lock(d->_annotations_mutex); d->_annotations.push_back(a); + + d->new_decode_data(); } } // namespace data diff --git a/pv/data/decoder.h b/pv/data/decoder.h index 8a0f00a4..c881403b 100644 --- a/pv/data/decoder.h +++ b/pv/data/decoder.h @@ -83,6 +83,9 @@ private: static void annotation_callback(srd_proto_data *pdata, void *decoder); +signals: + void new_decode_data(); + private: const srd_decoder *const _decoder; std::map > diff --git a/pv/view/decodesignal.cpp b/pv/view/decodesignal.cpp index 514fbca3..89d2c321 100644 --- a/pv/view/decodesignal.cpp +++ b/pv/view/decodesignal.cpp @@ -52,6 +52,9 @@ DecodeSignal::DecodeSignal(pv::SigSession &session, assert(_decoder); _colour = DecodeColours[index % countof(DecodeColours)]; + + connect(_decoder.get(), SIGNAL(new_decode_data()), + this, SLOT(on_new_decode_data())); } void DecodeSignal::init_context_bar_actions(QWidget *parent) @@ -111,5 +114,11 @@ const list DecodeSignal::get_context_bar_actions() return actions; } +void DecodeSignal::on_new_decode_data() +{ + if (_view) + _view->update_viewport(); +} + } // namespace view } // namespace pv diff --git a/pv/view/decodesignal.h b/pv/view/decodesignal.h index a9ff265e..673d6549 100644 --- a/pv/view/decodesignal.h +++ b/pv/view/decodesignal.h @@ -76,6 +76,9 @@ private: **/ int get_nominal_offset(const QRect &rect) const; +private slots: + void on_new_decode_data(); + private: boost::shared_ptr _decoder; diff --git a/pv/view/view.cpp b/pv/view/view.cpp index 54ab4ff9..508b91c5 100644 --- a/pv/view/view.cpp +++ b/pv/view/view.cpp @@ -252,6 +252,12 @@ void View::normalize_layout() v_scroll_value_changed(verticalScrollBar()->sliderPosition()); } +void View::update_viewport() +{ + assert(_viewport); + _viewport->update(); +} + void View::get_scroll_layout(double &length, double &offset) const { const shared_ptr sig_data = _session.get_data(); diff --git a/pv/view/view.h b/pv/view/view.h index 25e43b8a..c25ed78a 100644 --- a/pv/view/view.h +++ b/pv/view/view.h @@ -126,6 +126,8 @@ public: void normalize_layout(); + void update_viewport(); + signals: void hover_point_changed();