Branch: master

98fc8fbc 2014-09-06 14:01:43 Timothy Pearson
Add math waveform support to scope viewer
M clients/tde/debian/control
M clients/tde/src/part/scope/Makefile.am
M clients/tde/src/part/scope/layout.ui
M clients/tde/src/part/scope/part.cpp
M clients/tde/src/part/scope/part.h
diff --git a/clients/tde/debian/control b/clients/tde/debian/control
index 8739149..c8edf21 100644
--- a/clients/tde/debian/control
+++ b/clients/tde/debian/control
@@ -3,7 +3,7 @@
 Priority: optional
 Maintainer: Timothy Pearson <kb9vqf@...>
 Standards-Version: 3.8.4
-Build-Depends: debhelper (>= 5.0), cdbs, tdelibs14-trinity-dev, libtqtrla-dev, libtdekrb-trinity-dev, libtdeldap-trinity-dev, xutils, chrpath, gettext, quilt (>= 0.40), automake, autoconf, libtool, libltdl-dev
+Build-Depends: debhelper (>= 5.0), cdbs, tdelibs14-trinity-dev, libtqtrla-dev, libtdekrb-trinity-dev, libtdeldap-trinity-dev, libffts-dev, xutils, chrpath, gettext, quilt (>= 0.40), automake, autoconf, libtool, libltdl-dev
 Homepage: http://ulab.trinitydesktop.org/
 
 Package: remote-laboratory-client-trinity
diff --git a/clients/tde/src/part/scope/Makefile.am b/clients/tde/src/part/scope/Makefile.am
index 8a3dbb6..52d22c0 100644
--- a/clients/tde/src/part/scope/Makefile.am
+++ b/clients/tde/src/part/scope/Makefile.am
@@ -7,6 +7,6 @@
 #Part
 kde_module_LTLIBRARIES  =  libremotelab_scope.la
 libremotelab_scope_la_LIBADD  = ../../widgets/libtracewidget.la ../../widgets/libfloatspinbox.la $(LIB_KFILE) $(LIB_TDEPARTS) $(LIB_TDEUI) $(LIB_QT)
-libremotelab_scope_la_LDFLAGS = $(all_libraries) $(KDE_PLUGIN) -ltdecore -ltdeui -ltdeio -ltdefx -ltdekrbsocket -ltqtrla
+libremotelab_scope_la_LDFLAGS = $(all_libraries) $(KDE_PLUGIN) -ltdecore -ltdeui -ltdeio -ltdefx -ltdekrbsocket -ltqtrla -lffts
 libremotelab_scope_la_SOURCES = \
    part.cpp layout.ui
diff --git a/clients/tde/src/part/scope/layout.ui b/clients/tde/src/part/scope/layout.ui
index 2a94997..5447780 100644
--- a/clients/tde/src/part/scope/layout.ui
+++ b/clients/tde/src/part/scope/layout.ui
@@ -116,6 +116,21 @@
 					</widget>
 					<widget class="TQGroupBox" row="1" column="1">
 						<property name="name">
+							<cstring>groupOscilloscopeAnalysisControls</cstring>
+						</property>
+						<property name="title">
+							<string>Analysis Controls</string>
+						</property>
+						<grid>
+							<widget class="TQWidget" row="0" column="0" colspan="1">
+								<property name="name">
+									<cstring>mathTraceControlLayoutWidget</cstring>
+								</property>
+							</widget>
+						</grid>
+					</widget>
+					<widget class="TQGroupBox" row="2" column="1">
+						<property name="name">
 							<cstring>groupOscilloscopeAcquisitionControls</cstring>
 						</property>
 						<property name="title">
@@ -156,7 +171,7 @@
 							</widget>
 						</grid>
 					</widget>
-					<widget class="TQGroupBox" row="2" column="1">
+					<widget class="TQGroupBox" row="3" column="1">
 						<property name="name">
 							<cstring>groupOscilloscopeTestNotes</cstring>
 						</property>
diff --git a/clients/tde/src/part/scope/part.cpp b/clients/tde/src/part/scope/part.cpp
index fed1726..fb056cd 100644
--- a/clients/tde/src/part/scope/part.cpp
+++ b/clients/tde/src/part/scope/part.cpp
@@ -20,6 +20,8 @@
  * http://www.raptorengineeringinc.com
  */
 
