Restore measured parameters when waveform file is loaded

Consolidate parameter set routines
master
Timothy Pearson 9 years ago
parent c62b282dff
commit e4fcc7fd8f

@ -1089,19 +1089,20 @@ void CompAnalyzerPart::frequencyInputChanged(double value) {
processLockouts(); processLockouts();
} }
void CompAnalyzerPart::parameterASourceChanged(int index) { void CompAnalyzerPart::parameterSourceChanged() {
TQValueList<TQ_UINT32> sourceIndexList; TQValueList<TQ_UINT32> sourceIndexList;
TQString newSource = m_base->parameterASourceCombo->text(index);
TQString source = m_base->parameterBSourceCombo->currentText();
AllowedMeasurementInfoList::iterator it2; AllowedMeasurementInfoList::iterator it2;
TQString source;
source = m_base->parameterASourceCombo->currentText();
for (it2 = m_parameterSourceValues[0].begin(); it2 != m_parameterSourceValues[0].end(); ++it2) { for (it2 = m_parameterSourceValues[0].begin(); it2 != m_parameterSourceValues[0].end(); ++it2) {
if ((*it2).second == newSource) { if ((*it2).second == source) {
sourceIndexList.append((*it2).first); sourceIndexList.append((*it2).first);
break; break;
} }
} }
source = m_base->parameterBSourceCombo->currentText();
for (it2 = m_parameterSourceValues[1].begin(); it2 != m_parameterSourceValues[1].end(); ++it2) { for (it2 = m_parameterSourceValues[1].begin(); it2 != m_parameterSourceValues[1].end(); ++it2) {
if ((*it2).second == source) { if ((*it2).second == source) {
sourceIndexList.append((*it2).first); sourceIndexList.append((*it2).first);
@ -1113,35 +1114,15 @@ void CompAnalyzerPart::parameterASourceChanged(int index) {
m_worker->setNewParameterSourceList(sourceIndexList); m_worker->setNewParameterSourceList(sourceIndexList);
requestNetworkOperation(CompAnalyzerEvent(ChangeMeasurementSource, TQVariant()), true); requestNetworkOperation(CompAnalyzerEvent(ChangeMeasurementSource, TQVariant()), true);
} }
}
void CompAnalyzerPart::parameterASourceChanged(int) {
parameterSourceChanged();
processLockouts(); processLockouts();
} }
void CompAnalyzerPart::parameterBSourceChanged(int index) { void CompAnalyzerPart::parameterBSourceChanged(int) {
TQValueList<TQ_UINT32> sourceIndexList; parameterSourceChanged();
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);
}
processLockouts(); processLockouts();
} }
@ -1304,6 +1285,10 @@ void CompAnalyzerPart::recallWaveforms() {
if (traceno == 0) { if (traceno == 0) {
m_worker->setSweepStartFrequency(positions[0]); m_worker->setSweepStartFrequency(positions[0]);
m_worker->setSweepEndFrequency(positions[positions.count() - 1]); 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++) { for (int cursorno=0; cursorno<4; cursorno++) {
@ -1320,6 +1305,7 @@ void CompAnalyzerPart::recallWaveforms() {
m_base->sweepStartFrequencyBox->setFloatValue(sweepStartFrequency / 1000000.0); m_base->sweepStartFrequencyBox->setFloatValue(sweepStartFrequency / 1000000.0);
m_base->sweepEndFrequencyBox->setFloatValue(sweepEndFrequency / 1000000.0); m_base->sweepEndFrequencyBox->setFloatValue(sweepEndFrequency / 1000000.0);
m_base->sweepStepFrequencyBox->setFloatValue(sweepStepFrequency / 1000000.0); m_base->sweepStepFrequencyBox->setFloatValue(sweepStepFrequency / 1000000.0);
parameterSourceChanged();
} }
else { else {
KMessageBox::error(0, i18n("<qt>The selected waveform file version does not match this client</qt>"), i18n("Invalid File")); KMessageBox::error(0, i18n("<qt>The selected waveform file version does not match this client</qt>"), i18n("Invalid File"));

@ -227,6 +227,7 @@ namespace RemoteLab
TQString parameterMeasurementUnits(TQ_UINT32 parameter); TQString parameterMeasurementUnits(TQ_UINT32 parameter);
TQString parameterNameToMeasurementUnits(TQString name, unsigned int parameter_index); TQString parameterNameToMeasurementUnits(TQString name, unsigned int parameter_index);
void requestNetworkOperation(CompAnalyzerEvent item, bool syncPoint=false); void requestNetworkOperation(CompAnalyzerEvent item, bool syncPoint=false);
void parameterSourceChanged();
void patWatchDog(); void patWatchDog();
private: private:

Loading…
Cancel
Save