From: Joel Holdsworth Date: Thu, 13 Nov 2014 12:31:56 +0000 (+0000) Subject: Signal: Added a reference to _session X-Git-Tag: pulseview-0.3.0~513 X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=b86aa8f4a22857a90bbfca6e7993b2deaf1157d4;p=pulseview.git Signal: Added a reference to _session --- diff --git a/pv/sigsession.cpp b/pv/sigsession.cpp index eb4cd513..2d695af3 100644 --- a/pv/sigsession.cpp +++ b/pv/sigsession.cpp @@ -359,7 +359,8 @@ void SigSession::update_signals(shared_ptr device) switch(channel->type()->id()) { case SR_CHANNEL_LOGIC: signal = shared_ptr( - new view::LogicSignal(device, channel, _logic_data)); + new view::LogicSignal(*this, device, + channel, _logic_data)); break; case SR_CHANNEL_ANALOG: @@ -367,7 +368,8 @@ void SigSession::update_signals(shared_ptr device) shared_ptr data( new data::Analog()); signal = shared_ptr( - new view::AnalogSignal(channel, data)); + new view::AnalogSignal( + *this, channel, data)); break; } diff --git a/pv/view/analogsignal.cpp b/pv/view/analogsignal.cpp index 7b49bbd2..38468942 100644 --- a/pv/view/analogsignal.cpp +++ b/pv/view/analogsignal.cpp @@ -49,9 +49,11 @@ const QColor AnalogSignal::SignalColours[4] = { const float AnalogSignal::EnvelopeThreshold = 256.0f; -AnalogSignal::AnalogSignal(shared_ptr channel, +AnalogSignal::AnalogSignal( + pv::SigSession &session, + shared_ptr channel, shared_ptr data) : - Signal(channel), + Signal(session, channel), _data(data), _scale(1.0f) { diff --git a/pv/view/analogsignal.h b/pv/view/analogsignal.h index 4070a8aa..a7ae455b 100644 --- a/pv/view/analogsignal.h +++ b/pv/view/analogsignal.h @@ -42,7 +42,8 @@ private: static const float EnvelopeThreshold; public: - AnalogSignal(std::shared_ptr channel, + AnalogSignal(pv::SigSession &session, + std::shared_ptr channel, std::shared_ptr data); virtual ~AnalogSignal(); diff --git a/pv/view/logicsignal.cpp b/pv/view/logicsignal.cpp index 76890aa0..e214ec78 100644 --- a/pv/view/logicsignal.cpp +++ b/pv/view/logicsignal.cpp @@ -72,10 +72,12 @@ const QColor LogicSignal::SignalColours[10] = { QColor(0xEE, 0xEE, 0xEC), // White }; -LogicSignal::LogicSignal(shared_ptr device, - shared_ptr channel, - shared_ptr data) : - Signal(channel), +LogicSignal::LogicSignal( + pv::SigSession &session, + shared_ptr device, + shared_ptr channel, + shared_ptr data) : + Signal(session, channel), _device(device), _data(data), _trigger_none(NULL), diff --git a/pv/view/logicsignal.h b/pv/view/logicsignal.h index 11b1d2bd..48129380 100644 --- a/pv/view/logicsignal.h +++ b/pv/view/logicsignal.h @@ -54,7 +54,8 @@ private: static const QColor SignalColours[10]; public: - LogicSignal(std::shared_ptr device, + LogicSignal(pv::SigSession &session, + std::shared_ptr device, std::shared_ptr channel, std::shared_ptr data); diff --git a/pv/view/signal.cpp b/pv/view/signal.cpp index 16ebc74d..fab76fcf 100644 --- a/pv/view/signal.cpp +++ b/pv/view/signal.cpp @@ -58,8 +58,10 @@ const char *const ChannelNames[] = { "SCL" }; -Signal::Signal(shared_ptr channel) : +Signal::Signal(pv::SigSession &session, + std::shared_ptr channel) : Trace(channel->name().c_str()), + _session(session), _channel(channel), _name_widget(NULL), _updating_name_widget(false) diff --git a/pv/view/signal.h b/pv/view/signal.h index 7028b29e..b7666ee6 100644 --- a/pv/view/signal.h +++ b/pv/view/signal.h @@ -36,6 +36,8 @@ namespace sigrok { namespace pv { +class SigSession; + namespace data { class SignalData; } @@ -47,7 +49,8 @@ class Signal : public Trace Q_OBJECT protected: - Signal(std::shared_ptr channel); + Signal(pv::SigSession &session, + std::shared_ptr channel); public: /** @@ -76,6 +79,7 @@ private Q_SLOTS: void on_disable(); protected: + pv::SigSession &_session; std::shared_ptr _channel; QComboBox *_name_widget;