From 50b176ed9573154ca7e80dbb601f4a86678293ec Mon Sep 17 00:00:00 2001 From: dreamsourcelabTAI Date: Thu, 20 Apr 2023 19:35:01 +0800 Subject: [PATCH] fix: Update view is blocking --- DSView/pv/data/decoderstack.cpp | 4 ++++ DSView/pv/data/decoderstack.h | 8 +++++++- DSView/pv/dock/protocolitemlayer.cpp | 6 +++++- DSView/pv/sigsession.cpp | 1 + DSView/pv/view/viewport.cpp | 2 +- 5 files changed, 18 insertions(+), 3 deletions(-) diff --git a/DSView/pv/data/decoderstack.cpp b/DSView/pv/data/decoderstack.cpp index b779fd4f..51b35c72 100644 --- a/DSView/pv/data/decoderstack.cpp +++ b/DSView/pv/data/decoderstack.cpp @@ -68,6 +68,7 @@ DecoderStack::DecoderStack(pv::SigSession *session, _is_capture_end = true; _snapshot = NULL; _progress = 0; + _is_decoding = false; _stack.push_back(new decode::Decoder(dec)); @@ -518,6 +519,7 @@ void DecoderStack::decode_data(const uint64_t decode_start, const uint64_t decod _progress = 0; uint64_t sended_len = 0; + _is_decoding = true; while(i < end_index && !_no_memory && !status->_bStop) { @@ -606,6 +608,8 @@ void DecoderStack::decode_data(const uint64_t decode_start, const uint64_t decod } _progress = 100; + _is_decoding = false; + new_decode_data(); // the task is normal ends,so all samples was processed; diff --git a/DSView/pv/data/decoderstack.h b/DSView/pv/data/decoderstack.h index 622a5617..310161a2 100644 --- a/DSView/pv/data/decoderstack.h +++ b/DSView/pv/data/decoderstack.h @@ -169,10 +169,15 @@ public: inline void set_capture_end_flag(bool isEnd){ _is_capture_end = isEnd; - if (!isEnd){_progress = 0;} + if (!isEnd){ + _progress = 0; + _is_decoding = false; + } } inline int get_progress(){ + //if (!_is_decoding && _progress == 0) + // return -1; return _progress; } @@ -210,6 +215,7 @@ private: mutable std::mutex _output_mutex; bool _is_capture_end; int _progress; + bool _is_decoding; friend class DecoderStackTest::TwoDecoderStack; }; diff --git a/DSView/pv/dock/protocolitemlayer.cpp b/DSView/pv/dock/protocolitemlayer.cpp index 033554c8..64530732 100644 --- a/DSView/pv/dock/protocolitemlayer.cpp +++ b/DSView/pv/dock/protocolitemlayer.cpp @@ -103,7 +103,11 @@ void ProtocolItemLayer::on_format_select_changed(int index){ _progress_label->setStyleSheet("color:green;"); else _progress_label->setStyleSheet("color:red;"); - _progress_label->setText(str); + + if (progress >= 0) + _progress_label->setText(str); + else + _progress_label->setText(""); } void ProtocolItemLayer::ResetStyle(){ diff --git a/DSView/pv/sigsession.cpp b/DSView/pv/sigsession.cpp index 064ed6df..561687a8 100644 --- a/DSView/pv/sigsession.cpp +++ b/DSView/pv/sigsession.cpp @@ -1267,6 +1267,7 @@ namespace pv // Post a message to start all decode tasks. if (mode == LOGIC){ + dsv_info("Receive SR_DF_END."); _callback->trigger_message(DSV_MSG_REV_END_PACKET); } else{ diff --git a/DSView/pv/view/viewport.cpp b/DSView/pv/view/viewport.cpp index 65d1c51f..a4c06a1e 100644 --- a/DSView/pv/view/viewport.cpp +++ b/DSView/pv/view/viewport.cpp @@ -1356,7 +1356,7 @@ void Viewport::set_receive_len(quint64 length) } // Received new data, and refresh the view. - repaint(); + update(); } void Viewport::clear_measure()