| 101 | } |
| 102 | |
| 103 | QWidget *GRTimePlotAddonSettings::createXAxisMenu(QWidget *parent) |
| 104 | { |
| 105 | MenuSectionWidget *xaxiscontainer = new MenuSectionWidget(parent); |
| 106 | MenuCollapseSection *xaxis = new MenuCollapseSection("X-AXIS", MenuCollapseSection::MHCW_NONE, |
| 107 | MenuCollapseSection::MHW_BASEWIDGET, xaxiscontainer); |
| 108 | |
| 109 | QWidget *bufferPlotSize = new QWidget(xaxis); |
| 110 | QHBoxLayout *bufferPlotSizeLayout = new QHBoxLayout(bufferPlotSize); |
| 111 | bufferPlotSizeLayout->setMargin(0); |
| 112 | bufferPlotSizeLayout->setSpacing(10); |
| 113 | bufferPlotSize->setLayout(bufferPlotSizeLayout); |
| 114 | |
| 115 | m_bufferSizeSpin = new ScaleSpinButton( |
| 116 | { |
| 117 | {"samples", 1e0}, |
| 118 | {"ksamples", 1e3}, |
| 119 | {"Msamples", 1e6}, |
| 120 | }, |
| 121 | "Buffer Size", 16, DBL_MAX, false, false, bufferPlotSize); |
| 122 | |
| 123 | connect(m_bufferSizeSpin, &ScaleSpinButton::valueChanged, this, [=](double val) { |
| 124 | if(m_plotSizeSpin->value() < val) { |
| 125 | m_plotSizeSpin->setValue(val); |
| 126 | } |
| 127 | m_plotSizeSpin->setMinValue(val); |
| 128 | setBufferSize((uint32_t)val); |
| 129 | }); |
| 130 | connect(this, &GRTimePlotAddonSettings::bufferSizeChanged, m_plot, &GRTimePlotAddon::setBufferSize); |
| 131 | |
| 132 | m_plotSizeSpin = new ScaleSpinButton( |
| 133 | { |
| 134 | {"samples", 1e0}, |
| 135 | {"ksamples", 1e3}, |
| 136 | {"Msamples", 1e6}, |
| 137 | {"Gsamples", 1e9}, |
| 138 | }, |
| 139 | "Plot Size", 16, DBL_MAX, false, false, bufferPlotSize); |
| 140 | |
| 141 | connect(m_plotSizeSpin, &ScaleSpinButton::valueChanged, this, [=](double val) { setPlotSize((uint32_t)val); }); |
| 142 | connect(this, &GRTimePlotAddonSettings::plotSizeChanged, m_plot, &GRTimePlotAddon::setPlotSize); |
| 143 | |
| 144 | bufferPlotSizeLayout->addWidget(m_bufferSizeSpin); |
| 145 | bufferPlotSizeLayout->addWidget(m_plotSizeSpin); |
| 146 | |
| 147 | m_syncBufferPlot = new MenuOnOffSwitch(tr("SYNC BUFFER-PLOT SIZES"), xaxis, false); |
| 148 | connect(m_syncBufferPlot->onOffswitch(), &QAbstractButton::toggled, this, [=](bool b) { |
| 149 | m_plotSizeSpin->setEnabled(!b); |
| 150 | m_rollingModeSw->setEnabled(!b); |
| 151 | if(b) { |
| 152 | m_rollingModeSw->onOffswitch()->setChecked(false); |
| 153 | m_plotSizeSpin->setValue(m_bufferSizeSpin->value()); |
| 154 | connect(m_bufferSizeSpin, &ScaleSpinButton::valueChanged, m_plotSizeSpin, |
| 155 | &ScaleSpinButton::setValue); |
| 156 | } else { |
| 157 | disconnect(m_bufferSizeSpin, &ScaleSpinButton::valueChanged, m_plotSizeSpin, |
| 158 | &ScaleSpinButton::setValue); |
| 159 | } |
| 160 | }); |
nothing calls this directly
no test coverage detected