projects
/
pulseview.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Apply some clang-tidy fixes.
[pulseview.git]
/
pv
/
views
/
trace
/
decodetrace.cpp
diff --git
a/pv/views/trace/decodetrace.cpp
b/pv/views/trace/decodetrace.cpp
index ee9b0ee211472c47347deb84d7b01241db0a056d..b0395eaa05dc685828a6d31d3d69a1383be59361 100644
(file)
--- a/
pv/views/trace/decodetrace.cpp
+++ b/
pv/views/trace/decodetrace.cpp
@@
-54,18
+54,13
@@
extern "C" {
#include <pv/widgets/decodermenu.hpp>
using std::all_of;
#include <pv/widgets/decodermenu.hpp>
using std::all_of;
-using std::list;
using std::make_pair;
using std::max;
using std::make_pair;
using std::max;
-using std::make_pair;
-using std::map;
using std::min;
using std::out_of_range;
using std::pair;
using std::shared_ptr;
using std::min;
using std::out_of_range;
using std::pair;
using std::shared_ptr;
-using std::make_shared;
using std::tie;
using std::tie;
-using std::unordered_set;
using std::vector;
using pv::data::decode::Annotation;
using std::vector;
using pv::data::decode::Annotation;
@@
-92,6
+87,8
@@
const double DecodeTrace::EndCapWidth = 5;
const int DecodeTrace::RowTitleMargin = 10;
const int DecodeTrace::DrawPadding = 100;
const int DecodeTrace::RowTitleMargin = 10;
const int DecodeTrace::DrawPadding = 100;
+const int DecodeTrace::MaxTraceUpdateRate = 1; // No more than 1 Hz
+
const QColor DecodeTrace::Colours[16] = {
QColor(0xEF, 0x29, 0x29),
QColor(0xF6, 0x6A, 0x32),
const QColor DecodeTrace::Colours[16] = {
QColor(0xEF, 0x29, 0x29),
QColor(0xF6, 0x6A, 0x32),
@@
-149,6
+146,8
@@
DecodeTrace::DecodeTrace(pv::Session &session,
connect(decode_signal_.get(), SIGNAL(new_annotations()),
this, SLOT(on_new_annotations()));
connect(decode_signal_.get(), SIGNAL(new_annotations()),
this, SLOT(on_new_annotations()));
+ connect(decode_signal_.get(), SIGNAL(decode_finished()),
+ this, SLOT(on_decode_finished()));
connect(decode_signal_.get(), SIGNAL(channels_updated()),
this, SLOT(on_channels_updated()));
connect(decode_signal_.get(), SIGNAL(channels_updated()),
this, SLOT(on_channels_updated()));
@@
-156,6
+155,11
@@
DecodeTrace::DecodeTrace(pv::Session &session,
this, SLOT(on_delete_decoder(int)));
connect(&show_hide_mapper_, SIGNAL(mapped(int)),
this, SLOT(on_show_hide_decoder(int)));
this, SLOT(on_delete_decoder(int)));
connect(&show_hide_mapper_, SIGNAL(mapped(int)),
this, SLOT(on_show_hide_decoder(int)));
+
+ connect(&delayed_trace_updater_, SIGNAL(timeout()),
+ this, SLOT(on_delayed_trace_update()));
+ delayed_trace_updater_.setSingleShot(true);
+ delayed_trace_updater_.setInterval(1000 / MaxTraceUpdateRate);
}
bool DecodeTrace::enabled() const
}
bool DecodeTrace::enabled() const
@@
-304,8
+308,7
@@
void DecodeTrace::populate_popup_form(QWidget *parent, QFormLayout *form)
init_state_map_.clear();
decoder_forms_.clear();
init_state_map_.clear();
decoder_forms_.clear();
- const list< shared_ptr<Decoder> > &stack =
- decode_signal_->decoder_stack_list();
+ const vector< shared_ptr<Decoder> > &stack = decode_signal_->decoder_stack();
if (stack.empty()) {
QLabel *const l = new QLabel(
if (stack.empty()) {
QLabel *const l = new QLabel(
@@
-600,11
+603,11
@@
void DecodeTrace::draw_unresolved_period(QPainter &p, int h, int left, int right
double samples_per_pixel, pixels_offset;
double samples_per_pixel, pixels_offset;
- const int64_t sample_count = decode_signal_->sample_count();
+ const int64_t sample_count = decode_signal_->
get_working_
sample_count();
if (sample_count == 0)
return;
if (sample_count == 0)
return;
- const int64_t samples_decoded = decode_signal_->
samples_decoded
();
+ const int64_t samples_decoded = decode_signal_->
get_decoded_sample_count
();
if (sample_count == samples_decoded)
return;
if (sample_count == samples_decoded)
return;
@@
-776,7
+779,7
@@
void DecodeTrace::create_decoder_form(int index,
QFormLayout *const decoder_form = new QFormLayout;
group->add_layout(decoder_form);
QFormLayout *const decoder_form = new QFormLayout;
group->add_layout(decoder_form);
- const
list
<DecodeChannel> channels = decode_signal_->get_channels();
+ const
vector
<DecodeChannel> channels = decode_signal_->get_channels();
// Add the channels
for (DecodeChannel ch : channels) {
// Add the channels
for (DecodeChannel ch : channels) {
@@
-868,6
+871,18
@@
QComboBox* DecodeTrace::create_channel_selector_init_state(QWidget *parent,
}
void DecodeTrace::on_new_annotations()
}
void DecodeTrace::on_new_annotations()
+{
+ if (!delayed_trace_updater_.isActive())
+ delayed_trace_updater_.start();
+}
+
+void DecodeTrace::on_delayed_trace_update()
+{
+ if (owner_)
+ owner_->row_item_appearance_changed(false, true);
+}
+
+void DecodeTrace::on_decode_finished()
{
if (owner_)
owner_->row_item_appearance_changed(false, true);
{
if (owner_)
owner_->row_item_appearance_changed(false, true);