]> sigrok.org Git - pulseview.git/commitdiff
Rename Trace::channel_ to Trace::base_, including dependencies
authorSoeren Apel <redacted>
Tue, 16 Aug 2016 19:10:40 +0000 (21:10 +0200)
committerUwe Hermann <redacted>
Thu, 18 Aug 2016 22:36:02 +0000 (00:36 +0200)
14 files changed:
pv/data/decode/decoder.cpp
pv/popups/channels.cpp
pv/session.cpp
pv/storesession.cpp
pv/view/analogsignal.cpp
pv/view/analogsignal.hpp
pv/view/decodetrace.cpp
pv/view/logicsignal.cpp
pv/view/logicsignal.hpp
pv/view/signal.cpp
pv/view/signal.hpp
pv/view/trace.cpp
pv/view/trace.hpp
pv/view/view.cpp

index 1513b20be5cb70156db3dfe33c43c8c0e4fd594b..bd1d307fb5d00006bb4aa01d611d37467c681b82 100644 (file)
@@ -137,7 +137,7 @@ srd_decoder_inst* Decoder::create_decoder_inst(srd_session *session) const
        for (const auto& channel : channels_) {
                shared_ptr<view::LogicSignal> signal(channel.second);
                GVariant *const gvar = g_variant_new_int32(
-                       signal->channel()->index());
+                       signal->base()->index());
                g_variant_ref_sink(gvar);
                g_hash_table_insert(channels, channel.first->id, gvar);
        }
index 7489b93f81b832d0f8bb64586155c75b7502556c..f8f94d1a4273534d09fbf9a2bb6766db518810c7 100644 (file)
@@ -83,7 +83,7 @@ Channels::Channels(Session &session, QWidget *parent) :
 
        unordered_set< shared_ptr<SignalBase> > sigs;
        for (const shared_ptr<view::Signal> s : session_.signals())
-               sigs.insert(s->channel());
+               sigs.insert(s->base());
 
        for (const shared_ptr<SignalBase> &sig : sigs)
                signal_map[sig->channel()] = sig;
index 9c3a2c259e2a635f2eed79f5a8a607a9c33d490c..e1a1f010cf065dcad630f391161f819b5f494f0e 100644 (file)
@@ -299,7 +299,7 @@ bool Session::add_decoder(srd_decoder *const dec)
                                        dynamic_pointer_cast<view::LogicSignal>(s);
                                if (l && QString::fromUtf8(pdch->name).
                                        toLower().contains(
-                                       s->channel()->name().toLower()))
+                                       s->base()->name().toLower()))
                                        channels[pdch] = l;
                        }
 
@@ -412,7 +412,7 @@ void Session::update_signals()
                        const auto iter = std::find_if(
                                prev_sigs.cbegin(), prev_sigs.cend(),
                                [&](const shared_ptr<view::Signal> &s) {
-                                       return s->channel()->channel() == channel;
+                                       return s->base()->channel() == channel;
                                });
                        if (iter != prev_sigs.end()) {
                                // Copy the signal from the old set to the new
index f8ab2e69bc78c1a2ed985e86d176c662b56084d3..00f6af63ed0a9e1374e673bbc5adfb22e9db3b54 100644 (file)
@@ -151,7 +151,7 @@ bool StoreSession::start()
                        asegment_list.push_back(asegments.front());
                        any_segment = asegments.front();
 
-                       achannel_list.push_back(signal->channel());
+                       achannel_list.push_back(signal->base());
                }
        }
 
index 8ccad390eb4730ee8436d34007f133833579d329..cd57da06b6073e0143f3f859bad2b70a8120a426 100644 (file)
@@ -71,9 +71,9 @@ const int AnalogSignal::InfoTextMarginBottom = 5;
 
 AnalogSignal::AnalogSignal(
        pv::Session &session,
-       shared_ptr<data::SignalBase> channel,
+       shared_ptr<data::SignalBase> base,
        shared_ptr<data::Analog> data) :
-       Signal(session, channel),
+       Signal(session, base),
        data_(data),
        scale_index_(4), // 20 per div
        scale_index_drag_offset_(0),
