additional signal when traces were imported
This commit is contained in:
parent
7926c49974
commit
f0669ab4c0
@ -23,7 +23,8 @@ TraceImportDialog::~TraceImportDialog()
|
|||||||
|
|
||||||
void TraceImportDialog::on_buttonBox_accepted()
|
void TraceImportDialog::on_buttonBox_accepted()
|
||||||
{
|
{
|
||||||
tableModel->import(model);
|
auto traces = tableModel->import(model);
|
||||||
|
emit importFinsished(traces);
|
||||||
}
|
}
|
||||||
|
|
||||||
TraceParameterModel::TraceParameterModel(std::vector<Trace *> traces, QString prefix, QObject *parent)
|
TraceParameterModel::TraceParameterModel(std::vector<Trace *> traces, QString prefix, QObject *parent)
|
||||||
@ -153,17 +154,20 @@ Qt::ItemFlags TraceParameterModel::flags(const QModelIndex &index) const
|
|||||||
return (Qt::ItemFlags) flags;
|
return (Qt::ItemFlags) flags;
|
||||||
}
|
}
|
||||||
|
|
||||||
void TraceParameterModel::import(TraceModel &model)
|
std::vector<Trace *> TraceParameterModel::import(TraceModel &model)
|
||||||
{
|
{
|
||||||
|
std::vector<Trace*> importedTraces;
|
||||||
for(unsigned int i=0;i<params.size();i++) {
|
for(unsigned int i=0;i<params.size();i++) {
|
||||||
if(params[i].enabled) {
|
if(params[i].enabled) {
|
||||||
traces[i]->setColor(params[i].color);
|
traces[i]->setColor(params[i].color);
|
||||||
traces[i]->setName(params[i].name);
|
traces[i]->setName(params[i].name);
|
||||||
model.addTrace(traces[i]);
|
model.addTrace(traces[i]);
|
||||||
|
importedTraces.push_back(traces[i]);
|
||||||
} else {
|
} else {
|
||||||
delete traces[i];
|
delete traces[i];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return importedTraces;
|
||||||
}
|
}
|
||||||
|
|
||||||
void TraceImportDialog::on_tableView_doubleClicked(const QModelIndex &index)
|
void TraceImportDialog::on_tableView_doubleClicked(const QModelIndex &index)
|
||||||
|
@ -25,7 +25,7 @@ public:
|
|||||||
Qt::ItemFlags flags(const QModelIndex &index) const override;
|
Qt::ItemFlags flags(const QModelIndex &index) const override;
|
||||||
|
|
||||||
// adds all enabled traces to the model, deletes other traces
|
// adds all enabled traces to the model, deletes other traces
|
||||||
void import(TraceModel &model);
|
std::vector<Trace *> import(TraceModel &model);
|
||||||
private:
|
private:
|
||||||
class Parameter {
|
class Parameter {
|
||||||
public:
|
public:
|
||||||
@ -50,6 +50,9 @@ private slots:
|
|||||||
void on_buttonBox_accepted();
|
void on_buttonBox_accepted();
|
||||||
void on_tableView_doubleClicked(const QModelIndex &index);
|
void on_tableView_doubleClicked(const QModelIndex &index);
|
||||||
|
|
||||||
|
signals:
|
||||||
|
void importFinsished(const std::vector<Trace*> &traces);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Ui::TraceImportDialog *ui;
|
Ui::TraceImportDialog *ui;
|
||||||
TraceModel &model;
|
TraceModel &model;
|
||||||
|
@ -66,5 +66,13 @@ void TraceWidgetVNA::importDialog()
|
|||||||
prefix.append("_");
|
prefix.append("_");
|
||||||
auto i = new TraceImportDialog(model, traces, prefix);
|
auto i = new TraceImportDialog(model, traces, prefix);
|
||||||
i->show();
|
i->show();
|
||||||
|
if(filename.endsWith(".s2p")) {
|
||||||
|
// potential candidate to process via calibration/de-embedding
|
||||||
|
connect(i, &TraceImportDialog::importFinsished, [](const std::vector<Trace*> &traces) {
|
||||||
|
if(traces.size() == 4) {
|
||||||
|
// all traces imported, can calculate calibration/de-embedding
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user