From: Joel Holdsworth Date: Sun, 2 Dec 2012 15:07:12 +0000 (+0000) Subject: Added SigSession::signals_changed signals to indicate when signals are created X-Git-Tag: pulseview-0.1.0~207 X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=69dd2b030f0bf289fe3132cf3c0f3725c578a916;p=pulseview.git Added SigSession::signals_changed signals to indicate when signals are created --- diff --git a/pv/sigsession.cpp b/pv/sigsession.cpp index 137998bd..e8585c5f 100644 --- a/pv/sigsession.cpp +++ b/pv/sigsession.cpp @@ -167,6 +167,7 @@ void SigSession::data_feed_in(const struct sr_dev_inst *sdi, } } + signals_changed(); break; } diff --git a/pv/sigsession.h b/pv/sigsession.h index 744d8340..763fc169 100644 --- a/pv/sigsession.h +++ b/pv/sigsession.h @@ -81,6 +81,8 @@ private: std::auto_ptr _sampling_thread; signals: + void signals_changed(); + void data_updated(); private: diff --git a/pv/view/view.cpp b/pv/view/view.cpp index c5465ff3..7a444f7c 100644 --- a/pv/view/view.cpp +++ b/pv/view/view.cpp @@ -79,6 +79,9 @@ View::View(SigSession &session, QWidget *parent) : this, SLOT(h_scroll_value_changed(int))); connect(verticalScrollBar(), SIGNAL(valueChanged(int)), this, SLOT(v_scroll_value_changed(int))); + + connect(&_session, SIGNAL(signals_changed()), + this, SLOT(signals_changed())); connect(&_session, SIGNAL(data_updated()), this, SLOT(data_updated())); @@ -307,6 +310,11 @@ void View::v_scroll_value_changed(int value) _viewport->update(); } +void View::signals_changed() +{ + reset_signal_layout(); +} + void View::data_updated() { // Get the new data length @@ -326,9 +334,6 @@ void View::data_updated() // Repaint the view _viewport->update(); - - /// @todo: Call this only once when the signals are first created. - reset_signal_layout(); } void View::marker_time_changed() diff --git a/pv/view/view.h b/pv/view/view.h index 3cd2646e..5a10ee9e 100644 --- a/pv/view/view.h +++ b/pv/view/view.h @@ -131,6 +131,7 @@ private slots: void h_scroll_value_changed(int value); void v_scroll_value_changed(int value); + void signals_changed(); void data_updated(); void marker_time_changed();