display error flags in statusbar (overload/unlock/unlevel)

This commit is contained in:
Jan Käberich 2021-02-11 22:49:47 +01:00
parent 6d6f0843e9
commit e3f072b307
15 changed files with 89 additions and 13 deletions

View file

@ -11,6 +11,7 @@ Trace::Trace(QString name, QColor color, LiveParameter live)
_color(color),
_liveType(LivedataType::Overwrite),
_liveParam(live),
vFactor(0.66),
reflection(true),
visible(true),
paused(false),
@ -103,6 +104,11 @@ void Trace::setName(QString name) {
emit nameChanged();
}
void Trace::setVelocityFactor(double v)
{
vFactor = v;
}
void Trace::fillFromTouchstone(Touchstone &t, unsigned int parameter)
{
if(parameter >= t.ports()*t.ports()) {
@ -249,8 +255,7 @@ const std::vector<Trace::MathInfo>& Trace::getMathOperations() const
double Trace::velocityFactor()
{
// TODO make changeable
return 0.66;
return vFactor;
}
double Trace::timeToDistance(double time)
@ -293,8 +298,9 @@ nlohmann::json Trace::toJSON()
j["filename"] = filename.toStdString();
j["parameter"] = fileParemeter;
}
j["velocityFactor"] = vFactor;
j["reflection"] = reflection;
// TODO how to save assigned markers?
nlohmann::json mathList;
for(auto m : mathOps) {
if(m.math->getType() == Type::Last) {
@ -343,6 +349,7 @@ void Trace::fromJSON(nlohmann::json j)
throw runtime_error("Failed to create from file:" + what);
}
}
vFactor = j.value("velocityFactor", 0.66);
reflection = j.value("reflection", false);
for(auto jm : j["math"]) {
QString operation = QString::fromStdString(jm.value("operation", ""));

View file

@ -44,6 +44,7 @@ public:
void addData(const Data& d, const Protocol::SweepSettings& s);
void addData(const Data& d, const Protocol::SpectrumAnalyzerSettings& s);
void setName(QString name);
void setVelocityFactor(double v);
void fillFromTouchstone(Touchstone &t, unsigned int parameter);
QString fillFromCSV(CSV &csv, unsigned int parameter); // returns the suggested trace name (not yet set in member data)
void fromLivedata(LivedataType type, LiveParameter param);
@ -146,6 +147,7 @@ private:
QColor _color;
LivedataType _liveType;
LiveParameter _liveParam;
double vFactor;
bool reflection;
bool visible;
bool paused;

View file

@ -10,8 +10,10 @@ TraceEditDialog::TraceEditDialog(Trace &t, QWidget *parent) :
trace(t)
{
ui->setupUi(this);
ui->vFactor->setPrecision(3);
ui->name->setText(t.name());
ui->color->setColor(trace.color());
ui->vFactor->setValue(t.velocityFactor());
connect(ui->color, &ColorPickerButton::colorChanged, [=](const QColor& color){
trace.setColor(color);
});
@ -109,6 +111,7 @@ TraceEditDialog::~TraceEditDialog()
void TraceEditDialog::on_buttonBox_accepted()
{
trace.setName(ui->name->text());
trace.setVelocityFactor(ui->vFactor->value());
if(!trace.isCalibration()) {
// only apply changes if it is not a calibration trace
if (ui->bFile->isChecked()) {

View file

@ -10,7 +10,7 @@
<x>0</x>
<y>0</y>
<width>282</width>
<height>355</height>
<height>365</height>
</rect>
</property>
<property name="windowTitle">
@ -63,6 +63,16 @@
</item>
</layout>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label_6">
<property name="text">
<string>Velocity Factor:</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="SIUnitEdit" name="vFactor"/>
</item>
</layout>
</item>
<item>
@ -181,6 +191,11 @@
<extends>QPushButton</extends>
<header>CustomWidgets/colorpickerbutton.h</header>
</customwidget>
<customwidget>
<class>SIUnitEdit</class>
<extends>QLineEdit</extends>
<header>CustomWidgets/siunitedit.h</header>
</customwidget>
</customwidgets>
<resources/>
<connections>