+#define ENABLE_FFT
+
 #include "define.h"
 #include "part.h"
 
@@ -47,6 +49,10 @@
 #include <unistd.h>       //access()
 #include <stdint.h>
 #include <cmath>
+
+#ifdef ENABLE_FFT
+#include <ffts/ffts.h>
+#endif // ENABLE_FFT
 
 #include "tracewidget.h"
 #include "floatspinbox.h"
@@ -183,6 +189,213 @@
 	emit(triggerChannelChangeRequested());
 }
 
+MathTraceControlWidget::MathTraceControlWidget(TQWidget *parent, const char *name)
+	: TQWidget(parent, name)
+{
+	TQGridLayout *topGrid = new TQGridLayout(this);
+	m_groupBox = new TQGroupBox(this);
+	m_groupBox->setColumnLayout(0, TQt::Vertical);
+	topGrid->addMultiCellWidget(m_groupBox, 0, 0, 0, 0);
+	m_groupBox->setTitle(i18n("Unknown Math Channel"));
+	m_primaryLayout = new TQGridLayout(m_groupBox->layout(), 1, 1, KDialog::spacingHint());
+
+	m_channelEnabledCheckBox = new TQCheckBox(m_groupBox);
+	connect(m_channelEnabledCheckBox, SIGNAL(clicked()), this, SLOT(enableClicked()));
+	m_channelEnabledCheckBox->setText(i18n("Enable"));
+	m_primaryLayout->addMultiCellWidget(m_channelEnabledCheckBox, 0, 0, 0, 0);
+
+	m_voltsDivComboBox = new TQComboBox(m_groupBox);
+	connect(m_voltsDivComboBox, SIGNAL(activated(int)), this, SLOT(vdivChanged(int)));
+	m_primaryLayout->addMultiCellWidget(m_voltsDivComboBox, 0, 0, 1, 1);
+
+	m_verticalUnitsLabel = new TQLabel(m_groupBox);
+	m_verticalUnitsLabel->setText(i18n("V/div"));
+	m_primaryLayout->addMultiCellWidget(m_verticalUnitsLabel, 0, 0, 2, 2);
+
+	m_operandFirstComboBox = new TQComboBox(m_groupBox);
+	connect(m_operandFirstComboBox, SIGNAL(activated(int)), this, SLOT(operandFirstChanged(int)));
+	m_primaryLayout->addMultiCellWidget(m_operandFirstComboBox, 1, 1, 0, 0);
+
+	m_operandSecondComboBox = new TQComboBox(m_groupBox);
+	connect(m_operandSecondComboBox, SIGNAL(activated(int)), this, SLOT(operandSecondChanged(int)));
+	m_primaryLayout->addMultiCellWidget(m_operandSecondComboBox, 1, 1, 2, 2);
+
+	m_operatorComboBox = new TQComboBox(m_groupBox);
+	connect(m_operatorComboBox, SIGNAL(activated(int)), this, SLOT(operatorChanged(int)));
+	m_primaryLayout->addMultiCellWidget(m_operatorComboBox, 1, 1, 1, 1);
+}
+
+MathTraceControlWidget::~MathTraceControlWidget() {
+	//
+}
+
+void MathTraceControlWidget::setVoltsPerDivList(TQDoubleList list) {
+	m_voltsDivList = list;
+
+	// Update drop down list
+	double prevValue = m_voltsDivComboBox->currentText().toDouble();
+	m_voltsDivComboBox->clear();
+	TQDoubleList::iterator it;
+	int i = 0;
+	for (it = m_voltsDivList.begin(); it != m_voltsDivList.end(); ++it) {
+		m_voltsDivComboBox->insertItem(TQString("%1").arg(*it), i);
+		if (prevValue == (*it)) {
+			m_voltsDivComboBox->setCurrentItem(i);
+		}
+		i++;
+	}
+}
+
+void MathTraceControlWidget::setSelectedVoltsPerDiv(double vdiv) {
+	int i = 0;
+	for (i=0;i<m_voltsDivComboBox->count();i++) {
+		if (m_voltsDivComboBox->text(i).toDouble() == vdiv) {
+			m_voltsDivComboBox->setCurrentItem(i);
+		}
+	}
+}
+
+void MathTraceControlWidget::setFirstMathOperandList(TQInt16List list) {
+	m_firstMathOperandList = list;
+
+	// Update drop down list
+	int prevValue = (m_operandFirstComboBox->currentText().replace("Ch", "")).toInt();
+	m_operandFirstComboBox->clear();
+	TQInt16List::iterator it;
+	int i = 0;
+	for (it = m_firstMathOperandList.begin(); it != m_firstMathOperandList.end(); ++it) {
+		m_operandFirstComboBox->insertItem(TQString("Ch%1").arg(*it), i);
+		if (prevValue == (*it)) {
+			m_operandFirstComboBox->setCurrentItem(i);
+		}
+		i++;
+	}
+}
+
+void MathTraceControlWidget::setSelectedFirstMathOperand(int channel) {
+	int i = 0;
+	for (i=0;i<m_operandFirstComboBox->count();i++) {
+		if ((m_operandFirstComboBox->text(i).replace("Ch", "")).toInt() == channel) {
+			m_operandFirstComboBox->setCurrentItem(i);
+		}
+	}
+}
+
+void MathTraceControlWidget::setSecondMathOperandList(TQInt16List list) {
+	m_secondMathOperandList = list;
+
+	// Update drop down list
+	int prevValue = (m_operandSecondComboBox->currentText().replace("Ch", "")).toInt();
+	m_operandSecondComboBox->clear();
+	TQInt16List::iterator it;
+	int i = 0;
+	for (it = m_secondMathOperandList.begin(); it != m_secondMathOperandList.end(); ++it) {
+		m_operandSecondComboBox->insertItem(TQString("Ch%1").arg(*it), i);
+		if (prevValue == (*it)) {
+			m_operandSecondComboBox->setCurrentItem(i);
+		}
+		i++;
+	}
+}
+
+void MathTraceControlWidget::setSelectedSecondMathOperand(int channel) {
+	int i = 0;
+	for (i=0;i<m_operandSecondComboBox->count();i++) {
+		if ((m_operandSecondComboBox->text(i).replace("Ch", "")).toInt() == channel) {
+			m_operandSecondComboBox->setCurrentItem(i);
+		}
+	}
+}
+
+void MathTraceControlWidget::setMathOperatorList(MathOperatorList list) {
+	m_mathOperatorList = list;
+
+	// Update drop down list
+	TQString prevValue = m_operatorComboBox->currentText();
+	m_operatorComboBox->clear();
+	MathOperatorList::iterator it;
+	int i = 0;
+	for (it = m_mathOperatorList.begin(); it != m_mathOperatorList.end(); ++it) {
+		m_operatorComboBox->insertItem((*it).first, i);
+		if (prevValue == (*it).first) {
+			m_operatorComboBox->setCurrentItem(i);
+		}
+		i++;
+	}
+}
+
+void MathTraceControlWidget::setSelectedMathOperator(TQString op) {
+	int i = 0;
+	for (i=0;i<m_operatorComboBox->count();i++) {
+		if (m_operatorComboBox->text(i) == op) {
+			m_operatorComboBox->setCurrentItem(i);
+		}
+	}
+
+	updateMathOperatorOperandVisibility();
+}
+
+void MathTraceControlWidget::setTraceEnabled(bool enabled) {
+	m_channelEnabledCheckBox->setChecked(enabled);
+	m_voltsDivComboBox->setEnabled(enabled);
+	m_operandFirstComboBox->setEnabled(enabled);
+	m_operandSecondComboBox->setEnabled(enabled);
+	m_operatorComboBox->setEnabled(enabled);
+}
+
+void MathTraceControlWidget::setTraceName(TQString name) {
+	m_groupBox->setTitle(name);
+}
+
+void MathTraceControlWidget::setVerticalUnits(TQString units) {
+	m_verticalUnitsLabel->setText(i18n("%1/div").arg(units));
+}
+
 ** Diff limit reached (max: 250 lines) **
be213543 2014-09-06 14:02:00 Timothy Pearson
Merge branch 'master' of https://scm.trinitydesktop.org/scm/git/remotelaboratory
M lib/ffts/debian/rules
 ** Diff limit reached (max: 250 lines) **