From a4e991f181e5ac3470aa28a9a7bce74bc5c6ac61 Mon Sep 17 00:00:00 2001 From: DreamSourceLab Date: Sun, 3 May 2015 19:13:23 +0800 Subject: [PATCH 1/6] fix assert fail of mouse measure when capture count less than set sample count --- DSView/pv/view/logicsignal.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/DSView/pv/view/logicsignal.cpp b/DSView/pv/view/logicsignal.cpp index 4750a115..83db2e7c 100644 --- a/DSView/pv/view/logicsignal.cpp +++ b/DSView/pv/view/logicsignal.cpp @@ -288,7 +288,7 @@ bool LogicSignal::measure(const QPointF &p, uint64_t &index0, uint64_t &index1, return false; uint64_t index = _data->samplerate() * (_view->offset() - _data->get_start_time() + p.x() * _view->scale()); - if (index == 0) + if (index == 0 || index >= (snapshot->get_sample_count() - 1)) return false; const uint64_t sig_mask = 1ULL << get_index(); From e91c93f673fb835a039c6f5b83ce7dee2cb3a9a0 Mon Sep 17 00:00:00 2001 From: DreamSourceLab Date: Sun, 3 May 2015 20:14:17 +0800 Subject: [PATCH 2/6] fix decode issue when capture count less than set sample count --- DSView/pv/data/decoderstack.cpp | 5 +++++ DSView/pv/data/decoderstack.h | 2 ++ DSView/pv/view/decodetrace.cpp | 3 ++- 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/DSView/pv/data/decoderstack.cpp b/DSView/pv/data/decoderstack.cpp index 5e5ca875..b78b9996 100644 --- a/DSView/pv/data/decoderstack.cpp +++ b/DSView/pv/data/decoderstack.cpp @@ -433,6 +433,11 @@ void DecoderStack::decode_proc() _decode_state = Stopped; } +uint64_t DecoderStack::sample_count() const +{ + return _sample_count; +} + void DecoderStack::annotation_callback(srd_proto_data *pdata, void *decoder) { assert(pdata); diff --git a/DSView/pv/data/decoderstack.h b/DSView/pv/data/decoderstack.h index 955230a8..19c518a4 100644 --- a/DSView/pv/data/decoderstack.h +++ b/DSView/pv/data/decoderstack.h @@ -120,6 +120,8 @@ public: void options_changed(bool changed); + uint64_t sample_count() const; + private: boost::optional wait_for_data() const; diff --git a/DSView/pv/view/decodetrace.cpp b/DSView/pv/view/decodetrace.cpp index 6a4b080c..a478d9db 100644 --- a/DSView/pv/view/decodetrace.cpp +++ b/DSView/pv/view/decodetrace.cpp @@ -547,7 +547,8 @@ bool DecodeTrace::draw_unresolved_period(QPainter &p, int h, int left, shared_ptr data; shared_ptr logic_signal; - const int64_t sample_count = _session.get_device()->get_sample_limit(); + //const int64_t sample_count = _session.get_device()->get_sample_limit(); + const int64_t sample_count = _decoder_stack->sample_count(); if (sample_count == 0) return true; From 6dc75374bd1d769db77873ffed7ed320954efa06 Mon Sep 17 00:00:00 2001 From: DreamSourceLab Date: Mon, 4 May 2015 15:13:27 +0800 Subject: [PATCH 3/6] keep channel setting when reload @ LA mode --- DSView/pv/sigsession.cpp | 24 +++++++++++++++++------- DSView/pv/view/decodetrace.cpp | 2 +- DSView/pv/view/logicsignal.cpp | 9 +++++++++ DSView/pv/view/logicsignal.h | 4 ++++ DSView/pv/view/signal.cpp | 7 +++++++ DSView/pv/view/signal.h | 5 +++++ DSView/pv/view/trace.cpp | 29 +++++++++++++++++------------ DSView/pv/view/trace.h | 8 ++++++-- DSView/pv/view/view.cpp | 5 ++++- 9 files changed, 70 insertions(+), 23 deletions(-) diff --git a/DSView/pv/sigsession.cpp b/DSView/pv/sigsession.cpp index b122fbee..2a4f5006 100644 --- a/DSView/pv/sigsession.cpp +++ b/DSView/pv/sigsession.cpp @@ -667,6 +667,7 @@ void SigSession::init_signals() assert(_dev_inst); stop_capture(); + vector< boost::shared_ptr > sigs; boost::shared_ptr signal; unsigned int logic_probe_count = 0; unsigned int dso_probe_count = 0; @@ -726,8 +727,6 @@ void SigSession::init_signals() // Make the logic probe list { - _signals.clear(); - for (const GSList *l = _dev_inst->dev_inst()->channels; l; l = l->next) { const sr_channel *const probe = (const sr_channel *)l->data; @@ -752,8 +751,13 @@ void SigSession::init_signals() break; } if(signal.get()) - _signals.push_back(signal); + sigs.push_back(signal); } + + _signals.clear(); + vector< boost::shared_ptr >().swap(_signals); + _signals = sigs; + signals_changed(); data_updated(); } @@ -766,12 +770,11 @@ void SigSession::reload() if (_capture_state == Running) stop_capture(); + vector< boost::shared_ptr > sigs; boost::shared_ptr signal; // Make the logic probe list { - _signals.clear(); - for (const GSList *l = _dev_inst->dev_inst()->channels; l; l = l->next) { const sr_channel *const probe = (const sr_channel *)l->data; @@ -779,7 +782,10 @@ void SigSession::reload() signal.reset(); switch(probe->type) { case SR_CHANNEL_LOGIC: - if (probe->enabled) + if (probe->enabled && probe->index < _signals.size()) + signal = boost::shared_ptr( + new view::LogicSignal(*_signals[probe->index].get(), _logic_data, probe)); + else if (probe->enabled) signal = boost::shared_ptr( new view::LogicSignal(_dev_inst, _logic_data, probe)); break; @@ -796,8 +802,12 @@ void SigSession::reload() break; } if (signal.get()) - _signals.push_back(signal); + sigs.push_back(signal); } + + _signals.clear(); + vector< boost::shared_ptr >().swap(_signals); + _signals = sigs; } signals_changed(); diff --git a/DSView/pv/view/decodetrace.cpp b/DSView/pv/view/decodetrace.cpp index a478d9db..7b0fea45 100644 --- a/DSView/pv/view/decodetrace.cpp +++ b/DSView/pv/view/decodetrace.cpp @@ -117,7 +117,7 @@ const QColor DecodeTrace::OutlineColours[16] = { DecodeTrace::DecodeTrace(pv::SigSession &session, boost::shared_ptr decoder_stack, int index) : Trace(QString::fromUtf8( - decoder_stack->stack().front()->decoder()->name), Trace::DS_DECODER), + decoder_stack->stack().front()->decoder()->name), index, Trace::DS_DECODER), _session(session), _decoder_stack(decoder_stack), _show_hide_mapper(this) diff --git a/DSView/pv/view/logicsignal.cpp b/DSView/pv/view/logicsignal.cpp index 83db2e7c..bd95cc0a 100644 --- a/DSView/pv/view/logicsignal.cpp +++ b/DSView/pv/view/logicsignal.cpp @@ -76,6 +76,15 @@ LogicSignal::LogicSignal(boost::shared_ptr dev_inst, _colour = SignalColours[probe->index % countof(SignalColours)]; } +LogicSignal::LogicSignal(const Signal &s, + boost::shared_ptr data, + const sr_channel * const probe) : + Signal(s, probe), + _data(data) +{ + assert(probe->index >= 0); +} + LogicSignal::~LogicSignal() { } diff --git a/DSView/pv/view/logicsignal.h b/DSView/pv/view/logicsignal.h index 75ea8e4d..9a03464f 100644 --- a/DSView/pv/view/logicsignal.h +++ b/DSView/pv/view/logicsignal.h @@ -58,6 +58,10 @@ public: boost::shared_ptr data, const sr_channel * const probe); + LogicSignal(const Signal &s, + boost::shared_ptr data, + const sr_channel * const probe); + virtual ~LogicSignal(); const sr_channel* probe() const; diff --git a/DSView/pv/view/signal.cpp b/DSView/pv/view/signal.cpp index 4c9c09a5..e4cba490 100644 --- a/DSView/pv/view/signal.cpp +++ b/DSView/pv/view/signal.cpp @@ -42,6 +42,13 @@ Signal::Signal(boost::shared_ptr dev_inst, { } +Signal::Signal(const Signal &s, const sr_channel * const probe) : + Trace((const Trace &)s), + _dev_inst(s._dev_inst), + _probe(probe) +{ +} + bool Signal::enabled() const { return _probe->enabled; diff --git a/DSView/pv/view/signal.h b/DSView/pv/view/signal.h index b599a07c..3ad90f44 100644 --- a/DSView/pv/view/signal.h +++ b/DSView/pv/view/signal.h @@ -59,6 +59,11 @@ protected: Signal(boost::shared_ptr dev_inst, const sr_channel * const probe, int type); + /** + * Copy constructor + */ + Signal(const Signal &s, const sr_channel * const probe); + public: virtual boost::shared_ptr data() const = 0; diff --git a/DSView/pv/view/trace.cpp b/DSView/pv/view/trace.cpp index a6820b9d..e234a723 100644 --- a/DSView/pv/view/trace.cpp +++ b/DSView/pv/view/trace.cpp @@ -53,19 +53,9 @@ const QPen Trace::SignalAxisPen = QColor(128, 128, 128, 64); const QPen Trace::AxisPen(QColor(128, 128, 128, 64)); const int Trace::LabelHitPadding = 2; -Trace::Trace(QString name, int type) : - _name(name), - _v_offset(0), - _type(type), - _sec_index(0), - _signalHeight(30), - _trig(0) -{ -} - Trace::Trace(QString name, int index, int type) : _name(name), - _v_offset(0), + _v_offset(INT_MAX), _type(type), _sec_index(0), _signalHeight(30), @@ -76,7 +66,7 @@ Trace::Trace(QString name, int index, int type) : Trace::Trace(QString name, std::list index_list, int type, int sec_index) : _name(name), - _v_offset(0), + _v_offset(INT_MAX), _type(type), _index_list(index_list), _sec_index(sec_index), @@ -85,6 +75,21 @@ Trace::Trace(QString name, std::list index_list, int type, int sec_index) : { } +Trace::Trace(const Trace &t) : + _view(t._view), + _name(t._name), + _colour(t._colour), + _v_offset(t._v_offset), + _type(t._type), + _index_list(t._index_list), + _sec_index(t._sec_index), + _old_v_offset(t._old_v_offset), + _signalHeight(t._signalHeight), + _trig(t._trig), + _text_size(t._text_size) +{ +} + QString Trace::get_name() const { return _name; diff --git a/DSView/pv/view/trace.h b/DSView/pv/view/trace.h index 8eaae6bc..031f94a7 100644 --- a/DSView/pv/view/trace.h +++ b/DSView/pv/view/trace.h @@ -84,12 +84,16 @@ public: static const QPen SignalAxisPen; protected: - Trace(QString name, int type); Trace(QString name, int index, int type); Trace(QString name, std::list index_list, int type, int sec_index); + /** + * Copy constructor + */ + Trace(const Trace &t); + public: - enum {DS_LOGIC = 0, DS_ANALOG, DS_GROUP, DS_DSO, DS_DECODER}; + enum {DS_LOGIC = 0, DS_ANALOG, DS_DSO, DS_GROUP, DS_DECODER}; public: /** diff --git a/DSView/pv/view/view.cpp b/DSView/pv/view/view.cpp index 4ae18dd9..66f2e415 100644 --- a/DSView/pv/view/view.cpp +++ b/DSView/pv/view/view.cpp @@ -298,7 +298,10 @@ bool View::compare_trace_v_offsets(const boost::shared_ptr &a, { assert(a); assert(b); - return a->get_v_offset() < b->get_v_offset(); + if (a->get_type() != b->get_type()) + return a->get_type() > b->get_type(); + else + return a->get_v_offset() < b->get_v_offset(); } bool View::cursors_shown() const From f34c8b10ec5ef5ec2c2eff6b746326640f394f2d Mon Sep 17 00:00:00 2001 From: DreamSourceLab Date: Thu, 7 May 2015 14:14:53 +0800 Subject: [PATCH 4/6] keep channel settings when reload @ LA mode fix trigger setting @ LA stream mode --- DSView/pv/dock/triggerdock.cpp | 9 +++-- DSView/pv/mainwindow.cpp | 8 +++- DSView/pv/mainwindow.h | 2 + DSView/pv/toolbars/samplingbar.cpp | 62 ++++++++++++++++-------------- DSView/pv/view/ruler.cpp | 10 ++--- DSView/pv/view/ruler.h | 2 +- DSView/pv/view/viewport.cpp | 2 +- 7 files changed, 53 insertions(+), 42 deletions(-) diff --git a/DSView/pv/dock/triggerdock.cpp b/DSView/pv/dock/triggerdock.cpp index 1e382b91..ee4ae6f2 100644 --- a/DSView/pv/dock/triggerdock.cpp +++ b/DSView/pv/dock/triggerdock.cpp @@ -369,11 +369,12 @@ void TriggerDock::device_change() if (stream || strcmp(_session.get_device()->dev_inst()->driver->name, "DSLogic") != 0) { - position_spinBox->setDisabled(true); - position_slider->setDisabled(true); + const int maxRange = SR_MB(11)*100/_session.get_device()->get_sample_limit(); + position_spinBox->setRange(0, maxRange); + position_slider->setRange(0, maxRange); } else { - position_spinBox->setDisabled(false); - position_slider->setDisabled(false); + position_spinBox->setRange(0, 99); + position_slider->setRange(0, 99); } } diff --git a/DSView/pv/mainwindow.cpp b/DSView/pv/mainwindow.cpp index 9725804a..b37dc504 100644 --- a/DSView/pv/mainwindow.cpp +++ b/DSView/pv/mainwindow.cpp @@ -180,7 +180,7 @@ void MainWindow::setup_ui() connect(_sampling_bar, SIGNAL(device_selected()), this, SLOT(update_device_list())); - connect(_sampling_bar, SIGNAL(device_updated()), &_session, + connect(_sampling_bar, SIGNAL(device_updated()), this, SLOT(reload())); connect(_sampling_bar, SIGNAL(run_stop()), this, SLOT(run_stop())); @@ -317,6 +317,12 @@ void MainWindow::update_device_list() _logo_bar->dsl_connected(false); } +void MainWindow::reload() +{ + _trigger_widget->device_change(); + _session.reload(); +} + void MainWindow::load_file(QString file_name) { try { diff --git a/DSView/pv/mainwindow.h b/DSView/pv/mainwindow.h index a52e901c..34566805 100644 --- a/DSView/pv/mainwindow.h +++ b/DSView/pv/mainwindow.h @@ -90,6 +90,8 @@ private slots: */ void update_device_list(); + void reload(); + void show_session_error( const QString text, const QString info_text); diff --git a/DSView/pv/toolbars/samplingbar.cpp b/DSView/pv/toolbars/samplingbar.cpp index b7414547..289fce77 100644 --- a/DSView/pv/toolbars/samplingbar.cpp +++ b/DSView/pv/toolbars/samplingbar.cpp @@ -667,19 +667,21 @@ void SamplingBar::on_run_stop() const shared_ptr dev_inst = get_selected_device(); if (!dev_inst) return; - GVariant* gvar = dev_inst->get_config(NULL, NULL, SR_CONF_ZERO); - if (gvar != NULL) { - bool zero = g_variant_get_boolean(gvar); - g_variant_unref(gvar); - if (zero) { - QMessageBox msg(this); - msg.setText("Zero Adjustment"); - msg.setInformativeText("Please adjust zero skew and save the result!"); - msg.setStandardButtons(QMessageBox::Ok); - msg.setIcon(QMessageBox::Warning); - msg.exec(); - zero_adj(); - return; + if (dev_inst->dev_inst()->mode == DSO) { + GVariant* gvar = dev_inst->get_config(NULL, NULL, SR_CONF_ZERO); + if (gvar != NULL) { + bool zero = g_variant_get_boolean(gvar); + g_variant_unref(gvar); + if (zero) { + QMessageBox msg(this); + msg.setText("Zero Adjustment"); + msg.setInformativeText("Please adjust zero skew and save the result!"); + msg.setStandardButtons(QMessageBox::Ok); + msg.setIcon(QMessageBox::Warning); + msg.exec(); + zero_adj(); + return; + } } } run_stop(); @@ -695,22 +697,24 @@ void SamplingBar::on_instant_stop() const shared_ptr dev_inst = get_selected_device(); if (!dev_inst) return; - GVariant* gvar = dev_inst->get_config(NULL, NULL, SR_CONF_ZERO); - if (gvar != NULL) { - bool zero = g_variant_get_boolean(gvar); - g_variant_unref(gvar); - if (zero) { - QMessageBox msg(this); - msg.setText("Zero Adjustment"); - if(strcmp(dev_inst->dev_inst()->driver->name, "DSLogic") == 0) - msg.setInformativeText("Please adjust zero skew and save the result!\nPlease left both of channels unconnect for zero adjustment!"); - else - msg.setInformativeText("Please adjust zero skew and save the result!"); - msg.setStandardButtons(QMessageBox::Ok); - msg.setIcon(QMessageBox::Warning); - msg.exec(); - zero_adj(); - return; + if (dev_inst->dev_inst()->mode == DSO) { + GVariant* gvar = dev_inst->get_config(NULL, NULL, SR_CONF_ZERO); + if (gvar != NULL) { + bool zero = g_variant_get_boolean(gvar); + g_variant_unref(gvar); + if (zero) { + QMessageBox msg(this); + msg.setText("Zero Adjustment"); + if(strcmp(dev_inst->dev_inst()->driver->name, "DSLogic") == 0) + msg.setInformativeText("Please adjust zero skew and save the result!\nPlease left both of channels unconnect for zero adjustment!"); + else + msg.setInformativeText("Please adjust zero skew and save the result!"); + msg.setStandardButtons(QMessageBox::Ok); + msg.setIcon(QMessageBox::Warning); + msg.exec(); + zero_adj(); + return; + } } } instant_stop(); diff --git a/DSView/pv/view/ruler.cpp b/DSView/pv/view/ruler.cpp index ac920785..0a3b8015 100644 --- a/DSView/pv/view/ruler.cpp +++ b/DSView/pv/view/ruler.cpp @@ -102,9 +102,8 @@ QString Ruler::format_freq(double period, unsigned precision) } else { const int order = ceil(log10f(period)); assert(order >= FirstSIPrefixPower); - const unsigned int prefix = ceil((order - FirstSIPrefixPower) / 3.0f); - const double multiplier = pow(10.0, - static_cast(- prefix * 3 - FirstSIPrefixPower)); + const int prefix = ceil((order - FirstSIPrefixPower) / 3.0f); + const double multiplier = pow(10.0, max(-prefix * 3.0 - FirstSIPrefixPower, 0.0)); QString s; QTextStream ts(&s); @@ -115,11 +114,10 @@ QString Ruler::format_freq(double period, unsigned precision) } } -QString Ruler::format_time(double t, unsigned int prefix, +QString Ruler::format_time(double t, int prefix, unsigned int precision) { - const double multiplier = pow(10.0, - static_cast(- prefix * 3 - FirstSIPrefixPower + 6)); + const double multiplier = pow(10.0, -prefix * 3 - FirstSIPrefixPower + 6.0); QString s; QTextStream ts(&s); diff --git a/DSView/pv/view/ruler.h b/DSView/pv/view/ruler.h index 1f322470..c22d8cce 100644 --- a/DSView/pv/view/ruler.h +++ b/DSView/pv/view/ruler.h @@ -63,7 +63,7 @@ public: public: Ruler(View &parent); - static QString format_time(double t, unsigned int prefix, + static QString format_time(double t, int prefix, unsigned precision = pricision); static QString format_freq(double period, unsigned precision = pricision); QString format_time(double t); diff --git a/DSView/pv/view/viewport.cpp b/DSView/pv/view/viewport.cpp index 4ed6c381..0c362370 100644 --- a/DSView/pv/view/viewport.cpp +++ b/DSView/pv/view/viewport.cpp @@ -320,7 +320,7 @@ void Viewport::paintProgress(QPainter &p) if (triggred) p.drawText(status_rect, Qt::AlignCenter | Qt::AlignVCenter, - "Triggered! " + QString::number(captured_progress)+"% Captured"); + "Triggered! " + QString::number(1-captured_progress)+"% Captured"); else p.drawText(status_rect, Qt::AlignCenter | Qt::AlignVCenter, From adc2365efe4a820e6044de0824265b60b20c5022 Mon Sep 17 00:00:00 2001 From: DreamSourceLab Date: Thu, 7 May 2015 18:47:20 +0800 Subject: [PATCH 5/6] fix stack decoder create issue --- DSView/pv/view/decodetrace.cpp | 48 ++++++++++++++++++++-------------- DSView/pv/view/decodetrace.h | 4 +++ DSView/pv/view/viewport.cpp | 7 +++-- 3 files changed, 37 insertions(+), 22 deletions(-) diff --git a/DSView/pv/view/decodetrace.cpp b/DSView/pv/view/decodetrace.cpp index 7b0fea45..ecac15c1 100644 --- a/DSView/pv/view/decodetrace.cpp +++ b/DSView/pv/view/decodetrace.cpp @@ -120,7 +120,9 @@ DecodeTrace::DecodeTrace(pv::SigSession &session, decoder_stack->stack().front()->decoder()->name), index, Trace::DS_DECODER), _session(session), _decoder_stack(decoder_stack), - _show_hide_mapper(this) + _show_hide_mapper(this), + _popup_form(NULL), + _popup() { assert(_decoder_stack); @@ -297,21 +299,11 @@ void DecodeTrace::paint_fore(QPainter &p, int left, int right) bool DecodeTrace::create_popup() { - // Clear the layout - - // Transfer the layout and the child widgets to a temporary widget - // which then goes out of scope destroying the layout and all the child - // widgets. - //if (_popup_form) - // QWidget().setLayout(_popup_form); - int ret = false; - QDialog popup; - QFormLayout popup_form; - popup.setLayout(&popup_form); - populate_popup_form(&popup, &popup_form); + _popup = new QDialog(); + create_popup_form(); - if (QDialog::Accepted == popup.exec()) + if (QDialog::Accepted == _popup->exec()) { BOOST_FOREACH(shared_ptr dec, _decoder_stack->stack()) @@ -321,12 +313,28 @@ bool DecodeTrace::create_popup() ret = true; } } - return ret; } - else - return false; + + _popup = NULL; + _popup_form = NULL; + + return ret; } +void DecodeTrace::create_popup_form() +{ + // Clear the layout + + // Transfer the layout and the child widgets to a temporary widget + // which then goes out of scope destroying the layout and all the child + // widgets. + if (_popup_form) + QWidget().setLayout(_popup_form); + + _popup_form = new QFormLayout(_popup); + _popup->setLayout(_popup_form); + populate_popup_form(_popup, _popup_form); +} void DecodeTrace::populate_popup_form(QWidget *parent, QFormLayout *form) { @@ -368,8 +376,8 @@ void DecodeTrace::populate_popup_form(QWidget *parent, QFormLayout *form) new pv::widgets::DecoderMenu(parent); connect(decoder_menu, SIGNAL(decoder_selected(srd_decoder*)), this, SLOT(on_stack_decoder(srd_decoder*))); - connect(decoder_menu, SIGNAL(selected()), - parent, SLOT(accept())); + //connect(decoder_menu, SIGNAL(selected()), + // parent, SLOT(accept())); QPushButton *const stack_button = new QPushButton(tr("Stack Decoder"), parent); @@ -769,7 +777,7 @@ void DecodeTrace::on_stack_decoder(srd_decoder *decoder) new data::decode::Decoder(decoder))); //_decoder_stack->begin_decode(); - create_popup(); + create_popup_form(); } void DecodeTrace::on_show_hide_decoder(int index) diff --git a/DSView/pv/view/decodetrace.h b/DSView/pv/view/decodetrace.h index fa1c3db3..a7532dd0 100644 --- a/DSView/pv/view/decodetrace.h +++ b/DSView/pv/view/decodetrace.h @@ -128,6 +128,8 @@ protected: void paint_type_options(QPainter &p, int right, bool hover, int action); private: + void create_popup_form(); + void populate_popup_form(QWidget *parent, QFormLayout *form); void draw_annotation(const pv::data::decode::Annotation &a, QPainter &p, @@ -196,6 +198,8 @@ private: std::vector _cur_row_headings; QSignalMapper _show_hide_mapper; + QFormLayout *_popup_form; + QDialog *_popup; }; } // namespace view diff --git a/DSView/pv/view/viewport.cpp b/DSView/pv/view/viewport.cpp index 0c362370..b6de471e 100644 --- a/DSView/pv/view/viewport.cpp +++ b/DSView/pv/view/viewport.cpp @@ -308,7 +308,10 @@ void Viewport::paintProgress(QPainter &p) (status.captured_cnt1 << 8) + (status.captured_cnt2 << 16) + (status.captured_cnt3 << 24)); - captured_progress = captured_cnt * 100.0 / _total_sample_len; + if (triggred) + captured_progress = (_total_sample_len - captured_cnt) * 100.0 / _total_sample_len; + else + captured_progress = captured_cnt * 100.0 / _total_sample_len; p.setPen(Trace::dsLightBlue); @@ -320,7 +323,7 @@ void Viewport::paintProgress(QPainter &p) if (triggred) p.drawText(status_rect, Qt::AlignCenter | Qt::AlignVCenter, - "Triggered! " + QString::number(1-captured_progress)+"% Captured"); + "Triggered! " + QString::number(captured_progress)+"% Captured"); else p.drawText(status_rect, Qt::AlignCenter | Qt::AlignVCenter, From 3c676312a2b0187454ea749b6dae0fed743c08a0 Mon Sep 17 00:00:00 2001 From: DreamSourceLab Date: Thu, 7 May 2015 19:51:23 +0800 Subject: [PATCH 6/6] add group signal display --- DSView/pv/view/view.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/DSView/pv/view/view.cpp b/DSView/pv/view/view.cpp index 66f2e415..ef1e2f69 100644 --- a/DSView/pv/view/view.cpp +++ b/DSView/pv/view/view.cpp @@ -32,6 +32,7 @@ #include #include +#include "groupsignal.h" #include "decodetrace.h" #include "header.h" #include "devmode.h" @@ -274,13 +275,14 @@ void View::set_preScale_preOffset() vector< boost::shared_ptr > View::get_traces() const { const vector< boost::shared_ptr > sigs(_session.get_signals()); + const vector< boost::shared_ptr > groups(_session.get_group_signals()); #ifdef ENABLE_DECODE const vector< boost::shared_ptr > decode_sigs( _session.get_decode_signals()); vector< boost::shared_ptr > traces( - sigs.size() + decode_sigs.size()); + sigs.size() + groups.size() + decode_sigs.size()); #else - vector< boost::shared_ptr > traces(sigs.size()); + vector< boost::shared_ptr > traces(sigs.size() + groups.size()); #endif vector< boost::shared_ptr >::iterator i = traces.begin(); @@ -288,6 +290,7 @@ vector< boost::shared_ptr > View::get_traces() const #ifdef ENABLE_DECODE i = copy(decode_sigs.begin(), decode_sigs.end(), i); #endif + i = copy(groups.begin(), groups.end(), i); stable_sort(traces.begin(), traces.end(), compare_trace_v_offsets); return traces;