Add setting for graph behavior when trace no longer supported
This commit is contained in:
parent
b45645f04e
commit
dda149f3d5
@ -83,8 +83,8 @@ void Marker::assignTrace(Trace *t)
|
||||
// Marker was just created and this is the first assignment to a trace.
|
||||
// Use display format on graph from preferences
|
||||
auto p = Preferences::getInstance();
|
||||
if(p.General.markerDefault.showDataOnGraphs) {
|
||||
if(p.General.markerDefault.showAllData) {
|
||||
if(p.Graphs.markerBehavior.showDataOnGraphs) {
|
||||
if(p.Graphs.markerBehavior.showAllData) {
|
||||
for(auto f : applicableFormats()) {
|
||||
formatGraph.insert(f);
|
||||
}
|
||||
|
@ -334,8 +334,8 @@ void Math::TimeGateGraph::paintEvent(QPaintEvent *event)
|
||||
auto pref = Preferences::getInstance();
|
||||
QPainter p(this);
|
||||
// fill background
|
||||
p.setBackground(QBrush(pref.General.graphColors.background));
|
||||
p.fillRect(0, 0, width(), height(), QBrush(pref.General.graphColors.background));
|
||||
p.setBackground(QBrush(pref.Graphs.Color.background));
|
||||
p.fillRect(0, 0, width(), height(), QBrush(pref.Graphs.Color.background));
|
||||
|
||||
// plot trace
|
||||
auto pen = QPen(Qt::green, 1);
|
||||
|
@ -15,6 +15,7 @@ TracePlot::TracePlot(TraceModel &model, QWidget *parent)
|
||||
: QWidget(parent),
|
||||
model(model),
|
||||
selectedMarker(nullptr),
|
||||
traceRemovalPending(false),
|
||||
dropPending(false),
|
||||
dropTrace(nullptr)
|
||||
{
|
||||
@ -96,6 +97,17 @@ void TracePlot::initializeTraceInfo()
|
||||
connect(&model, &TraceModel::traceAdded, this, &TracePlot::newTraceAvailable);
|
||||
}
|
||||
|
||||
std::vector<Trace *> TracePlot::activeTraces()
|
||||
{
|
||||
std::vector<Trace*> ret;
|
||||
for(auto t : traces) {
|
||||
if(t.second) {
|
||||
ret.push_back(t.first);
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
void TracePlot::contextMenuEvent(QContextMenuEvent *event)
|
||||
{
|
||||
auto m = markerAtPosition(event->pos());
|
||||
@ -117,13 +129,25 @@ void TracePlot::contextMenuEvent(QContextMenuEvent *event)
|
||||
|
||||
void TracePlot::paintEvent(QPaintEvent *event)
|
||||
{
|
||||
if(traceRemovalPending) {
|
||||
for(auto t : traces) {
|
||||
if(!t.second) {
|
||||
// trace already disabled
|
||||
}
|
||||
if(!supported(t.first)) {
|
||||
enableTrace(t.first, false);
|
||||
}
|
||||
}
|
||||
traceRemovalPending = false;
|
||||
}
|
||||
|
||||
Q_UNUSED(event)
|
||||
auto pref = Preferences::getInstance();
|
||||
QPainter p(this);
|
||||
// p.setRenderHint(QPainter::Antialiasing);
|
||||
// fill background
|
||||
p.setBackground(QBrush(pref.General.graphColors.background));
|
||||
p.fillRect(0, 0, width(), height(), QBrush(pref.General.graphColors.background));
|
||||
p.setBackground(QBrush(pref.Graphs.Color.background));
|
||||
p.fillRect(0, 0, width(), height(), QBrush(pref.Graphs.Color.background));
|
||||
|
||||
// show names of active traces and marker data (if enabled)
|
||||
bool hasMarkerData = false;
|
||||
@ -374,7 +398,27 @@ void TracePlot::checkIfStillSupported(Trace *t)
|
||||
{
|
||||
if(!supported(t)) {
|
||||
// something with this trace changed and it can no longer be displayed on this graph
|
||||
enableTrace(t, false);
|
||||
// behavior depends on preferences
|
||||
switch(Preferences::getInstance().Graphs.domainChangeBehavior) {
|
||||
case GraphDomainChangeBehavior::RemoveChangedTraces:
|
||||
// simply remove the changed trace
|
||||
enableTrace(t, false);
|
||||
break;
|
||||
case GraphDomainChangeBehavior::AdjustGrahpsIfOnlyTrace:
|
||||
// remove trace if other traces are present, otherwise try to adjust graph
|
||||
if(activeTraces().size() > 1) {
|
||||
enableTrace(t, false);
|
||||
break;
|
||||
}
|
||||
[[fallthrough]];
|
||||
case GraphDomainChangeBehavior::AdjustGraphs:
|
||||
// attempt to configure the graph for the changed trace, remove only if this fails
|
||||
if(!configureForTrace(t)) {
|
||||
enableTrace(t, false);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -39,6 +39,9 @@ protected:
|
||||
static constexpr int MinUpdateInterval = 100;
|
||||
// need to be called in derived class constructor
|
||||
void initializeTraceInfo();
|
||||
std::vector<Trace*> activeTraces();
|
||||
// changes the graph settings to make it possible to display a specific trace. The trace is not aded yet
|
||||
virtual bool configureForTrace(Trace *t) { Q_UNUSED(t) return false; }; // default implementation fails for all traces
|
||||
void contextMenuEvent(QContextMenuEvent *event) override;
|
||||
void paintEvent(QPaintEvent *event) override;
|
||||
virtual void updateContextMenu(){};
|
||||
@ -92,6 +95,9 @@ protected:
|
||||
TraceModel &model;
|
||||
Marker *selectedMarker;
|
||||
|
||||
// graph settings have been changed, check and possibly remove incompatible traces before next paint event
|
||||
bool traceRemovalPending;
|
||||
|
||||
bool dropPending;
|
||||
QPoint dropPosition;
|
||||
Trace *dropTrace;
|
||||
|
@ -145,14 +145,14 @@ void TraceSmithChart::draw(QPainter &p) {
|
||||
transform = p.transform();
|
||||
|
||||
// Outer circle
|
||||
auto pen = QPen(pref.General.graphColors.axis);
|
||||
auto pen = QPen(pref.Graphs.Color.axis);
|
||||
pen.setCosmetic(true);
|
||||
p.setPen(pen);
|
||||
QRectF rectangle(-smithCoordMax, -smithCoordMax, 2*smithCoordMax, 2*smithCoordMax);
|
||||
p.drawArc(rectangle, 0, 5760);
|
||||
|
||||
constexpr int Circles = 6;
|
||||
pen = QPen(pref.General.graphColors.divisions, 0.5, Qt::DashLine);
|
||||
pen = QPen(pref.Graphs.Color.divisions, 0.5, Qt::DashLine);
|
||||
pen.setCosmetic(true);
|
||||
p.setPen(pen);
|
||||
for(int i=1;i<Circles;i++) {
|
||||
|
@ -77,7 +77,7 @@ void TraceXYPlot::setYAxis(int axis, TraceXYPlot::YAxisType type, bool log, bool
|
||||
YAxis[axis].rangeMin = min;
|
||||
YAxis[axis].rangeMax = max;
|
||||
YAxis[axis].rangeDiv = div;
|
||||
removeUnsupportedTraces();
|
||||
traceRemovalPending = true;
|
||||
updateAxisTicks();
|
||||
updateContextMenu();
|
||||
replot();
|
||||
@ -90,7 +90,7 @@ void TraceXYPlot::setXAxis(XAxisType type, XAxisMode mode, double min, double ma
|
||||
XAxis.rangeMin = min;
|
||||
XAxis.rangeMax = max;
|
||||
XAxis.rangeDiv = div;
|
||||
removeUnsupportedTraces();
|
||||
traceRemovalPending = true;
|
||||
updateAxisTicks();
|
||||
updateContextMenu();
|
||||
replot();
|
||||
@ -223,6 +223,32 @@ void TraceXYPlot::axisSetupDialog()
|
||||
setup->show();
|
||||
}
|
||||
|
||||
bool TraceXYPlot::configureForTrace(Trace *t)
|
||||
{
|
||||
switch(t->outputType()) {
|
||||
case Trace::DataType::Frequency:
|
||||
setXAxis(XAxisType::Frequency, XAxisMode::FitTraces, 0, 1, 0.1);
|
||||
setYAxis(0, YAxisType::Magnitude, false, true, 0, 1, 1.0);
|
||||
setYAxis(1, YAxisType::Phase, false, true, 0, 1, 1.0);
|
||||
break;
|
||||
case Trace::DataType::Time:
|
||||
setXAxis(XAxisType::Time, XAxisMode::FitTraces, 0, 1, 0.1);
|
||||
setYAxis(0, YAxisType::ImpulseMag, false, true, 0, 1, 1.0);
|
||||
setYAxis(1, YAxisType::Disabled, false, true, 0, 1, 1.0);
|
||||
break;
|
||||
case Trace::DataType::Power:
|
||||
setXAxis(XAxisType::Power, XAxisMode::FitTraces, 0, 1, 0.1);
|
||||
setYAxis(0, YAxisType::Magnitude, false, true, 0, 1, 1.0);
|
||||
setYAxis(1, YAxisType::Phase, false, true, 0, 1, 1.0);
|
||||
break;
|
||||
case Trace::DataType::Invalid:
|
||||
// unable to add
|
||||
return false;
|
||||
}
|
||||
traceRemovalPending = true;
|
||||
return true;
|
||||
}
|
||||
|
||||
void TraceXYPlot::updateContextMenu()
|
||||
{
|
||||
contextmenu->clear();
|
||||
@ -322,7 +348,7 @@ void TraceXYPlot::draw(QPainter &p)
|
||||
constexpr int yAxisDisabledSpace = 10;
|
||||
constexpr int xAxisSpace = 30;
|
||||
auto w = p.window();
|
||||
auto pen = QPen(pref.General.graphColors.axis, 0);
|
||||
auto pen = QPen(pref.Graphs.Color.axis, 0);
|
||||
pen.setCosmetic(true);
|
||||
p.setPen(pen);
|
||||
plotAreaLeft = YAxis[0].type == YAxisType::Disabled ? yAxisDisabledSpace : yAxisSpace;
|
||||
@ -378,14 +404,14 @@ void TraceXYPlot::draw(QPainter &p)
|
||||
p.setPen(QPen(QColor("orange")));
|
||||
QRect bounding;
|
||||
p.drawText(QRect(2, plotAreaBottom + AxisLabelSize + 5, w.width(), AxisLabelSize), 0, front, &bounding);
|
||||
p.setPen(pref.General.graphColors.axis);
|
||||
p.setPen(pref.Graphs.Color.axis);
|
||||
p.drawText(QRect(bounding.x() + bounding.width(), plotAreaBottom + AxisLabelSize + 5, w.width(), AxisLabelSize), 0, back);
|
||||
}
|
||||
|
||||
for(auto t : XAxis.ticks) {
|
||||
auto xCoord = Util::Scale<double>(t, XAxis.rangeMin, XAxis.rangeMax, plotAreaLeft, plotAreaLeft + plotAreaWidth);
|
||||
auto tickValue = Unit::ToString(t, "", prefixes, significantDigits);
|
||||
p.setPen(QPen(pref.General.graphColors.axis, 1));
|
||||
p.setPen(QPen(pref.Graphs.Color.axis, 1));
|
||||
if(displayFullFreq) {
|
||||
p.drawText(QRect(xCoord - 40, plotAreaBottom + 5, 80, AxisLabelSize), Qt::AlignHCenter, tickValue);
|
||||
} else {
|
||||
@ -400,11 +426,11 @@ void TraceXYPlot::draw(QPainter &p)
|
||||
p.drawText(QRect(xCoord - 40, plotAreaBottom + 5, 80, AxisLabelSize), Qt::AlignHCenter, tickValue, &bounding);
|
||||
p.setPen(QPen(QColor("orange")));
|
||||
p.drawText(QRect(0, plotAreaBottom + 5, bounding.x() - 1, AxisLabelSize), Qt::AlignRight, "..");
|
||||
p.setPen(QPen(pref.General.graphColors.axis, 1));
|
||||
p.setPen(QPen(pref.Graphs.Color.axis, 1));
|
||||
}
|
||||
p.drawLine(xCoord, plotAreaBottom, xCoord, plotAreaBottom + 2);
|
||||
if(xCoord != plotAreaLeft && xCoord != plotAreaLeft + plotAreaWidth) {
|
||||
p.setPen(QPen(pref.General.graphColors.divisions, 0.5, Qt::DashLine));
|
||||
p.setPen(QPen(pref.Graphs.Color.divisions, 0.5, Qt::DashLine));
|
||||
p.drawLine(xCoord, 0, xCoord, plotAreaBottom);
|
||||
}
|
||||
}
|
||||
@ -415,7 +441,7 @@ void TraceXYPlot::draw(QPainter &p)
|
||||
continue;
|
||||
}
|
||||
QString labelY = AxisTypeToName(YAxis[i].type);
|
||||
p.setPen(QPen(pref.General.graphColors.axis, 1));
|
||||
p.setPen(QPen(pref.Graphs.Color.axis, 1));
|
||||
auto xStart = i == 0 ? 0 : w.width() - AxisLabelSize * 1.5;
|
||||
p.save();
|
||||
p.translate(xStart, w.height()-xAxisSpace);
|
||||
@ -436,7 +462,7 @@ void TraceXYPlot::draw(QPainter &p)
|
||||
int significantDigits = floor(log10(max)) - floor(log10(step)) + 1;
|
||||
for(auto t : YAxis[i].ticks) {
|
||||
auto yCoord = Util::Scale<double>(t, YAxis[i].rangeMax, YAxis[i].rangeMin, 0, w.height() - xAxisSpace);
|
||||
p.setPen(QPen(pref.General.graphColors.axis, 1));
|
||||
p.setPen(QPen(pref.Graphs.Color.axis, 1));
|
||||
// draw tickmark on axis
|
||||
auto tickStart = i == 0 ? plotAreaLeft : plotAreaLeft + plotAreaWidth;
|
||||
auto tickLen = i == 0 ? -2 : 2;
|
||||
@ -455,7 +481,7 @@ void TraceXYPlot::draw(QPainter &p)
|
||||
}
|
||||
if(i == 0) {
|
||||
// only draw tick lines for primary axis
|
||||
p.setPen(QPen(pref.General.graphColors.divisions, 0.5, Qt::DashLine));
|
||||
p.setPen(QPen(pref.Graphs.Color.divisions, 0.5, Qt::DashLine));
|
||||
p.drawLine(plotAreaLeft, yCoord, plotAreaLeft + plotAreaWidth, yCoord);
|
||||
}
|
||||
}
|
||||
@ -839,18 +865,6 @@ bool TraceXYPlot::supported(Trace *t, TraceXYPlot::YAxisType type)
|
||||
return true;
|
||||
}
|
||||
|
||||
void TraceXYPlot::removeUnsupportedTraces()
|
||||
{
|
||||
for(unsigned int i=0;i<2;i++) {
|
||||
auto set_copy = tracesAxis[i];
|
||||
for(auto t : set_copy) {
|
||||
if(!supported(t, YAxis[i].type)) {
|
||||
enableTraceAxis(t, i, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
QPointF TraceXYPlot::traceToCoordinate(Trace *t, unsigned int sample, TraceXYPlot::YAxisType type)
|
||||
{
|
||||
QPointF ret = QPointF(numeric_limits<double>::quiet_NaN(), numeric_limits<double>::quiet_NaN());
|
||||
@ -981,24 +995,8 @@ void TraceXYPlot::traceDropped(Trace *t, QPoint position)
|
||||
// user declined to change domain, to not add trace
|
||||
return;
|
||||
}
|
||||
switch(t->outputType()) {
|
||||
case Trace::DataType::Frequency:
|
||||
setXAxis(XAxisType::Frequency, XAxisMode::FitTraces, 0, 1, 0.1);
|
||||
setYAxis(0, YAxisType::Magnitude, false, true, 0, 1, 1.0);
|
||||
setYAxis(1, YAxisType::Phase, false, true, 0, 1, 1.0);
|
||||
break;
|
||||
case Trace::DataType::Time:
|
||||
setXAxis(XAxisType::Time, XAxisMode::FitTraces, 0, 1, 0.1);
|
||||
setYAxis(0, YAxisType::ImpulseMag, false, true, 0, 1, 1.0);
|
||||
setYAxis(1, YAxisType::Disabled, false, true, 0, 1, 1.0);
|
||||
break;
|
||||
case Trace::DataType::Power:
|
||||
setXAxis(XAxisType::Power, XAxisMode::FitTraces, 0, 1, 0.1);
|
||||
setYAxis(0, YAxisType::Magnitude, false, true, 0, 1, 1.0);
|
||||
setYAxis(1, YAxisType::Phase, false, true, 0, 1, 1.0);
|
||||
break;
|
||||
case Trace::DataType::Invalid:
|
||||
// unable to add
|
||||
if(!configureForTrace(t)) {
|
||||
// failed to configure
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -60,6 +60,7 @@ public slots:
|
||||
void axisSetupDialog();
|
||||
|
||||
protected:
|
||||
virtual bool configureForTrace(Trace *t) override;
|
||||
virtual void updateContextMenu() override;
|
||||
virtual bool dropSupported(Trace *t) override;
|
||||
virtual void draw(QPainter &p) override;
|
||||
@ -77,7 +78,6 @@ private:
|
||||
void enableTraceAxis(Trace *t, int axis, bool enabled);
|
||||
bool supported(Trace *t) override;
|
||||
bool supported(Trace *t, YAxisType type);
|
||||
void removeUnsupportedTraces();
|
||||
QPointF traceToCoordinate(Trace *t, unsigned int sample, YAxisType type);
|
||||
QPoint plotValueToPixel(QPointF plotValue, int Yaxis);
|
||||
QPointF pixelToPlotValue(QPoint pixel, int YAxis);
|
||||
|
@ -92,12 +92,12 @@ AppWindow::AppWindow(QWidget *parent)
|
||||
auto port = parser.value("port").toUInt(&OK);
|
||||
if(!OK) {
|
||||
// set default port
|
||||
port = Preferences::getInstance().General.SCPI.port;
|
||||
port = Preferences::getInstance().SCPIServer.port;
|
||||
}
|
||||
StartTCPServer(port);
|
||||
Preferences::getInstance().manualTCPport();
|
||||
} else if(Preferences::getInstance().General.SCPI.enabled) {
|
||||
StartTCPServer(Preferences::getInstance().General.SCPI.port);
|
||||
} else if(Preferences::getInstance().SCPIServer.enabled) {
|
||||
StartTCPServer(Preferences::getInstance().SCPIServer.port);
|
||||
}
|
||||
|
||||
ui->setupUi(this);
|
||||
@ -194,13 +194,13 @@ AppWindow::AppWindow(QWidget *parent)
|
||||
connect(ui->actionPreferences, &QAction::triggered, [=](){
|
||||
// save previous SCPI settings in case they change
|
||||
auto &p = Preferences::getInstance();
|
||||
auto SCPIenabled = p.General.SCPI.enabled;
|
||||
auto SCPIport = p.General.SCPI.port;
|
||||
auto SCPIenabled = p.SCPIServer.enabled;
|
||||
auto SCPIport = p.SCPIServer.port;
|
||||
p.edit();
|
||||
if(SCPIenabled != p.General.SCPI.enabled || SCPIport != p.General.SCPI.port) {
|
||||
if(SCPIenabled != p.SCPIServer.enabled || SCPIport != p.SCPIServer.port) {
|
||||
StopTCPServer();
|
||||
if(p.General.SCPI.enabled) {
|
||||
StartTCPServer(p.General.SCPI.port);
|
||||
if(p.SCPIServer.enabled) {
|
||||
StartTCPServer(p.SCPIServer.port);
|
||||
}
|
||||
}
|
||||
auto active = Mode::getActiveMode();
|
||||
|
@ -74,17 +74,19 @@ PreferencesDialog::PreferencesDialog(Preferences *pref, QWidget *parent) :
|
||||
|
||||
// General page
|
||||
if(p->TCPoverride) {
|
||||
ui->GeneralSCPIPort->setEnabled(false);
|
||||
ui->GeneralSCPIEnabled->setEnabled(false);
|
||||
ui->SCPIServerPort->setEnabled(false);
|
||||
ui->SCPIServerEnabled->setEnabled(false);
|
||||
}
|
||||
|
||||
connect(ui->GeneralMarkerDataGraph, &QCheckBox::toggled, [=](bool enabled) {
|
||||
ui->GeneralMarkerDataGraphAll->setEnabled(enabled);
|
||||
connect(ui->GraphsShowMarkerData, &QCheckBox::toggled, [=](bool enabled) {
|
||||
ui->GraphsShowAllMarkerData->setEnabled(enabled);
|
||||
});
|
||||
|
||||
// Page selection
|
||||
connect(ui->treeWidget, &QTreeWidget::currentItemChanged, [=](QTreeWidgetItem *current, QTreeWidgetItem *) {
|
||||
auto name = current->text(0);
|
||||
// remove any potential white space in name (can't have whitespace in page names)
|
||||
name.replace(" ", "");
|
||||
for(int i=0;i<ui->pageWidget->count();i++) {
|
||||
auto w = ui->pageWidget->widget(i);
|
||||
if(name == w->objectName()) {
|
||||
@ -130,13 +132,14 @@ PreferencesDialog::PreferencesDialog(Preferences *pref, QWidget *parent) :
|
||||
p->Acquisition.harmonicMixing = ui->AcquisitionUseHarmonic->isChecked();
|
||||
p->Acquisition.useDFTinSAmode = ui->AcquisitionUseDFT->isChecked();
|
||||
p->Acquisition.RBWLimitForDFT = ui->AcquisitionDFTlimitRBW->value();
|
||||
p->General.graphColors.background = ui->GeneralGraphBackground->getColor();
|
||||
p->General.graphColors.axis = ui->GeneralGraphAxis->getColor();
|
||||
p->General.graphColors.divisions = ui->GeneralGraphDivisions->getColor();
|
||||
p->General.markerDefault.showDataOnGraphs = ui->GeneralMarkerDataGraph->isChecked();
|
||||
p->General.markerDefault.showAllData = ui->GeneralMarkerDataGraphAll->isChecked();
|
||||
p->General.SCPI.enabled = ui->GeneralSCPIEnabled->isChecked();
|
||||
p->General.SCPI.port = ui->GeneralSCPIPort->value();
|
||||
p->Graphs.Color.background = ui->GraphsColorBackground->getColor();
|
||||
p->Graphs.Color.axis = ui->GraphsColorAxis->getColor();
|
||||
p->Graphs.Color.divisions = ui->GraphsColorDivisions->getColor();
|
||||
p->Graphs.domainChangeBehavior = (GraphDomainChangeBehavior) ui->GraphsDomainChangeBehavior->currentIndex();
|
||||
p->Graphs.markerBehavior.showDataOnGraphs = ui->GraphsShowMarkerData->isChecked();
|
||||
p->Graphs.markerBehavior.showAllData = ui->GraphsShowAllMarkerData->isChecked();
|
||||
p->SCPIServer.enabled = ui->SCPIServerEnabled->isChecked();
|
||||
p->SCPIServer.port = ui->SCPIServerPort->value();
|
||||
accept();
|
||||
});
|
||||
|
||||
@ -193,13 +196,14 @@ void PreferencesDialog::setInitialGUIState()
|
||||
ui->AcquisitionUseDFT->setChecked(p->Acquisition.useDFTinSAmode);
|
||||
ui->AcquisitionDFTlimitRBW->setValue(p->Acquisition.RBWLimitForDFT);
|
||||
|
||||
ui->GeneralGraphBackground->setColor(p->General.graphColors.background);
|
||||
ui->GeneralGraphAxis->setColor(p->General.graphColors.axis);
|
||||
ui->GeneralGraphDivisions->setColor(p->General.graphColors.divisions);
|
||||
ui->GeneralMarkerDataGraph->setChecked(p->General.markerDefault.showDataOnGraphs);
|
||||
ui->GeneralMarkerDataGraphAll->setChecked(p->General.markerDefault.showAllData);
|
||||
ui->GeneralSCPIEnabled->setChecked(p->General.SCPI.enabled);
|
||||
ui->GeneralSCPIPort->setValue(p->General.SCPI.port);
|
||||
ui->GraphsColorBackground->setColor(p->Graphs.Color.background);
|
||||
ui->GraphsColorAxis->setColor(p->Graphs.Color.axis);
|
||||
ui->GraphsColorDivisions->setColor(p->Graphs.Color.divisions);
|
||||
ui->GraphsDomainChangeBehavior->setCurrentIndex((int) p->Graphs.domainChangeBehavior);
|
||||
ui->GraphsShowMarkerData->setChecked(p->Graphs.markerBehavior.showDataOnGraphs);
|
||||
ui->GraphsShowAllMarkerData->setChecked(p->Graphs.markerBehavior.showAllData);
|
||||
ui->SCPIServerEnabled->setChecked(p->SCPIServer.enabled);
|
||||
ui->SCPIServerPort->setValue(p->SCPIServer.port);
|
||||
|
||||
QTreeWidgetItem *item = ui->treeWidget->topLevelItem(0);
|
||||
if (item != nullptr) {
|
||||
|
@ -6,6 +6,15 @@
|
||||
#include <exception>
|
||||
#include "Util/qpointervariant.h"
|
||||
|
||||
enum GraphDomainChangeBehavior {
|
||||
RemoveChangedTraces = 0,
|
||||
AdjustGraphs = 1,
|
||||
AdjustGrahpsIfOnlyTrace = 2,
|
||||
};
|
||||
|
||||
Q_DECLARE_METATYPE(GraphDomainChangeBehavior);
|
||||
|
||||
|
||||
class Preferences {
|
||||
public:
|
||||
static Preferences& getInstance() {
|
||||
@ -62,16 +71,17 @@ public:
|
||||
QColor background;
|
||||
QColor axis;
|
||||
QColor divisions;
|
||||
} graphColors;
|
||||
} Color;
|
||||
GraphDomainChangeBehavior domainChangeBehavior;
|
||||
struct {
|
||||
bool showDataOnGraphs;
|
||||
bool showAllData;
|
||||
} markerDefault;
|
||||
struct {
|
||||
bool enabled;
|
||||
int port;
|
||||
} SCPI;
|
||||
} General;
|
||||
} markerBehavior;
|
||||
} Graphs;
|
||||
struct {
|
||||
bool enabled;
|
||||
int port;
|
||||
} SCPIServer;
|
||||
|
||||
bool TCPoverride; // in case of manual port specification via command line
|
||||
private:
|
||||
@ -83,7 +93,7 @@ private:
|
||||
QString name;
|
||||
QVariant def;
|
||||
};
|
||||
const std::array<SettingDescription, 34> descr = {{
|
||||
const std::array<SettingDescription, 35> descr = {{
|
||||
{&Startup.ConnectToFirstDevice, "Startup.ConnectToFirstDevice", true},
|
||||
{&Startup.RememberSweepSettings, "Startup.RememberSweepSettings", false},
|
||||
{&Startup.DefaultSweep.type, "Startup.DefaultSweep.type", "Frequency"},
|
||||
@ -111,13 +121,14 @@ private:
|
||||
{&Acquisition.harmonicMixing, "Acquisition.harmonicMixing", false},
|
||||
{&Acquisition.useDFTinSAmode, "Acquisition.useDFTinSAmode", true},
|
||||
{&Acquisition.RBWLimitForDFT, "Acquisition.RBWLimitForDFT", 3000.0},
|
||||
{&General.graphColors.background, "General.graphColors.background", QColor(Qt::black)},
|
||||
{&General.graphColors.axis, "General.graphColors.axis", QColor(Qt::white)},
|
||||
{&General.graphColors.divisions, "General.graphColors.divisions", QColor(Qt::gray)},
|
||||
{&General.markerDefault.showDataOnGraphs, "General.MarkerDefault.ShowDataOnGraphs", true},
|
||||
{&General.markerDefault.showAllData, "General.MarkerDefault.ShowAllData", false},
|
||||
{&General.SCPI.enabled, "General.SCPI.enabled", true},
|
||||
{&General.SCPI.port, "General.SCPI.port", 19542},
|
||||
{&Graphs.Color.background, "Graphs.Color.background", QColor(Qt::black)},
|
||||
{&Graphs.Color.axis, "Graphs.Color.axis", QColor(Qt::white)},
|
||||
{&Graphs.Color.divisions, "Graphs.Color.divisions", QColor(Qt::gray)},
|
||||
{&Graphs.domainChangeBehavior, "Graphs.domainChangeBehavior", GraphDomainChangeBehavior::AdjustGraphs},
|
||||
{&Graphs.markerBehavior.showDataOnGraphs, "Graphs.markerBehavior.ShowDataOnGraphs", true},
|
||||
{&Graphs.markerBehavior.showAllData, "Graphs.markerBehavior.ShowAllData", false},
|
||||
{&SCPIServer.enabled, "SCPIServer.enabled", true},
|
||||
{&SCPIServer.port, "SCPIServer.port", 19542},
|
||||
}};
|
||||
};
|
||||
|
||||
|
@ -7,7 +7,7 @@
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>919</width>
|
||||
<height>875</height>
|
||||
<height>876</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
@ -53,7 +53,12 @@
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>General</string>
|
||||
<string>Graphs</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>SCPI Server</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
@ -73,7 +78,7 @@
|
||||
</size>
|
||||
</property>
|
||||
<property name="currentIndex">
|
||||
<number>0</number>
|
||||
<number>3</number>
|
||||
</property>
|
||||
<widget class="QWidget" name="Startup">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_4">
|
||||
@ -647,153 +652,221 @@
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="General">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_6">
|
||||
<widget class="QWidget" name="Graphs">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_5">
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_5">
|
||||
<layout class="QVBoxLayout" name="verticalLayout_11">
|
||||
<item>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_4">
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox_5">
|
||||
<property name="title">
|
||||
<string>Graph colors</string>
|
||||
</property>
|
||||
<layout class="QFormLayout" name="formLayout_4">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label_15">
|
||||
<property name="text">
|
||||
<string>Background:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="ColorPickerButton" name="GeneralGraphBackground">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_16">
|
||||
<property name="text">
|
||||
<string>Axis:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="ColorPickerButton" name="GeneralGraphAxis">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="label_17">
|
||||
<property name="text">
|
||||
<string>Divisions:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="ColorPickerButton" name="GeneralGraphDivisions">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox_9">
|
||||
<property name="title">
|
||||
<string>Marker Default Behavior</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_9">
|
||||
<item>
|
||||
<widget class="QCheckBox" name="GeneralMarkerDataGraph">
|
||||
<property name="text">
|
||||
<string>Show data on graphs</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="GeneralMarkerDataGraphAll">
|
||||
<property name="text">
|
||||
<string>Show data in all available formats</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox_8">
|
||||
<property name="title">
|
||||
<string>SCPI Control</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_8">
|
||||
<item>
|
||||
<widget class="QCheckBox" name="GeneralSCPIEnabled">
|
||||
<property name="text">
|
||||
<string>Enable server</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_7">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_20">
|
||||
<property name="text">
|
||||
<string>Port:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QSpinBox" name="GeneralSCPIPort">
|
||||
<property name="minimum">
|
||||
<number>1</number>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>65535</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacer_3">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
<widget class="QGroupBox" name="groupBox_5">
|
||||
<property name="title">
|
||||
<string>Colors</string>
|
||||
</property>
|
||||
<layout class="QFormLayout" name="formLayout_4">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label_15">
|
||||
<property name="text">
|
||||
<string>Background:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="ColorPickerButton" name="GraphsColorBackground">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_16">
|
||||
<property name="text">
|
||||
<string>Axis:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="ColorPickerButton" name="GraphsColorAxis">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="label_17">
|
||||
<property name="text">
|
||||
<string>Divisions:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="ColorPickerButton" name="GraphsColorDivisions">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_3">
|
||||
<widget class="QGroupBox" name="groupBox_12">
|
||||
<property name="title">
|
||||
<string>Trace Domain Handling</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_4">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_25">
|
||||
<property name="text">
|
||||
<string><html><head/><body><p>A trace may change its output format/domain if certain settings are changed (e.g. from frequency to time domain when enabling TDR). Depending on the type of change, the graphs settings also have to be adjusted. Select the the behavior of the graphs when this happens:</p></body></html></string>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QComboBox" name="GraphsDomainChangeBehavior">
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Remove changed trace from all unsupported graphs</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Adjust graphs to support the changed trace (may remove other traces)</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Adjust graph only if it contains no other traces</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox_9">
|
||||
<property name="title">
|
||||
<string>Marker Default Behavior</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_9">
|
||||
<item>
|
||||
<widget class="QCheckBox" name="GraphsShowMarkerData">
|
||||
<property name="text">
|
||||
<string>Show data on graphs</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="GraphsShowAllMarkerData">
|
||||
<property name="text">
|
||||
<string>Show data in all available formats</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacer_3">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_3">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>80</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="SCPIServer">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_10">
|
||||
<item>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_10">
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox_8">
|
||||
<property name="title">
|
||||
<string>SCPI Control</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_8">
|
||||
<item>
|
||||
<widget class="QCheckBox" name="SCPIServerEnabled">
|
||||
<property name="text">
|
||||
<string>Enable server</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_7">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_20">
|
||||
<property name="text">
|
||||
<string>Port:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QSpinBox" name="SCPIServerPort">
|
||||
<property name="minimum">
|
||||
<number>1</number>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>65535</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacer_4">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_4">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>471</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
|
Loading…
Reference in New Issue
Block a user