pv/view/analogsignal.cpp
pv/view/cursor.cpp
pv/view/cursorpair.cpp
- pv/view/decodesignal.cpp
+ pv/view/decodetrace.cpp
pv/view/header.cpp
pv/view/marginwidget.cpp
pv/view/logicsignal.cpp
pv/prop/string.h
pv/toolbars/samplingbar.h
pv/view/cursor.h
- pv/view/decodesignal.h
+ pv/view/decodetrace.h
pv/view/header.h
pv/view/logicsignal.h
pv/view/marginwidget.h
#include "data/logicsnapshot.h"
#include "view/analogsignal.h"
-#include "view/decodesignal.h"
+#include "view/decodetrace.h"
#include "view/logicsignal.h"
#include <assert.h>
decoder->set_probes(probes);
// Create the decode signal
- shared_ptr<view::DecodeSignal> d(
- new view::DecodeSignal(*this, decoder,
+ shared_ptr<view::DecodeTrace> d(
+ new view::DecodeTrace(*this, decoder,
_decode_traces.size()));
_decode_traces.push_back(d);
}
return true;
}
-vector< shared_ptr<view::DecodeSignal> > SigSession::get_decode_signals() const
+vector< shared_ptr<view::DecodeTrace> > SigSession::get_decode_signals() const
{
lock_guard<mutex> lock(_signals_mutex);
return _decode_traces;
}
-void SigSession::remove_decode_signal(view::DecodeSignal *signal)
+void SigSession::remove_decode_signal(view::DecodeTrace *signal)
{
- for (vector< shared_ptr<view::DecodeSignal> >::iterator i =
+ for (vector< shared_ptr<view::DecodeTrace> >::iterator i =
_decode_traces.begin();
i != _decode_traces.end();
i++)
}
namespace view {
-class DecodeSignal;
+class DecodeTrace;
class LogicSignal;
class Signal;
}
bool add_decoder(srd_decoder *const dec);
- std::vector< boost::shared_ptr<view::DecodeSignal> >
+ std::vector< boost::shared_ptr<view::DecodeTrace> >
get_decode_signals() const;
- void remove_decode_signal(view::DecodeSignal *signal);
+ void remove_decode_signal(view::DecodeTrace *signal);
private:
void set_capture_state(capture_state state);
*/
struct sr_dev_inst *_sdi;
- std::vector< boost::shared_ptr<view::DecodeSignal> > _decode_traces;
+ std::vector< boost::shared_ptr<view::DecodeTrace> > _decode_traces;
mutable boost::mutex _sampling_mutex;
capture_state _capture_state;
+++ /dev/null
-/*
- * This file is part of the PulseView project.
- *
- * Copyright (C) 2012 Joel Holdsworth <joel@airwebreathe.org.uk>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-extern "C" {
-#include <libsigrokdecode/libsigrokdecode.h>
-}
-
-#include <extdef.h>
-
-#include <boost/foreach.hpp>
-
-#include <QAction>
-#include <QComboBox>
-#include <QFormLayout>
-#include <QLabel>
-#include <QMenu>
-
-#include "decodesignal.h"
-
-#include <pv/sigsession.h>
-#include <pv/data/decoder.h>
-#include <pv/view/logicsignal.h>
-#include <pv/view/view.h>
-#include <pv/view/decode/annotation.h>
-
-using namespace boost;
-using namespace std;
-
-namespace pv {
-namespace view {
-
-const QColor DecodeSignal::DecodeColours[4] = {
- QColor(0xEF, 0x29, 0x29), // Red
- QColor(0xFC, 0xE9, 0x4F), // Yellow
- QColor(0x8A, 0xE2, 0x34), // Green
- QColor(0x72, 0x9F, 0xCF) // Blue
-};
-
-const QColor DecodeSignal::ErrorBgColour = QColor(0xEF, 0x29, 0x29);
-
-DecodeSignal::DecodeSignal(pv::SigSession &session,
- boost::shared_ptr<pv::data::Decoder> decoder, int index) :
- Trace(session, QString(decoder->decoder()->name)),
- _decoder(decoder),
- _binding(decoder)
-{
- assert(_decoder);
-
- _colour = DecodeColours[index % countof(DecodeColours)];
-
- connect(_decoder.get(), SIGNAL(new_decode_data()),
- this, SLOT(on_new_decode_data()));
-}
-
-bool DecodeSignal::enabled() const
-{
- return true;
-}
-
-const boost::shared_ptr<pv::data::Decoder>& DecodeSignal::decoder() const
-{
- return _decoder;
-}
-
-void DecodeSignal::set_view(pv::view::View *view)
-{
- assert(view);
- Trace::set_view(view);
-}
-
-void DecodeSignal::paint_back(QPainter &p, int left, int right)
-{
- paint_axis(p, get_y(), left, right);
-}
-
-void DecodeSignal::paint_mid(QPainter &p, int left, int right)
-{
- using namespace pv::view::decode;
-
- assert(_decoder);
- const QString err = _decoder->error_message();
- if (!err.isEmpty()) {
- draw_error(p, err, left, right);
- return;
- }
-
- assert(_view);
- const int y = get_y();
-
- const double scale = _view->scale();
- assert(scale > 0);
-
- double samplerate = _decoder->get_samplerate();
-
- // Show sample rate as 1Hz when it is unknown
- if (samplerate == 0.0)
- samplerate = 1.0;
-
- const double pixels_offset = (_view->offset() -
- _decoder->get_start_time()) / scale;
- const double samples_per_pixel = samplerate * scale;
-
- assert(_decoder);
- vector< shared_ptr<Annotation> > annotations(_decoder->annotations());
- BOOST_FOREACH(shared_ptr<Annotation> a, annotations) {
- assert(a);
- a->paint(p, get_text_colour(), _text_size.height(),
- left, right, samples_per_pixel, pixels_offset, y);
- }
-}
-
-void DecodeSignal::populate_popup_form(QWidget *parent, QFormLayout *form)
-{
- const GSList *probe;
-
- assert(form);
- assert(parent);
- assert(_decoder);
-
- const srd_decoder *const decoder = _decoder->decoder();
-
- assert(decoder);
-
- Trace::populate_popup_form(parent, form);
-
- form->addRow(new QLabel(tr("<h3>Probes</h3>"), parent));
-
- _probe_selector_map.clear();
-
- // Add the mandatory probes
- for(probe = decoder->probes; probe; probe = probe->next) {
- const struct srd_probe *const p =
- (struct srd_probe *)probe->data;
- QComboBox *const combo = create_probe_selector(parent, p);
- connect(combo, SIGNAL(currentIndexChanged(int)),
- this, SLOT(on_probe_selected(int)));
- form->addRow(tr("<b>%1</b> (%2) *")
- .arg(p->name).arg(p->desc), combo);
-
- _probe_selector_map[p] = combo;
- }
-
- // Add the optional probes
- for(probe = decoder->opt_probes; probe; probe = probe->next) {
- const struct srd_probe *const p =
- (struct srd_probe *)probe->data;
- QComboBox *const combo = create_probe_selector(parent, p);
- connect(combo, SIGNAL(currentIndexChanged(int)),
- this, SLOT(on_probe_selected(int)));
- form->addRow(tr("<b>%1</b> (%2)")
- .arg(p->name).arg(p->desc), combo);
-
- _probe_selector_map[p] = combo;
- }
-
- form->addRow(new QLabel(
- tr("<i>* Required Probes</i>"), parent));
-
- // Add the options
- if (!_binding.properties().empty()) {
- form->addRow(new QLabel(tr("<h3>Options</h3>"),
- parent));
- _binding.add_properties_to_form(form, true);
- }
-}
-
-QMenu* DecodeSignal::create_context_menu(QWidget *parent)
-{
- QMenu *const menu = Trace::create_context_menu(parent);
-
- menu->addSeparator();
-
- QAction *const del = new QAction(tr("Delete"), this);
- del->setShortcuts(QKeySequence::Delete);
- connect(del, SIGNAL(triggered()), this, SLOT(on_delete()));
- menu->addAction(del);
-
- return menu;
-}
-
-void DecodeSignal::draw_error(QPainter &p, const QString &message,
- int left, int right)
-{
- const int y = get_y();
-
- p.setPen(ErrorBgColour.darker());
- p.setBrush(ErrorBgColour);
-
- const QRectF bounding_rect =
- QRectF(left, INT_MIN / 2 + y, right - left, INT_MAX);
- const QRectF text_rect = p.boundingRect(bounding_rect,
- Qt::AlignCenter, message);
- const float r = text_rect.height() / 4;
-
- p.drawRoundedRect(text_rect.adjusted(-r, -r, r, r), r, r,
- Qt::AbsoluteSize);
-
- p.setPen(get_text_colour());
- p.drawText(text_rect, message);
-}
-
-QComboBox* DecodeSignal::create_probe_selector(
- QWidget *parent, const srd_probe *const probe)
-{
- const vector< shared_ptr<Signal> > sigs = _session.get_signals();
-
- assert(_decoder);
- const map<const srd_probe*,
- shared_ptr<LogicSignal> >::const_iterator probe_iter =
- _decoder->probes().find(probe);
-
- QComboBox *selector = new QComboBox(parent);
-
- selector->addItem("-", qVariantFromValue((void*)NULL));
-
- if (probe_iter == _decoder->probes().end())
- selector->setCurrentIndex(0);
-
- for(size_t i = 0; i < sigs.size(); i++) {
- const shared_ptr<view::Signal> s(sigs[i]);
- assert(s);
-
- if (dynamic_pointer_cast<LogicSignal>(s) && s->enabled())
- {
- selector->addItem(s->get_name(),
- qVariantFromValue((void*)s.get()));
- if ((*probe_iter).second == s)
- selector->setCurrentIndex(i + 1);
- }
- }
-
- return selector;
-}
-
-void DecodeSignal::commit_probes()
-{
- assert(_decoder);
-
- map<const srd_probe*, shared_ptr<LogicSignal> > probe_map;
- const vector< shared_ptr<Signal> > sigs = _session.get_signals();
-
- for(map<const srd_probe*, QComboBox*>::const_iterator i =
- _probe_selector_map.begin();
- i != _probe_selector_map.end(); i++)
- {
- const QComboBox *const combo = (*i).second;
- const LogicSignal *const selection =
- (LogicSignal*)combo->itemData(combo->currentIndex()).
- value<void*>();
-
- BOOST_FOREACH(shared_ptr<Signal> s, sigs)
- if(s.get() == selection) {
- probe_map[(*i).first] =
- dynamic_pointer_cast<LogicSignal>(s);
- break;
- }
- }
-
- _decoder->set_probes(probe_map);
-}
-
-void DecodeSignal::on_new_decode_data()
-{
- if (_view)
- _view->update_viewport();
-}
-
-void DecodeSignal::delete_pressed()
-{
- on_delete();
-}
-
-void DecodeSignal::on_delete()
-{
- _session.remove_decode_signal(this);
-}
-
-void DecodeSignal::on_probe_selected(int)
-{
- commit_probes();
-}
-
-} // namespace view
-} // namespace pv
+++ /dev/null
-/*
- * This file is part of the PulseView project.
- *
- * Copyright (C) 2012 Joel Holdsworth <joel@airwebreathe.org.uk>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef PULSEVIEW_PV_VIEW_DECODESIGNAL_H
-#define PULSEVIEW_PV_VIEW_DECODESIGNAL_H
-
-#include "trace.h"
-
-#include <map>
-
-#include <boost/shared_ptr.hpp>
-
-#include <pv/prop/binding/decoderoptions.h>
-
-struct srd_probe;
-
-class QComboBox;
-
-namespace pv {
-
-namespace data {
-class Decoder;
-}
-
-namespace view {
-
-class DecodeSignal : public Trace
-{
- Q_OBJECT
-
-private:
- static const QColor DecodeColours[4];
- static const QColor ErrorBgColour;
-
-public:
- DecodeSignal(pv::SigSession &session,
- boost::shared_ptr<pv::data::Decoder> decoder, int index);
-
- bool enabled() const;
-
- const boost::shared_ptr<pv::data::Decoder>& decoder() const;
-
- void set_view(pv::view::View *view);
-
- /**
- * Paints the background layer of the trace with a QPainter
- * @param p the QPainter to paint into.
- * @param left the x-coordinate of the left edge of the signal.
- * @param right the x-coordinate of the right edge of the signal.
- **/
- void paint_back(QPainter &p, int left, int right);
-
- /**
- * Paints the mid-layer of the trace with a QPainter
- * @param p the QPainter to paint into.
- * @param left the x-coordinate of the left edge of the signal
- * @param right the x-coordinate of the right edge of the signal
- **/
- void paint_mid(QPainter &p, int left, int right);
-
- void populate_popup_form(QWidget *parent, QFormLayout *form);
-
- QMenu* create_context_menu(QWidget *parent);
-
- void delete_pressed();
-
-private:
- void draw_error(QPainter &p, const QString &message,
- int left, int right);
-
- QComboBox* create_probe_selector(
- QWidget *parent, const srd_probe *const probe);
-
- void commit_probes();
-
-private slots:
- void on_new_decode_data();
-
- void on_delete();
-
- void on_probe_selected(int);
-
-private:
- boost::shared_ptr<pv::data::Decoder> _decoder;
-
- uint64_t _decode_start, _decode_end;
-
- pv::prop::binding::DecoderOptions _binding;
-
- std::map<const srd_probe*, QComboBox*> _probe_selector_map;
-};
-
-} // namespace view
-} // namespace pv
-
-#endif // PULSEVIEW_PV_VIEW_DECODESIGNAL_H
--- /dev/null
+/*
+ * This file is part of the PulseView project.
+ *
+ * Copyright (C) 2012 Joel Holdsworth <joel@airwebreathe.org.uk>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+extern "C" {
+#include <libsigrokdecode/libsigrokdecode.h>
+}
+
+#include <extdef.h>
+
+#include <boost/foreach.hpp>
+
+#include <QAction>
+#include <QComboBox>
+#include <QFormLayout>
+#include <QLabel>
+#include <QMenu>
+
+#include "decodetrace.h"
+
+#include <pv/sigsession.h>
+#include <pv/data/decoder.h>
+#include <pv/view/logicsignal.h>
+#include <pv/view/view.h>
+#include <pv/view/decode/annotation.h>
+
+using namespace boost;
+using namespace std;
+
+namespace pv {
+namespace view {
+
+const QColor DecodeTrace::DecodeColours[4] = {
+ QColor(0xEF, 0x29, 0x29), // Red
+ QColor(0xFC, 0xE9, 0x4F), // Yellow
+ QColor(0x8A, 0xE2, 0x34), // Green
+ QColor(0x72, 0x9F, 0xCF) // Blue
+};
+
+const QColor DecodeTrace::ErrorBgColour = QColor(0xEF, 0x29, 0x29);
+
+DecodeTrace::DecodeTrace(pv::SigSession &session,
+ boost::shared_ptr<pv::data::Decoder> decoder, int index) :
+ Trace(session, QString(decoder->decoder()->name)),
+ _decoder(decoder),
+ _binding(decoder)
+{
+ assert(_decoder);
+
+ _colour = DecodeColours[index % countof(DecodeColours)];
+
+ connect(_decoder.get(), SIGNAL(new_decode_data()),
+ this, SLOT(on_new_decode_data()));
+}
+
+bool DecodeTrace::enabled() const
+{
+ return true;
+}
+
+const boost::shared_ptr<pv::data::Decoder>& DecodeTrace::decoder() const
+{
+ return _decoder;
+}
+
+void DecodeTrace::set_view(pv::view::View *view)
+{
+ assert(view);
+ Trace::set_view(view);
+}
+
+void DecodeTrace::paint_back(QPainter &p, int left, int right)
+{
+ paint_axis(p, get_y(), left, right);
+}
+
+void DecodeTrace::paint_mid(QPainter &p, int left, int right)
+{
+ using namespace pv::view::decode;
+
+ assert(_decoder);
+ const QString err = _decoder->error_message();
+ if (!err.isEmpty()) {
+ draw_error(p, err, left, right);
+ return;
+ }
+
+ assert(_view);
+ const int y = get_y();
+
+ const double scale = _view->scale();
+ assert(scale > 0);
+
+ double samplerate = _decoder->get_samplerate();
+
+ // Show sample rate as 1Hz when it is unknown
+ if (samplerate == 0.0)
+ samplerate = 1.0;
+
+ const double pixels_offset = (_view->offset() -
+ _decoder->get_start_time()) / scale;
+ const double samples_per_pixel = samplerate * scale;
+
+ assert(_decoder);
+ vector< shared_ptr<Annotation> > annotations(_decoder->annotations());
+ BOOST_FOREACH(shared_ptr<Annotation> a, annotations) {
+ assert(a);
+ a->paint(p, get_text_colour(), _text_size.height(),
+ left, right, samples_per_pixel, pixels_offset, y);
+ }
+}
+
+void DecodeTrace::populate_popup_form(QWidget *parent, QFormLayout *form)
+{
+ const GSList *probe;
+
+ assert(form);
+ assert(parent);
+ assert(_decoder);
+
+ const srd_decoder *const decoder = _decoder->decoder();
+
+ assert(decoder);
+
+ Trace::populate_popup_form(parent, form);
+
+ form->addRow(new QLabel(tr("<h3>Probes</h3>"), parent));
+
+ _probe_selector_map.clear();
+
+ // Add the mandatory probes
+ for(probe = decoder->probes; probe; probe = probe->next) {
+ const struct srd_probe *const p =
+ (struct srd_probe *)probe->data;
+ QComboBox *const combo = create_probe_selector(parent, p);
+ connect(combo, SIGNAL(currentIndexChanged(int)),
+ this, SLOT(on_probe_selected(int)));
+ form->addRow(tr("<b>%1</b> (%2) *")
+ .arg(p->name).arg(p->desc), combo);
+
+ _probe_selector_map[p] = combo;
+ }
+
+ // Add the optional probes
+ for(probe = decoder->opt_probes; probe; probe = probe->next) {
+ const struct srd_probe *const p =
+ (struct srd_probe *)probe->data;
+ QComboBox *const combo = create_probe_selector(parent, p);
+ connect(combo, SIGNAL(currentIndexChanged(int)),
+ this, SLOT(on_probe_selected(int)));
+ form->addRow(tr("<b>%1</b> (%2)")
+ .arg(p->name).arg(p->desc), combo);
+
+ _probe_selector_map[p] = combo;
+ }
+
+ form->addRow(new QLabel(
+ tr("<i>* Required Probes</i>"), parent));
+
+ // Add the options
+ if (!_binding.properties().empty()) {
+ form->addRow(new QLabel(tr("<h3>Options</h3>"),
+ parent));
+ _binding.add_properties_to_form(form, true);
+ }
+}
+
+QMenu* DecodeTrace::create_context_menu(QWidget *parent)
+{
+ QMenu *const menu = Trace::create_context_menu(parent);
+
+ menu->addSeparator();
+
+ QAction *const del = new QAction(tr("Delete"), this);
+ del->setShortcuts(QKeySequence::Delete);
+ connect(del, SIGNAL(triggered()), this, SLOT(on_delete()));
+ menu->addAction(del);
+
+ return menu;
+}
+
+void DecodeTrace::draw_error(QPainter &p, const QString &message,
+ int left, int right)
+{
+ const int y = get_y();
+
+ p.setPen(ErrorBgColour.darker());
+ p.setBrush(ErrorBgColour);
+
+ const QRectF bounding_rect =
+ QRectF(left, INT_MIN / 2 + y, right - left, INT_MAX);
+ const QRectF text_rect = p.boundingRect(bounding_rect,
+ Qt::AlignCenter, message);
+ const float r = text_rect.height() / 4;
+
+ p.drawRoundedRect(text_rect.adjusted(-r, -r, r, r), r, r,
+ Qt::AbsoluteSize);
+
+ p.setPen(get_text_colour());
+ p.drawText(text_rect, message);
+}
+
+QComboBox* DecodeTrace::create_probe_selector(
+ QWidget *parent, const srd_probe *const probe)
+{
+ const vector< shared_ptr<Signal> > sigs = _session.get_signals();
+
+ assert(_decoder);
+ const map<const srd_probe*,
+ shared_ptr<LogicSignal> >::const_iterator probe_iter =
+ _decoder->probes().find(probe);
+
+ QComboBox *selector = new QComboBox(parent);
+
+ selector->addItem("-", qVariantFromValue((void*)NULL));
+
+ if (probe_iter == _decoder->probes().end())
+ selector->setCurrentIndex(0);
+
+ for(size_t i = 0; i < sigs.size(); i++) {
+ const shared_ptr<view::Signal> s(sigs[i]);
+ assert(s);
+
+ if (dynamic_pointer_cast<LogicSignal>(s) && s->enabled())
+ {
+ selector->addItem(s->get_name(),
+ qVariantFromValue((void*)s.get()));
+ if ((*probe_iter).second == s)
+ selector->setCurrentIndex(i + 1);
+ }
+ }
+
+ return selector;
+}
+
+void DecodeTrace::commit_probes()
+{
+ assert(_decoder);
+
+ map<const srd_probe*, shared_ptr<LogicSignal> > probe_map;
+ const vector< shared_ptr<Signal> > sigs = _session.get_signals();
+
+ for(map<const srd_probe*, QComboBox*>::const_iterator i =
+ _probe_selector_map.begin();
+ i != _probe_selector_map.end(); i++)
+ {
+ const QComboBox *const combo = (*i).second;
+ const LogicSignal *const selection =
+ (LogicSignal*)combo->itemData(combo->currentIndex()).
+ value<void*>();
+
+ BOOST_FOREACH(shared_ptr<Signal> s, sigs)
+ if(s.get() == selection) {
+ probe_map[(*i).first] =
+ dynamic_pointer_cast<LogicSignal>(s);
+ break;
+ }
+ }
+
+ _decoder->set_probes(probe_map);
+}
+
+void DecodeTrace::on_new_decode_data()
+{
+ if (_view)
+ _view->update_viewport();
+}
+
+void DecodeTrace::delete_pressed()
+{
+ on_delete();
+}
+
+void DecodeTrace::on_delete()
+{
+ _session.remove_decode_signal(this);
+}
+
+void DecodeTrace::on_probe_selected(int)
+{
+ commit_probes();
+}
+
+} // namespace view
+} // namespace pv
--- /dev/null
+/*
+ * This file is part of the PulseView project.
+ *
+ * Copyright (C) 2012 Joel Holdsworth <joel@airwebreathe.org.uk>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#ifndef PULSEVIEW_PV_VIEW_DECODETRACE_H
+#define PULSEVIEW_PV_VIEW_DECODETRACE_H
+
+#include "trace.h"
+
+#include <map>
+
+#include <boost/shared_ptr.hpp>
+
+#include <pv/prop/binding/decoderoptions.h>
+
+struct srd_probe;
+
+class QComboBox;
+
+namespace pv {
+
+namespace data {
+class Decoder;
+}
+
+namespace view {
+
+class DecodeTrace : public Trace
+{
+ Q_OBJECT
+
+private:
+ static const QColor DecodeColours[4];
+ static const QColor ErrorBgColour;
+
+public:
+ DecodeTrace(pv::SigSession &session,
+ boost::shared_ptr<pv::data::Decoder> decoder, int index);
+
+ bool enabled() const;
+
+ const boost::shared_ptr<pv::data::Decoder>& decoder() const;
+
+ void set_view(pv::view::View *view);
+
+ /**
+ * Paints the background layer of the trace with a QPainter
+ * @param p the QPainter to paint into.
+ * @param left the x-coordinate of the left edge of the signal.
+ * @param right the x-coordinate of the right edge of the signal.
+ **/
+ void paint_back(QPainter &p, int left, int right);
+
+ /**
+ * Paints the mid-layer of the trace with a QPainter
+ * @param p the QPainter to paint into.
+ * @param left the x-coordinate of the left edge of the signal
+ * @param right the x-coordinate of the right edge of the signal
+ **/
+ void paint_mid(QPainter &p, int left, int right);
+
+ void populate_popup_form(QWidget *parent, QFormLayout *form);
+
+ QMenu* create_context_menu(QWidget *parent);
+
+ void delete_pressed();
+
+private:
+ void draw_error(QPainter &p, const QString &message,
+ int left, int right);
+
+ QComboBox* create_probe_selector(
+ QWidget *parent, const srd_probe *const probe);
+
+ void commit_probes();
+
+private slots:
+ void on_new_decode_data();
+
+ void on_delete();
+
+ void on_probe_selected(int);
+
+private:
+ boost::shared_ptr<pv::data::Decoder> _decoder;
+
+ uint64_t _decode_start, _decode_end;
+
+ pv::prop::binding::DecoderOptions _binding;
+
+ std::map<const srd_probe*, QComboBox*> _probe_selector_map;
+};
+
+} // namespace view
+} // namespace pv
+
+#endif // PULSEVIEW_PV_VIEW_DECODETRACE_H
#include <QMouseEvent>
#include <QScrollBar>
-#include "decodesignal.h"
+#include "decodetrace.h"
#include "header.h"
#include "ruler.h"
#include "signal.h"
{
const vector< shared_ptr<Signal> > sigs(
session().get_signals());
- const vector< shared_ptr<DecodeSignal> > decode_sigs(
+ const vector< shared_ptr<DecodeTrace> > decode_sigs(
session().get_decode_signals());
vector< shared_ptr<Trace> > traces(
sigs.size() + decode_sigs.size());
${PROJECT_SOURCE_DIR}/pv/view/analogsignal.cpp
${PROJECT_SOURCE_DIR}/pv/view/cursor.cpp
${PROJECT_SOURCE_DIR}/pv/view/cursorpair.cpp
- ${PROJECT_SOURCE_DIR}/pv/view/decodesignal.cpp
+ ${PROJECT_SOURCE_DIR}/pv/view/decodetrace.cpp
${PROJECT_SOURCE_DIR}/pv/view/header.cpp
${PROJECT_SOURCE_DIR}/pv/view/logicsignal.cpp
${PROJECT_SOURCE_DIR}/pv/view/marginwidget.cpp
${PROJECT_SOURCE_DIR}/pv/prop/property.h
${PROJECT_SOURCE_DIR}/pv/prop/string.h
${PROJECT_SOURCE_DIR}/pv/view/cursor.h
- ${PROJECT_SOURCE_DIR}/pv/view/decodesignal.h
+ ${PROJECT_SOURCE_DIR}/pv/view/decodetrace.h
${PROJECT_SOURCE_DIR}/pv/view/header.h
${PROJECT_SOURCE_DIR}/pv/view/logicsignal.h
${PROJECT_SOURCE_DIR}/pv/view/marginwidget.h
#include "../../pv/data/decoder.h"
#include "../../pv/devicemanager.h"
#include "../../pv/sigsession.h"
-#include "../../pv/view/decodesignal.h"
+#include "../../pv/view/decodetrace.h"
using namespace boost;
using namespace std;
ss.add_decoder(dec);
// Check the signals were created
- const vector< shared_ptr<view::DecodeSignal> > sigs =
+ const vector< shared_ptr<view::DecodeTrace> > sigs =
ss.get_decode_signals();
shared_ptr<data::Decoder> dec0 = sigs[0]->decoder();