void UI_Mainwindow::adjdial_timer_handler() { char str[512]; adjdial_timer->stop(); adjDialLabel->setStyleSheet(def_stylesh); adjDialLabel->setStyleSheet("font: 7pt;"); adjDialLabel->setText(""); if(adjDialFunc == ADJ_DIAL_FUNC_HOLDOFF) { strcpy(str, "Trigger holdoff: "); convert_to_metric_suffix(str + strlen(str), devparms.triggerholdoff, 2); strcat(str, "s"); statusLabel->setText(str); sprintf(str, ":TRIG:HOLD %e", devparms.triggerholdoff); set_cue_cmd(str); if(devparms.modelserie == 6) { usleep(20000); set_cue_cmd(":CLE"); } } else if(adjDialFunc == ADJ_DIAL_FUNC_ACQ_AVG) { sprintf(str, "Acquire averages: %i", devparms.acquireaverages); statusLabel->setText(str); sprintf(str, ":ACQ:AVER %i", devparms.acquireaverages); set_cue_cmd(str); } adjDialFunc = ADJ_DIAL_FUNC_NONE; if(navDial_timer->isActive() == false) { navDialFunc = NAV_DIAL_FUNC_NONE; } }
void UI_FreqSpectrumWindow::thr_finished_func() { char str[1024]; if(spectrumdialog_is_destroyed) { return; } if(malloc_err) { QApplication::restoreOverrideCursor(); QMessageBox messagewindow(QMessageBox::Critical, "Error", "The system was not able to provide enough resources (memory) to perform the requested action."); messagewindow.exec(); curve1->clear(); busy = 0; return; } strcpy(str, "FFT resolution: "); convert_to_metric_suffix(str + strlen(str), freqstep, 3); remove_trailing_zeros(str); sprintf(str + strlen(str), "Hz %i blocks of %i samples", dftblocks, dftblocksize); curve1->setUpperLabel1(str); curve1->setUpperLabel2(signallabel); sliderMoved(0); curve1->setUpdatesEnabled(true); busy = 0; QApplication::restoreOverrideCursor(); }
void UI_FreqSpectrumWindow::sliderMoved(int) { long long startstep, stopstep, spanstep; double max_freq, start_freq; char str[1024]; if(VlogCheckBox->checkState() == Qt::Checked) { mainwindow->spectrum_vlog = 1; log_minslider->setVisible(true); } else { mainwindow->spectrum_vlog = 0; log_minslider->setVisible(false); } if(sqrtCheckBox->checkState() == Qt::Checked) { mainwindow->spectrum_sqrt = 1; sprintf(str, "Amplitude Spectrum %s", signallabel); SpectrumDialog->setWindowTitle(str); if(mainwindow->spectrum_vlog) { sprintf(str, "log10(%s)", physdimension); curve1->setV_label(str); } else { curve1->setV_label(physdimension); } } else { mainwindow->spectrum_sqrt = 0; sprintf(str, "Power Spectral Density %s", signallabel); SpectrumDialog->setWindowTitle(str); if(mainwindow->spectrum_vlog) { sprintf(str, "log10((%s)^2/Hz)", physdimension); } else { sprintf(str, "(%s)^2/Hz", physdimension); } curve1->setV_label(str); } if(BWCheckBox->isChecked() == true) { curve1->setSignalColor(Qt::black); curve1->setBackgroundColor(Qt::white); curve1->setRasterColor(Qt::black); curve1->setMarker1Color(Qt::black); curve1->setBorderColor(Qt::white); curve1->setTextColor(Qt::black); curve1->setCrosshairColor(Qt::black); mainwindow->spectrum_bw = 1; } else { curve1->setSignalColor(Qt::green); curve1->setBackgroundColor(Qt::black); curve1->setRasterColor(Qt::gray); curve1->setMarker1Color(Qt::yellow); curve1->setBorderColor(Qt::lightGray); curve1->setTextColor(Qt::black); curve1->setCrosshairColor(Qt::red); mainwindow->spectrum_bw = 0; } spanstep = (long long)spanSlider->value() * (long long)steps / 1000LL; startstep = (long long)centerSlider->value() * ((long long)steps - spanstep) / 1000LL; stopstep = startstep + spanstep; if(mainwindow->spectrum_sqrt) { if(mainwindow->spectrum_vlog) { curve1->drawCurve(buf5 + startstep, stopstep - startstep, (maxvalue_sqrt_vlog * ((double)flywheel_value / 1000.0) * (double)amplitudeSlider->value()) / 1000.0, minvalue_sqrt_vlog * (double)log_minslider->value() / 1000.0); } else { curve1->drawCurve(buf3 + startstep, stopstep - startstep, (maxvalue_sqrt * ((double)flywheel_value / 1000.0) * (double)amplitudeSlider->value()) / 1000.0, 0.0); } } else { if(mainwindow->spectrum_vlog) { curve1->drawCurve(buf4 + startstep, stopstep - startstep, (maxvalue_vlog * ((double)flywheel_value / 1000.0) * (double)amplitudeSlider->value()) / 1000.0, minvalue_vlog * (double)log_minslider->value() / 1000.0); } else { curve1->drawCurve(buf2 + startstep, stopstep - startstep, (maxvalue * ((double)flywheel_value / 1000.0) * (double)amplitudeSlider->value()) / 1000.0, 0.0); } } max_freq = ((double)samplefreq / 2.0) * stopstep / steps; start_freq = ((double)samplefreq / 2.0) * startstep / steps; // printf("steps: %i\n" // "startstep: %lli\n" // "stopstep: %lli\n" // "spanstep: %lli\n" // "samplefreq: %f\n" // "max_freq: %f\n" // "start_freq: %f\n", // steps, // startstep, // stopstep, // spanstep, // samplefreq, // max_freq, // start_freq); curve1->setH_RulerValues(start_freq, max_freq); strcpy(str, "Center "); convert_to_metric_suffix(str + strlen(str), start_freq + ((max_freq - start_freq) / 2.0), 3); remove_trailing_zeros(str); strcat(str, "Hz"); centerLabel->setText(str); strcpy(str, "Span "); convert_to_metric_suffix(str + strlen(str), max_freq - start_freq, 3); remove_trailing_zeros(str); strcat(str, "Hz"); spanLabel->setText(str); }