Fix a number of problems and streamline instrument parts

master
Timothy Pearson 12 years ago
parent 1f5a3c2804
commit 043cc2c3d9

@ -61,7 +61,7 @@ bool InstrumentView::eventFilter(TQObject *o, TQEvent *e) {
TQWidget *childPartWidget = m_instrumentPart->widget();
if (childPartWidget) {
if (o == childPartWidget) {
if (e->type() == TQEvent::Resize) {
if ((e->type() == TQEvent::Resize) || (e->type() == TQEvent::LayoutHint)) {
setChildSizeData();
}
}

@ -16,153 +16,132 @@
<property name="name">
<cstring>unnamed</cstring>
</property>
<widget class="TQTabWidget" row="0" column="0">
<widget class="TQGroupBox" row="0" column="0">
<property name="name">
<cstring>TabWidget2</cstring>
<cstring>groupSpectrumAnalyzer</cstring>
</property>
<property name="enabled">
<bool>true</bool>
<property name="title">
<string>Spectrum Analyzer</string>
</property>
<widget class="TQWidget">
<grid>
<property name="name">
<cstring>tab</cstring>
<cstring>unnamed</cstring>
</property>
<attribute name="title">
<string>Spectrum Analyzer</string>
</attribute>
<grid>
<widget class="TQGroupBox" row="0" column="0" rowspan="10">
<property name="name">
<cstring>unnamed</cstring>
<cstring>groupSpectrumAnalyzerView</cstring>
</property>
<widget class="TQGroupBox" row="0" column="0">
<property name="title">
<string>Trace Viewer</string>
</property>
<property name="sizePolicy">
<sizepolicy>
<hsizetype>7</hsizetype>
<vsizetype>7</vsizetype>
<horstretch>1</horstretch>
<verstretch>1</verstretch>
</sizepolicy>
</property>
<grid>
<property name="name">
<cstring>groupSpectrumAnalyzer</cstring>
<cstring>unnamed</cstring>
</property>
<property name="title">
<string>Spectrum Analyzer</string>
</property>
<grid>
<widget class="TQSplitter" row="0" column="0" colspan="1">
<property name="name">
<cstring>unnamed</cstring>
<cstring>splitter1</cstring>
</property>
<widget class="TQGroupBox" row="0" column="0" rowspan="10">
<property name="orientation">
<enum>Vertical</enum>
</property>
<widget class="TraceWidget" row="0" column="0" colspan="1">
<property name="name">
<cstring>groupSpectrumAnalyzerView</cstring>
</property>
<property name="title">
<string>Trace Viewer</string>
<cstring>traceWidget</cstring>
</property>
<property name="sizePolicy">
<sizepolicy>
<hsizetype>7</hsizetype>
<vsizetype>7</vsizetype>
<horstretch>1</horstretch>
<verstretch>1</verstretch>
</sizepolicy>
<property name="minimumSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<grid>
<property name="name">
<cstring>unnamed</cstring>
</property>
<widget class="TQSplitter" row="0" column="0" colspan="1">
<property name="name">
<cstring>splitter1</cstring>
</property>
<property name="orientation">
<enum>Vertical</enum>
</property>
<widget class="TraceWidget" row="0" column="0" colspan="1">
<property name="name">
<cstring>traceWidget</cstring>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
</widget>
<widget class="TraceWidget" row="1" column="0" colspan="1">
<property name="name">
<cstring>traceZoomWidget</cstring>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
</widget>
</widget>
</grid>
</widget>
<widget class="TQGroupBox" row="0" column="1">
<widget class="TraceWidget" row="1" column="0" colspan="1">
<property name="name">
<cstring>groupSpectrumAnalyzerRecControls</cstring>
<cstring>traceZoomWidget</cstring>
</property>
<property name="title">
<string>Receiver Controls</string>
<property name="minimumSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<grid>
<widget class="TQLabel" row="0" column="0" colspan="1">
<property name="name">
<cstring>unnamed</cstring>
</property>
<property name="text">
<string>Reference Power Level:</string>
</property>
<property name="textFormat">
<enum>PlainText</enum>
</property>
</widget>
<widget class="FloatSpinBox" row="0" column="1" colspan="1">
<property name="name">
<cstring>saRefLevel</cstring>
</property>
<property name="enabled">
<bool>true</bool>
</property>
<property name="sizePolicy">
<sizepolicy>
<hsizetype>3</hsizetype>
<vsizetype>0</vsizetype>
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>80</width>
<height>0</height>
</size>
</property>
<property name="maxValue">
<number>128</number>
</property>
<property name="minValue">
<number>-128</number>
</property>
<property name="value">
<number>0</number>
</property>
</widget>
<widget class="TQLabel" row="0" column="3" colspan="1">
<property name="name">
<cstring>unnamed</cstring>
</property>
<property name="text">
<string>dBm</string>
</property>
<property name="textFormat">
<enum>PlainText</enum>
</property>
</widget>
</grid>
</widget>
</grid>
</widget>
</grid>
</widget>
</widget>
</grid>
</widget>
<widget class="TQGroupBox" row="0" column="1">
<property name="name">
<cstring>groupSpectrumAnalyzerRecControls</cstring>
</property>
<property name="title">
<string>Receiver Controls</string>
</property>
<grid>
<widget class="TQLabel" row="0" column="0" colspan="1">
<property name="name">
<cstring>unnamed</cstring>
</property>
<property name="text">
<string>Reference Power Level:</string>
</property>
<property name="textFormat">
<enum>PlainText</enum>
</property>
</widget>
<widget class="FloatSpinBox" row="0" column="1" colspan="1">
<property name="name">
<cstring>saRefLevel</cstring>
</property>
<property name="enabled">
<bool>true</bool>
</property>
<property name="sizePolicy">
<sizepolicy>
<hsizetype>3</hsizetype>
<vsizetype>0</vsizetype>
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>80</width>
<height>0</height>
</size>
</property>
<property name="maxValue">
<number>128</number>
</property>
<property name="minValue">
<number>-128</number>
</property>
<property name="value">
<number>0</number>
</property>
</widget>
<widget class="TQLabel" row="0" column="3" colspan="1">
<property name="name">
<cstring>unnamed</cstring>
</property>
<property name="text">
<string>dBm</string>
</property>
<property name="textFormat">
<enum>PlainText</enum>
</property>
</widget>
</grid>
</widget>
</grid>
</widget>
</grid>
</widget>

@ -16,163 +16,142 @@
<property name="name">
<cstring>unnamed</cstring>
</property>
<widget class="TQTabWidget" row="0" column="0">
<widget class="TQGroupBox" row="0" column="0">
<property name="name">
<cstring>TabWidget2</cstring>
<cstring>groupOscilloscope</cstring>
</property>
<property name="enabled">
<bool>true</bool>
<property name="title">
<string>Oscilloscope</string>
</property>
<widget class="TQWidget">
<grid>
<property name="name">
<cstring>tab</cstring>
<cstring>unnamed</cstring>
</property>
<attribute name="title">
<string>Oscilloscope</string>
</attribute>
<grid>
<widget class="TQGroupBox" row="0" column="0" rowspan="10">
<property name="name">
<cstring>unnamed</cstring>
<cstring>groupOscilloscopeView</cstring>
</property>
<widget class="TQGroupBox" row="0" column="0">
<property name="title">
<string>Trace Viewer</string>
</property>
<property name="sizePolicy">
<sizepolicy>
<hsizetype>7</hsizetype>
<vsizetype>7</vsizetype>
<horstretch>1</horstretch>
<verstretch>1</verstretch>
</sizepolicy>
</property>
<grid>
<property name="name">
<cstring>groupOscilloscope</cstring>
</property>
<property name="title">
<string>Oscilloscope</string>
<cstring>unnamed</cstring>
</property>
<grid>
<widget class="TQSplitter" row="0" column="0" colspan="1">
<property name="name">
<cstring>unnamed</cstring>
<cstring>splitter1</cstring>
</property>
<widget class="TQGroupBox" row="0" column="0" rowspan="10">
<property name="name">
<cstring>groupOscilloscopeView</cstring>
</property>
<property name="title">
<string>Trace Viewer</string>
</property>
<property name="sizePolicy">
<sizepolicy>
<hsizetype>7</hsizetype>
<vsizetype>7</vsizetype>
<horstretch>1</horstretch>
<verstretch>1</verstretch>
</sizepolicy>
</property>
<grid>
<property name="name">
<cstring>unnamed</cstring>
</property>
<widget class="TQSplitter" row="0" column="0" colspan="1">
<property name="name">
<cstring>splitter1</cstring>
</property>
<property name="orientation">
<enum>Vertical</enum>
</property>
<widget class="TraceWidget" row="0" column="0" colspan="1">
<property name="name">
<cstring>traceWidget</cstring>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
</widget>
<widget class="TraceWidget" row="1" column="0" colspan="1">
<property name="name">
<cstring>traceZoomWidget</cstring>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
</widget>
</widget>
</grid>
</widget>
<widget class="TQGroupBox" row="0" column="1">
<property name="orientation">
<enum>Vertical</enum>
</property>
<widget class="TraceWidget" row="0" column="0" colspan="1">
<property name="name">
<cstring>groupOscilloscopeCaptureControls</cstring>
<cstring>traceWidget</cstring>
</property>
<property name="title">
<string>Capture Controls</string>
<property name="minimumSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<grid>
<widget class="TQPushButton" row="0" column="0" colspan="1">
<property name="name">
<cstring>runControlStartButton</cstring>
</property>
<property name="text">
<string>Run</string>
</property>
</widget>
<widget class="TQPushButton" row="0" column="1" colspan="1">
<property name="name">
<cstring>runControlStopButton</cstring>
</property>
<property name="text">
<string>Stop</string>
</property>
</widget>
<widget class="TQWidget" row="1" column="0" colspan="2">
<property name="name">
<cstring>traceControlLayoutWidget</cstring>
</property>
</widget>
</grid>
</widget>
<widget class="TQGroupBox" row="1" column="1">
<widget class="TraceWidget" row="1" column="0" colspan="1">
<property name="name">
<cstring>groupOscilloscopeAcquisitionControls</cstring>
<cstring>traceZoomWidget</cstring>
</property>
<property name="title">
<string>Acquisition Controls</string>
<property name="minimumSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<grid>
<widget class="TQPushButton" row="0" column="0" colspan="1">
<property name="name">
<cstring>acqStart</cstring>
</property>
<property name="text">
<string>Start Acquisition</string>
</property>
</widget>
<widget class="TQPushButton" row="0" column="1" colspan="1">
<property name="name">
<cstring>acqStop</cstring>
</property>
<property name="text">
<string>Stop Acquisition</string>
</property>
</widget>
<widget class="TQPushButton" row="1" column="0" colspan="1">
<property name="name">
<cstring>waveformSave</cstring>
</property>
<property name="text">
<string>Save Waveforms</string>
</property>
</widget>
<widget class="TQPushButton" row="1" column="1" colspan="1">
<property name="name">
<cstring>waveformRecall</cstring>
</property>
<property name="text">
<string>Recall Waveforms</string>
</property>
</widget>
</grid>
</widget>
</grid>
</widget>
</grid>
</widget>
</widget>
</grid>
</widget>
<widget class="TQGroupBox" row="0" column="1">
<property name="name">
<cstring>groupOscilloscopeCaptureControls</cstring>
</property>
<property name="title">
<string>Capture Controls</string>
</property>
<grid>
<widget class="TQPushButton" row="0" column="0" colspan="1">
<property name="name">
<cstring>runControlStartButton</cstring>
</property>
<property name="text">
<string>Run</string>
</property>
</widget>
<widget class="TQPushButton" row="0" column="1" colspan="1">
<property name="name">
<cstring>runControlStopButton</cstring>
</property>
<property name="text">
<string>Stop</string>
</property>
</widget>
<widget class="TQWidget" row="1" column="0" colspan="2">
<property name="name">
<cstring>traceControlLayoutWidget</cstring>
</property>
</widget>
</grid>
</widget>
<widget class="TQGroupBox" row="1" column="1">
<property name="name">
<cstring>groupOscilloscopeAcquisitionControls</cstring>
</property>
<property name="title">
<string>Acquisition Controls</string>
</property>
<grid>
<widget class="TQPushButton" row="0" column="0" colspan="1">
<property name="name">
<cstring>acqStart</cstring>
</property>
<property name="text">
<string>Start Acquisition</string>
</property>
</widget>
<widget class="TQPushButton" row="0" column="1" colspan="1">
<property name="name">
<cstring>acqStop</cstring>
</property>
<property name="text">
<string>Stop Acquisition</string>
</property>
</widget>
<widget class="TQPushButton" row="1" column="0" colspan="1">
<property name="name">
<cstring>waveformSave</cstring>
</property>
<property name="text">
<string>Save Waveforms</string>
</property>
</widget>
<widget class="TQPushButton" row="1" column="1" colspan="1">
<property name="name">
<cstring>waveformRecall</cstring>
</property>
<property name="text">
<string>Recall Waveforms</string>
</property>
</widget>
</grid>
</widget>
</grid>
</widget>
</grid>
</widget>

@ -76,7 +76,7 @@ TraceControlWidget::TraceControlWidget(TQWidget *parent, const char *name)
m_groupBox->setColumnLayout(0, TQt::Vertical);
topGrid->addMultiCellWidget(m_groupBox, 0, 0, 0, 0);
m_groupBox->setTitle(i18n("Unknown Channel"));
m_primaryLayout = new TQGridLayout(m_groupBox->layout(), KDialog::marginHint(), KDialog::spacingHint());
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()));

@ -16,31 +16,31 @@
<property name="name">
<cstring>unnamed</cstring>
</property>
<widget class="TQTabWidget" row="0" column="0">
<widget class="TQGroupBox" row="0" column="0">
<property name="name">
<cstring>TabWidget2</cstring>
<cstring>groupMonitor</cstring>
</property>
<property name="enabled">
<bool>true</bool>
<property name="title">
<string>Monitor</string>
</property>
<widget class="TQWidget">
<grid>
<property name="name">
<cstring>tab</cstring>
<cstring>unnamed</cstring>
</property>
<attribute name="title">
<string>Monitor</string>
</attribute>
<grid>
<widget class="TQTabWidget" row="0" column="0">
<property name="name">
<cstring>unnamed</cstring>
<cstring>TabWidget2</cstring>
</property>
<widget class="TQGroupBox" row="0" column="0">
<property name="enabled">
<bool>true</bool>
</property>
<widget class="TQWidget">
<property name="name">
<cstring>groupMonitor</cstring>
</property>
<property name="title">
<string>Monitor</string>
<cstring>tab</cstring>
</property>
<attribute name="title">
<string>Plotter</string>
</attribute>
<grid>
<property name="name">
<cstring>unnamed</cstring>
@ -96,86 +96,99 @@
</widget>
</grid>
</widget>
<widget class="TQGroupBox" row="0" column="1">
<property name="name">
<cstring>groupMonitorCaptureControls</cstring>
</property>
<property name="title">
<string>Sensor Capture Controls</string>
</property>
<grid>
<widget class="TQWidget" row="1" column="0" colspan="2">
<property name="name">
<cstring>traceControlLayoutWidget</cstring>
</property>
</widget>
</grid>
</widget>
<widget class="TQGroupBox" row="1" column="1">
<property name="name">
<cstring>groupAcquisitionControls</cstring>
</property>
<property name="title">
<string>Acquisition Controls</string>
</property>
<grid>
<widget class="TQPushButton" row="0" column="0" colspan="1">
<property name="name">
<cstring>runControlStartButton</cstring>
</property>
<property name="text">
<string>Start Acquisition</string>
</property>
</widget>
<widget class="TQPushButton" row="0" column="1" colspan="1">
<property name="name">
<cstring>runControlStopButton</cstring>
</property>
<property name="text">
<string>Stop Acquisition</string>
</property>
</widget>
<widget class="TQPushButton" row="1" column="0" colspan="1">
<property name="name">
<cstring>waveformSave</cstring>
</property>
<property name="text">
<string>Save Waveforms</string>
</property>
</widget>
<widget class="TQPushButton" row="1" column="1" colspan="1">
<property name="name">
<cstring>waveformRecall</cstring>
</property>
<property name="text">
<string>Recall Waveforms</string>
</property>
</widget>
<widget class="TQCheckBox" row="2" column="0" colspan="2">
<property name="name">
<cstring>autoSave</cstring>
</property>
<property name="text">
<string>Enable Automatic Saving</string>
</property>
</widget>
<widget class="KURLRequester" row="3" column="0" colspan="2">
<property name="name">
<cstring>autoSaveFile</cstring>
</property>
<property name="mode">
<number>25</number>
</property>
<property name="filter">
<cstring>*.wfm|Waveform Files (*.wfm)</cstring>
</property>
</widget>
</grid>
</widget>
</grid>
</widget>
</grid>
</widget>
</widget>
</grid>
</widget>
<widget class="TQGroupBox" row="0" column="1">
<property name="name">
<cstring>groupControl</cstring>
</property>
<property name="title">
<string>Controls</string>
</property>
<grid>
<property name="name">
<cstring>unnamed</cstring>
</property>
<widget class="TQGroupBox" row="0" column="1">
<property name="name">
<cstring>groupMonitorCaptureControls</cstring>
</property>
<property name="title">
<string>Capture Controls</string>
</property>
<grid>
<widget class="TQWidget" row="1" column="0" colspan="2">
<property name="name">
<cstring>traceControlLayoutWidget</cstring>
</property>
</widget>
</grid>
</widget>
<widget class="TQGroupBox" row="1" column="1">
<property name="name">
<cstring>groupAcquisitionControls</cstring>
</property>
<property name="title">
<string>Acquisition Controls</string>
</property>
<grid>
<widget class="TQPushButton" row="0" column="0" colspan="1">
<property name="name">
<cstring>runControlStartButton</cstring>
</property>
<property name="text">
<string>Start Acquisition</string>
</property>
</widget>
<widget class="TQPushButton" row="0" column="1" colspan="1">
<property name="name">
<cstring>runControlStopButton</cstring>
</property>
<property name="text">
<string>Stop Acquisition</string>
</property>
</widget>
<widget class="TQPushButton" row="1" column="0" colspan="1">
<property name="name">
<cstring>waveformSave</cstring>
</property>
<property name="text">
<string>Save Waveforms</string>
</property>
</widget>
<widget class="TQPushButton" row="1" column="1" colspan="1">
<property name="name">
<cstring>waveformRecall</cstring>
</property>
<property name="text">
<string>Recall Waveforms</string>
</property>
</widget>
<widget class="TQCheckBox" row="2" column="0" colspan="2">
<property name="name">
<cstring>autoSave</cstring>
</property>
<property name="text">
<string>Enable Automatic Saving</string>
</property>
</widget>
<widget class="KURLRequester" row="3" column="0" colspan="2">
<property name="name">
<cstring>autoSaveFile</cstring>
</property>
<property name="mode">
<number>25</number>
</property>
<property name="filter">
<cstring>*.wfm|Waveform Files (*.wfm)</cstring>
</property>
</widget>
</grid>
</widget>
</grid>
</widget>
</grid>
</widget>

@ -114,39 +114,46 @@ TraceControlWidget::TraceControlWidget(TQWidget *parent, const char *name)
m_groupBox->setColumnLayout(0, TQt::Vertical);
topGrid->addMultiCellWidget(m_groupBox, 0, 0, 0, 0);
m_groupBox->setTitle(i18n("Unknown Channel"));
m_primaryLayout = new TQGridLayout(m_groupBox->layout(), KDialog::marginHint(), KDialog::spacingHint());
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_primaryLayout->addMultiCellWidget(m_channelEnabledCheckBox, 0, 0, 0, 2);
m_valueLabel = new TQLabel(m_groupBox);
m_valueLabel->setText(i18n("<qt><nobr>Value: <b>%1</b></qt>").arg(i18n("<unknown>")));
m_primaryLayout->addMultiCellWidget(m_valueLabel, 1, 1, 0, 1);
m_primaryLayout->addMultiCellWidget(m_valueLabel, 1, 1, 0, 2);
m_valueLabel->hide();
m_timestampLabel = new TQLabel(m_groupBox);
m_timestampLabel->setText(i18n("<qt><nobr>Sampled: <b>%1</b></qt>").arg(i18n("<unknown>")));
m_primaryLayout->addMultiCellWidget(m_timestampLabel, 2, 2, 0, 1);
m_primaryLayout->addMultiCellWidget(m_timestampLabel, 2, 2, 0, 2);
m_timestampLabel->hide();
m_timestepLabel1 = new TQLabel(m_groupBox);
m_timestepLabel1->setText(i18n("Sample every:"));
m_timestepLabel1->setText(i18n("<qt><nobr>Sample every:</qt>"));
m_primaryLayout->addMultiCellWidget(m_timestepLabel1, 3, 3, 0, 0);
m_timestepLabel1->hide();
m_timestepSpinBox = new FloatSpinBox(m_groupBox);
m_timestepSpinBox->setFloatMax(60*60*24); // 1 day
connect(m_timestepSpinBox, SIGNAL(floatValueChanged(double)), this, SLOT(timestepChanged(double)));
m_primaryLayout->addMultiCellWidget(m_timestepSpinBox, 4, 4, 0, 0);
m_primaryLayout->addMultiCellWidget(m_timestepSpinBox, 3, 3, 1, 1);
m_timestepSpinBox->hide();
m_timestepLabel2 = new TQLabel(m_groupBox);
m_timestepLabel2->setText(i18n("seconds"));
m_primaryLayout->addMultiCellWidget(m_timestepLabel2, 4, 4, 1, 1);
m_timestepLabel2->setText(i18n("<qt><nobr>seconds<qt>"));
m_primaryLayout->addMultiCellWidget(m_timestepLabel2, 3, 3, 2, 2);
m_timestepLabel2->hide();
m_clearPushButton = new TQPushButton(m_groupBox);
m_clearPushButton->setText(i18n("Erase Existing Data"));
connect(m_clearPushButton, SIGNAL(clicked()), this, SLOT(clearTraceDataClicked()));
m_primaryLayout->addMultiCellWidget(m_clearPushButton, 5, 5, 0, 2);
m_clearPushButton->setSizePolicy(TQSizePolicy(TQSizePolicy::MinimumExpanding, TQSizePolicy::Minimum));
m_clearPushButton->hide();
m_sampleTimer = new TQTimer();
connect(m_sampleTimer, SIGNAL(timeout()), this, SIGNAL(newSampleDesired()));
}
@ -156,6 +163,10 @@ TraceControlWidget::~TraceControlWidget() {
delete m_sampleTimer;
}
void TraceControlWidget::clearTraceDataClicked() {
emit(clearTraceRequested());
}
void TraceControlWidget::startSampleTimer(int msecs) {
if (m_channelEnabledCheckBox->isOn()) {
m_nominalTimeStep = msecs/1.0e3;
@ -178,6 +189,7 @@ void TraceControlWidget::setTraceEnabled(bool enabled) {
m_timestepSpinBox->show();
m_valueLabel->show();
m_timestampLabel->show();
m_clearPushButton->show();
}
else {
m_timestepLabel1->hide();
@ -185,6 +197,7 @@ void TraceControlWidget::setTraceEnabled(bool enabled) {
m_timestepSpinBox->hide();
m_valueLabel->hide();
m_timestampLabel->hide();
m_clearPushButton->hide();
}
}
@ -205,6 +218,18 @@ void TraceControlWidget::setTimestep(double seconds) {
void TraceControlWidget::setMinTimestep(double seconds) {
m_minimumTimeStep = seconds;
m_timestepSpinBox->setFloatMin(seconds);
if (seconds < 0.001) {
m_timestepSpinBox->setPrecision(3);
}
else if (seconds < 0.01) {
m_timestepSpinBox->setPrecision(2);
}
else if (seconds < 0.1) {
m_timestepSpinBox->setPrecision(1);
}
else {
m_timestepSpinBox->setPrecision(0);
}
}
void TraceControlWidget::enableClicked() {
@ -223,7 +248,7 @@ void TraceControlWidget::setCurrentSampleValue(double value, TQString units) {
}
void TraceControlWidget::setCurrentSampleTimestamp(TQDateTime timestamp) {
m_timestampLabel->setText(i18n("<qt><nobr>Sampled: <b>%1</b></qt>").arg(timestamp.toString()));
m_timestampLabel->setText(i18n("<qt><nobr>Sampled: <b>%1 UTC</b></qt>").arg(timestamp.toString()));
}
SensorMonitorPart::SensorMonitorPart(TQWidget *parentWidget, const char *widgetName, TQObject *parent, const char *name, const TQStringList&)
@ -701,6 +726,7 @@ void SensorMonitorPart::updateTraceControlWidgets() {
m_traceControlWidgetList[i] = new TraceControlWidget(m_base->traceControlLayoutWidget);
connect(m_traceControlWidgetList[i], SIGNAL(enableChanged(bool)), this, SLOT(traceControlEnableChanged(bool)));
connect(m_traceControlWidgetList[i], SIGNAL(newSampleDesired()), this, SLOT(processNewSampleRequest()));
connect(m_traceControlWidgetList[i], SIGNAL(clearTraceRequested()), this, SLOT(traceControlClearRequested()));
m_traceControlWidgetGrid->addMultiCellWidget(m_traceControlWidgetList[i], i, i, 0, 0);
m_traceControlWidgetList[i]->setTraceName(i18n("Sensor %1").arg(m_sensorList[i].name));
m_traceControlWidgetList[i]->show();
@ -739,6 +765,36 @@ void SensorMonitorPart::traceControlEnableChanged(bool enabled) {
updateTraceControlWidgets();
}
void SensorMonitorPart::traceControlClearRequested() {
int i;
int channel = -1;
const TraceControlWidget* widget = dynamic_cast<const TraceControlWidget*>(sender());
if (widget) {
for (i=0; i<MAXTRACES;i++) {
if (m_traceControlWidgetList[i] == widget) {
channel = i;
break;
}
}
if ((channel >= 0) && (channel <=MAXTRACES)) {
m_samplesInTrace[channel] = 0;
TQDoubleArray sampleArray;
TQDoubleArray positionArray;
m_traceWidget->setSamples(m_sampleRequestIndex, sampleArray);
m_traceWidget->setPositions(m_sampleRequestIndex, positionArray);
m_base->traceZoomWidget->setSamples(m_sampleRequestIndex, sampleArray);
m_base->traceZoomWidget->setPositions(m_sampleRequestIndex, positionArray);
m_traceControlWidgetList[m_sampleRequestIndex]->setCurrentSampleValue(0, m_sensorList[channel].units);
m_traceControlWidgetList[m_sampleRequestIndex]->setCurrentSampleTimestamp(TQDateTime());
}
}
updateGraticule();
m_traceWidget->repaint(false);
m_base->traceZoomWidget->repaint(false);
updateTraceControlWidgets();
}
void SensorMonitorPart::processNewSampleRequest() {
int i;
int channel = -1;
@ -901,6 +957,12 @@ void SensorMonitorPart::recallWaveforms() {
m_traceWidget->setPositions(traceno, positions);
m_base->traceZoomWidget->setSamples(traceno, values);
m_base->traceZoomWidget->setPositions(traceno, positions);
if (m_samplesInTrace[traceno] > 0) {
m_traceControlWidgetList[traceno]->setCurrentSampleValue(values[m_samplesInTrace[traceno]-1], m_sensorList[traceno].units);
TQDateTime lastSampleTime;
lastSampleTime.setTime_t(positions[m_samplesInTrace[traceno]-1]);
m_traceControlWidgetList[traceno]->setCurrentSampleTimestamp(lastSampleTime);
}
}
for (int cursorno=0; cursorno<4; cursorno++) {
double cursorPos;

@ -53,6 +53,7 @@ class TQCheckBox;
class TQGroupBox;
class TQFile;
class TQLabel;
class TQPushButton;
class SensorMonitorBase;
namespace RemoteLab
@ -99,10 +100,12 @@ namespace RemoteLab
signals:
void enableChanged(bool enabled);
void newSampleDesired();
void clearTraceRequested();
private slots:
void enableClicked();
void timestepChanged(double);
void clearTraceDataClicked();
private:
TQGroupBox* m_groupBox;
@ -114,6 +117,7 @@ namespace RemoteLab
TQLabel* m_timestepLabel2;
TQLabel* m_valueLabel;
TQLabel* m_timestampLabel;
TQPushButton* m_clearPushButton;
double m_minimumTimeStep;
double m_nominalTimeStep;
@ -149,6 +153,7 @@ namespace RemoteLab
void updateGraticule();
void updateTraceControlWidgets();
void traceControlEnableChanged(bool enabled);
void traceControlClearRequested();
void processNewSampleRequest();
void processNewSampleRequest(int channel);
void processAutosave();

@ -25,14 +25,19 @@ FloatSpinBox::FloatSpinBox(TQWidget *parent , const char* name) : TQSpinBox(pare
connect( this, SIGNAL(valueChanged(int)), SLOT(acceptValueChanged(int)) );
}
void FloatSpinBox::init(double fmin, double fmax, double fvalue) {
void FloatSpinBox::init(double fmin, double fmax, double fvalue, int precision) {
min = fmin;
max = fmax;
value = fvalue;
// How many decimals after the floating point?
dec = ((fmax - fmin) == 0) ? 2 : 2 - (int)( log10(fabs(fmax - fmin)) );
if (dec < 0) dec = 0;
if (precision < 0) {
dec = ((fmax - fmin) == 0) ? 2 : 2 - (int)( log10(fabs(fmax - fmin)) );
if (dec < 0) dec = 0;
}
else {
dec = precision;
}
int intmax = (int)((max - min) * pow( 10, dec ));
int intval = ROUND( (value - min) * pow( 10, dec ) );
@ -45,11 +50,15 @@ void FloatSpinBox::init(double fmin, double fmax, double fvalue) {
}
void FloatSpinBox::setFloatMin(double fmin) {
init(fmin, max, value);
init(fmin, max, value, dec);
}
void FloatSpinBox::setFloatMax(double fmax) {
init(min, fmax, value);
init(min, fmax, value, dec);
}
void FloatSpinBox::setPrecision(int precision) {
init(min, max, value, precision);
}
TQString FloatSpinBox::mapValueToText(int ival) {

@ -21,9 +21,10 @@ class FloatSpinBox : public TQSpinBox
FloatSpinBox(double min, double max, double value, TQWidget *parent = 0);
~FloatSpinBox();
void init(double min, double max, double value);
void init(double min, double max, double value, int precision=-1);
void setFloatMin(double min);
void setFloatMax(double max);
void setPrecision(int precision);
private:
int dec;

@ -822,6 +822,7 @@ TraceWidget::TraceWidget(TQWidget* parent, const char* name) : TQWidget(parent,
m_graticuleWidget = new GraticuleWidget(this);
connect(m_graticuleWidget, SIGNAL(cursorPositionChanged(uint, double)), this, SLOT(processChangedCursor(uint, double)));
m_primaryLayout->addMultiCellWidget(m_graticuleWidget, 0, 254, 0, 254);
m_primaryLayout->setAlignment(TQt::AlignTop);
m_rightPaneLayout = new TQGridLayout;
m_traceLabelLayout = new TQGridLayout;
m_infoLabelLayout = new TQGridLayout;
@ -1578,7 +1579,7 @@ void TraceWidget::resizeTraceArray(uint newsize) {
m_traceLabelLayout->addWidget(m_traceArray[i]->singleIncrBtn, 0, (i*2)+1);
m_traceLabelLayout->addWidget(m_traceArray[i]->posResetBtn, 1, (i*2)+1);
m_traceLabelLayout->addWidget(m_traceArray[i]->singleDecrBtn, 2, (i*2)+1);
m_statusLabelLayout->insertWidget(i, m_traceArray[i]->graphStatusLabel);
m_statusLabelLayout->insertWidget(i, m_traceArray[i]->graphStatusLabel, TQt::AlignTop);
m_statusLabelLayoutInner->insertWidget(i, m_traceArray[i]->graphStatusLabelInner);
}
}
@ -1609,10 +1610,10 @@ void TraceWidget::resizeCursorArray(uint newsize) {
connect(m_cursorArray[i], SIGNAL(positionChanged(double)), this, SLOT(processChangedCusorPosition(double)));
if (m_cursorArray[i]->paramLabel) {
m_cursorLabelLayout->addMultiCellWidget(m_cursorArray[i]->paramLabel, i*2, i*2, 0, 3);
m_cursorLabelLayout->addMultiCellWidget(m_cursorArray[i]->multiIncrBtn, (i*2)+1, (i*2)+1, 0, 0);
m_cursorLabelLayout->addMultiCellWidget(m_cursorArray[i]->singleIncrBtn, (i*2)+1, (i*2)+1, 1, 1);
m_cursorLabelLayout->addMultiCellWidget(m_cursorArray[i]->singleDecrBtn, (i*2)+1, (i*2)+1, 2, 2);
m_cursorLabelLayout->addMultiCellWidget(m_cursorArray[i]->multiDecrBtn, (i*2)+1, (i*2)+1, 3, 3);
m_cursorLabelLayout->addMultiCellWidget(m_cursorArray[i]->multiIncrBtn, (i*2)+1, (i*2)+1, 0, 0, TQt::AlignHCenter);
m_cursorLabelLayout->addMultiCellWidget(m_cursorArray[i]->singleIncrBtn, (i*2)+1, (i*2)+1, 1, 1, TQt::AlignHCenter);
m_cursorLabelLayout->addMultiCellWidget(m_cursorArray[i]->singleDecrBtn, (i*2)+1, (i*2)+1, 2, 2, TQt::AlignHCenter);
m_cursorLabelLayout->addMultiCellWidget(m_cursorArray[i]->multiDecrBtn, (i*2)+1, (i*2)+1, 3, 3, TQt::AlignHCenter);
}
}
}

Loading…
Cancel
Save