From b9288b11b68a01f7eaa8896fb464ba8eb5c06282 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20Niew=C3=B6hner?= Date: Wed, 24 Jan 2024 14:36:13 +0100 Subject: [PATCH 1/2] Update decoded data table on each new annotation MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Currently, the decoded data table only gets updated on 10% steps of the overall capture time. This slows down updating of the table on long running sessions, making realtime inspection of e.g. I2C communication impossible. Instead of relying on the capture progress, bind the table update to the annotation generation. Fixes: #728 Signed-off-by: Michael Niewöhner --- DSView/pv/data/decoderstack.cpp | 1 + DSView/pv/data/decoderstack.h | 1 + DSView/pv/dock/protocoldock.cpp | 11 ++++++----- DSView/pv/dock/protocoldock.h | 2 +- DSView/pv/view/decodetrace.cpp | 2 +- DSView/pv/view/decodetrace.h | 2 +- 6 files changed, 11 insertions(+), 8 deletions(-) diff --git a/DSView/pv/data/decoderstack.cpp b/DSView/pv/data/decoderstack.cpp index 7e0e33b65..c588b1db3 100644 --- a/DSView/pv/data/decoderstack.cpp +++ b/DSView/pv/data/decoderstack.cpp @@ -818,6 +818,7 @@ void DecoderStack::annotation_callback(srd_proto_data *pdata, void *self) // Add the annotation if (!(*row_iter).second->push_annotation(a)) d->_no_memory = true; + d->new_annotation(); } void DecoderStack::frame_ended() diff --git a/DSView/pv/data/decoderstack.h b/DSView/pv/data/decoderstack.h index 310161a2d..9a8eb5df3 100644 --- a/DSView/pv/data/decoderstack.h +++ b/DSView/pv/data/decoderstack.h @@ -190,6 +190,7 @@ class DecoderStack : public QObject, public SignalData signals: void new_decode_data(); void decode_done(); + void new_annotation(); private: std::list _stack; diff --git a/DSView/pv/dock/protocoldock.cpp b/DSView/pv/dock/protocoldock.cpp index eeb58903c..ff14b2983 100644 --- a/DSView/pv/dock/protocoldock.cpp +++ b/DSView/pv/dock/protocoldock.cpp @@ -417,7 +417,10 @@ bool ProtocolDock::add_protocol_by_id(QString id, bool silent, std::listget_decode_signals(); protocol_updated(); - connect(decode_sigs.back(), SIGNAL(decoded_progress(int)), this, SLOT(decoded_progress(int))); + connect(decode_sigs.back(), SIGNAL(decoded_progress()), this, SLOT(decoded_progress())); + + const auto _decoder_stack = _session->get_decoder_model()->getDecoderStack(); + connect(_decoder_stack, SIGNAL(new_annotation()), this, SLOT(update_model())); return true; } @@ -451,7 +454,7 @@ void ProtocolDock::del_all_protocol() } } -void ProtocolDock::decoded_progress(int progress) +void ProtocolDock::decoded_progress() { const auto &decode_sigs = _session->get_decode_signals(); unsigned int index = 0; @@ -477,10 +480,8 @@ void ProtocolDock::decoded_progress(int progress) index++; } - if (progress == 0 || progress % 10 == 1){ update_model(); } -} void ProtocolDock::set_model() { @@ -1017,7 +1018,7 @@ bool ProtocolDock::protocol_sort_callback(const DecoderInfoItem *o1, const Decod void ProtocolDock::reset_view() { - decoded_progress(0); + decoded_progress(); update(); } diff --git a/DSView/pv/dock/protocoldock.h b/DSView/pv/dock/protocoldock.h index adbaa233e..19b194162 100644 --- a/DSView/pv/dock/protocoldock.h +++ b/DSView/pv/dock/protocoldock.h @@ -128,7 +128,7 @@ public slots: private slots: void on_add_protocol(); void on_del_all_protocol(); - void decoded_progress(int progress); + void decoded_progress(); void set_model(); void export_table_view(); void nav_table_view(); diff --git a/DSView/pv/view/decodetrace.cpp b/DSView/pv/view/decodetrace.cpp index 49dddf108..2ee48e23e 100644 --- a/DSView/pv/view/decodetrace.cpp +++ b/DSView/pv/view/decodetrace.cpp @@ -547,7 +547,7 @@ void DecodeTrace::draw_unshown_row(QPainter &p, int y, int h, int left, void DecodeTrace::on_new_decode_data() { - decoded_progress(_decoder_stack->get_progress()); + decoded_progress(); if (_view && _view->session().is_stopped_status()) _view->data_updated(); diff --git a/DSView/pv/view/decodetrace.h b/DSView/pv/view/decodetrace.h index 29ebe571d..5475c4939 100644 --- a/DSView/pv/view/decodetrace.h +++ b/DSView/pv/view/decodetrace.h @@ -171,7 +171,7 @@ class DecodeTrace : public Trace signals: - void decoded_progress(int progress); + void decoded_progress(); private slots: void on_new_decode_data(); From e742360576f7fb4c7767bbe0d7e00db4b95ac68a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20Niew=C3=B6hner?= Date: Wed, 24 Jan 2024 15:42:48 +0100 Subject: [PATCH 2/2] DecodeDock: add auto scroll feature MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add a button that makes the decode table scroll down on each new entry. Signed-off-by: Michael Niewöhner --- DSView/pv/dock/protocoldock.cpp | 16 ++++++++++++++++ DSView/pv/dock/protocoldock.h | 2 ++ 2 files changed, 18 insertions(+) diff --git a/DSView/pv/dock/protocoldock.cpp b/DSView/pv/dock/protocoldock.cpp index ff14b2983..6675503f3 100644 --- a/DSView/pv/dock/protocoldock.cpp +++ b/DSView/pv/dock/protocoldock.cpp @@ -140,6 +140,9 @@ ProtocolDock::ProtocolDock(QWidget *parent, view::View &view, SigSession *sessio _bot_set_button->setFlat(true); _bot_save_button = new QPushButton(bot_panel); _bot_save_button->setFlat(true); + _auto_scroll_button = new QPushButton(bot_panel); + _auto_scroll_button->setFlat(true); + _auto_scroll_button->setCheckable(true); _dn_nav_button = new QPushButton(bot_panel); _dn_nav_button->setFlat(true); _bot_title_label = new QLabel(bot_panel); @@ -149,6 +152,7 @@ ProtocolDock::ProtocolDock(QWidget *parent, view::View &view, SigSession *sessio bot_title_layout->addWidget(_bot_set_button); bot_title_layout->addWidget(_bot_save_button); bot_title_layout->addWidget(_bot_title_label, 1); + bot_title_layout->addWidget(_auto_scroll_button); bot_title_layout->addWidget(_dn_nav_button); _pre_button = new QPushButton(bot_panel); @@ -206,6 +210,7 @@ ProtocolDock::ProtocolDock(QWidget *parent, view::View &view, SigSession *sessio retranslateUi(); + connect(_auto_scroll_button, SIGNAL(clicked()),this, SLOT(auto_scroll())); connect(_dn_nav_button, SIGNAL(clicked()),this, SLOT(nav_table_view())); connect(_bot_save_button, SIGNAL(clicked()),this, SLOT(export_table_view())); connect(_bot_set_button, SIGNAL(clicked()),this, SLOT(set_model())); @@ -260,6 +265,7 @@ void ProtocolDock::reStyle() _del_all_button->setIcon(QIcon(iconPath+"/del.svg")); _bot_set_button->setIcon(QIcon(iconPath+"/gear.svg")); _bot_save_button->setIcon(QIcon(iconPath+"/save.svg")); + _auto_scroll_button->setIcon(QIcon(iconPath+"/loop.svg")); _dn_nav_button->setIcon(QIcon(iconPath+"/nav.svg")); _pre_button->setIcon(QIcon(iconPath+"/pre.svg")); _nxt_button->setIcon(QIcon(iconPath+"/next.svg")); @@ -523,6 +529,8 @@ void ProtocolDock::update_model() _model_proxy.setSourceModel(decoder_model); search_done(); resize_table_view(decoder_model); + + auto_scroll(); } void ProtocolDock::resize_table_view(data::DecoderModel* decoder_model) @@ -621,6 +629,14 @@ void ProtocolDock::export_table_view() protocolexp_dlg->exec(); } +void ProtocolDock::auto_scroll() +{ + if (_auto_scroll_button->isChecked()) { + _table_view->scrollToBottom(); + _table_view->clearSelection(); + } +} + void ProtocolDock::nav_table_view() { uint64_t row_index = 0; diff --git a/DSView/pv/dock/protocoldock.h b/DSView/pv/dock/protocoldock.h index 19b194162..904e6bff0 100644 --- a/DSView/pv/dock/protocoldock.h +++ b/DSView/pv/dock/protocoldock.h @@ -132,6 +132,7 @@ private slots: void set_model(); void export_table_view(); void nav_table_view(); + void auto_scroll(); void item_clicked(const QModelIndex &index); void column_resize(int index, int old_size, int new_size); void search_pre(); @@ -164,6 +165,7 @@ private slots: QPushButton *_bot_set_button; QPushButton *_bot_save_button; + QPushButton *_auto_scroll_button; QPushButton *_dn_nav_button; QPushButton *_ann_search_button; std::vector _decoderInfoList;