mirror of
https://github.com/jankae/LibreVNA.git
synced 2026-04-05 14:35:23 +00:00
Save/load trace and graph setup
This commit is contained in:
parent
b91f431473
commit
9ad8def2ea
33 changed files with 605 additions and 28 deletions
|
|
@ -1,5 +1,6 @@
|
|||
#include "tracemodel.h"
|
||||
#include <QIcon>
|
||||
#include <QDebug>
|
||||
|
||||
using namespace std;
|
||||
|
||||
|
|
@ -164,6 +165,32 @@ bool TraceModel::PortExcitationRequired(int port)
|
|||
return false;
|
||||
}
|
||||
|
||||
nlohmann::json TraceModel::toJSON()
|
||||
{
|
||||
nlohmann::json j;
|
||||
for(auto t : traces) {
|
||||
j.push_back(t->toJSON());
|
||||
}
|
||||
return j;
|
||||
}
|
||||
|
||||
void TraceModel::fromJSON(nlohmann::json j)
|
||||
{
|
||||
// clear old traces
|
||||
while(traces.size()) {
|
||||
removeTrace(0);
|
||||
}
|
||||
for(auto jt : j) {
|
||||
auto trace = new Trace();
|
||||
try {
|
||||
trace->fromJSON(jt);
|
||||
addTrace(trace);
|
||||
} catch (const exception &e) {
|
||||
qWarning() << "Failed to create trace:" << e.what();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void TraceModel::clearVNAData()
|
||||
{
|
||||
for(auto t : traces) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue