#include "i0mapmon.h" #include "ui_i0mapmon.h" // cumbia #include #include #include #include // cumbia #include #include I0mapmon::I0mapmon(CumbiaPool *cumbia_pool, QWidget *parent) : QWidget(parent) { // cumbia CuModuleLoader mloader(cumbia_pool, &m_ctrl_factory_pool, &m_log_impl); cu_pool = cumbia_pool; ui = new Ui::I0mapmon; ui->setupUi(this, cu_pool, m_ctrl_factory_pool); // mloader.modules() to get the list of loaded modules // cumbia m_fel0x = 0; for(int i = 1; i < qApp->arguments().size() && m_fel0x < 1; i++) { if(qApp->arguments()[i].contains("f01")) m_fel0x = 1; else if(qApp->arguments()[i].contains("f02")) m_fel0x = 2; } if(m_fel0x < 1) ui->lTitle->setText("Unknown operation mode FEL01 / FEL02 from command line args"); else { ui->lTitle->setText(ui->lTitle->text() + QString(" FEL0%1").arg(m_fel0x)); // continue setup QuWatcher *w = new QuWatcher(this, cumbia_pool, m_ctrl_factory_pool); w->setSingleShot(true); w->setAutoDestroy(true); w->attach(this, SLOT(onNamesReady(QStringList))); w->setSource("$1/name"); connect(ui->pbApplyWlens, SIGNAL(clicked()), this, SLOT(applyWavelenX())); connect(ui->pbApplyWlenWei, SIGNAL(clicked()), this, SLOT(applyWavelenX())); // qu-line edit for wavelen / wavelen weights ui->quleWlens->setTarget(QString("$2/FEL0%1_IOM_wavelengths").arg(m_fel0x)); ui->quleWlenWei->setTarget(QString("$2/FEL0%1_IOM_wavelength_weights").arg(m_fel0x)); // label ui->qulWlens->setSource(QString("$2/FEL0%1_IOM_wavelengths").arg(m_fel0x)); ui->qulWlenWei->setSource(QString("$2/FEL0%1_IOM_wavelength_weights").arg(m_fel0x)); // plot ui->quSpectrumPlot->setYLowerBound(-1.0); ui->quSpectrumPlot->setYUpperBound(1.0); // autoscale ui->quSpectrumPlot->setYAxisAutoscaleEnabled(true); } } I0mapmon::~I0mapmon() { delete ui; } void I0mapmon::onNamesReady(const QStringList &n) { ui->qucbx->clear(); ui->qucbx->insertItems(0, n); if(n.size()) { onXChanged(n.first()); // X combo box connect(ui->qucbx, SIGNAL(currentTextChanged(QString)), this, SLOT(onXChanged(QString))); } } void I0mapmon::applyWavelenX() { bool ok; QString tgt, txt; QVector vals; sender()->objectName() == "pbApplyWlens" ? txt = ui->quleWlens->text() : txt = ui->quleWlenWei->text(); foreach(const QString& v, txt.split(QRegularExpression(",\\s*"))) if(v.toDouble(&ok) && ok) vals.push_back(v.toDouble()); sender()->objectName() == "pbApplyWlens" ? tgt = QString("$2/FEL0%1_IOM_wavelengths").arg(m_fel0x) : tgt = QString("$2/FEL0%1_IOM_wavelength_weights").arg(m_fel0x); qDebug() << __PRETTY_FUNCTION__ << "*WOULD WRITE ON* target" << tgt << "values" << vals; } void I0mapmon::onXChanged(const QString &x) { ui->quSpectrumPlot->unsetSources(); ui->quSpectrumPlot->clearPlot(); ui->quSpectrumPlot->setSource("$1/" + x); }