mirror of
https://github.com/jankae/LibreVNA.git
synced 2026-04-06 06:53:37 +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
|
|
@ -13,15 +13,43 @@ using namespace std;
|
|||
TraceSmithChart::TraceSmithChart(TraceModel &model, QWidget *parent)
|
||||
: TracePlot(model, parent)
|
||||
{
|
||||
chartLinesPen = QPen(palette().windowText(), 0.75);
|
||||
thinPen = QPen(palette().windowText(), 0.25);
|
||||
textPen = QPen(palette().windowText(), 0.25);
|
||||
pointDataPen = QPen(QColor("red"), 4.0, Qt::SolidLine, Qt::RoundCap);
|
||||
lineDataPen = QPen(QColor("blue"), 1.0);
|
||||
limitToSpan = true;
|
||||
initializeTraceInfo();
|
||||
}
|
||||
|
||||
nlohmann::json TraceSmithChart::toJSON()
|
||||
{
|
||||
nlohmann::json j;
|
||||
j["limit_to_span"] = limitToSpan;
|
||||
nlohmann::json jtraces;
|
||||
for(auto t : traces) {
|
||||
if(t.second) {
|
||||
jtraces.push_back(t.first->toHash());
|
||||
}
|
||||
}
|
||||
j["traces"] = jtraces;
|
||||
return j;
|
||||
}
|
||||
|
||||
void TraceSmithChart::fromJSON(nlohmann::json j)
|
||||
{
|
||||
limitToSpan = j.value("limit_to_span", true);
|
||||
for(unsigned int hash : j["traces"]) {
|
||||
// attempt to find the traces with this hash
|
||||
bool found = false;
|
||||
for(auto t : model.getTraces()) {
|
||||
if(t->toHash() == hash) {
|
||||
enableTrace(t, true);
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(!found) {
|
||||
qWarning() << "Unable to find trace with hash" << hash;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void TraceSmithChart::axisSetupDialog()
|
||||
{
|
||||
auto dialog = new QDialog();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue