mirror of
https://github.com/DreamSourceLab/DSView.git
synced 2025-01-23 13:42:55 +08:00
fix: The binded channel index of decoder trace can't restore from file
This commit is contained in:
parent
7c652aec56
commit
577dd31c96
@ -438,8 +438,7 @@ void DecoderOptionsDlg::commit_decoder_probes(data::decode::Decoder *dec)
|
||||
std::map<const srd_channel*, int> probe_map;
|
||||
const auto &sigs = AppControl::Instance()->GetSession()->get_signals();
|
||||
|
||||
auto index_list = _trace->get_sig_index_list();
|
||||
index_list->clear();
|
||||
std::list<int> index_list;
|
||||
|
||||
for(auto &p : _probe_selectors)
|
||||
{
|
||||
@ -451,13 +450,16 @@ void DecoderOptionsDlg::commit_decoder_probes(data::decode::Decoder *dec)
|
||||
for(auto s : sigs){
|
||||
if(s->get_index() == selection) {
|
||||
probe_map[p._pdch] = selection;
|
||||
index_list->push_back(selection);
|
||||
index_list.push_back(selection);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
dec->set_probes(probe_map);
|
||||
|
||||
if (index_list.size())
|
||||
_trace->set_index_list(index_list);
|
||||
}
|
||||
|
||||
void DecoderOptionsDlg::on_accept()
|
||||
|
@ -390,6 +390,8 @@ public:
|
||||
|
||||
void set_decoder_row_label(int index, QString label);
|
||||
|
||||
view::DecodeTrace* get_decoder_trace(int index);
|
||||
|
||||
private:
|
||||
void set_cur_samplelimits(uint64_t samplelimits);
|
||||
void set_cur_snap_samplerate(uint64_t samplerate);
|
||||
@ -413,8 +415,7 @@ private:
|
||||
void add_decode_task(view::DecodeTrace *trace);
|
||||
void remove_decode_task(view::DecodeTrace *trace);
|
||||
void clear_all_decode_task(int &runningDex);
|
||||
|
||||
view::DecodeTrace* get_decoder_trace(int index);
|
||||
|
||||
void decode_task_proc();
|
||||
view::DecodeTrace* get_top_decode_task();
|
||||
|
||||
|
@ -1166,6 +1166,8 @@ bool StoreSession::load_decoders(dock::ProtocolDock *widget, QJsonArray &dec_arr
|
||||
_session->set_decoder_row_label(dec_index, dec_obj["label"].toString());
|
||||
}
|
||||
|
||||
std::list<int> bind_indexs;
|
||||
|
||||
std::vector<view::DecodeTrace*> &aft_dsigs = _session->get_decode_signals();
|
||||
|
||||
if (aft_dsigs.size() >= pre_dsigs.size()) {
|
||||
@ -1176,7 +1178,8 @@ bool StoreSession::load_decoders(dock::ProtocolDock *widget, QJsonArray &dec_arr
|
||||
|
||||
auto &decoder_list = stack->stack();
|
||||
|
||||
for(auto dec : decoder_list) {
|
||||
for(auto dec : decoder_list)
|
||||
{
|
||||
const srd_decoder *const d = dec->decoder();
|
||||
QJsonObject options_obj;
|
||||
|
||||
@ -1189,7 +1192,12 @@ bool StoreSession::load_decoders(dock::ProtocolDock *widget, QJsonArray &dec_arr
|
||||
for (const QJsonValue &value : dec_obj["channel"].toArray()) {
|
||||
QJsonObject ch_obj = value.toObject();
|
||||
if (ch_obj.contains(pdch->id)) {
|
||||
probe_map[pdch] = ch_obj[pdch->id].toInt();
|
||||
int bind_chan = ch_obj[pdch->id].toInt();
|
||||
probe_map[pdch] = bind_chan;
|
||||
|
||||
auto fd_it = find(bind_indexs.begin(), bind_indexs.end(), bind_chan);
|
||||
if (fd_it == bind_indexs.end())
|
||||
bind_indexs.push_back(bind_chan);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -1202,7 +1210,12 @@ bool StoreSession::load_decoders(dock::ProtocolDock *widget, QJsonArray &dec_arr
|
||||
for (const QJsonValue &value : dec_obj["channel"].toArray()) {
|
||||
QJsonObject ch_obj = value.toObject();
|
||||
if (ch_obj.contains(pdch->id)) {
|
||||
probe_map[pdch] = ch_obj[pdch->id].toInt();
|
||||
int bind_chan = ch_obj[pdch->id].toInt();
|
||||
probe_map[pdch] = bind_chan;
|
||||
|
||||
auto fd_it = find(bind_indexs.begin(), bind_indexs.end(), bind_chan);
|
||||
if (fd_it == bind_indexs.end())
|
||||
bind_indexs.push_back(bind_chan);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -1294,6 +1307,13 @@ bool StoreSession::load_decoders(dock::ProtocolDock *widget, QJsonArray &dec_arr
|
||||
}
|
||||
}
|
||||
|
||||
// Restore the binded channel index
|
||||
if (bind_indexs.size() > 0){
|
||||
auto dec_trace = _session->get_decoder_trace(dec_index);
|
||||
if (dec_trace != NULL)
|
||||
dec_trace->set_index_list(bind_indexs);
|
||||
}
|
||||
|
||||
int decoder_cfg_version = -1;
|
||||
|
||||
if (dec_obj.contains("version")){
|
||||
|
@ -621,6 +621,7 @@ void DecodeTrace::paint_type_options(QPainter &p, int right, const QPoint pt, QC
|
||||
std::list<int>::iterator i = _index_list.begin();
|
||||
last_index = (*i);
|
||||
index_string = QString::number(last_index);
|
||||
|
||||
while (++i != _index_list.end()) {
|
||||
if ((*i) == last_index + 1 && index_string.indexOf("-") < 3 && index_string.indexOf("-") > 0)
|
||||
index_string.replace(QString::number(last_index), QString::number((*i)));
|
||||
@ -630,6 +631,7 @@ void DecodeTrace::paint_type_options(QPainter &p, int right, const QPoint pt, QC
|
||||
index_string = QString::number((*i)) + "," + index_string;
|
||||
last_index = (*i);
|
||||
}
|
||||
|
||||
p.setPen(fore);
|
||||
p.drawText(group_index_rect, Qt::AlignRight | Qt::AlignVCenter, index_string);
|
||||
}
|
||||
|
@ -140,10 +140,6 @@ public:
|
||||
|
||||
void* get_key_handel();
|
||||
|
||||
inline std::list<int>* get_sig_index_list(){
|
||||
return &_index_list;
|
||||
}
|
||||
|
||||
bool create_popup(bool isnew);
|
||||
|
||||
protected:
|
||||
@ -188,7 +184,6 @@ public:
|
||||
private:
|
||||
pv::SigSession *_session;
|
||||
pv::data::DecoderStack *_decoder_stack;
|
||||
std::list<int> _index_list;
|
||||
|
||||
uint64_t _decode_start;
|
||||
uint64_t _decode_end;
|
||||
|
@ -136,12 +136,12 @@ int Trace::get_index()
|
||||
return _index_list.front();
|
||||
}
|
||||
|
||||
std::list<int> &Trace::get_index_list()
|
||||
std::list<int> Trace::get_index_list()
|
||||
{
|
||||
return _index_list;
|
||||
}
|
||||
|
||||
void Trace::set_index_list(std::list<int> index_list)
|
||||
void Trace::set_index_list(const std::list<int> &index_list)
|
||||
{
|
||||
assert(index_list.size() != 0);
|
||||
|
||||
|
@ -110,8 +110,8 @@ public:
|
||||
* Index process
|
||||
*/
|
||||
int get_index();
|
||||
std::list<int> &get_index_list();
|
||||
void set_index_list(std::list<int> index_list);
|
||||
std::list<int> get_index_list();
|
||||
void set_index_list(const std::list<int> &index_list);
|
||||
int get_sec_index();
|
||||
void set_sec_index(int sec_index);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user