forked from Ivasoft/DSView
Merge branch 'master' of https://github.com/dreamsourcelab/DSView into dev-1.3
This commit is contained in:
@@ -28,6 +28,7 @@
|
||||
#include "../utility/path.h"
|
||||
#include <stdlib.h>
|
||||
#include "../ZipMaker.h"
|
||||
#include "../log.h"
|
||||
|
||||
namespace pv {
|
||||
namespace device {
|
||||
@@ -80,11 +81,18 @@ QJsonArray File::get_decoders()
|
||||
ZipReader rd(f_name.c_str());
|
||||
auto *data = rd.GetInnterFileData("decoders");
|
||||
|
||||
if (data != NULL){
|
||||
QJsonDocument sessionDoc = QJsonDocument::fromJson(
|
||||
QByteArray::fromRawData(data->data(), data->size()), &error);
|
||||
dec_array = sessionDoc.array();
|
||||
rd.ReleaseInnerFileData(data);
|
||||
if (data != NULL){
|
||||
QString jsonStr(data->data());
|
||||
QByteArray qbs = jsonStr.toUtf8();
|
||||
QJsonDocument sessionDoc = QJsonDocument::fromJson(qbs, &error);
|
||||
|
||||
if (error.error != QJsonParseError::NoError){
|
||||
QString estr = error.errorString();
|
||||
dsv_err("File::get_decoders(), parse json error:\"%s\"!", estr.toUtf8().data());
|
||||
}
|
||||
|
||||
dec_array = sessionDoc.array();
|
||||
rd.ReleaseInnerFileData(data);
|
||||
}
|
||||
|
||||
return dec_array;
|
||||
@@ -100,8 +108,15 @@ QJsonDocument File::get_session()
|
||||
auto *data = rd.GetInnterFileData("session");
|
||||
|
||||
if (data != NULL){
|
||||
sessionDoc = QJsonDocument::fromJson(
|
||||
QByteArray::fromRawData(data->data(), data->size()), &error);
|
||||
QString jsonStr(data->data());
|
||||
QByteArray qbs = jsonStr.toUtf8();
|
||||
sessionDoc = QJsonDocument::fromJson(qbs, &error);
|
||||
|
||||
if (error.error != QJsonParseError::NoError){
|
||||
QString estr = error.errorString();
|
||||
dsv_err("File::get_session(), parse json error:\"%s\"!", estr.toUtf8().data());
|
||||
}
|
||||
|
||||
rd.ReleaseInnerFileData(data);
|
||||
}
|
||||
|
||||
|
||||
@@ -1375,6 +1375,13 @@ uint16_t SigSession::get_ch_num(int type)
|
||||
bool SigSession::add_decoder(srd_decoder *const dec, bool silent, DecoderStatus *dstatus,
|
||||
std::list<pv::data::decode::Decoder*> &sub_decoders){
|
||||
|
||||
if (dec == NULL){
|
||||
dsv_err("%s", "Decoder instance is null!");
|
||||
assert(false);
|
||||
}
|
||||
|
||||
dsv_info("Create new decoder,name:\"%s\",id:\"%s\"", dec->name, dec->id);
|
||||
|
||||
try {
|
||||
|
||||
bool ret = false;
|
||||
|
||||
@@ -60,6 +60,7 @@
|
||||
#include "dsvdef.h"
|
||||
#include "utility/encoding.h"
|
||||
#include "utility/path.h"
|
||||
#include "log.h"
|
||||
|
||||
|
||||
namespace pv {
|
||||
@@ -951,7 +952,7 @@ bool StoreSession::json_decoders(QJsonArray &array)
|
||||
auto rows = stack->get_rows_gshow();
|
||||
for (auto i = rows.begin(); i != rows.end(); i++) {
|
||||
pv::data::decode::Row _row = (*i).first;
|
||||
QString kn = _row.title();
|
||||
QString kn(_row.title().toUtf8().data());
|
||||
show_obj[kn] = QJsonValue::fromVariant((*i).second);
|
||||
}
|
||||
dec_obj["show"] = show_obj;
|
||||
@@ -964,8 +965,14 @@ bool StoreSession::json_decoders(QJsonArray &array)
|
||||
|
||||
bool StoreSession::load_decoders(dock::ProtocolDock *widget, QJsonArray dec_array)
|
||||
{
|
||||
if (_session->get_device()->dev_inst()->mode != LOGIC || dec_array.empty())
|
||||
if (_session->get_device()->dev_inst()->mode != LOGIC)
|
||||
{
|
||||
dsv_info("%s", "StoreSession::load_decoders(), is not LOGIC mode.");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (dec_array.empty()){
|
||||
dsv_info("%s", "StoreSession::load_decoders(), json object is array empty.");
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -1139,7 +1146,8 @@ bool StoreSession::load_decoders(dock::ProtocolDock *widget, QJsonArray dec_arra
|
||||
std::map<const pv::data::decode::Row, bool> rows = stack->get_rows_gshow();
|
||||
|
||||
for (auto i = rows.begin();i != rows.end(); i++) {
|
||||
QString key = (*i).first.title();
|
||||
QString key = (*i).first.title();
|
||||
|
||||
if (show_obj.contains(key)) {
|
||||
bool bShow = show_obj[key].toBool();
|
||||
const pv::data::decode::Row r = (*i).first;
|
||||
|
||||
Reference in New Issue
Block a user