Work on issue #79

This commit is contained in:
Alex Spataru 2021-11-05 04:52:28 -06:00
parent 8e65c65230
commit affb80f0a2
2 changed files with 9 additions and 28 deletions

View File

@ -97,9 +97,11 @@ CONFIG += silent
#-----------------------------------------------------------------------------------------
CONFIG(debug, debug|release) {
CONFIG -= ltcg
DEFINES += UNITY_BUILD=0
} else {
DEFINES += UNITY_BUILD=1
SOURCES += src/SingleCompilationUnit.cpp
}
#-----------------------------------------------------------------------------------------
@ -251,8 +253,7 @@ SOURCES += \
src/Widgets/MultiPlot.cpp \
src/Widgets/Plot.cpp \
src/Widgets/Terminal.cpp \
src/main.cpp \
src/SingleCompilationUnit.cpp
src/main.cpp
#-------------------------------------------------------------------------------
# Deploy files

View File

@ -342,24 +342,14 @@ void Generator::processFrame(const QByteArray &data, const quint64 frame,
return;
// Separate incoming data & add it to the JSON map
auto json = jsonMapData().toStdString();
auto json = jsonMapData();
auto sepr = IO::Manager::getInstance()->separatorSequence();
auto list = QString::fromUtf8(data).split(sepr);
for (int i = 0; i < list.count(); ++i)
{
size_t start_pos = 0;
std::string id = "%" + std::to_string(i + 1);
std::string value = list.at(i).toStdString();
while ((start_pos = json.find(id, start_pos)) != std::string::npos)
{
json.replace(start_pos, id.length(), value);
start_pos += value.length();
}
}
json.replace(QString("\"%%1\"").arg(i + 1), "\"" + list.at(i) + "\"");
// Create json document
auto jsonData = QString::fromStdString(json).toUtf8();
auto jsonData = json.toUtf8();
auto jsonDocument = QJsonDocument::fromJson(jsonData, &error);
// Calculate dynamically generated values
@ -451,24 +441,14 @@ void JSONWorker::process()
m_engine = new QJSEngine(this);
// Separate incoming data & add it to the JSON map
auto json = generator->jsonMapData().toStdString();
auto json = generator->jsonMapData();
auto sepr = IO::Manager::getInstance()->separatorSequence();
auto list = QString::fromUtf8(m_data).split(sepr);
for (int i = 0; i < list.count(); ++i)
{
size_t start_pos = 0;
std::string id = "%" + std::to_string(i + 1);
std::string value = list.at(i).toStdString();
while ((start_pos = json.find(id, start_pos)) != std::string::npos)
{
json.replace(start_pos, id.length(), value);
start_pos += value.length();
}
}
json.replace(QString("\"%%1\"").arg(i + 1), "\"" + list.at(i) + "\"");
// Create json document
auto jsonData = QString::fromStdString(json).toUtf8();
auto jsonData = json.toUtf8();
auto jsonDocument = QJsonDocument::fromJson(jsonData, &error);
// Calculate dynamically generated values