mirror of
https://github.com/DreamSourceLab/DSView.git
synced 2025-01-13 13:32:53 +08:00
Fix session load issue for dsl file
This commit is contained in:
parent
9af32655db
commit
9dfea2e314
@ -99,6 +99,7 @@ void StoreProgress::export_run()
|
|||||||
|
|
||||||
void StoreProgress::show_error()
|
void StoreProgress::show_error()
|
||||||
{
|
{
|
||||||
|
_done = true;
|
||||||
if (!_store_session.error().isEmpty()) {
|
if (!_store_session.error().isEmpty()) {
|
||||||
dialogs::DSMessageBox msg(parentWidget());
|
dialogs::DSMessageBox msg(parentWidget());
|
||||||
msg.mBox()->setText(tr("Failed to save data."));
|
msg.mBox()->setText(tr("Failed to save data."));
|
||||||
@ -125,12 +126,9 @@ void StoreProgress::on_progress_updated()
|
|||||||
const QString err = _store_session.error();
|
const QString err = _store_session.error();
|
||||||
if (!err.isEmpty()) {
|
if (!err.isEmpty()) {
|
||||||
show_error();
|
show_error();
|
||||||
//close();
|
|
||||||
_done = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (p.first == p.second) {
|
if (p.first == p.second) {
|
||||||
//close();
|
|
||||||
_done = true;
|
_done = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -988,6 +988,26 @@ bool MainWindow::load_session_json(QJsonDocument json, bool file_dev)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// load channel settings
|
// load channel settings
|
||||||
|
if (file_dev && (sdi->mode == DSO)) {
|
||||||
|
for (const GSList *l = _session.get_device()->dev_inst()->channels; l; l = l->next) {
|
||||||
|
sr_channel *const probe = (sr_channel*)l->data;
|
||||||
|
assert(probe);
|
||||||
|
foreach (const QJsonValue &value, sessionObj["channel"].toArray()) {
|
||||||
|
QJsonObject obj = value.toObject();
|
||||||
|
if ((strcmp(probe->name, g_strdup(obj["name"].toString().toStdString().c_str())) == 0) &&
|
||||||
|
(probe->type == obj["type"].toDouble())) {
|
||||||
|
probe->vdiv = obj["vdiv"].toDouble();
|
||||||
|
probe->coupling = obj["coupling"].toDouble();
|
||||||
|
probe->vfactor = obj["vfactor"].toDouble();
|
||||||
|
probe->trig_value = obj["trigValue"].toDouble();
|
||||||
|
probe->map_unit = g_strdup(obj["mapUnit"].toString().toStdString().c_str());
|
||||||
|
probe->map_min = obj["mapMin"].toDouble();
|
||||||
|
probe->map_max = obj["mapMax"].toDouble();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
for (const GSList *l = _session.get_device()->dev_inst()->channels; l; l = l->next) {
|
for (const GSList *l = _session.get_device()->dev_inst()->channels; l; l = l->next) {
|
||||||
sr_channel *const probe = (sr_channel*)l->data;
|
sr_channel *const probe = (sr_channel*)l->data;
|
||||||
assert(probe);
|
assert(probe);
|
||||||
@ -1012,11 +1032,32 @@ bool MainWindow::load_session_json(QJsonDocument json, bool file_dev)
|
|||||||
if (!isEnabled)
|
if (!isEnabled)
|
||||||
probe->enabled = false;
|
probe->enabled = false;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//_session.init_signals();
|
//_session.init_signals();
|
||||||
_session.reload();
|
_session.reload();
|
||||||
|
|
||||||
// load signal setting
|
// load signal setting
|
||||||
|
if (file_dev && (sdi->mode == DSO)) {
|
||||||
|
BOOST_FOREACH(const boost::shared_ptr<view::Signal> s, _session.get_signals()) {
|
||||||
|
foreach (const QJsonValue &value, sessionObj["channel"].toArray()) {
|
||||||
|
QJsonObject obj = value.toObject();
|
||||||
|
if ((strcmp(s->get_name().toStdString().c_str(), g_strdup(obj["name"].toString().toStdString().c_str())) == 0) &&
|
||||||
|
(s->get_type() == obj["type"].toDouble())) {
|
||||||
|
s->set_colour(QColor(obj["colour"].toString()));
|
||||||
|
|
||||||
|
boost::shared_ptr<view::DsoSignal> dsoSig;
|
||||||
|
if ((dsoSig = dynamic_pointer_cast<view::DsoSignal>(s))) {
|
||||||
|
dsoSig->load_settings();
|
||||||
|
dsoSig->set_zero_ratio(obj["zeroPos"].toDouble());
|
||||||
|
dsoSig->set_trig_ratio(obj["trigValue"].toDouble());
|
||||||
|
dsoSig->commit_settings();
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
BOOST_FOREACH(const boost::shared_ptr<view::Signal> s, _session.get_signals()) {
|
BOOST_FOREACH(const boost::shared_ptr<view::Signal> s, _session.get_signals()) {
|
||||||
foreach (const QJsonValue &value, sessionObj["channel"].toArray()) {
|
foreach (const QJsonValue &value, sessionObj["channel"].toArray()) {
|
||||||
QJsonObject obj = value.toObject();
|
QJsonObject obj = value.toObject();
|
||||||
@ -1048,6 +1089,7 @@ bool MainWindow::load_session_json(QJsonDocument json, bool file_dev)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// update UI settings
|
// update UI settings
|
||||||
_sampling_bar->update_sample_rate_selector();
|
_sampling_bar->update_sample_rate_selector();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user