MCPcopy Index your code
hub / github.com/DreamSourceLab/DSView / search_pre

Method search_pre

DSView/pv/dock/protocoldock.cpp:661–726  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

659}
660
661void ProtocolDock::search_pre()
662{
663 search_update();
664 // now the proxy only contains rows that match the name
665 // let's take the pre one and map it to the original model
666 if (_model_proxy.rowCount() == 0) {
667 _table_view->scrollToTop();
668 _table_view->clearSelection();
669 _matchs_label->setText(QString::number(0));
670 _cur_search_index = -1;
671 return;
672 }
673 int i = 0;
674 uint64_t rowCount = _model_proxy.rowCount();
675 QModelIndex matchingIndex;
676 pv::data::DecoderModel *decoder_model = _session->get_decoder_model();
677
678 auto decoder_stack = decoder_model->getDecoderStack();
679 do {
680 _cur_search_index--;
681 if (_cur_search_index <= -1 || _cur_search_index >= _model_proxy.rowCount())
682 _cur_search_index = _model_proxy.rowCount() - 1;
683
684 matchingIndex = _model_proxy.mapToSource(_model_proxy.index(ceil(_cur_search_index),_model_proxy.filterKeyColumn()));
685 if (!decoder_stack || !matchingIndex.isValid())
686 break;
687 i = 1;
688 uint64_t row = matchingIndex.row() + 1;
689 uint64_t col = matchingIndex.column();
690 pv::data::decode::Annotation ann;
691 bool ann_valid = false;
692
693 while(i < _str_list.size()) {
694 QString nxt = _str_list.at(i);
695
696 do {
697 ann_valid = decoder_stack->list_annotation(&ann, col, row);
698 row++;
699 }
700 while(ann_valid && !ann.is_numberic());
701
702 if (ann_valid){
703 QString source = ann.annotations().at(0);
704 if (source.contains(nxt))
705 i++;
706 else
707 break;
708 }
709 else{
710 break;
711 }
712 }
713 }
714 while(i < _str_list.size() && --rowCount);
715
716 if(i >= _str_list.size() && matchingIndex.isValid()){
717 _table_view->scrollTo(matchingIndex);
718 _table_view->setCurrentIndex(matchingIndex);

Callers

nothing calls this directly

Calls 8

rowCountMethod · 0.80
get_decoder_modelMethod · 0.80
getDecoderStackMethod · 0.80
indexMethod · 0.80
rowMethod · 0.80
sizeMethod · 0.80
list_annotationMethod · 0.80
is_numbericMethod · 0.80

Tested by

no test coverage detected