--- /dev/null
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://creativecommons.org/ns#"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ version="1.1"
+ width="22"
+ height="22"
+ id="svg2989">
+ <defs
+ id="defs2991" />
+ <metadata
+ id="metadata2994">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ <dc:title></dc:title>
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <path
+ d="m 19.426489,11.070664 a 11,11 0 0 1 -16.8529782,-1e-6"
+ transform="matrix(1.1867339,0,0,1.1867339,-2.0540724,-2.1379314)"
+ id="path3053"
+ style="fill:none;stroke:#000000;stroke-width:1.26397336" />
+</svg>
--- /dev/null
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://creativecommons.org/ns#"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ version="1.1"
+ width="22"
+ height="22"
+ id="svg2989">
+ <defs
+ id="defs2991" />
+ <metadata
+ id="metadata2994">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ <dc:title></dc:title>
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <path
+ d="M 13.390812,-9.3707772 A 5.87888,5.87888 0 0 1 14.476134,0.74106762"
+ transform="matrix(0.89442417,0,0,0.89442417,1.1613345,14.644558)"
+ id="path2989"
+ style="fill:none;stroke:#000000;stroke-width:0.5;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0" />
+ <path
+ d="m 12,-4 a 1,1 0 1 1 -2,0 1,1 0 1 1 2,0 z"
+ transform="matrix(1.3065319,0,0,1.3065319,-3.3718505,16.219638)"
+ id="path2995"
+ style="fill:#000000;stroke:none" />
+ <path
+ d="M 10.875,6.34375 C 7.9493854,6.36765 5.0099958,7.3787791 2.59375,9.40625 2.0116039,9.8947285 1.4884785,10.417854 1,11 1.4884785,11.582146 2.0116039,12.105271 2.59375,12.59375 8.1165975,17.227969 16.365781,16.522848 21,11 18.393252,7.8933983 14.636505,6.3130214 10.875,6.34375 z"
+ id="path3053"
+ style="fill:none;stroke:#000000;stroke-width:1.5" />
+ <path
+ d="M 7.5357022,0.74972325 A 5.87888,5.87888 0 0 1 8.1948438,-9.1664619"
+ transform="matrix(0.89442417,0,0,0.89442417,1.1613345,14.644558)"
+ id="path3057"
+ style="fill:none;stroke:#000000;stroke-width:0.5;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0" />
+</svg>
namespace decode {
Decoder::Decoder(const srd_decoder *const dec) :
- _decoder(dec)
+ _decoder(dec),
+ _shown(true)
{
}
return _decoder;
}
+bool Decoder::shown() const
+{
+ return _shown;
+}
+
+void Decoder::show(bool show)
+{
+ _shown = show;
+}
+
const map<const srd_probe*, shared_ptr<view::LogicSignal> >&
Decoder::probes() const
{
const srd_decoder* decoder() const;
+ bool shown() const;
+ void show(bool show = true);
+
const std::map<const srd_probe*,
boost::shared_ptr<view::LogicSignal> >& probes() const;
void set_probes(std::map<const srd_probe*,
private:
const srd_decoder *const _decoder;
+
+ bool _shown;
+
std::map<const srd_probe*, boost::shared_ptr<pv::view::LogicSignal> >
_probes;
std::map<std::string, GVariant*> _options;
return _samples_decoded;
}
-std::vector<Row> DecoderStack::get_rows() const
+std::vector<Row> DecoderStack::get_visible_rows() const
{
lock_guard<mutex> lock(_mutex);
BOOST_FOREACH (const shared_ptr<decode::Decoder> &dec, _stack)
{
assert(dec);
+ if (!dec->shown())
+ continue;
+
const srd_decoder *const decc = dec->decoder();
assert(dec->decoder());
int64_t samples_decoded() const;
- std::vector<decode::Row> get_rows() const;
+ std::vector<decode::Row> get_visible_rows() const;
/**
* Extracts sorted annotations between two period into a vector.
Trace(session, QString::fromUtf8(
decoder_stack->stack().front()->decoder()->name)),
_decoder_stack(decoder_stack),
- _delete_mapper(this)
+ _delete_mapper(this),
+ _show_hide_mapper(this)
{
assert(_decoder_stack);
this, SLOT(on_new_decode_data()));
connect(&_delete_mapper, SIGNAL(mapped(int)),
this, SLOT(on_delete_decoder(int)));
+ connect(&_show_hide_mapper, SIGNAL(mapped(int)),
+ this, SLOT(on_show_hide_decoder(int)));
}
bool DecodeTrace::enabled() const
assert(_decoder_stack);
- const vector<Row> rows(_decoder_stack->get_rows());
+ const vector<Row> rows(_decoder_stack->get_visible_rows());
for (size_t i = 0; i < rows.size(); i++)
{
const Row &row = rows[i];
// Add the decoder options
_bindings.clear();
_probe_selectors.clear();
+ _decoder_forms.clear();
const list< shared_ptr<Decoder> >& stack = _decoder_stack->stack();
pv::widgets::DecoderGroupBox *const group =
new pv::widgets::DecoderGroupBox(
QString::fromUtf8(decoder->name));
+ group->set_decoder_visible(dec->shown());
_delete_mapper.setMapping(group, index);
connect(group, SIGNAL(delete_decoder()), &_delete_mapper, SLOT(map()));
+ _show_hide_mapper.setMapping(group, index);
+ connect(group, SIGNAL(show_hide_decoder()),
+ &_show_hide_mapper, SLOT(map()));
+
QFormLayout *const decoder_form = new QFormLayout;
group->add_layout(decoder_form);
_bindings.push_back(binding);
form->addRow(group);
+ _decoder_forms.push_back(group);
}
QComboBox* DecodeTrace::create_probe_selector(
_decoder_stack->begin_decode();
}
+void DecodeTrace::on_show_hide_decoder(int index)
+{
+ using pv::data::decode::Decoder;
+
+ const list< shared_ptr<Decoder> > stack(_decoder_stack->stack());
+
+ // Find the decoder in the stack
+ list< shared_ptr<Decoder> >::const_iterator iter = stack.begin();
+ for(int i = 0; i < index; i++, iter++)
+ assert(iter != stack.end());
+
+ shared_ptr<Decoder> dec = *iter;
+ assert(dec);
+
+ const bool show = !dec->shown();
+ dec->show(show);
+
+ assert(index < (int)_decoder_forms.size());
+ _decoder_forms[index]->set_decoder_visible(show);
+
+ _view->update_viewport();
+}
+
} // namespace view
} // namespace pv
}
}
+namespace widgets {
+class DecoderGroupBox;
+}
+
namespace view {
class DecodeTrace : public Trace
void on_delete_decoder(int index);
+ void on_show_hide_decoder(int index);
+
private:
boost::shared_ptr<pv::data::DecoderStack> _decoder_stack;
_bindings;
std::list<ProbeSelector> _probe_selectors;
+ std::vector<pv::widgets::DecoderGroupBox*> _decoder_forms;
- QSignalMapper _delete_mapper;
+ QSignalMapper _delete_mapper, _show_hide_mapper;
};
} // namespace view
DecoderGroupBox::DecoderGroupBox(QString title, QWidget *parent) :
QWidget(parent),
- _layout(new QGridLayout)
+ _layout(new QGridLayout),
+ _show_hide_button(QIcon(":/icons/decoder-shown.svg"), QString(), this)
{
_layout->setContentsMargins(0, 0, 0, 0);
setLayout(_layout);
QHBoxLayout *const toolbar = new QHBoxLayout;
_layout->addLayout(toolbar, 0, 1);
+ _show_hide_button.setFlat(true);
+ _show_hide_button.setIconSize(QSize(16, 16));
+ connect(&_show_hide_button, SIGNAL(clicked()),
+ this, SIGNAL(show_hide_decoder()));
+ toolbar->addWidget(&_show_hide_button);
+
QPushButton *const delete_button = new QPushButton(
QIcon(":/icons/decoder-delete.svg"), QString(), this);
delete_button->setFlat(true);
_layout->addLayout(layout, 1, 0, 1, 2);
}
+void DecoderGroupBox::set_decoder_visible(bool visible)
+{
+ _show_hide_button.setIcon(QIcon(visible ?
+ ":/icons/decoder-shown.svg" :
+ ":/icons/decoder-hidden.svg"));
+}
+
} // widgets
} // pv
#ifndef PULSEVIEW_PV_WIDGETS_DECODERGROUPBox_H
#define PULSEVIEW_PV_WIDGETS_DECODERGROUPBOX_H
-#include <QWidget>
+#include <QPushButton>
class QGridLayout;
class QToolBar;
void add_layout(QLayout *layout);
+ void set_decoder_visible(bool visible);
+
signals:
void delete_decoder();
+ void show_hide_decoder();
+
private:
QGridLayout *const _layout;
+ QPushButton _show_hide_button;
};
} // widgets