diff --git a/clients/tde/src/app/views/instrumentview.cpp b/clients/tde/src/app/views/instrumentview.cpp index 9f4b061..4a9acf9 100644 --- a/clients/tde/src/app/views/instrumentview.cpp +++ b/clients/tde/src/app/views/instrumentview.cpp @@ -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(); } } diff --git a/clients/tde/src/part/commanalyzer/layout.ui b/clients/tde/src/part/commanalyzer/layout.ui index fca0baa..ae3c6e0 100644 --- a/clients/tde/src/part/commanalyzer/layout.ui +++ b/clients/tde/src/part/commanalyzer/layout.ui @@ -16,153 +16,132 @@ unnamed - + - TabWidget2 + groupSpectrumAnalyzer - - true + + Spectrum Analyzer - + - tab + unnamed - - Spectrum Analyzer - - + - unnamed + groupSpectrumAnalyzerView - + + Trace Viewer + + + + 7 + 7 + 1 + 1 + + + - groupSpectrumAnalyzer + unnamed - - Spectrum Analyzer - - + - unnamed + splitter1 - + + Vertical + + - groupSpectrumAnalyzerView - - - Trace Viewer + traceWidget - - - 7 - 7 - 1 - 1 - + + + 0 + 0 + - - - unnamed - - - - splitter1 - - - Vertical - - - - traceWidget - - - - 0 - 0 - - - - - - traceZoomWidget - - - - 0 - 0 - - - - - - + - groupSpectrumAnalyzerRecControls + traceZoomWidget - - Receiver Controls + + + 0 + 0 + - - - - unnamed - - - Reference Power Level: - - - PlainText - - - - - saRefLevel - - - true - - - - 3 - 0 - 0 - 0 - - - - - 80 - 0 - - - - 128 - - - -128 - - - 0 - - - - - unnamed - - - dBm - - - PlainText - - - - - - - + + + + + + groupSpectrumAnalyzerRecControls + + + Receiver Controls + + + + + unnamed + + + Reference Power Level: + + + PlainText + + + + + saRefLevel + + + true + + + + 3 + 0 + 0 + 0 + + + + + 80 + 0 + + + + 128 + + + -128 + + + 0 + + + + + unnamed + + + dBm + + + PlainText + + + + + diff --git a/clients/tde/src/part/scope/layout.ui b/clients/tde/src/part/scope/layout.ui index a104177..dfde26b 100644 --- a/clients/tde/src/part/scope/layout.ui +++ b/clients/tde/src/part/scope/layout.ui @@ -16,163 +16,142 @@ unnamed - + - TabWidget2 + groupOscilloscope - - true + + Oscilloscope - + - tab + unnamed - - Oscilloscope - - + - unnamed + groupOscilloscopeView - + + Trace Viewer + + + + 7 + 7 + 1 + 1 + + + - groupOscilloscope - - - Oscilloscope + unnamed - + - unnamed + splitter1 - - - groupOscilloscopeView - - - Trace Viewer - - - - 7 - 7 - 1 - 1 - - - - - unnamed - - - - splitter1 - - - Vertical - - - - traceWidget - - - - 0 - 0 - - - - - - traceZoomWidget - - - - 0 - 0 - - - - - - - + + Vertical + + - groupOscilloscopeCaptureControls + traceWidget - - Capture Controls + + + 0 + 0 + - - - - runControlStartButton - - - Run - - - - - runControlStopButton - - - Stop - - - - - traceControlLayoutWidget - - - - + - groupOscilloscopeAcquisitionControls + traceZoomWidget - - Acquisition Controls + + + 0 + 0 + - - - - acqStart - - - Start Acquisition - - - - - acqStop - - - Stop Acquisition - - - - - waveformSave - - - Save Waveforms - - - - - waveformRecall - - - Recall Waveforms - - - - - - - + + + + + + groupOscilloscopeCaptureControls + + + Capture Controls + + + + + runControlStartButton + + + Run + + + + + runControlStopButton + + + Stop + + + + + traceControlLayoutWidget + + + + + + + groupOscilloscopeAcquisitionControls + + + Acquisition Controls + + + + + acqStart + + + Start Acquisition + + + + + acqStop + + + Stop Acquisition + + + + + waveformSave + + + Save Waveforms + + + + + waveformRecall + + + Recall Waveforms + + + + + diff --git a/clients/tde/src/part/scope/part.cpp b/clients/tde/src/part/scope/part.cpp index 2b76a49..c319891 100644 --- a/clients/tde/src/part/scope/part.cpp +++ b/clients/tde/src/part/scope/part.cpp @@ -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())); diff --git a/clients/tde/src/part/sensormonitor/layout.ui b/clients/tde/src/part/sensormonitor/layout.ui index de29914..69e6600 100644 --- a/clients/tde/src/part/sensormonitor/layout.ui +++ b/clients/tde/src/part/sensormonitor/layout.ui @@ -16,31 +16,31 @@ unnamed - + - TabWidget2 + groupMonitor - - true + + Monitor - + - tab + unnamed - - Monitor - - + - unnamed + TabWidget2 - + + true + + - groupMonitor - - - Monitor + tab + + Plotter + unnamed @@ -96,86 +96,99 @@ - - - groupMonitorCaptureControls - - - Sensor Capture Controls - - - - - traceControlLayoutWidget - - - - - - - groupAcquisitionControls - - - Acquisition Controls - - - - - runControlStartButton - - - Start Acquisition - - - - - runControlStopButton - - - Stop Acquisition - - - - - waveformSave - - - Save Waveforms - - - - - waveformRecall - - - Recall Waveforms - - - - - autoSave - - - Enable Automatic Saving - - - - - autoSaveFile - - - 25 - - - *.wfm|Waveform Files (*.wfm) - - - - - - + + + + + + groupControl + + + Controls + + + + unnamed + + + + groupMonitorCaptureControls + + + Capture Controls + + + + + traceControlLayoutWidget + + + + + + + groupAcquisitionControls + + + Acquisition Controls + + + + + runControlStartButton + + + Start Acquisition + + + + + runControlStopButton + + + Stop Acquisition + + + + + waveformSave + + + Save Waveforms + + + + + waveformRecall + + + Recall Waveforms + + + + + autoSave + + + Enable Automatic Saving + + + + + autoSaveFile + + + 25 + + + *.wfm|Waveform Files (*.wfm) + + + + + diff --git a/clients/tde/src/part/sensormonitor/part.cpp b/clients/tde/src/part/sensormonitor/part.cpp index 4d39b86..92fd199 100644 --- a/clients/tde/src/part/sensormonitor/part.cpp +++ b/clients/tde/src/part/sensormonitor/part.cpp @@ -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("Value: %1").arg(i18n(""))); - 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("Sampled: %1").arg(i18n(""))); - 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("Sample every:")); 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("seconds")); + 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("Sampled: %1").arg(timestamp.toString())); + m_timestampLabel->setText(i18n("Sampled: %1 UTC").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(sender()); + if (widget) { + for (i=0; i= 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; diff --git a/clients/tde/src/part/sensormonitor/part.h b/clients/tde/src/part/sensormonitor/part.h index 478fda4..f0a5527 100644 --- a/clients/tde/src/part/sensormonitor/part.h +++ b/clients/tde/src/part/sensormonitor/part.h @@ -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(); diff --git a/clients/tde/src/widgets/floatspinbox.cpp b/clients/tde/src/widgets/floatspinbox.cpp index 10d9020..5e135eb 100644 --- a/clients/tde/src/widgets/floatspinbox.cpp +++ b/clients/tde/src/widgets/floatspinbox.cpp @@ -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) { diff --git a/clients/tde/src/widgets/floatspinbox.h b/clients/tde/src/widgets/floatspinbox.h index f6d877c..3d5c1d1 100644 --- a/clients/tde/src/widgets/floatspinbox.h +++ b/clients/tde/src/widgets/floatspinbox.h @@ -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; diff --git a/clients/tde/src/widgets/tracewidget.cpp b/clients/tde/src/widgets/tracewidget.cpp index f4a19e0..d1424d2 100644 --- a/clients/tde/src/widgets/tracewidget.cpp +++ b/clients/tde/src/widgets/tracewidget.cpp @@ -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); } } }