MCPcopy Create free account
hub / github.com/BatchDrake/SigDigger / onZeroPointChanged

Method onZeroPointChanged

Components/TimeWindow.cpp:2223–2282  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2221}
2222
2223void
2224TimeWindow::onZeroPointChanged(void)
2225{
2226 QList<WaveVCursor> vCursors, vEmpty;
2227 QList<WaveACursor> aCursors, aEmpty;
2228 bool isAmplitude = false;
2229 bool imag = false;
2230 bool real = false;
2231
2232 isAmplitude = this->ui->decAmplitudeButton->isChecked();
2233
2234 this->ui->zeroPointSpin->setEnabled(isAmplitude);
2235 this->ui->clkComponentCombo->setEnabled(isAmplitude);
2236
2237 if (this->ui->clkZcButton->isChecked() && isAmplitude) {
2238 WaveVCursor vCursor;
2239 WaveACursor aCursor;
2240
2241 vCursor.color = QColor(0xff, 0xff, 0x00);
2242 vCursor.string = "Zero point";
2243
2244 switch (this->ui->clkComponentCombo->currentIndex()) {
2245 case 0:
2246 vCursor.level = SCAST(SUCOMPLEX, this->ui->zeroPointSpin->value());
2247 vCursors.append(vCursor);
2248 real = true;
2249 break;
2250
2251 case 1:
2252 vCursor.level = I * SCAST(SUCOMPLEX, this->ui->zeroPointSpin->value());
2253 vCursors.append(vCursor);
2254 imag = true;
2255 break;
2256
2257 case 2:
2258 aCursor.color = QColor(0xc1, 0x2e, 0x81);
2259 aCursor.string = vCursor.string;
2260 aCursor.amplitude = this->ui->zeroPointSpin->value();
2261 aCursors.append(aCursor);
2262 real = imag = true;
2263 break;
2264 }
2265 }
2266
2267 if (real) {
2268 this->ui->realWaveform->setVCursorList(vCursors);
2269 this->ui->realWaveform->setACursorList(aCursors);
2270 } else {
2271 this->ui->realWaveform->setVCursorList(vEmpty);
2272 this->ui->realWaveform->setACursorList(aEmpty);
2273 }
2274
2275 if (imag) {
2276 this->ui->imagWaveform->setVCursorList(vCursors);
2277 this->ui->imagWaveform->setACursorList(aCursors);
2278 } else {
2279 this->ui->imagWaveform->setVCursorList(vEmpty);
2280 this->ui->imagWaveform->setACursorList(aEmpty);

Callers 2

refreshUiMethod · 0.95

Calls 3

valueMethod · 0.80
appendMethod · 0.80
setEnabledMethod · 0.45

Tested by

no test coverage detected