@@ -81,7 +81,7 @@ AnalogSignal::AnalogSignal(
        vdivs_(1),
        resolution_(0)
 {
-       channel_->set_colour(SignalColours[channel_->index() % countof(SignalColours)]);
+       base_->set_colour(SignalColours[base_->index() % countof(SignalColours)]);
        update_scale();
 }
 
@@ -127,7 +127,7 @@ void AnalogSignal::scale_handle_drag_release()
 
 void AnalogSignal::paint_back(QPainter &p, const ViewItemPaintParams &pp)
 {
-       if (channel_->enabled()) {
+       if (base_->enabled()) {
                Trace::paint_back(p, pp);
                paint_axis(p, pp, get_visual_y());
        }
@@ -140,7 +140,7 @@ void AnalogSignal::paint_mid(QPainter &p, const ViewItemPaintParams &pp)
 
        const int y = get_visual_y();
 
-       if (!channel_->enabled())
+       if (!base_->enabled())
                return;
 
        paint_grid(p, y, pp.left(), pp.right());
@@ -186,7 +186,7 @@ void AnalogSignal::paint_fore(QPainter &p, const ViewItemPaintParams &pp)
        // Show the info section on the right side of the trace
        const QString infotext = QString("%1 V/div").arg(resolution_);
 
-       p.setPen(channel_->colour());
+       p.setPen(base_->colour());
        p.setFont(QApplication::font());
 
        const QRectF bounding_rect = QRectF(pp.left(),
@@ -235,7 +235,7 @@ void AnalogSignal::paint_trace(QPainter &p,
        const float *const samples = segment->get_samples(start, end);
        assert(samples);
 
-       p.setPen(channel_->colour());
+       p.setPen(base_->colour());
 
        QPointF *points = new QPointF[sample_count];
        QPointF *point = points;
@@ -267,7 +267,7 @@ void AnalogSignal::paint_envelope(QPainter &p,
                return;
 
        p.setPen(QPen(Qt::NoPen));
-       p.setBrush(channel_->colour());
+       p.setBrush(base_->colour());
 
        QRectF *const rects = new QRectF[e.length];
        QRectF *rect = rects;
index 601ae110d0403fb9c54745dff5e156a030f9f828..f35fe79f1eb839ee719f452c3ca0183b4c7348ad 100644 (file)
@@ -53,7 +53,7 @@ private:
 
 public:
        AnalogSignal(pv::Session &session,
-               std::shared_ptr<data::SignalBase> channel,
+               std::shared_ptr<data::SignalBase> base,
                std::shared_ptr<pv::data::Analog> data);
 
        virtual ~AnalogSignal() = default;
index 3ece1303ca513e5d40b6bc0d49848aa66dbea56c..2d9a6bf82227a3b50f59c3fa746a216fcc5e3ef5 100644 (file)
@@ -851,8 +851,8 @@ QComboBox* DecodeTrace::create_channel_selector(
        vector< shared_ptr<Signal> > sig_list(sigs.begin(), sigs.end());
        std::sort(sig_list.begin(), sig_list.end(),
                [](const shared_ptr<Signal> &a, const shared_ptr<Signal> b) {
-                       return strnatcasecmp(a->channel()->name().toStdString(),
-                               b->channel()->name().toStdString()) < 0; });
+                       return strnatcasecmp(a->base()->name().toStdString(),
+                               b->base()->name().toStdString()) < 0; });
 
        assert(decoder_stack_);
        const auto channel_iter = dec->channels().find(pdch);
@@ -867,7 +867,7 @@ QComboBox* DecodeTrace::create_channel_selector(
        for (const shared_ptr<view::Signal> &s : sig_list) {
                assert(s);
                if (dynamic_pointer_cast<LogicSignal>(s) && s->enabled()) {
-                       selector->addItem(s->channel()->name(),
+                       selector->addItem(s->base()->name(),
                                qVariantFromValue((void*)s.get()));
 
                        if (channel_iter != dec->channels().end() &&
index 7bb2ee0caebaa9803e51f56af205d80520491e21..52a2d22dab76050dfdf4345801dd74724dcf198b 100644 (file)
@@ -99,9 +99,9 @@ QCache<QString, const QPixmap> LogicSignal::pixmap_cache_;
 LogicSignal::LogicSignal(
        pv::Session &session,
        shared_ptr<devices::Device> device,
-       shared_ptr<data::SignalBase> channel,
+       shared_ptr<data::SignalBase> base,
        shared_ptr<data::Logic> data) :
-       Signal(session, channel),
+       Signal(session, base),
        signal_height_(QFontMetrics(QApplication::font()).height() * 2),
        device_(device),
        data_(data),
@@ -114,7 +114,7 @@ LogicSignal::LogicSignal(
 {
        shared_ptr<Trigger> trigger;
 
-       channel_->set_colour(SignalColours[channel->index() % countof(SignalColours)]);
+       base_->set_colour(SignalColours[base->index() % countof(SignalColours)]);
 
        /* Populate this channel's trigger setting with whatever we
         * find in the current session trigger, if anything. */
@@ -122,7 +122,7 @@ LogicSignal::LogicSignal(
        if ((trigger = session_.session()->trigger()))
                for (auto stage : trigger->stages())
                        for (auto match : stage->matches())
-                               if (match->channel() == channel_->channel())
+                               if (match->channel() == base_->channel())
                                        trigger_match_ = match->type();
 }
 
@@ -166,13 +166,13 @@ void LogicSignal::paint_mid(QPainter &p, const ViewItemPaintParams &pp)
 
        vector< pair<int64_t, bool> > edges;
 
-       assert(channel_);
+       assert(base_);
        assert(data_);
        assert(owner_);
 
        const int y = get_visual_y();
 
-       if (!channel_->enabled())
+       if (!base_->enabled())
                return;
 
        const float high_offset = y - signal_height_ + 0.5f;
@@ -205,7 +205,7 @@ void LogicSignal::paint_mid(QPainter &p, const ViewItemPaintParams &pp)
                (int64_t)0), last_sample);
 
        segment->get_subsampled_edges(edges, start_sample, end_sample,
-               samples_per_pixel / Oversampling, channel_->index());
+               samples_per_pixel / Oversampling, base_->index());
        assert(edges.size() >= 2);
 
        // Paint the edges
@@ -240,7 +240,7 @@ void LogicSignal::paint_mid(QPainter &p, const ViewItemPaintParams &pp)
 void LogicSignal::paint_fore(QPainter &p, const ViewItemPaintParams &pp)
 {
        // Draw the trigger marker
-       if (!trigger_match_ || !channel_->enabled())
+       if (!trigger_match_ || !base_->enabled())
                return;
 
        const int y = get_visual_y();
@@ -430,12 +430,12 @@ void LogicSignal::modify_trigger()
                        const auto &matches = stage->matches();
                        if (std::none_of(matches.begin(), matches.end(),
                            [&](shared_ptr<TriggerMatch> match) {
-                                       return match->channel() != channel_->channel(); }))
+                                       return match->channel() != base_->channel(); }))
                                continue;
 
                        auto new_stage = new_trigger->add_stage();
                        for (auto match : stage->matches()) {
-                               if (match->channel() == channel_->channel())
+                               if (match->channel() == base_->channel())
                                        continue;
                                new_stage->add_match(match->channel(), match->type());
                        }
@@ -449,7 +449,7 @@ void LogicSignal::modify_trigger()
                if (new_trigger->stages().empty())
                        new_trigger->add_stage();
 
-               new_trigger->stages().back()->add_match(channel_->channel(),
+               new_trigger->stages().back()->add_match(base_->channel(),
                        trigger_match_);
        }
 
index 9bd91ba93a54eb6994f5569337921aa7580f472c..14eeed4baf82bbd272e390c46468d8e30d9b1dd8 100644 (file)
@@ -66,7 +66,7 @@ private:
 public:
        LogicSignal(pv::Session &session,
                std::shared_ptr<devices::Device> device,
-               std::shared_ptr<data::SignalBase> channel,
+               std::shared_ptr<data::SignalBase> base,
                std::shared_ptr<pv::data::Logic> data);
 
        virtual ~LogicSignal() = default;
index fc90eba1fcd11cf6f5b5d0e132895304b8cbc9f9..a8de4d504aaa36b0fdb9960fb4f5b72c5b2391ae 100644 (file)
@@ -67,7 +67,7 @@ Signal::Signal(pv::Session &session,
        items_({scale_handle_}),
        name_widget_(nullptr)
 {
-       assert(channel_);
+       assert(base_);
 }
 
 void Signal::set_name(QString name)
@@ -80,20 +80,20 @@ void Signal::set_name(QString name)
 
 bool Signal::enabled() const
 {
-       return channel_->enabled();
+       return base_->enabled();
 }
 
 void Signal::enable(bool enable)
 {
-       channel_->set_enabled(enable);
+       base_->set_enabled(enable);
 
        if (owner_)
                owner_->extents_changed(true, true);
 }
 
-shared_ptr<data::SignalBase> Signal::channel() const
+shared_ptr<data::SignalBase> Signal::base() const
 {
-       return channel_;
+       return base_;
 }
 
 const ViewItemOwner::item_list& Signal::child_items() const
@@ -103,7 +103,7 @@ const ViewItemOwner::item_list& Signal::child_items() const
 
 void Signal::paint_back(QPainter &p, const ViewItemPaintParams &pp)
 {
-       if (channel_->enabled())
+       if (base_->enabled())
                Trace::paint_back(p, pp);
 }
 
@@ -116,10 +116,10 @@ void Signal::populate_popup_form(QWidget *parent, QFormLayout *form)
        for (unsigned int i = 0; i < countof(ChannelNames); i++)
                name_widget_->insertItem(i, ChannelNames[i]);
 
-       const int index = name_widget_->findText(channel_->name(), Qt::MatchExactly);
+       const int index = name_widget_->findText(base_->name(), Qt::MatchExactly);
 
        if (index == -1) {
-               name_widget_->insertItem(0, channel_->name());
+               name_widget_->insertItem(0, base_->name());
                name_widget_->setCurrentIndex(0);
        } else {
                name_widget_->setCurrentIndex(index);
index 36d87d4594d0a6def78eb2f29daeb1c42408ace4..72c97e1d00c6f1720cc5cebabfbb38ee05b7f0a9 100644 (file)
@@ -66,7 +66,7 @@ public:
 
        void enable(bool enable = true);
 
-       std::shared_ptr<data::SignalBase> channel() const;
+       std::shared_ptr<data::SignalBase> base() const;
 
        /**
         * Returns a list of row items owned by this object.
index d6a4fec6045ad1bf21ee3dd5ee3d01685d43c47c..d9cccdb649e94a0669be4d30084323341cc5077d 100644 (file)
@@ -45,7 +45,7 @@ const QColor Trace::BrightGrayBGColour = QColor(0, 0, 0, 10*255/100);
 const QColor Trace::DarkGrayBGColour = QColor(0, 0, 0, 15*255/100);
 
 Trace::Trace(std::shared_ptr<data::SignalBase> channel) :
-       channel_(channel),
+       base_(channel),
        coloured_bg_(true), // Default setting is set in MainWindow::setup_ui()
        popup_(nullptr),
        popup_form_(nullptr)
@@ -65,7 +65,7 @@ void Trace::paint_label(QPainter &p, const QRect &rect, bool hover)
 {
        const int y = get_visual_y();
 
-       p.setBrush(channel_->colour());
+       p.setBrush(base_->colour());
 
        if (!enabled())
                return;
@@ -96,23 +96,23 @@ void Trace::paint_label(QPainter &p, const QRect &rect, bool hover)
        }
 
        p.setPen(Qt::transparent);
-       p.setBrush(hover ? channel_->colour().lighter() : channel_->colour());
+       p.setBrush(hover ? base_->colour().lighter() : base_->colour());
        p.drawPolygon(points, countof(points));
 
-       p.setPen(channel_->colour().lighter());
+       p.setPen(base_->colour().lighter());
        p.setBrush(Qt::transparent);
        p.drawPolygon(highlight_points, countof(highlight_points));
 
-       p.setPen(channel_->colour().darker());
+       p.setPen(base_->colour().darker());
        p.setBrush(Qt::transparent);
        p.drawPolygon(points, countof(points));
 
        // Paint the text
-       p.setPen(select_text_colour(channel_->colour()));
+       p.setPen(select_text_colour(base_->colour()));
        p.setFont(QApplication::font());
        p.drawText(QRectF(r.x(), r.y(),
                r.width() - label_arrow_length, r.height()),
-               Qt::AlignCenter | Qt::AlignVCenter, channel_->name());
+               Qt::AlignCenter | Qt::AlignVCenter, base_->name());
 }
 
 QMenu* Trace::create_context_menu(QWidget *parent)
@@ -144,7 +144,7 @@ QRectF Trace::label_rect(const QRectF &rect) const
 
        QFontMetrics m(QApplication::font());
        const QSize text_size(
-               m.boundingRect(QRect(), 0, channel_->name()).width(), m.height());
+               m.boundingRect(QRect(), 0, base_->name()).width(), m.height());
        const QSizeF label_size(
                text_size.width() + LabelPadding.width() * 2,
                ceilf((text_size.height() + LabelPadding.height() * 2) / 2) * 2);
@@ -159,7 +159,7 @@ QRectF Trace::label_rect(const QRectF &rect) const
 void Trace::paint_back(QPainter &p, const ViewItemPaintParams &pp)
 {
        if (coloured_bg_)
-               p.setBrush(channel_->bgcolour());
+               p.setBrush(base_->bgcolour());
        else
                p.setBrush(bgcolour_state_ ? BrightGrayBGColour : DarkGrayBGColour);
 
@@ -192,7 +192,7 @@ void Trace::add_colour_option(QWidget *parent, QFormLayout *form)
        ColourButton *const colour_button = new ColourButton(
                TracePalette::Rows, TracePalette::Cols, parent);
        colour_button->set_palette(TracePalette::Colours);
-       colour_button->set_colour(channel_->colour());
+       colour_button->set_colour(base_->colour());
        connect(colour_button, SIGNAL(selected(const QColor&)),
                this, SLOT(on_colouredit_changed(const QColor&)));
 
@@ -222,7 +222,7 @@ void Trace::create_popup_form()
 void Trace::populate_popup_form(QWidget *parent, QFormLayout *form)
 {
        QLineEdit *const name_edit = new QLineEdit(parent);
-       name_edit->setText(channel_->name());
+       name_edit->setText(base_->name());
        connect(name_edit, SIGNAL(textChanged(const QString&)),
                this, SLOT(on_nameedit_changed(const QString&)));
        form->addRow(tr("Name"), name_edit);
@@ -232,12 +232,12 @@ void Trace::populate_popup_form(QWidget *parent, QFormLayout *form)
 
 void Trace::set_name(QString name)
 {
-       channel_->set_name(name);
+       base_->set_name(name);
 }
 
 void Trace::set_colour(QColor colour)
 {
-       channel_->set_colour(colour);
+       base_->set_colour(colour);
 }
 
 void Trace::on_name_changed(const QString &text)
index 397ec7c0d108380719d13313114eb6d9553dafd8..0a6735f59d0787539fec1ef1cdac4e5eb91c645c 100644 (file)
@@ -127,7 +127,7 @@ private Q_SLOTS:
        void on_colouredit_changed(const QColor &colour);
 
 protected:
-       std::shared_ptr<data::SignalBase> channel_;
+       std::shared_ptr<data::SignalBase> base_;
        bool coloured_bg_, coloured_bg_state_;
 
 private:
index e7308ddf69f0586064b0112e2586d07eab423957..570e7b766a4c80f980e5feb5e9417f0c12b3d0b9 100644 (file)
@@ -976,7 +976,7 @@ void View::signals_changed()
        unordered_map<shared_ptr<data::SignalBase>, shared_ptr<Signal> >
                signal_map;
        for (const shared_ptr<Signal> &sig : sigs)
-               signal_map[sig->channel()] = sig;
+               signal_map[sig->base()] = sig;
 
        // Populate channel groups
        if (sr_dev)