Branch: master

e4fcc7fd 2015-09-12 21:17:28 Timothy Pearson
Restore measured parameters when waveform file is loaded
Consolidate parameter set routines
M clients/tde/src/part/companalyzer/part.cpp
M clients/tde/src/part/companalyzer/part.h
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 @@
 	processLockouts();
 }
 
-void CompAnalyzerPart::parameterASourceChanged(int index) {
+void CompAnalyzerPart::parameterSourceChanged() {
 	TQValueList<TQ_UINT32> 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 @@
 		m_worker->setNewParameterSourceList(sourceIndexList);
 		requestNetworkOperation(CompAnalyzerEvent(ChangeMeasurementSource, TQVariant()), true);
 	}
+}
 
+void CompAnalyzerPart::parameterASourceChanged(int) {
+	parameterSourceChanged();
 	processLockouts();
 }
 
-void CompAnalyzerPart::parameterBSourceChanged(int index) {
-	TQValueList<TQ_UINT32> 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 @@
 					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 @@
 				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("<qt>The selected waveform file version does not match this client</qt>"), 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 @@
 			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: