X-Git-Url: http://sigrok.org/gitweb/?a=blobdiff_plain;f=pv%2Fdata%2Fdecodesignal.cpp;h=28157794208c6fbf4a7b65be20b76773bb21b189;hb=57e7e17efd833527069607595be0847080d0a6a2;hp=811aff65589529887d8b57b7924c6df05b5024f2;hpb=85125b0f34be424fdf8a8a5133f2494722077d7d;p=pulseview.git diff --git a/pv/data/decodesignal.cpp b/pv/data/decodesignal.cpp index 811aff65..28157794 100644 --- a/pv/data/decodesignal.cpp +++ b/pv/data/decodesignal.cpp @@ -86,6 +86,9 @@ void DecodeSignal::stack_decoder(const srd_decoder *decoder, bool restart_decode const shared_ptr dec = make_shared(decoder, stack_.size()); stack_.push_back(dec); + connect(dec.get(), SIGNAL(annotation_visibility_changed()), + this, SLOT(on_annotation_visibility_changed())); + // Include the newly created decode channels in the channel lists update_channel_list(); @@ -105,11 +108,12 @@ void DecodeSignal::remove_decoder(int index) assert(index < (int)stack_.size()); // Find the decoder in the stack - auto iter = stack_.begin(); - for (int i = 0; i < index; i++, iter++) - assert(iter != stack_.end()); + auto iter = stack_.begin() + index; + assert(iter != stack_.end()); + + shared_ptr dec = *iter; - decoder_removed(iter->get()); + decoder_removed(dec.get()); // Delete the element stack_.erase(iter); @@ -698,7 +702,7 @@ void DecodeSignal::save_settings(QSettings &settings) const i = 0; for (const AnnotationClass* ann_class : decoder->ann_classes()) { settings.beginGroup("ann_class" + QString::number(i)); - settings.setValue("visible", ann_class->visible); + settings.setValue("visible", ann_class->visible()); settings.endGroup(); i++; } @@ -752,6 +756,9 @@ void DecodeSignal::restore_settings(QSettings &settings) if (QString::fromUtf8(dec->id) == id) { shared_ptr decoder = make_shared(dec, stack_.size()); + connect(decoder.get(), SIGNAL(annotation_visibility_changed()), + this, SLOT(on_annotation_visibility_changed())); + stack_.push_back(decoder); decoder->set_visible(settings.value("visible", true).toBool()); @@ -782,7 +789,7 @@ void DecodeSignal::restore_settings(QSettings &settings) i = 0; for (AnnotationClass* ann_class : decoder->ann_classes()) { settings.beginGroup("ann_class" + QString::number(i)); - ann_class->visible = settings.value("visible", true).toBool(); + ann_class->set_visible(settings.value("visible", true).toBool()); settings.endGroup(); i++; } @@ -1591,5 +1598,10 @@ void DecodeSignal::on_data_received() logic_mux_cond_.notify_one(); } +void DecodeSignal::on_annotation_visibility_changed() +{ + annotation_visibility_changed(); +} + } // namespace data } // namespace pv