X-Git-Url: https://sigrok.org/gitweb/?a=blobdiff_plain;f=pv%2Fdata%2Fdecode%2Frow.cpp;h=6212c92195bb888838348122f14624d0e83f2edc;hb=HEAD;hp=4f0e245fc65c359528a7cf3e5a5d8c3760671740;hpb=86d4b8e3e52a422fe3a6956d6bbef27f1859717b;p=pulseview.git diff --git a/pv/data/decode/row.cpp b/pv/data/decode/row.cpp index 4f0e245f..6212c921 100644 --- a/pv/data/decode/row.cpp +++ b/pv/data/decode/row.cpp @@ -18,6 +18,7 @@ */ #include +#include #include "decoder.hpp" #include "row.hpp" @@ -110,6 +111,8 @@ bool Row::visible() const void Row::set_visible(bool visible) { visible_ = visible; + + visibility_changed(); } void Row::set_base_color(QColor base_color) @@ -147,23 +150,37 @@ const QColor Row::color() const const QColor Row::get_class_color(uint32_t ann_class_id) const { - return ann_class_color_.at(ann_class_id); + try { + return ann_class_color_.at(ann_class_id); + } catch (std::out_of_range &e) { + qWarning() << "Warning: annotation type" << decoder_->get_ann_class_by_id(ann_class_id)->name + << "(" << ann_class_id << ")" << "not assigned to any annotation row!"; + return QColor(20, 20, 20); + } } const QColor Row::get_bright_class_color(uint32_t ann_class_id) const { - return ann_bright_class_color_.at(ann_class_id); + try { + return ann_bright_class_color_.at(ann_class_id); + } catch (std::out_of_range &e) { + return QColor(20, 20, 20); + } } const QColor Row::get_dark_class_color(uint32_t ann_class_id) const { - return ann_dark_class_color_.at(ann_class_id); + try { + return ann_dark_class_color_.at(ann_class_id); + } catch (std::out_of_range &e) { + return QColor(20, 20, 20); + } } bool Row::has_hidden_classes() const { for (const AnnotationClass* c : ann_classes()) - if (!c->visible) + if (!c->visible()) return true; return false; @@ -171,7 +188,7 @@ bool Row::has_hidden_classes() const bool Row::class_is_visible(uint32_t ann_class_id) const { - return decoder_->get_ann_class_by_id(ann_class_id)->visible; + return decoder_->get_ann_class_by_id(ann_class_id)->visible(); } bool Row::operator<(const Row& other) const