From e4fcc7fd8faab801c98d972fe305aeed9b9d7790 Mon Sep 17 00:00:00 2001 From: Timothy Pearson Date: Sat, 12 Sep 2015 21:17:28 -0500 Subject: [PATCH] Restore measured parameters when waveform file is loaded Consolidate parameter set routines --- clients/tde/src/part/companalyzer/part.cpp | 46 ++++++++-------------- clients/tde/src/part/companalyzer/part.h | 1 + 2 files changed, 17 insertions(+), 30 deletions(-) diff --git a/clients/tde/src/part/companalyzer/part.cpp b/clients/tde/src/part/companalyzer/part.cpp index 8762616..32eede1 100755 --- a/clients/tde/src/part/companalyzer/part.cpp +++ b/clients/tde/src/part/companalyzer/part.cpp @@ -1089,19 +1089,20 @@ void CompAnalyzerPart::frequencyInputChanged(double value) { processLockouts(); } -void CompAnalyzerPart::parameterASourceChanged(int index) { +void CompAnalyzerPart::parameterSourceChanged() { TQValueList sourceIndexList; - TQString newSource = m_base->parameterASourceCombo->text(index); - TQString source = m_base->parameterBSourceCombo->currentText(); - AllowedMeasurementInfoList::iterator it2; + TQString source; + + source = m_base->parameterASourceCombo->currentText(); for (it2 = m_parameterSourceValues[0].begin(); it2 != m_parameterSourceValues[0].end(); ++it2) { - if ((*it2).second == newSource) { + if ((*it2).second == source) { sourceIndexList.append((*it2).first); break; } } + source = m_base->parameterBSourceCombo->currentText(); for (it2 = m_parameterSourceValues[1].begin(); it2 != m_parameterSourceValues[1].end(); ++it2) { if ((*it2).second == source) { sourceIndexList.append((*it2).first); @@ -1113,35 +1114,15 @@ void CompAnalyzerPart::parameterASourceChanged(int index) { m_worker->setNewParameterSourceList(sourceIndexList); requestNetworkOperation(CompAnalyzerEvent(ChangeMeasurementSource, TQVariant()), true); } +} +void CompAnalyzerPart::parameterASourceChanged(int) { + parameterSourceChanged(); processLockouts(); } -void CompAnalyzerPart::parameterBSourceChanged(int index) { - TQValueList sourceIndexList; - TQString newSource = m_base->parameterBSourceCombo->text(index); - TQString source = m_base->parameterASourceCombo->currentText(); - - AllowedMeasurementInfoList::iterator it2; - for (it2 = m_parameterSourceValues[0].begin(); it2 != m_parameterSourceValues[0].end(); ++it2) { - if ((*it2).second == source) { - sourceIndexList.append((*it2).first); - break; - } - } - - for (it2 = m_parameterSourceValues[1].begin(); it2 != m_parameterSourceValues[1].end(); ++it2) { - if ((*it2).second == newSource) { - sourceIndexList.append((*it2).first); - break; - } - } - - if (sourceIndexList.count() >= 2) { - m_worker->setNewParameterSourceList(sourceIndexList); - requestNetworkOperation(CompAnalyzerEvent(ChangeMeasurementSource, TQVariant()), true); - } - +void CompAnalyzerPart::parameterBSourceChanged(int) { + parameterSourceChanged(); processLockouts(); } @@ -1304,6 +1285,10 @@ void CompAnalyzerPart::recallWaveforms() { if (traceno == 0) { m_worker->setSweepStartFrequency(positions[0]); m_worker->setSweepEndFrequency(positions[positions.count() - 1]); + m_base->parameterASourceCombo->setCurrentText(m_sensorList[traceno].name); + } + else if (traceno == 1) { + m_base->parameterBSourceCombo->setCurrentText(m_sensorList[traceno].name); } } for (int cursorno=0; cursorno<4; cursorno++) { @@ -1320,6 +1305,7 @@ void CompAnalyzerPart::recallWaveforms() { m_base->sweepStartFrequencyBox->setFloatValue(sweepStartFrequency / 1000000.0); m_base->sweepEndFrequencyBox->setFloatValue(sweepEndFrequency / 1000000.0); m_base->sweepStepFrequencyBox->setFloatValue(sweepStepFrequency / 1000000.0); + parameterSourceChanged(); } else { KMessageBox::error(0, i18n("The selected waveform file version does not match this client"), i18n("Invalid File")); diff --git a/clients/tde/src/part/companalyzer/part.h b/clients/tde/src/part/companalyzer/part.h index 517e81d..6795eb9 100644 --- a/clients/tde/src/part/companalyzer/part.h +++ b/clients/tde/src/part/companalyzer/part.h @@ -227,6 +227,7 @@ namespace RemoteLab TQString parameterMeasurementUnits(TQ_UINT32 parameter); TQString parameterNameToMeasurementUnits(TQString name, unsigned int parameter_index); void requestNetworkOperation(CompAnalyzerEvent item, bool syncPoint=false); + void parameterSourceChanged(); void patWatchDog(); private: