]> sigrok.org Git - pulseview.git/commitdiff
Update the viewport as new data is decoded
authorJoel Holdsworth <redacted>
Sat, 7 Sep 2013 13:50:22 +0000 (14:50 +0100)
committerJoel Holdsworth <redacted>
Sun, 29 Sep 2013 14:56:12 +0000 (23:56 +0900)
pv/data/decoder.cpp
pv/data/decoder.h
pv/view/decodesignal.cpp
pv/view/decodesignal.h
pv/view/view.cpp
pv/view/view.h

index 787d1600bb89f5695c44c90625c06aed44a5cf0a..00b9e0b7efb0b87b3d508828922707e46f73f5e6 100644 (file)
@@ -189,6 +189,8 @@ void Decoder::annotation_callback(srd_proto_data *pdata, void *decoder)
        shared_ptr<Annotation> a(new Annotation(pdata));
        lock_guard<mutex> lock(d->_annotations_mutex);
        d->_annotations.push_back(a);
+
+       d->new_decode_data();
 }
 
 } // namespace data
index 8a0f00a42a5a731bb83b48d3a2c0bd6a3ce05e13..c881403b42e22f8f1391d4d80c94e2ecaee1cf12 100644 (file)
@@ -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<const srd_probe*, boost::shared_ptr<view::Signal> >
index 514fbca339a0b07ca8f6349e0d1451b50c78647e..89d2c3212774cd229d72666a32cdd73f72e5ae8f 100644 (file)
@@ -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<QAction*> DecodeSignal::get_context_bar_actions()
        return actions;
 }
 
+void DecodeSignal::on_new_decode_data()
+{
+       if (_view)
+               _view->update_viewport();
+}
+
 } // namespace view
 } // namespace pv
index a9ff265e0569ad59cea4b7be869347180d8310ed..673d65499509a409ca1266c5fbcd693ed4d97cd4 100644 (file)
@@ -76,6 +76,9 @@ private:
         **/
        int get_nominal_offset(const QRect &rect) const;
 
+private slots:
+       void on_new_decode_data();
+
 private:
        boost::shared_ptr<pv::data::Decoder> _decoder;
 
index 54ab4ff9e2beb1d5892dd5d46e3bb4028474bc72..508b91c5c385ff7e34fae595105396ba94bc4d66 100644 (file)
@@ -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<data::SignalData> sig_data = _session.get_data();
index 25e43b8a36c17b7feedf914c8fc2dd95e4c9cbac..c25ed78ada3f90a8cab3d6d4a9c7964c83c2a4a9 100644 (file)
@@ -126,6 +126,8 @@ public:
 
        void normalize_layout();
 
+       void update_viewport();
+
 signals:
        void hover_point_changed();