]> sigrok.org Git - pulseview.git/commitdiff
Remove data_ also for LogicSignal and use SignalBase data instead
authorSoeren Apel <redacted>
Tue, 16 Aug 2016 19:14:55 +0000 (21:14 +0200)
committerUwe Hermann <redacted>
Thu, 18 Aug 2016 22:36:03 +0000 (00:36 +0200)
pv/session.cpp
pv/view/logicsignal.cpp
pv/view/logicsignal.hpp

index 9d00a51032c649455b15eceab0f7dfdead57e335..a61224048b018701cad13b891db4baf00a50a8b7 100644 (file)
@@ -417,11 +417,6 @@ void Session::update_signals()
                        if (iter != prev_sigs.end()) {
                                // Copy the signal from the old set to the new
                                signal = *iter;
-                               auto logic_signal = dynamic_pointer_cast<
-                                       view::LogicSignal>(signal);
-                               if (logic_signal)
-                                       logic_signal->set_logic_data(
-                                               logic_data_);
                        } else {
                                // Create a new signal
                                signalbase = shared_ptr<data::SignalBase>(
@@ -429,9 +424,10 @@ void Session::update_signals()
 
                                switch(channel->type()->id()) {
                                case SR_CHANNEL_LOGIC:
+                                       signalbase->set_data(logic_data_);
                                        signal = shared_ptr<view::Signal>(
                                                new view::LogicSignal(*this,
-                                                       device_, signalbase, logic_data_));
+                                                       device_, signalbase));
                                        all_signal_data_.insert(logic_data_);
                                        signalbases_.insert(signalbase);
                                        break;
index 52a2d22dab76050dfdf4345801dd74724dcf198b..b8be8bbad0eb4a7c2ab438291f131b436e559263 100644 (file)
@@ -99,12 +99,10 @@ QCache<QString, const QPixmap> LogicSignal::pixmap_cache_;
 LogicSignal::LogicSignal(
        pv::Session &session,
        shared_ptr<devices::Device> device,
-       shared_ptr<data::SignalBase> base,
-       shared_ptr<data::Logic> data) :
+       shared_ptr<data::SignalBase> base) :
        Signal(session, base),
        signal_height_(QFontMetrics(QApplication::font()).height() * 2),
        device_(device),
-       data_(data),
        trigger_none_(nullptr),
        trigger_rising_(nullptr),
        trigger_high_(nullptr),
@@ -128,17 +126,12 @@ LogicSignal::LogicSignal(
 
 shared_ptr<pv::data::SignalData> LogicSignal::data() const
 {
-       return data_;
+       return base_->logic_data();
 }
 
 shared_ptr<pv::data::Logic> LogicSignal::logic_data() const
 {
-       return data_;
-}
-
-void LogicSignal::set_logic_data(std::shared_ptr<pv::data::Logic> data)
-{
-       data_ = data;
+       return base_->logic_data();
 }
 
 std::pair<int, int> LogicSignal::v_extents() const
@@ -167,7 +160,6 @@ void LogicSignal::paint_mid(QPainter &p, const ViewItemPaintParams &pp)
        vector< pair<int64_t, bool> > edges;
 
        assert(base_);
-       assert(data_);
        assert(owner_);
 
        const int y = get_visual_y();
@@ -179,7 +171,7 @@ void LogicSignal::paint_mid(QPainter &p, const ViewItemPaintParams &pp)
        const float low_offset = y + 0.5f;
 
        const deque< shared_ptr<pv::data::LogicSegment> > &segments =
-               data_->logic_segments();
+               base_->logic_data()->logic_segments();
        if (segments.empty())
                return;
 
index 14eeed4baf82bbd272e390c46468d8e30d9b1dd8..8274b618a541b565126aa4c67562292957e29cd8 100644 (file)
@@ -66,8 +66,7 @@ private:
 public:
        LogicSignal(pv::Session &session,
                std::shared_ptr<devices::Device> device,
-               std::shared_ptr<data::SignalBase> base,
-               std::shared_ptr<pv::data::Logic> data);
+               std::shared_ptr<data::SignalBase> base);
 
        virtual ~LogicSignal() = default;
 
@@ -75,8 +74,6 @@ public:
 
        std::shared_ptr<pv::data::Logic> logic_data() const;
 
-       void set_logic_data(std::shared_ptr<pv::data::Logic> data);
-
        /**
         * Computes the vertical extents of the contents of this row item.
         * @return A pair containing the minimum and maximum y-values.
@@ -134,7 +131,6 @@ private:
        int signal_height_;
 
        std::shared_ptr<pv::devices::Device> device_;
-       std::shared_ptr<pv::data::Logic> data_;
 
        const sigrok::TriggerMatchType *trigger_match_;
        QToolBar *trigger_bar_;