mirror of
https://github.com/DreamSourceLab/DSView.git
synced 2025-01-13 13:32:53 +08:00
fix: Failed to load the measure information of DSCope on bottom from file
This commit is contained in:
parent
7053af0a8f
commit
2f3227b668
@ -1096,7 +1096,7 @@ namespace pv
|
||||
if (sessionObj.contains("measure"))
|
||||
{
|
||||
auto *bottom_bar = _view->get_viewstatus();
|
||||
bottom_bar->load_session(sessionObj["measure"].toArray());
|
||||
bottom_bar->load_session(sessionObj["measure"].toArray(), format_ver);
|
||||
}
|
||||
|
||||
if (gvar_opts != NULL)
|
||||
|
@ -258,7 +258,7 @@ QJsonArray ViewStatus::get_session()
|
||||
return measureVar;
|
||||
}
|
||||
|
||||
void ViewStatus::load_session(QJsonArray measure_array)
|
||||
void ViewStatus::load_session(QJsonArray measure_array, int version)
|
||||
{
|
||||
if (_session->get_device()->get_work_mode() != DSO){
|
||||
return;
|
||||
@ -269,11 +269,28 @@ void ViewStatus::load_session(QJsonArray measure_array)
|
||||
std::get<1>(_mrects[i]) = -1;
|
||||
std::get<2>(_mrects[i]) = DSO_MS_BEGIN;
|
||||
}
|
||||
|
||||
for (const QJsonValue &measure_value : measure_array) {
|
||||
|
||||
for (const QJsonValue &measure_value : measure_array)
|
||||
{
|
||||
QJsonObject m_obj = measure_value.toObject();
|
||||
int index = m_obj["site"].toInt();
|
||||
int sig_index = m_obj["index"].toInt();
|
||||
|
||||
if (version >= 3){
|
||||
Signal *trace = NULL;
|
||||
|
||||
for(auto s : _session->get_signals()){
|
||||
if (s->get_name().toInt() == sig_index){
|
||||
trace = s;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (trace == NULL)
|
||||
continue;
|
||||
sig_index = trace->get_index();
|
||||
}
|
||||
|
||||
enum DSO_MEASURE_TYPE ms_type = DSO_MEASURE_TYPE(m_obj["type"].toInt());
|
||||
set_measure(index, false, sig_index, ms_type);
|
||||
}
|
||||
|
@ -54,7 +54,7 @@ public:
|
||||
int sig_index, enum DSO_MEASURE_TYPE ms_type);
|
||||
|
||||
QJsonArray get_session();
|
||||
void load_session(QJsonArray meausre_array);
|
||||
void load_session(QJsonArray meausre_array, int version);
|
||||
void set_capture_status(bool triggered, int progess);
|
||||
|
||||
public slots:
|
||||
|
Loading…
x
Reference in New Issue
Block a user